From 1b8e89751a40ba7bcb1e068f60d4d5228d31f4ce Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Thu, 7 Feb 2008 01:52:39 +0000 Subject: * Added the Scripted objectflag if there is a script running in a prim. Remove the flag if you delete all of the scripts in the object. --- OpenSim/Region/Environment/Scenes/Scene.cs | 1 + .../Environment/Scenes/SceneObjectPart.Inventory.cs | 15 ++++++++++++++- OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 7 ++++++- 3 files changed, 21 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 4f32774..6b891fd 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -1003,6 +1003,7 @@ namespace OpenSim.Region.Environment.Scenes { AddEntityFromStorage(group); SceneObjectPart rootPart = group.GetChildPart(group.UUID); + rootPart.ObjectFlags &= ~(uint)LLObject.ObjectFlags.Scripted; rootPart.TrimPermissions(); group.ApplyPhysics(m_physicalPrim); diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs index e74b8ed..94bf10e 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs @@ -151,12 +151,15 @@ namespace OpenSim.Region.Environment.Scenes // "[PRIMINVENTORY]: " + // "Starting script {0}, {1} in prim {2}, {3}", // item.Name, item.ItemID, Name, UUID)); + AddFlag(LLObject.ObjectFlags.Scripted); + if (!((m_parentGroup.Scene.RegionInfo.EstateSettings.regionFlags & Simulator.RegionFlags.SkipScripts) == Simulator.RegionFlags.SkipScripts)) { AssetBase rezAsset = m_parentGroup.Scene.AssetCache.GetAsset(item.AssetID, false); if (rezAsset != null) { + string script = Helpers.FieldToUTF8String(rezAsset.Data); m_parentGroup.Scene.EventManager.TriggerRezScript(LocalID, item.ItemID, script); m_parentGroup.AddActiveScriptCount(1); @@ -169,6 +172,7 @@ namespace OpenSim.Region.Environment.Scenes item.Name, item.ItemID, item.AssetID)); } } + ScheduleFullUpdate(); } /// @@ -202,10 +206,18 @@ namespace OpenSim.Region.Environment.Scenes /// public void StopScript(LLUUID itemId) { + + if (m_taskInventory.ContainsKey(itemId)) { + m_parentGroup.Scene.EventManager.TriggerRemoveScript(LocalID, itemId); m_parentGroup.AddActiveScriptCount(-1); + + + + + } else { @@ -213,7 +225,8 @@ namespace OpenSim.Region.Environment.Scenes "[PRIMINVENTORY]: " + "Couldn't stop script with ID {0} since it couldn't be found for prim {1}, {2}", itemId, Name, UUID)); - } + } + } /// diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 4456fce..0a9d21a 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs @@ -670,6 +670,7 @@ namespace OpenSim.Region.Environment.Scenes LLObject.ObjectFlags.AllowInventoryDrop | LLObject.ObjectFlags.CreateSelected; + TrimPermissions(); ScheduleFullUpdate(); @@ -707,7 +708,11 @@ namespace OpenSim.Region.Environment.Scenes OffsetPosition = position; RotationOffset = rotation; ObjectFlags = flags; - + + // Since we don't store script state, this is only a 'temporary' objectflag now + // If the object is scripted, the script will get loaded and this will be set again + ObjectFlags &= ~(uint)LLObject.ObjectFlags.Scripted; + TrimPermissions(); // ApplyPhysics(); -- cgit v1.1