diff options
Diffstat (limited to 'src/localplayer.cpp')
-rw-r--r-- | src/localplayer.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 34a99bc9..85030eb7 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -112,8 +112,8 @@ void LocalPlayer::logic() break; } - // Actions are allowed once per second - if (get_elapsed_time(mLastAction) >= 1000) { + // Actions are allowed twice per second + if (get_elapsed_time(mLastAction) >= 500) { mLastAction = -1; } @@ -125,6 +125,15 @@ void LocalPlayer::logic() mLastAction = -1; } + if (mTarget) + { + if (mTarget->mAction == DEAD) + { + setTarget(mTarget); + mLastAction = -1; + } + } + for (int i = Being::TC_SMALL; i < Being::NUM_TC; i++) { player_node->mTargetCursorInRange[i]->update(10); @@ -439,14 +448,11 @@ void LocalPlayer::attack(Being *target, bool keep) if (mAction != STAND) return; - if (keep && target) + if (keep && (mTarget != target)) { + mLastAction = -1; setTarget(target); } - else if (mTarget) - { - target = mTarget; - } if (!target) return; @@ -535,6 +541,7 @@ bool LocalPlayer::withinAttackRange(Being *target) void LocalPlayer::setGotoTarget(Being *target) { + mLastAction = -1; setTarget(target); mGoingToTarget = true; setDestination(target->mX, target->mY); |