From 9c66c2c5f9acc9c1297bc0d459e0bc4fd9f202ca Mon Sep 17 00:00:00 2001 From: Marco Cawthorne Date: Mon, 4 Mar 2024 19:25:51 -0800 Subject: [PATCH] func_door: Fix `targetClose` not getting triggered right when START_OPEN spawnflag is set --- src/gs-entbase/server/func_door.qc | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/gs-entbase/server/func_door.qc b/src/gs-entbase/server/func_door.qc index 8ceeaaaa..24a8590b 100644 --- a/src/gs-entbase/server/func_door.qc +++ b/src/gs-entbase/server/func_door.qc @@ -416,16 +416,23 @@ func_door::MoverFinishesMoving(void) MoveToPosition(GetMoverPosition1(), m_flSpeed); } - /* we arrived at our starting position within the map */ - if (GetMoverState() == MOVER_POS1) { - if (targetClose) - for (entity f = world; (f = find(f, ::targetname, targetClose));) { - NSEntity trigger = (NSEntity)f; - if (trigger.Trigger != __NULL__) { - trigger.Trigger(this, TRIG_TOGGLE); + + if (targetClose && targetClose != "") { + /* when it starts open the positions are reversed... */ + if (GetMoverState() == MOVER_POS1 || + (HasSpawnFlags(SF_MOV_OPEN) && GetMoverState() == MOVER_POS2)) { + for (entity f = world; (f = find(f, ::targetname, targetClose));) { + NSEntity trigger = (NSEntity)f; + if (trigger.Trigger != __NULL__) { + trigger.Trigger(this, TRIG_TOGGLE); + } } } + } + + /* we arrived at our starting position within the map */ + if (GetMoverState() == MOVER_POS1) { if (m_strSndStop) { StartSoundDef(m_strSndStop, CHAN_VOICE, true); } else {