Added GoalReached(Actor oldgoal) function to actors.

This commit is contained in:
Major Cooke 2024-11-19 19:22:17 -06:00
parent ebc36650a4
commit 895462c46a
2 changed files with 18 additions and 2 deletions

View file

@ -2371,6 +2371,20 @@ nosee:
return 0;
}
void GoalReached(AActor* self, AActor* oldgoal)
{
if (self && self->Level)
self->Level->localEventManager->WorldThingGoalReached(self, oldgoal);
}
DEFINE_ACTION_FUNCTION(AActor, GoalReached)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_OBJECT(oldgoal, AActor);
GoalReached(self, oldgoal);
return 0;
}
//=============================================================================
//
// A_Chase
@ -2594,8 +2608,7 @@ void A_DoChase (AActor *actor, bool fastchase, FState *meleestate, FState *missi
}
actor->flags7 &= ~MF7_INCHASE;
actor->goal = newgoal;
if (actor->goal != savedgoal)
actor->Level->localEventManager->WorldThingGoalReached(actor, savedgoal);
GoalReached(actor, savedgoal);
return;
}
if (actor->goal == actor->target) goto nomissile;

View file

@ -813,6 +813,9 @@ class Actor : Thinker native
movecount = random[TryWalk](0, 15);
return true;
}
// Calls WorldThingGoalReached.
native void GoalReached(Actor oldgoal);
native bool TryMove(vector2 newpos, int dropoff, bool missilecheck = false, FCheckPosition tm = null);
native bool CheckMove(vector2 newpos, int flags = 0, FCheckPosition tm = null);