diff options
author | Melanie | 2010-04-19 06:29:26 +0100 |
---|---|---|
committer | Melanie | 2010-04-19 06:29:26 +0100 |
commit | 21cad5d3ac68ceb4ac48346835ac087ecb107446 (patch) | |
tree | b413c2c0e42a38008bd61cdd8191787bccb45b13 | |
parent | Slightly tweak README to account for the fact that first-time standalone user... (diff) | |
download | opensim-SC-21cad5d3ac68ceb4ac48346835ac087ecb107446.zip opensim-SC-21cad5d3ac68ceb4ac48346835ac087ecb107446.tar.gz opensim-SC-21cad5d3ac68ceb4ac48346835ac087ecb107446.tar.bz2 opensim-SC-21cad5d3ac68ceb4ac48346835ac087ecb107446.tar.xz |
All scripts are now created suspended and are only unsuspended when the object
is fully rezzed and all scripts in it are instantiated. This ensures that link
messages will not be lost on rez/region crossing and makes heavily scripted
objects reliable.
Diffstat (limited to '')
14 files changed, 85 insertions, 3 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index c87a383..77e73fb 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -250,6 +250,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
250 | itemID, remoteClient.Name, AttachmentPt); | 250 | itemID, remoteClient.Name, AttachmentPt); |
251 | } | 251 | } |
252 | 252 | ||
253 | objatt.ResumeScripts(); | ||
253 | return objatt; | 254 | return objatt; |
254 | } | 255 | } |
255 | 256 | ||
@@ -413,4 +414,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
413 | } | 414 | } |
414 | } | 415 | } |
415 | } | 416 | } |
416 | } \ No newline at end of file | 417 | } |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 16e05b7..32a0df9 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -621,6 +621,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
621 | } | 621 | } |
622 | } | 622 | } |
623 | 623 | ||
624 | rootPart.ParentGroup.ResumeScripts(); | ||
624 | return rootPart.ParentGroup; | 625 | return rootPart.ParentGroup; |
625 | } | 626 | } |
626 | } | 627 | } |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 55028d0..c52f029 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -284,6 +284,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
284 | { | 284 | { |
285 | sceneObjectsLoadedCount++; | 285 | sceneObjectsLoadedCount++; |
286 | sceneObject.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, 0); | 286 | sceneObject.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, 0); |
287 | sceneObject.ResumeScripts(); | ||
287 | } | 288 | } |
288 | } | 289 | } |
289 | 290 | ||
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs index f58904f..2b90960 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs | |||
@@ -74,6 +74,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
74 | void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource); | 74 | void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource); |
75 | 75 | ||
76 | ArrayList GetScriptErrors(UUID itemID); | 76 | ArrayList GetScriptErrors(UUID itemID); |
77 | void ResumeScripts(); | ||
77 | 78 | ||
78 | /// <summary> | 79 | /// <summary> |
79 | /// Stop all the scripts in this entity. | 80 | /// Stop all the scripts in this entity. |
diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs index e90b300..fecdd1b 100644 --- a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs | |||
@@ -41,6 +41,14 @@ namespace OpenSim.Region.Framework.Interfaces | |||
41 | bool PostScriptEvent(UUID itemID, string name, Object[] args); | 41 | bool PostScriptEvent(UUID itemID, string name, Object[] args); |
42 | bool PostObjectEvent(UUID itemID, string name, Object[] args); | 42 | bool PostObjectEvent(UUID itemID, string name, Object[] args); |
43 | 43 | ||
44 | // Suspend ALL scripts in a given scene object. The item ID | ||
45 | // is the UUID of a SOG, and the method acts on all contained | ||
46 | // scripts. This is different from the suspend/resume that | ||
47 | // can be issued by a client. | ||
48 | // | ||
49 | void SuspendScript(UUID itemID); | ||
50 | void ResumeScript(UUID itemID); | ||
51 | |||
44 | ArrayList GetScriptErrors(UUID itemID); | 52 | ArrayList GetScriptErrors(UUID itemID); |
45 | } | 53 | } |
46 | } | 54 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 7661068..435026c 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -63,6 +63,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
63 | if (group is SceneObjectGroup) | 63 | if (group is SceneObjectGroup) |
64 | { | 64 | { |
65 | ((SceneObjectGroup) group).CreateScriptInstances(0, false, DefaultScriptEngine, 0); | 65 | ((SceneObjectGroup) group).CreateScriptInstances(0, false, DefaultScriptEngine, 0); |
66 | ((SceneObjectGroup) group).ResumeScripts(); | ||
66 | } | 67 | } |
67 | } | 68 | } |
68 | } | 69 | } |
@@ -218,6 +219,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
218 | { | 219 | { |
219 | remoteClient.SendAgentAlertMessage("Script saved", false); | 220 | remoteClient.SendAgentAlertMessage("Script saved", false); |
220 | } | 221 | } |
222 | part.ParentGroup.ResumeScripts(); | ||
221 | return errors; | 223 | return errors; |
222 | } | 224 | } |
223 | 225 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index a34f57e..57587be 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1131,7 +1131,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1131 | { | 1131 | { |
1132 | if (m_scripts_enabled != !ScriptEngine) | 1132 | if (m_scripts_enabled != !ScriptEngine) |
1133 | { | 1133 | { |
1134 | // Tedd! Here's the method to disable the scripting engine! | ||
1135 | if (ScriptEngine) | 1134 | if (ScriptEngine) |
1136 | { | 1135 | { |
1137 | m_log.Info("Stopping all Scripts in Scene"); | 1136 | m_log.Info("Stopping all Scripts in Scene"); |
@@ -1153,6 +1152,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1153 | if (ent is SceneObjectGroup) | 1152 | if (ent is SceneObjectGroup) |
1154 | { | 1153 | { |
1155 | ((SceneObjectGroup)ent).CreateScriptInstances(0, false, DefaultScriptEngine, 0); | 1154 | ((SceneObjectGroup)ent).CreateScriptInstances(0, false, DefaultScriptEngine, 0); |
1155 | ((SceneObjectGroup)ent).ResumeScripts(); | ||
1156 | } | 1156 | } |
1157 | } | 1157 | } |
1158 | } | 1158 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 89eb54d..1421d0e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -1755,6 +1755,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1755 | copy.CreateScriptInstances(0, false, m_parentScene.DefaultScriptEngine, 0); | 1755 | copy.CreateScriptInstances(0, false, m_parentScene.DefaultScriptEngine, 0); |
1756 | copy.HasGroupChanged = true; | 1756 | copy.HasGroupChanged = true; |
1757 | copy.ScheduleGroupForFullUpdate(); | 1757 | copy.ScheduleGroupForFullUpdate(); |
1758 | copy.ResumeScripts(); | ||
1758 | 1759 | ||
1759 | // required for physics to update it's position | 1760 | // required for physics to update it's position |
1760 | copy.AbsolutePosition = copy.AbsolutePosition; | 1761 | copy.AbsolutePosition = copy.AbsolutePosition; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs index 4034744..f7e46af 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs | |||
@@ -416,5 +416,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
416 | scriptModule.SetXMLState(itemID, n.OuterXml); | 416 | scriptModule.SetXMLState(itemID, n.OuterXml); |
417 | } | 417 | } |
418 | } | 418 | } |
419 | |||
420 | public void ResumeScripts() | ||
421 | { | ||
422 | foreach (SceneObjectPart part in m_parts.Values) | ||
423 | { | ||
424 | part.Inventory.ResumeScripts(); | ||
425 | } | ||
426 | } | ||
419 | } | 427 | } |
420 | } | 428 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 2e13f90..2b6be29 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -1042,5 +1042,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
1042 | 1042 | ||
1043 | return ret; | 1043 | return ret; |
1044 | } | 1044 | } |
1045 | |||
1046 | public void ResumeScripts() | ||
1047 | { | ||
1048 | IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); | ||
1049 | if (engines == null) | ||
1050 | return; | ||
1051 | |||
1052 | |||
1053 | lock (m_items) | ||
1054 | { | ||
1055 | foreach (TaskInventoryItem item in m_items.Values) | ||
1056 | { | ||
1057 | if (item.InvType == (int)InventoryType.LSL) | ||
1058 | { | ||
1059 | foreach (IScriptModule engine in engines) | ||
1060 | { | ||
1061 | if (engine != null) | ||
1062 | engine.ResumeScript(item.ItemID); | ||
1063 | } | ||
1064 | } | ||
1065 | } | ||
1066 | } | ||
1067 | } | ||
1045 | } | 1068 | } |
1046 | } \ No newline at end of file | 1069 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs index cf0f345..b6677f0 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs | |||
@@ -182,6 +182,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
182 | foreach (SceneObjectGroup sceneObject in sceneObjects) | 182 | foreach (SceneObjectGroup sceneObject in sceneObjects) |
183 | { | 183 | { |
184 | sceneObject.CreateScriptInstances(0, true, scene.DefaultScriptEngine, 0); | 184 | sceneObject.CreateScriptInstances(0, true, scene.DefaultScriptEngine, 0); |
185 | sceneObject.ResumeScripts(); | ||
185 | } | 186 | } |
186 | } | 187 | } |
187 | 188 | ||
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs index ae148a9..9f6ea35 100644 --- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs | |||
@@ -81,6 +81,9 @@ namespace OpenSim.Region.ScriptEngine.Interfaces | |||
81 | 81 | ||
82 | void PostEvent(EventParams data); | 82 | void PostEvent(EventParams data); |
83 | 83 | ||
84 | void Suspend(); | ||
85 | void Resume(); | ||
86 | |||
84 | /// <summary> | 87 | /// <summary> |
85 | /// Process the next event queued for this script | 88 | /// Process the next event queued for this script |
86 | /// </summary> | 89 | /// </summary> |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index d30d2dc..74f25aa 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | |||
@@ -95,6 +95,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
95 | private bool m_startedFromSavedState; | 95 | private bool m_startedFromSavedState; |
96 | private UUID m_CurrentStateHash; | 96 | private UUID m_CurrentStateHash; |
97 | private UUID m_RegionID; | 97 | private UUID m_RegionID; |
98 | private bool m_Suspended = true; | ||
98 | 99 | ||
99 | private Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> | 100 | private Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> |
100 | m_LineMap; | 101 | m_LineMap; |
@@ -638,6 +639,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
638 | /// <returns></returns> | 639 | /// <returns></returns> |
639 | public object EventProcessor() | 640 | public object EventProcessor() |
640 | { | 641 | { |
642 | if (m_Suspended) | ||
643 | return 0; | ||
644 | |||
641 | lock (m_Script) | 645 | lock (m_Script) |
642 | { | 646 | { |
643 | EventParams data = null; | 647 | EventParams data = null; |
@@ -1011,5 +1015,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
1011 | { | 1015 | { |
1012 | get { return m_RegionID; } | 1016 | get { return m_RegionID; } |
1013 | } | 1017 | } |
1018 | |||
1019 | public void Suspend() | ||
1020 | { | ||
1021 | m_Suspended = true; | ||
1022 | } | ||
1023 | |||
1024 | public void Resume() | ||
1025 | { | ||
1026 | m_Suspended = false; | ||
1027 | } | ||
1014 | } | 1028 | } |
1015 | } | 1029 | } |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 98e77c0..54074ed 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -1488,5 +1488,23 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1488 | return new ArrayList(); | 1488 | return new ArrayList(); |
1489 | } | 1489 | } |
1490 | } | 1490 | } |
1491 | |||
1492 | public void SuspendScript(UUID itemID) | ||
1493 | { | ||
1494 | IScriptInstance instance = GetInstance(itemID); | ||
1495 | if (instance == null) | ||
1496 | return; | ||
1497 | |||
1498 | instance.Suspend(); | ||
1499 | } | ||
1500 | |||
1501 | public void ResumeScript(UUID itemID) | ||
1502 | { | ||
1503 | IScriptInstance instance = GetInstance(itemID); | ||
1504 | if (instance == null) | ||
1505 | return; | ||
1506 | |||
1507 | instance.Resume(); | ||
1508 | } | ||
1491 | } | 1509 | } |
1492 | } | 1510 | } |