Skip to content

Commit

Permalink
Kick players while they are attacking or attacked by monsters (when a…
Browse files Browse the repository at this point in the history
…fk) (otland#2990)
  • Loading branch information
nekiro authored Jun 13, 2020
1 parent 61e43c5 commit 4bd1941
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1401,7 +1401,7 @@ void Player::setNextWalkTask(SchedulerTask* task)
}
}

void Player::setNextActionTask(SchedulerTask* task)
void Player::setNextActionTask(SchedulerTask* task, bool resetIdleTime /*= true */)
{
if (actionTaskEvent != 0) {
g_scheduler.stopEvent(actionTaskEvent);
Expand All @@ -1410,7 +1410,9 @@ void Player::setNextActionTask(SchedulerTask* task)

if (task) {
actionTaskEvent = g_scheduler.addEvent(task);
resetIdleTime();
if (resetIdleTime) {
this->resetIdleTime();
}
}
}

Expand Down Expand Up @@ -3192,7 +3194,7 @@ void Player::doAttacking(uint32_t)

SchedulerTask* task = createSchedulerTask(std::max<uint32_t>(SCHEDULER_MINTICKS, delay), std::bind(&Game::checkCreatureAttack, &g_game, getID()));
if (!classicSpeed) {
setNextActionTask(task);
setNextActionTask(task, false);
} else {
g_scheduler.addEvent(task);
}
Expand Down
2 changes: 1 addition & 1 deletion src/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,7 @@ class Player final : public Creature, public Cylinder

void setNextWalkActionTask(SchedulerTask* task);
void setNextWalkTask(SchedulerTask* task);
void setNextActionTask(SchedulerTask* task);
void setNextActionTask(SchedulerTask* task, bool resetIdleTime = true);

void death(Creature* lastHitCreature) override;
bool dropCorpse(Creature* lastHitCreature, Creature* mostDamageCreature, bool lastHitUnjustified, bool mostDamageUnjustified) override;
Expand Down

0 comments on commit 4bd1941

Please sign in to comment.