NSIO: new method CheckOutput(string), which will see if a given Output is ready to fire again.

This commit is contained in:
Marco Cawthorne 2023-09-27 00:25:25 -07:00
parent 9518a23f03
commit 5b52c57a56
Signed by: eukara
GPG Key ID: CE2032F0A2882A22
3 changed files with 19 additions and 0 deletions

View File

@ -29,6 +29,8 @@ NSOutput::TriggerOutput(void)
/* we're not -1 (infinite) and we've still got one use to deduct */
if (m_iCount > 0)
m_iCount--;
nextthink = 0.0f;
}
void

View File

@ -92,6 +92,10 @@ public:
Input/Output specification. */
nonvirtual string CreateOutput(string);
/** Returns whether the Output is ready, or has done firing - not currently scheduled to fire, etc.
Input is the identifier of an output. */
nonvirtual bool CheckOutput(string);
/* save game related methods */
/** Saves a floating point key/value pair to a filehandle. */
nonvirtual void SaveFloat(float,string,float);

View File

@ -164,6 +164,19 @@ NSIO::CreateOutput(string outmsg)
return outname;
}
bool
NSIO::CheckOutput(string strOut)
{
for (entity f = world; (f = find(f, ::targetname, strOut));) {
NSOutput op = (NSOutput)f;
if (op.nextthink != 0.0f)
return false;
}
return true;
}
string
NSIO::PrepareOutput(string strOut, string strValue)
{