diff --git a/src/scripting/vmthunks_actors.cpp b/src/scripting/vmthunks_actors.cpp index b366e679c..74a2c5d3b 100644 --- a/src/scripting/vmthunks_actors.cpp +++ b/src/scripting/vmthunks_actors.cpp @@ -1427,6 +1427,35 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, LookForPlayers, P_LookForPlayers) ACTION_RETURN_BOOL(P_LookForPlayers(self, allaround, params)); } +static int CheckMonsterUseSpecials(AActor *self) +{ + spechit_t spec; + int good = 0; + + if (!(self->flags6 & MF6_NOTRIGGER)) + { + while (spechit.Pop (spec)) + { + // [RH] let monsters push lines, as well as use them + if (((self->flags4 & MF4_CANUSEWALLS) && P_ActivateLine (spec.line, self, 0, SPAC_Use)) || + ((self->flags2 & MF2_PUSHWALL) && P_ActivateLine (spec.line, self, 0, SPAC_Push))) + { + good |= spec.line == self->BlockingLine ? 1 : 2; + } + } + } + else spechit.Clear(); + + return good; +} + +DEFINE_ACTION_FUNCTION_NATIVE(AActor, CheckMonsterUseSpecials, CheckMonsterUseSpecials) +{ + PARAM_SELF_PROLOGUE(AActor); + + ACTION_RETURN_INT(CheckMonsterUseSpecials(self)); +} + DEFINE_ACTION_FUNCTION_NATIVE(AActor, A_Wander, A_Wander) { PARAM_SELF_PROLOGUE(AActor); diff --git a/wadsrc/static/zscript/actor.txt b/wadsrc/static/zscript/actor.txt index 0b8fc96c2..31f855258 100644 --- a/wadsrc/static/zscript/actor.txt +++ b/wadsrc/static/zscript/actor.txt @@ -627,6 +627,7 @@ class Actor : Thinker native native void CheckFakeFloorTriggers (double oldz, bool oldz_has_viewheight = false); native bool CheckFor3DFloorHit(double z, bool trigger); native bool CheckFor3DCeilingHit(double z, bool trigger); + native int CheckMonsterUseSpecials(); native bool CheckMissileSpawn(double maxdist); native bool CheckPosition(Vector2 pos, bool actorsonly = false, FCheckPosition tm = null);