Remove unused previous state in AI StateMachine

The StateMachine offered a feature to remember the previous state and allow reverting to it. However this feature is unused. Remove it to allow the previous states to be reclaimed by the GC earlier.
This commit is contained in:
RoosterDragon
2024-07-06 12:17:41 +01:00
committed by Gustas
parent c1de85f700
commit b3168928c6
5 changed files with 23 additions and 32 deletions

View File

@@ -16,7 +16,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
sealed class UnitsForProtectionIdleState : GroundStateBase, IState
{
public void Activate(Squad owner) { }
public void Tick(Squad owner) { owner.FuzzyStateMachine.ChangeState(owner, new UnitsForProtectionAttackState(), true); }
public void Tick(Squad owner) { owner.FuzzyStateMachine.ChangeState(owner, new UnitsForProtectionAttackState()); }
public void Deactivate(Squad owner) { }
}
@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
owner.SetActorToTarget(target);
if (target.Actor == null)
{
owner.FuzzyStateMachine.ChangeState(owner, new UnitsForProtectionFleeState(), true);
owner.FuzzyStateMachine.ChangeState(owner, new UnitsForProtectionFleeState());
return;
}
}
@@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
{
if (Backoff < 0)
{
owner.FuzzyStateMachine.ChangeState(owner, new UnitsForProtectionFleeState(), true);
owner.FuzzyStateMachine.ChangeState(owner, new UnitsForProtectionFleeState());
Backoff = BackoffTicks;
return;
}
@@ -72,7 +72,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
return;
GoToRandomOwnBuilding(owner);
owner.FuzzyStateMachine.ChangeState(owner, new UnitsForProtectionIdleState(), true);
owner.FuzzyStateMachine.ChangeState(owner, new UnitsForProtectionIdleState());
}
public void Deactivate(Squad owner) { owner.SquadManager.UnregisterSquad(owner); }