NSIO: Prevent firing an output when no activator is set
This commit is contained in:
parent
d7ddfc1c87
commit
9518a23f03
3 changed files with 17 additions and 4 deletions
|
@ -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. */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue