Cleanup props when parent object no longer exists

A timed event to check for the existence of the rezzing object and cleanup when the check fails.
This commit is contained in:
Oddunity 2017-08-11 13:48:38 -05:00 committed by Sei-Lisa
parent 19424493e9
commit 4ff281d1f2

View file

@ -21,6 +21,7 @@ integer prop_id;
integer prop_point;
integer experience_denied_reason;
key originalowner;
key parentkey;
key give_prop_warning_request;
unsit_all()
@ -89,6 +90,11 @@ state prop
{
llSetClickAction(CLICK_ACTION_TOUCH);
}
if(llGetStartParameter())
{
parentkey = llList2String(llGetObjectDetails(llGetKey(), [OBJECT_REZZER_KEY]), 0);
llSetTimerEvent(10);
}
}
attach(key id)
@ -235,6 +241,22 @@ state prop
llSay(comm_channel, "SAVEPROP|" + (string)prop_id);
}
}
timer()
{
//the parent key should be stored global?
if(llGetBoundingBox(parentkey) == [])
{
if(!llGetAttached())
{
llDie();
}
else
{
llRequestPermissions(llGetOwner(), PERMISSION_ATTACH);
}
}
}
}
state restart_prop