diff --git a/src/server/NSOutput.h b/src/server/NSOutput.h index a6e39786..32fe7437 100644 --- a/src/server/NSOutput.h +++ b/src/server/NSOutput.h @@ -36,6 +36,8 @@ public: /** Call to trigger the NSOutput's target. */ virtual void TriggerOutput(void); + virtual void ScheduleOutput(entity); + /** Internal use only. */ virtual void Init(void); /** Internal use only. */ diff --git a/src/server/NSOutput.qc b/src/server/NSOutput.qc index 4be25994..56cde759 100644 --- a/src/server/NSOutput.qc +++ b/src/server/NSOutput.qc @@ -31,6 +31,14 @@ NSOutput::TriggerOutput(void) m_iCount--; } +void +NSOutput::ScheduleOutput(entity activatorEnt) +{ + m_eActivator = activatorEnt; + think = TriggerOutput; + nextthink = time + m_flDelay; +} + void NSOutput::Init(void) { @@ -44,6 +52,8 @@ NSOutput::Respawn(void) { /* gotta reset our counter */ m_iCount = m_iOldCount; + nextthink = 0.0f; + think = __NULL__; } void diff --git a/src/shared/NSIO.qc b/src/shared/NSIO.qc index d65e406c..badd15f3 100644 --- a/src/shared/NSIO.qc +++ b/src/shared/NSIO.qc @@ -101,7 +101,10 @@ NSIO::Spawned(void) void NSIO::UseOutput(entity act, string outname) { - if (!outname) + if (!outname || outname == "") + return; + + if (!act) return; for (entity f = world; (f = find(f, ::targetname, outname));) { @@ -112,9 +115,7 @@ NSIO::UseOutput(entity act, string outname) return; } - op.m_eActivator = act; - op.think = NSOutput::TriggerOutput; - op.nextthink = time + op.m_flDelay; + op.ScheduleOutput(act); } }