Skip to content

Commit

Permalink
ABrain.Stop: Set FSM state to IDLE.
Browse files Browse the repository at this point in the history
* Fixes `/mob path` not making the target follow the path immediately.
* It could result in various undesirable effects, but resetting the state makes sense to me.
  • Loading branch information
bm01 committed Jul 11, 2024
1 parent 13b6685 commit b63492b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions GameServer/ai/ABrain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public virtual bool Stop()
{
bool wasReturningToSpawnPoint = Body.IsReturningToSpawnPoint;
Body.StopMoving();
FSM?.SetCurrentState(eFSMStateType.IDLE);

// Without `IsActive` check, charming a NPC that's returning to spawn would teleport it.
if (wasReturningToSpawnPoint && !IsActive)
Expand Down
6 changes: 4 additions & 2 deletions GameServer/ai/brain/Animist/TurretBrain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,11 @@ protected virtual bool TrustCast(Spell spell, eCheckSpellType type, GameLiving t

public override bool Stop()
{
ClearAggroList();
if (!base.Stop())
return false;

_defensiveSpellTargets.Clear();
return base.Stop();
return true;
}

#region AI
Expand Down
10 changes: 4 additions & 6 deletions GameServer/ai/brain/StandardMob/StandardMobBrain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,11 @@ public override string ToString()
public override bool Stop()
{
// tolakram - when the brain stops, due to either death or no players in the vicinity, clear the aggro list
if (base.Stop())
{
ClearAggroList();
return true;
}
if (!base.Stop())
return false;

return false;
ClearAggroList();
return true;
}

public override void KillFSM()
Expand Down

0 comments on commit b63492b

Please sign in to comment.