generated from Jaysyn/ModuleTemplate
68 lines
1.3 KiB
Plaintext
68 lines
1.3 KiB
Plaintext
#include "corpse_lib"
|
|
object GetFinalMaster(object target)
|
|
{
|
|
object master = GetMaster(target);
|
|
object lastMaster = OBJECT_INVALID;
|
|
|
|
|
|
while(GetIsObjectValid(master))
|
|
{
|
|
lastMaster = master;
|
|
|
|
master = GetMaster(lastMaster);
|
|
}
|
|
|
|
return lastMaster;
|
|
}
|
|
void restoreEquipement(object target)
|
|
{
|
|
int slot = 0;
|
|
while(slot<= NUM_INVENTORY_SLOTS)
|
|
{
|
|
object item = GetItemInSlot(slot++,target);
|
|
|
|
if(GetIsObjectValid(item))
|
|
{
|
|
|
|
|
|
if(GetLocalInt(item,CorspeWasDroppableSet))
|
|
{
|
|
DeleteLocalInt(item,CorspeWasDroppableSet);
|
|
SetItemCursedFlag(item,GetLocalInt(item,CorspeWasDroppable));
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
void main()
|
|
{
|
|
object exitingObject = GetExitingObject();
|
|
|
|
if(!GetIsDM(exitingObject) && !GetIsDMPossessed(exitingObject) && !GetIsDM(GetFinalMaster(exitingObject))&& !GetIsCorpseCopying(exitingObject))
|
|
{
|
|
effect ghost = GetFirstEffect(exitingObject);
|
|
|
|
while(GetIsEffectValid(ghost) && GetEffectType(ghost) != EFFECT_TYPE_CUTSCENEGHOST)
|
|
{
|
|
ghost = GetNextEffect(exitingObject);
|
|
}
|
|
|
|
|
|
if(GetIsEffectValid(ghost))
|
|
{
|
|
RemoveEffect(exitingObject,ghost);
|
|
|
|
}
|
|
|
|
|
|
|
|
SetImmortal(exitingObject,FALSE);
|
|
|
|
restoreEquipement(exitingObject);
|
|
}
|
|
|
|
}
|