From 4ff281d1f246e212fb9ffe939b41902848b44472 Mon Sep 17 00:00:00 2001 From: Oddunity Date: Fri, 11 Aug 2017 13:48:38 -0500 Subject: [PATCH] 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. --- AVsitter2/Plugins/AVprop/[AV]object.lsl | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/AVsitter2/Plugins/AVprop/[AV]object.lsl b/AVsitter2/Plugins/AVprop/[AV]object.lsl index aae90df..0d61301 100644 --- a/AVsitter2/Plugins/AVprop/[AV]object.lsl +++ b/AVsitter2/Plugins/AVprop/[AV]object.lsl @@ -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