Files
2018-06-07 00:32:29 +01:00

44 lines
1.5 KiB
Java
Executable File

package script.object;
import script.dictionary;
import script.obj_id;
public class destroy_message extends script.base_script
{
public destroy_message()
{
}
public int OnIncapacitated(obj_id self, obj_id attacker) throws InterruptedException
{
sendMessages(self);
return SCRIPT_CONTINUE;
}
public int OnDestroy(obj_id self) throws InterruptedException
{
sendMessages(self);
return SCRIPT_CONTINUE;
}
public int OnObjectDisabled(obj_id self, obj_id killer) throws InterruptedException
{
sendMessages(self);
return SCRIPT_CONTINUE;
}
public void sendMessages(obj_id object) throws InterruptedException
{
if (!hasObjVar(object, "destroyMessageList"))
{
return;
}
String[] destroyMessageNames = getStringArrayObjVar(object, "destroyMessageList.handlerNames");
float[] destroyMessageDelays = getFloatArrayObjVar(object, "destroyMessageList.delays");
obj_id[] destroyMessageRecipients = getObjIdArrayObjVar(object, "destroyMessageList.recipients");
removeObjVar(object, "destroyMessageList");
dictionary parms = new dictionary();
parms.put("object", object);
for (int i = 0; i < destroyMessageNames.length; i++)
{
messageTo(destroyMessageRecipients[i], destroyMessageNames[i], parms, destroyMessageDelays[i], isObjectPersisted(destroyMessageRecipients[i]));
}
}
}