mirror of
https://bitbucket.org/seefoe/dsrc.git
synced 2026-07-31 01:15:55 -04:00
61 lines
988 B
Plaintext
61 lines
988 B
Plaintext
|
|
include library.callable;
|
|
include library.utils;
|
|
|
|
|
|
trigger OnInitialize()
|
|
{
|
|
int expirationTime = getIntObjVar(self, "mount_vendor.create");
|
|
|
|
if(getGameTime() > expirationTime)
|
|
{
|
|
messageTo(self, "expireAndCleanup", null, 0, false);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnDestroy()
|
|
{
|
|
|
|
obj_id currentPet = callable.getCDCallable(self);
|
|
|
|
messageTo(currentPet, "handlePackRequest", null, 1, false);
|
|
|
|
if(hasObjVar(self, "hasOwner"))
|
|
{
|
|
obj_id player = getObjIdObjVar(self, "hasOwner");
|
|
|
|
if(hasObjVar(player, "hasTestVehicle"))
|
|
{
|
|
removeObjVar(player, "hasTestVehicle");
|
|
}
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
messageHandler expireAndCleanup()
|
|
{
|
|
obj_id currentPet = callable.getCDCallable(self);
|
|
|
|
if(isIdValid(currentPet))
|
|
{
|
|
// pet is out, is it mounted?
|
|
obj_id riderId = getRiderId(currentPet);
|
|
|
|
if(isIdValid(riderId))
|
|
{
|
|
// dismount
|
|
dismountCreature(riderId);
|
|
}
|
|
}
|
|
|
|
setObjVar(self, "pet.isDead", true);
|
|
|
|
destroyObject(self);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|