diff options
Diffstat (limited to 'OpenSim')
13 files changed, 157 insertions, 32 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs index 2fe36a8..11024d6 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -192,7 +192,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
192 | 192 | ||
193 | foreach (SceneObjectGroup sceneObject in sceneObjects) | 193 | foreach (SceneObjectGroup sceneObject in sceneObjects) |
194 | { | 194 | { |
195 | sceneObject.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine); | 195 | sceneObject.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 0); |
196 | } | 196 | } |
197 | } | 197 | } |
198 | 198 | ||
diff --git a/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs b/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs index a069ac3..c856b5b 100644 --- a/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs +++ b/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs | |||
@@ -180,7 +180,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
180 | 180 | ||
181 | foreach (SceneObjectGroup sceneObject in sceneObjects) | 181 | foreach (SceneObjectGroup sceneObject in sceneObjects) |
182 | { | 182 | { |
183 | sceneObject.CreateScriptInstances(0, true, scene.DefaultScriptEngine); | 183 | sceneObject.CreateScriptInstances(0, true, scene.DefaultScriptEngine, 0); |
184 | } | 184 | } |
185 | } | 185 | } |
186 | 186 | ||
diff --git a/OpenSim/Region/Environment/Scenes/EventManager.cs b/OpenSim/Region/Environment/Scenes/EventManager.cs index 244b76f8..5d21dc5 100644 --- a/OpenSim/Region/Environment/Scenes/EventManager.cs +++ b/OpenSim/Region/Environment/Scenes/EventManager.cs | |||
@@ -104,7 +104,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
104 | 104 | ||
105 | public event OnPermissionErrorDelegate OnPermissionError; | 105 | public event OnPermissionErrorDelegate OnPermissionError; |
106 | 106 | ||
107 | public delegate void NewRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine); | 107 | public delegate void NewRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource); |
108 | 108 | ||
109 | public event NewRezScript OnRezScript; | 109 | public event NewRezScript OnRezScript; |
110 | 110 | ||
@@ -548,13 +548,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
548 | } | 548 | } |
549 | } | 549 | } |
550 | 550 | ||
551 | public void TriggerRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine) | 551 | public void TriggerRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource) |
552 | { | 552 | { |
553 | handlerRezScript = OnRezScript; | 553 | handlerRezScript = OnRezScript; |
554 | if (handlerRezScript != null) | 554 | if (handlerRezScript != null) |
555 | { | 555 | { |
556 | handlerRezScript(localID, itemID, script, startParam, | 556 | handlerRezScript(localID, itemID, script, startParam, |
557 | postOnRez, engine); | 557 | postOnRez, engine, stateSource); |
558 | } | 558 | } |
559 | } | 559 | } |
560 | 560 | ||
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index 0b24ce9..aca82c3 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs | |||
@@ -1667,7 +1667,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1667 | copy.UpdateGroupRotation(rot); | 1667 | copy.UpdateGroupRotation(rot); |
1668 | } | 1668 | } |
1669 | 1669 | ||
1670 | copy.CreateScriptInstances(0, false, m_parentScene.DefaultScriptEngine); | 1670 | copy.CreateScriptInstances(0, false, m_parentScene.DefaultScriptEngine, 0); |
1671 | copy.HasGroupChanged = true; | 1671 | copy.HasGroupChanged = true; |
1672 | copy.ScheduleGroupForFullUpdate(); | 1672 | copy.ScheduleGroupForFullUpdate(); |
1673 | return copy; | 1673 | return copy; |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 4e93551..b0bac42 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -61,7 +61,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
61 | { | 61 | { |
62 | if (group is SceneObjectGroup) | 62 | if (group is SceneObjectGroup) |
63 | { | 63 | { |
64 | ((SceneObjectGroup) group).CreateScriptInstances(0, false, DefaultScriptEngine); | 64 | ((SceneObjectGroup) group).CreateScriptInstances(0, false, DefaultScriptEngine, 0); |
65 | } | 65 | } |
66 | } | 66 | } |
67 | } | 67 | } |
@@ -292,7 +292,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
292 | { | 292 | { |
293 | // Needs to determine which engine was running it and use that | 293 | // Needs to determine which engine was running it and use that |
294 | // | 294 | // |
295 | part.CreateScriptInstance(item.ItemID, 0, false, DefaultScriptEngine); | 295 | part.CreateScriptInstance(item.ItemID, 0, false, DefaultScriptEngine, 0); |
296 | } | 296 | } |
297 | else | 297 | else |
298 | { | 298 | { |
@@ -1343,7 +1343,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1343 | part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID); | 1343 | part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID); |
1344 | // TODO: switch to posting on_rez here when scripts | 1344 | // TODO: switch to posting on_rez here when scripts |
1345 | // have state in inventory | 1345 | // have state in inventory |
1346 | part.CreateScriptInstance(copyID, 0, false, DefaultScriptEngine); | 1346 | part.CreateScriptInstance(copyID, 0, false, DefaultScriptEngine, 0); |
1347 | 1347 | ||
1348 | // m_log.InfoFormat("[PRIMINVENTORY]: " + | 1348 | // m_log.InfoFormat("[PRIMINVENTORY]: " + |
1349 | // "Rezzed script {0} into prim local ID {1} for user {2}", | 1349 | // "Rezzed script {0} into prim local ID {1} for user {2}", |
@@ -1407,7 +1407,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1407 | part.AddInventoryItem(taskItem); | 1407 | part.AddInventoryItem(taskItem); |
1408 | part.GetProperties(remoteClient); | 1408 | part.GetProperties(remoteClient); |
1409 | 1409 | ||
1410 | part.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine); | 1410 | part.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0); |
1411 | } | 1411 | } |
1412 | } | 1412 | } |
1413 | 1413 | ||
@@ -1503,7 +1503,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1503 | 1503 | ||
1504 | if (running > 0) | 1504 | if (running > 0) |
1505 | { | 1505 | { |
1506 | destPart.CreateScriptInstance(destTaskItem, 0, false, DefaultScriptEngine); | 1506 | destPart.CreateScriptInstance(destTaskItem, 0, false, DefaultScriptEngine, 0); |
1507 | } | 1507 | } |
1508 | 1508 | ||
1509 | ScenePresence avatar; | 1509 | ScenePresence avatar; |
@@ -2050,7 +2050,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
2050 | } | 2050 | } |
2051 | 2051 | ||
2052 | // Fire on_rez | 2052 | // Fire on_rez |
2053 | group.CreateScriptInstances(0, true, DefaultScriptEngine); | 2053 | group.CreateScriptInstances(0, true, DefaultScriptEngine, 0); |
2054 | 2054 | ||
2055 | if (!attachment) | 2055 | if (!attachment) |
2056 | rootPart.ScheduleFullUpdate(); | 2056 | rootPart.ScheduleFullUpdate(); |
@@ -2154,7 +2154,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
2154 | group.UpdateGroupRotation(rot); | 2154 | group.UpdateGroupRotation(rot); |
2155 | //group.ApplyPhysics(m_physicalPrim); | 2155 | //group.ApplyPhysics(m_physicalPrim); |
2156 | group.Velocity = vel; | 2156 | group.Velocity = vel; |
2157 | group.CreateScriptInstances(param, true, DefaultScriptEngine); | 2157 | group.CreateScriptInstances(param, true, DefaultScriptEngine, 0); |
2158 | rootPart.ScheduleFullUpdate(); | 2158 | rootPart.ScheduleFullUpdate(); |
2159 | 2159 | ||
2160 | if (!ExternalChecks.ExternalChecksBypassPermissions()) | 2160 | if (!ExternalChecks.ExternalChecksBypassPermissions()) |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 70ea709..62e6691 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -30,6 +30,7 @@ using System.Collections.Generic; | |||
30 | using System.Drawing; | 30 | using System.Drawing; |
31 | using System.Drawing.Imaging; | 31 | using System.Drawing.Imaging; |
32 | using System.IO; | 32 | using System.IO; |
33 | using System.Xml; | ||
33 | using System.Threading; | 34 | using System.Threading; |
34 | using System.Timers; | 35 | using System.Timers; |
35 | using OpenMetaverse; | 36 | using OpenMetaverse; |
@@ -591,7 +592,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
591 | { | 592 | { |
592 | if (ent is SceneObjectGroup) | 593 | if (ent is SceneObjectGroup) |
593 | { | 594 | { |
594 | ((SceneObjectGroup)ent).CreateScriptInstances(0, false, DefaultScriptEngine); | 595 | ((SceneObjectGroup)ent).CreateScriptInstances(0, false, DefaultScriptEngine, 0); |
595 | } | 596 | } |
596 | } | 597 | } |
597 | } | 598 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs index 24ebc48..a4801ad 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs | |||
@@ -26,11 +26,14 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.IO; | ||
29 | using System.Reflection; | 30 | using System.Reflection; |
30 | using OpenMetaverse; | 31 | using OpenMetaverse; |
31 | using log4net; | 32 | using log4net; |
32 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
33 | using OpenSim.Region.Environment.Interfaces; | 34 | using OpenSim.Region.Environment.Interfaces; |
35 | using System.Collections.Generic; | ||
36 | using System.Xml; | ||
34 | 37 | ||
35 | namespace OpenSim.Region.Environment.Scenes | 38 | namespace OpenSim.Region.Environment.Scenes |
36 | { | 39 | { |
@@ -56,14 +59,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
56 | /// Start the scripts contained in all the prims in this group. | 59 | /// Start the scripts contained in all the prims in this group. |
57 | /// </summary> | 60 | /// </summary> |
58 | public void CreateScriptInstances(int startParam, bool postOnRez, | 61 | public void CreateScriptInstances(int startParam, bool postOnRez, |
59 | string engine) | 62 | string engine, int stateSource) |
60 | { | 63 | { |
61 | // Don't start scripts if they're turned off in the region! | 64 | // Don't start scripts if they're turned off in the region! |
62 | if (!m_scene.RegionInfo.RegionSettings.DisableScripts) | 65 | if (!m_scene.RegionInfo.RegionSettings.DisableScripts) |
63 | { | 66 | { |
64 | foreach (SceneObjectPart part in m_parts.Values) | 67 | foreach (SceneObjectPart part in m_parts.Values) |
65 | { | 68 | { |
66 | part.CreateScriptInstances(startParam, postOnRez, engine); | 69 | part.CreateScriptInstances(startParam, postOnRez, engine, |
70 | stateSource); | ||
67 | } | 71 | } |
68 | } | 72 | } |
69 | } | 73 | } |
@@ -277,5 +281,89 @@ namespace OpenSim.Region.Environment.Scenes | |||
277 | foreach (SceneObjectPart part in m_parts.Values) | 281 | foreach (SceneObjectPart part in m_parts.Values) |
278 | part.ApplyNextOwnerPermissions(); | 282 | part.ApplyNextOwnerPermissions(); |
279 | } | 283 | } |
284 | |||
285 | public string GetStateSnapshot() | ||
286 | { | ||
287 | List<string> assemblies = new List<string>(); | ||
288 | Dictionary<UUID, string> states = new Dictionary<UUID, string>(); | ||
289 | |||
290 | foreach (SceneObjectPart part in m_parts.Values) | ||
291 | { | ||
292 | foreach (string a in part.GetScriptAssemblies()) | ||
293 | { | ||
294 | if (a != "" && !assemblies.Contains(a)) | ||
295 | assemblies.Add(a); | ||
296 | } | ||
297 | |||
298 | foreach (KeyValuePair<UUID, string> s in part.GetScriptStates()) | ||
299 | { | ||
300 | states[s.Key] = s.Value; | ||
301 | } | ||
302 | } | ||
303 | |||
304 | if (states.Count < 1 || assemblies.Count < 1) | ||
305 | return ""; | ||
306 | |||
307 | XmlDocument xmldoc = new XmlDocument(); | ||
308 | |||
309 | XmlNode xmlnode = xmldoc.CreateNode(XmlNodeType.XmlDeclaration, | ||
310 | "", ""); | ||
311 | |||
312 | xmldoc.AppendChild(xmlnode); | ||
313 | XmlElement rootElement = xmldoc.CreateElement("", "ScriptData", | ||
314 | ""); | ||
315 | |||
316 | xmldoc.AppendChild(rootElement); | ||
317 | |||
318 | XmlElement wrapper = xmldoc.CreateElement("", "Assemblies", | ||
319 | ""); | ||
320 | |||
321 | rootElement.AppendChild(wrapper); | ||
322 | |||
323 | foreach (string assembly in assemblies) | ||
324 | { | ||
325 | string fn = Path.GetFileName(assembly); | ||
326 | FileInfo fi = new FileInfo(assembly); | ||
327 | Byte[] data = new Byte[fi.Length]; | ||
328 | |||
329 | FileStream fs = File.Open(assembly, FileMode.Open, FileAccess.Read); | ||
330 | fs.Read(data, 0, data.Length); | ||
331 | fs.Close(); | ||
332 | |||
333 | XmlElement assemblyData = xmldoc.CreateElement("", "Assembly", ""); | ||
334 | XmlAttribute assemblyName = xmldoc.CreateAttribute("", "Filename", ""); | ||
335 | assemblyName.Value = fn; | ||
336 | assemblyData.Attributes.Append(assemblyName); | ||
337 | |||
338 | assemblyData.InnerText = System.Convert.ToBase64String(data); | ||
339 | |||
340 | wrapper.AppendChild(assemblyData); | ||
341 | } | ||
342 | |||
343 | wrapper = xmldoc.CreateElement("", "ScriptStates", | ||
344 | ""); | ||
345 | |||
346 | rootElement.AppendChild(wrapper); | ||
347 | |||
348 | foreach (KeyValuePair<UUID, string> state in states) | ||
349 | { | ||
350 | XmlElement stateData = xmldoc.CreateElement("", "State", ""); | ||
351 | |||
352 | XmlAttribute stateID = xmldoc.CreateAttribute("", "UUID", ""); | ||
353 | stateID.Value = state.Key.ToString(); | ||
354 | stateData.Attributes.Append(stateID); | ||
355 | |||
356 | XmlDocument sdoc = new XmlDocument(); | ||
357 | sdoc.LoadXml(state.Value); | ||
358 | XmlNodeList rootL = sdoc.GetElementsByTagName("ScriptState"); | ||
359 | XmlNode rootNode = rootL[0]; | ||
360 | |||
361 | XmlNode newNode = xmldoc.ImportNode(rootNode, true); | ||
362 | stateData.AppendChild(newNode); | ||
363 | wrapper.AppendChild(stateData); | ||
364 | } | ||
365 | |||
366 | return xmldoc.InnerXml; | ||
367 | } | ||
280 | } | 368 | } |
281 | } | 369 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs index 2f08322..501f199 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs | |||
@@ -126,7 +126,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
126 | /// <summary> | 126 | /// <summary> |
127 | /// Start all the scripts contained in this prim's inventory | 127 | /// Start all the scripts contained in this prim's inventory |
128 | /// </summary> | 128 | /// </summary> |
129 | public void CreateScriptInstances(int startParam, bool postOnRez, string engine) | 129 | public void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource) |
130 | { | 130 | { |
131 | lock (m_taskInventory) | 131 | lock (m_taskInventory) |
132 | { | 132 | { |
@@ -134,7 +134,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
134 | { | 134 | { |
135 | if ((int)InventoryType.LSL == item.InvType) | 135 | if ((int)InventoryType.LSL == item.InvType) |
136 | { | 136 | { |
137 | CreateScriptInstance(item, startParam, postOnRez, engine); | 137 | CreateScriptInstance(item, startParam, postOnRez, engine, stateSource); |
138 | } | 138 | } |
139 | } | 139 | } |
140 | } | 140 | } |
@@ -163,7 +163,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
163 | /// </summary> | 163 | /// </summary> |
164 | /// <param name="item"></param> | 164 | /// <param name="item"></param> |
165 | /// <returns></returns> | 165 | /// <returns></returns> |
166 | public void CreateScriptInstance(TaskInventoryItem item, int startParam, bool postOnRez, string engine) | 166 | public void CreateScriptInstance(TaskInventoryItem item, int startParam, bool postOnRez, string engine, int stateSource) |
167 | { | 167 | { |
168 | // m_log.InfoFormat( | 168 | // m_log.InfoFormat( |
169 | // "[PRIM INVENTORY]: " + | 169 | // "[PRIM INVENTORY]: " + |
@@ -194,7 +194,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
194 | m_taskInventory[item.ItemID].PermsGranter = UUID.Zero; | 194 | m_taskInventory[item.ItemID].PermsGranter = UUID.Zero; |
195 | string script = Utils.BytesToString(asset.Data); | 195 | string script = Utils.BytesToString(asset.Data); |
196 | m_parentGroup.Scene.EventManager.TriggerRezScript(LocalId, item.ItemID, script, | 196 | m_parentGroup.Scene.EventManager.TriggerRezScript(LocalId, item.ItemID, script, |
197 | startParam, postOnRez, engine); | 197 | startParam, postOnRez, engine, stateSource); |
198 | m_parentGroup.AddActiveScriptCount(1); | 198 | m_parentGroup.AddActiveScriptCount(1); |
199 | ScheduleFullUpdate(); | 199 | ScheduleFullUpdate(); |
200 | } | 200 | } |
@@ -208,13 +208,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
208 | /// <param name="itemId"> | 208 | /// <param name="itemId"> |
209 | /// A <see cref="UUID"/> | 209 | /// A <see cref="UUID"/> |
210 | /// </param> | 210 | /// </param> |
211 | public void CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine) | 211 | public void CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource) |
212 | { | 212 | { |
213 | lock (m_taskInventory) | 213 | lock (m_taskInventory) |
214 | { | 214 | { |
215 | if (m_taskInventory.ContainsKey(itemId)) | 215 | if (m_taskInventory.ContainsKey(itemId)) |
216 | { | 216 | { |
217 | CreateScriptInstance(m_taskInventory[itemId], startParam, postOnRez, engine); | 217 | CreateScriptInstance(m_taskInventory[itemId], startParam, postOnRez, engine, stateSource); |
218 | } | 218 | } |
219 | else | 219 | else |
220 | { | 220 | { |
@@ -765,7 +765,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
765 | return ret; | 765 | return ret; |
766 | } | 766 | } |
767 | 767 | ||
768 | string[] GetScriptAssemblies() | 768 | public string[] GetScriptAssemblies() |
769 | { | 769 | { |
770 | IScriptModule[] engines = m_parentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); | 770 | IScriptModule[] engines = m_parentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); |
771 | 771 | ||
@@ -789,5 +789,29 @@ namespace OpenSim.Region.Environment.Scenes | |||
789 | } | 789 | } |
790 | return ret.ToArray(); | 790 | return ret.ToArray(); |
791 | } | 791 | } |
792 | |||
793 | public Dictionary<UUID, string> GetScriptStates() | ||
794 | { | ||
795 | IScriptModule[] engines = m_parentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); | ||
796 | Dictionary<UUID, string> ret = new Dictionary<UUID, string>(); | ||
797 | |||
798 | foreach (TaskInventoryItem item in m_taskInventory.Values) | ||
799 | { | ||
800 | if (item.InvType == 10) | ||
801 | { | ||
802 | foreach (IScriptModule e in engines) | ||
803 | { | ||
804 | string n = e.GetXMLState(item.ItemID); | ||
805 | if (n != "") | ||
806 | { | ||
807 | if (!ret.ContainsKey(item.ItemID)) | ||
808 | ret[item.ItemID] = n; | ||
809 | break; | ||
810 | } | ||
811 | } | ||
812 | } | ||
813 | } | ||
814 | return ret; | ||
815 | } | ||
792 | } | 816 | } |
793 | } | 817 | } |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs index 4abea40..d1dbf94 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs | |||
@@ -232,7 +232,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
232 | } | 232 | } |
233 | 233 | ||
234 | public void OnRezScript(uint localID, UUID itemID, string script, | 234 | public void OnRezScript(uint localID, UUID itemID, string script, |
235 | int startParam, bool postOnRez, string engine) | 235 | int startParam, bool postOnRez, string engine, int stateSource) |
236 | { | 236 | { |
237 | List<IScriptModule> engines = | 237 | List<IScriptModule> engines = |
238 | new List<IScriptModule>( | 238 | new List<IScriptModule>( |
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs index 508e00f..f615250 100644 --- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs | |||
@@ -39,8 +39,7 @@ namespace OpenSim.Region.ScriptEngine.Interfaces | |||
39 | public enum StateSource | 39 | public enum StateSource |
40 | { | 40 | { |
41 | NewRez = 0, | 41 | NewRez = 0, |
42 | PrimCrossing = 1, | 42 | PrimCrossing = 1 |
43 | AttachmentCrossing = 2 | ||
44 | } | 43 | } |
45 | 44 | ||
46 | public interface IScriptWorkItem | 45 | public interface IScriptWorkItem |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 30f03ac..08a97f07 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | |||
@@ -286,6 +286,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
286 | PostEvent(new EventParams("changed", | 286 | PostEvent(new EventParams("changed", |
287 | new Object[] {new LSL_Types.LSLInteger(256)}, new DetectParams[0])); | 287 | new Object[] {new LSL_Types.LSLInteger(256)}, new DetectParams[0])); |
288 | } | 288 | } |
289 | else if (stateSource == StateSource.PrimCrossing) | ||
290 | { | ||
291 | // CHANGED_REGION | ||
292 | PostEvent(new EventParams("changed", | ||
293 | new Object[] {new LSL_Types.LSLInteger(512)}, new DetectParams[0])); | ||
294 | } | ||
289 | } | 295 | } |
290 | } | 296 | } |
291 | else | 297 | else |
@@ -313,6 +319,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
313 | } | 319 | } |
314 | else | 320 | else |
315 | { | 321 | { |
322 | ScenePresence presence = m_Engine.World.GetScenePresence(part.OwnerID); | ||
323 | |||
324 | if (presence != null && (!postOnRez)) | ||
325 | presence.ControllingClient.SendAgentAlertMessage("Compile successful", false); | ||
326 | |||
316 | // m_Engine.Log.ErrorFormat("[Script] Unable to load script state, file not found"); | 327 | // m_Engine.Log.ErrorFormat("[Script] Unable to load script state, file not found"); |
317 | Start(); | 328 | Start(); |
318 | PostEvent(new EventParams("state_entry", | 329 | PostEvent(new EventParams("state_entry", |
@@ -856,8 +867,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
856 | 867 | ||
857 | public string GetXMLState() | 868 | public string GetXMLState() |
858 | { | 869 | { |
870 | bool run = Running; | ||
859 | Stop(100); | 871 | Stop(100); |
872 | Running = run; | ||
860 | return ScriptSerializer.Serialize(this); | 873 | return ScriptSerializer.Serialize(this); |
874 | Running = false; | ||
861 | } | 875 | } |
862 | } | 876 | } |
863 | } | 877 | } |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 221562e..6584bb3 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -333,7 +333,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
333 | get { return false; } | 333 | get { return false; } |
334 | } | 334 | } |
335 | 335 | ||
336 | public void OnRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine) | 336 | public void OnRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource) |
337 | { | 337 | { |
338 | List<IScriptModule> engines = new List<IScriptModule>(m_Scene.RequestModuleInterfaces<IScriptModule>()); | 338 | List<IScriptModule> engines = new List<IScriptModule>(m_Scene.RequestModuleInterfaces<IScriptModule>()); |
339 | 339 | ||
@@ -388,7 +388,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
388 | if (engine != ScriptEngineName) | 388 | if (engine != ScriptEngineName) |
389 | return; | 389 | return; |
390 | 390 | ||
391 | Object[] parms = new Object[]{localID, itemID, script, startParam, postOnRez}; | 391 | Object[] parms = new Object[]{localID, itemID, script, startParam, postOnRez, (StateSource)stateSource}; |
392 | 392 | ||
393 | lock (m_CompileQueue) | 393 | lock (m_CompileQueue) |
394 | { | 394 | { |
@@ -471,6 +471,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
471 | string script =(string)p[2]; | 471 | string script =(string)p[2]; |
472 | int startParam = (int)p[3]; | 472 | int startParam = (int)p[3]; |
473 | bool postOnRez = (bool)p[4]; | 473 | bool postOnRez = (bool)p[4]; |
474 | StateSource stateSource = (StateSource)p[5]; | ||
474 | 475 | ||
475 | // Get the asset ID of the script, so we can check if we | 476 | // Get the asset ID of the script, so we can check if we |
476 | // already have it. | 477 | // already have it. |
@@ -505,8 +506,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
505 | { | 506 | { |
506 | assembly = m_Compiler.PerformScriptCompile(script, | 507 | assembly = m_Compiler.PerformScriptCompile(script, |
507 | assetID.ToString()); | 508 | assetID.ToString()); |
508 | if (presence != null && (!postOnRez)) | ||
509 | presence.ControllingClient.SendAgentAlertMessage("Compile successful", false); | ||
510 | } | 509 | } |
511 | catch (Exception e) | 510 | catch (Exception e) |
512 | { | 511 | { |
@@ -584,7 +583,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
584 | m_AppDomains[appDomain], | 583 | m_AppDomains[appDomain], |
585 | part.ParentGroup.RootPart.Name, | 584 | part.ParentGroup.RootPart.Name, |
586 | item.Name, startParam, postOnRez, | 585 | item.Name, startParam, postOnRez, |
587 | StateSource.NewRez, m_MaxScriptQueue); | 586 | stateSource, m_MaxScriptQueue); |
588 | 587 | ||
589 | m_log.DebugFormat("[XEngine] Loaded script {0}.{1}", | 588 | m_log.DebugFormat("[XEngine] Loaded script {0}.{1}", |
590 | part.ParentGroup.RootPart.Name, item.Name); | 589 | part.ParentGroup.RootPart.Name, item.Name); |
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Events/LSLEventProvider.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Events/LSLEventProvider.cs index 794b132..a2f855c 100644 --- a/OpenSim/ScriptEngine/Components/DotNetEngine/Events/LSLEventProvider.cs +++ b/OpenSim/ScriptEngine/Components/DotNetEngine/Events/LSLEventProvider.cs | |||
@@ -77,7 +77,7 @@ namespace OpenSim.ScriptEngine.Components.DotNetEngine.Events | |||
77 | RemoveScript(localID, itemID); | 77 | RemoveScript(localID, itemID); |
78 | } | 78 | } |
79 | 79 | ||
80 | private void OnRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine) | 80 | private void OnRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource) |
81 | { | 81 | { |
82 | // New script being created, fire event | 82 | // New script being created, fire event |
83 | if (RezScript != null) | 83 | if (RezScript != null) |