func_door_rotating: Handle trigger state (on/off/toggle).

This commit is contained in:
Marco Cawthorne 2020-08-07 22:16:00 +02:00
parent c9094d86d9
commit 2299a478bb

View file

@ -196,7 +196,6 @@ void func_door_rotating::Away(void)
RotToDest(m_vecPos2 * fDirection, Arrived); RotToDest(m_vecPos2 * fDirection, Arrived);
} }
/* TODO: Handle state */
void func_door_rotating::Trigger(int state) void func_door_rotating::Trigger(int state)
{ {
if (GetMaster() == FALSE) { if (GetMaster() == FALSE) {
@ -208,12 +207,19 @@ void func_door_rotating::Trigger(int state)
} }
m_flNextAction = time + m_flWait; m_flNextAction = time + m_flWait;
if ((m_iState == STATE_UP) || (m_iState == STATE_RAISED)) { if (state == TRIG_TOGGLE) {
if ((m_iState == STATE_UP) || (m_iState == STATE_RAISED)) {
Back();
return;
} else {
Away();
}
} else if (state == TRIG_OFF) {
Back(); Back();
return; } else if (state == TRIG_ON) {
Away();
} }
Away();
if (m_flDelay) { if (m_flDelay) {
CBaseTrigger::UseTargets_Delay(TRIG_TOGGLE, m_flDelay); CBaseTrigger::UseTargets_Delay(TRIG_TOGGLE, m_flDelay);