Files
dsrc/sku.0/sys.server/compiled/game/script/event/invasion/key_object.script
T

47 lines
1013 B
Plaintext

include library.utils;
trigger OnAttach()
{
float expirationTime = getFloatObjVar(self, "event.invasion.keyObject.expirationTime");
messageTo(self, "cleanUp", null, expirationTime, false);
return SCRIPT_CONTINUE;
}
messageHandler cleanUp()
{
destroyObject(self);
return SCRIPT_CONTINUE;
}
void checkTimeLimit(obj_id self)
{
float expirationTime = getFloatObjVar(self, "event.invasion.keyObject.expirationTime");
float timeStamp = getFloatObjVar(self, "event.invasion.keyObject.timeStamp");
float rightNow = getGameTime();
float delta = rightNow - timeStamp;
if(delta > expirationTime)
destroyObject(self);
return;
}
trigger OnAddedToWorld()
{
checkTimeLimit(self);
return SCRIPT_CONTINUE;
}
trigger OnHearSpeech(obj_id objSpeaker, string strText)
{
obj_id coordinator = getObjIdObjVar(self, "event.invasion.coordinator");
if(objSpeaker == coordinator && strText.equals("abortEventNow"))
messageTo(self, "cleanUp", null, 1, false);
checkTimeLimit(self);
return SCRIPT_CONTINUE;
}