diff options
Diffstat (limited to '')
6 files changed, 65 insertions, 73 deletions
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs index ec13b6c..b04f6b6 100644 --- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs | |||
@@ -64,16 +64,6 @@ namespace OpenSim.Region.ScriptEngine.Interfaces | |||
64 | bool Running { get; set; } | 64 | bool Running { get; set; } |
65 | 65 | ||
66 | /// <summary> | 66 | /// <summary> |
67 | /// Gets or sets a value indicating whether this | ||
68 | /// <see cref="OpenSim.Region.ScriptEngine.Interfaces.IScriptInstance"/> is run. | ||
69 | /// For viewer script editor control | ||
70 | /// </summary> | ||
71 | /// <value> | ||
72 | /// <c>true</c> if run; otherwise, <c>false</c>. | ||
73 | /// </value> | ||
74 | bool Run { get; set; } | ||
75 | |||
76 | /// <summary> | ||
77 | /// Is the script suspended? | 67 | /// Is the script suspended? |
78 | /// </summary> | 68 | /// </summary> |
79 | bool Suspended { get; set; } | 69 | bool Suspended { get; set; } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index f88338d..084bd41 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -3973,23 +3973,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3973 | if (agentItem == null) | 3973 | if (agentItem == null) |
3974 | return; | 3974 | return; |
3975 | 3975 | ||
3976 | byte[] bucket = new byte[17]; | 3976 | if (m_TransferModule != null) |
3977 | bucket[0] = (byte)item.Type; | 3977 | { |
3978 | byte[] objBytes = agentItem.ID.GetBytes(); | 3978 | byte[] bucket = new byte[] { (byte)item.Type }; |
3979 | Array.Copy(objBytes, 0, bucket, 1, 16); | ||
3980 | 3979 | ||
3981 | GridInstantMessage msg = new GridInstantMessage(World, | 3980 | GridInstantMessage msg = new GridInstantMessage(World, |
3982 | m_host.UUID, m_host.Name + ", an object owned by " + | 3981 | m_host.UUID, m_host.Name + ", an object owned by " + |
3983 | resolveName(m_host.OwnerID) + ",", destId, | 3982 | resolveName(m_host.OwnerID) + ",", destId, |
3984 | (byte)InstantMessageDialog.TaskInventoryOffered, | 3983 | (byte)InstantMessageDialog.TaskInventoryOffered, |
3985 | false, item.Name + "\n" + m_host.Name + " is located at " + | 3984 | false, item.Name + "\n" + m_host.Name + " is located at " + |
3986 | World.RegionInfo.RegionName+" "+ | 3985 | World.RegionInfo.RegionName+" "+ |
3987 | m_host.AbsolutePosition.ToString(), | 3986 | m_host.AbsolutePosition.ToString(), |
3988 | agentItem.ID, true, m_host.AbsolutePosition, | 3987 | agentItem.ID, true, m_host.AbsolutePosition, |
3989 | bucket); | 3988 | bucket); |
3990 | 3989 | ||
3991 | if (m_TransferModule != null) | ||
3992 | m_TransferModule.SendInstantMessage(msg, delegate(bool success) {}); | 3990 | m_TransferModule.SendInstantMessage(msg, delegate(bool success) {}); |
3991 | } | ||
3993 | 3992 | ||
3994 | ScriptSleep(3000); | 3993 | ScriptSleep(3000); |
3995 | } | 3994 | } |
@@ -6397,23 +6396,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6397 | if (folderID == UUID.Zero) | 6396 | if (folderID == UUID.Zero) |
6398 | return; | 6397 | return; |
6399 | 6398 | ||
6400 | byte[] bucket = new byte[17]; | ||
6401 | bucket[0] = (byte)AssetType.Folder; | ||
6402 | byte[] objBytes = folderID.GetBytes(); | ||
6403 | Array.Copy(objBytes, 0, bucket, 1, 16); | ||
6404 | |||
6405 | GridInstantMessage msg = new GridInstantMessage(World, | ||
6406 | m_host.UUID, m_host.Name + ", an object owned by " + | ||
6407 | resolveName(m_host.OwnerID) + ",", destID, | ||
6408 | (byte)InstantMessageDialog.InventoryOffered, | ||
6409 | false, category + "\n" + m_host.Name + " is located at " + | ||
6410 | World.RegionInfo.RegionName + " " + | ||
6411 | m_host.AbsolutePosition.ToString(), | ||
6412 | folderID, true, m_host.AbsolutePosition, | ||
6413 | bucket); | ||
6414 | |||
6415 | if (m_TransferModule != null) | 6399 | if (m_TransferModule != null) |
6400 | { | ||
6401 | byte[] bucket = new byte[] { (byte)AssetType.Folder }; | ||
6402 | |||
6403 | GridInstantMessage msg = new GridInstantMessage(World, | ||
6404 | m_host.UUID, m_host.Name + ", an object owned by " + | ||
6405 | resolveName(m_host.OwnerID) + ",", destID, | ||
6406 | (byte)InstantMessageDialog.TaskInventoryOffered, | ||
6407 | false, category + "\n" + m_host.Name + " is located at " + | ||
6408 | World.RegionInfo.RegionName + " " + | ||
6409 | m_host.AbsolutePosition.ToString(), | ||
6410 | folderID, true, m_host.AbsolutePosition, | ||
6411 | bucket); | ||
6412 | |||
6416 | m_TransferModule.SendInstantMessage(msg, delegate(bool success) {}); | 6413 | m_TransferModule.SendInstantMessage(msg, delegate(bool success) {}); |
6414 | } | ||
6417 | } | 6415 | } |
6418 | 6416 | ||
6419 | public void llSetVehicleType(int type) | 6417 | public void llSetVehicleType(int type) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 3654106..4137397 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -1664,9 +1664,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1664 | CheckThreatLevel(ThreatLevel.Low, "osMessageObject"); | 1664 | CheckThreatLevel(ThreatLevel.Low, "osMessageObject"); |
1665 | m_host.AddScriptLPS(1); | 1665 | m_host.AddScriptLPS(1); |
1666 | 1666 | ||
1667 | UUID objUUID; | ||
1668 | if (!UUID.TryParse(objectUUID, out objUUID)) // prior to patching, a thrown exception regarding invalid GUID format would be shouted instead. | ||
1669 | { | ||
1670 | OSSLShoutError("osMessageObject() cannot send messages to objects with invalid UUIDs"); | ||
1671 | return; | ||
1672 | } | ||
1673 | |||
1667 | object[] resobj = new object[] { new LSL_Types.LSLString(m_host.UUID.ToString()), new LSL_Types.LSLString(message) }; | 1674 | object[] resobj = new object[] { new LSL_Types.LSLString(m_host.UUID.ToString()), new LSL_Types.LSLString(message) }; |
1668 | 1675 | ||
1669 | SceneObjectPart sceneOP = World.GetSceneObjectPart(new UUID(objectUUID)); | 1676 | SceneObjectPart sceneOP = World.GetSceneObjectPart(objUUID); |
1677 | |||
1678 | if (sceneOP == null) // prior to patching, PostObjectEvent() would cause a throw exception to be shouted instead. | ||
1679 | { | ||
1680 | OSSLShoutError("osMessageObject() cannot send message to " + objUUID.ToString() + ", object was not found in scene."); | ||
1681 | return; | ||
1682 | } | ||
1670 | 1683 | ||
1671 | m_ScriptEngine.PostObjectEvent( | 1684 | m_ScriptEngine.PostObjectEvent( |
1672 | sceneOP.LocalId, new EventParams( | 1685 | sceneOP.LocalId, new EventParams( |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index f1abd4b..5793cc9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | |||
@@ -121,8 +121,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
121 | 121 | ||
122 | public bool Running { get; set; } | 122 | public bool Running { get; set; } |
123 | 123 | ||
124 | public bool Run { get; set; } | ||
125 | |||
126 | public bool Suspended | 124 | public bool Suspended |
127 | { | 125 | { |
128 | get { return m_Suspended; } | 126 | get { return m_Suspended; } |
@@ -218,7 +216,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
218 | m_postOnRez = postOnRez; | 216 | m_postOnRez = postOnRez; |
219 | m_AttachedAvatar = part.ParentGroup.AttachedAvatar; | 217 | m_AttachedAvatar = part.ParentGroup.AttachedAvatar; |
220 | m_RegionID = part.ParentGroup.Scene.RegionInfo.RegionID; | 218 | m_RegionID = part.ParentGroup.Scene.RegionInfo.RegionID; |
221 | Run = true; | ||
222 | 219 | ||
223 | if (part != null) | 220 | if (part != null) |
224 | { | 221 | { |
@@ -315,11 +312,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
315 | part.SetScriptEvents(ItemID, | 312 | part.SetScriptEvents(ItemID, |
316 | (int)m_Script.GetStateEventFlags(State)); | 313 | (int)m_Script.GetStateEventFlags(State)); |
317 | 314 | ||
318 | Running = false; | 315 | if (!Running) |
319 | |||
320 | if (ShuttingDown) | ||
321 | m_startOnInit = false; | 316 | m_startOnInit = false; |
322 | 317 | ||
318 | Running = false; | ||
319 | |||
323 | // we get new rez events on sim restart, too | 320 | // we get new rez events on sim restart, too |
324 | // but if there is state, then we fire the change | 321 | // but if there is state, then we fire the change |
325 | // event | 322 | // event |
@@ -355,15 +352,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
355 | 352 | ||
356 | public void Init() | 353 | public void Init() |
357 | { | 354 | { |
358 | if (!m_startOnInit) | 355 | if (ShuttingDown) |
359 | return; | 356 | return; |
360 | 357 | ||
361 | if (m_startedFromSavedState) | 358 | if (m_startedFromSavedState) |
362 | { | 359 | { |
363 | if (!Run) | 360 | if (m_startOnInit) |
364 | return; | 361 | Start(); |
365 | |||
366 | Start(); | ||
367 | if (m_postOnRez) | 362 | if (m_postOnRez) |
368 | { | 363 | { |
369 | PostEvent(new EventParams("on_rez", | 364 | PostEvent(new EventParams("on_rez", |
@@ -395,10 +390,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
395 | } | 390 | } |
396 | else | 391 | else |
397 | { | 392 | { |
398 | if (!Run) | 393 | if (m_startOnInit) |
399 | return; | 394 | Start(); |
400 | |||
401 | Start(); | ||
402 | PostEvent(new EventParams("state_entry", | 395 | PostEvent(new EventParams("state_entry", |
403 | new Object[0], new DetectParams[0])); | 396 | new Object[0], new DetectParams[0])); |
404 | if (m_postOnRez) | 397 | if (m_postOnRez) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptSerializer.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptSerializer.cs index 797bce3..bcdc7bf 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptSerializer.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptSerializer.cs | |||
@@ -55,7 +55,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
55 | public static string Serialize(ScriptInstance instance) | 55 | public static string Serialize(ScriptInstance instance) |
56 | { | 56 | { |
57 | bool running = instance.Running; | 57 | bool running = instance.Running; |
58 | bool enabled = instance.Run; | ||
59 | 58 | ||
60 | XmlDocument xmldoc = new XmlDocument(); | 59 | XmlDocument xmldoc = new XmlDocument(); |
61 | 60 | ||
@@ -78,12 +77,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
78 | 77 | ||
79 | rootElement.AppendChild(run); | 78 | rootElement.AppendChild(run); |
80 | 79 | ||
81 | XmlElement run_enable = xmldoc.CreateElement("", "Run", ""); | ||
82 | run_enable.AppendChild(xmldoc.CreateTextNode( | ||
83 | enabled.ToString())); | ||
84 | |||
85 | rootElement.AppendChild(run_enable); | ||
86 | |||
87 | Dictionary<string, Object> vars = instance.GetVars(); | 80 | Dictionary<string, Object> vars = instance.GetVars(); |
88 | 81 | ||
89 | XmlElement variables = xmldoc.CreateElement("", "Variables", ""); | 82 | XmlElement variables = xmldoc.CreateElement("", "Variables", ""); |
@@ -232,7 +225,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
232 | { | 225 | { |
233 | object varValue; | 226 | object varValue; |
234 | XmlNodeList partL = rootNode.ChildNodes; | 227 | XmlNodeList partL = rootNode.ChildNodes; |
235 | instance.Run = true; | ||
236 | 228 | ||
237 | foreach (XmlNode part in partL) | 229 | foreach (XmlNode part in partL) |
238 | { | 230 | { |
@@ -244,9 +236,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
244 | case "Running": | 236 | case "Running": |
245 | instance.Running=bool.Parse(part.InnerText); | 237 | instance.Running=bool.Parse(part.InnerText); |
246 | break; | 238 | break; |
247 | case "Run": | ||
248 | instance.Run = bool.Parse(part.InnerText); | ||
249 | break; | ||
250 | case "Variables": | 239 | case "Variables": |
251 | XmlNodeList varL = part.ChildNodes; | 240 | XmlNodeList varL = part.ChildNodes; |
252 | foreach (XmlNode var in varL) | 241 | foreach (XmlNode var in varL) |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 20fad05..7a9c80c 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -108,6 +108,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
108 | private bool m_KillTimedOutScripts; | 108 | private bool m_KillTimedOutScripts; |
109 | private string m_ScriptEnginesPath = null; | 109 | private string m_ScriptEnginesPath = null; |
110 | 110 | ||
111 | private ExpiringCache<UUID, bool> m_runFlags = new ExpiringCache<UUID, bool>(); | ||
112 | |||
111 | /// <summary> | 113 | /// <summary> |
112 | /// Is the entire simulator in the process of shutting down? | 114 | /// Is the entire simulator in the process of shutting down? |
113 | /// </summary> | 115 | /// </summary> |
@@ -1196,6 +1198,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1196 | if (instance != null) | 1198 | if (instance != null) |
1197 | instance.Init(); | 1199 | instance.Init(); |
1198 | 1200 | ||
1201 | bool runIt; | ||
1202 | if (m_runFlags.TryGetValue(itemID, out runIt)) | ||
1203 | { | ||
1204 | if (!runIt) | ||
1205 | StopScript(itemID); | ||
1206 | m_runFlags.Remove(itemID); | ||
1207 | } | ||
1208 | |||
1199 | return true; | 1209 | return true; |
1200 | } | 1210 | } |
1201 | 1211 | ||
@@ -1541,13 +1551,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1541 | } | 1551 | } |
1542 | } | 1552 | } |
1543 | 1553 | ||
1544 | public void SetRunEnable(UUID instanceID, bool enable) | ||
1545 | { | ||
1546 | IScriptInstance instance = GetInstance(instanceID); | ||
1547 | if (instance != null) | ||
1548 | instance.Run = enable; | ||
1549 | } | ||
1550 | |||
1551 | public bool GetScriptState(UUID itemID) | 1554 | public bool GetScriptState(UUID itemID) |
1552 | { | 1555 | { |
1553 | IScriptInstance instance = GetInstance(itemID); | 1556 | IScriptInstance instance = GetInstance(itemID); |
@@ -1575,6 +1578,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1575 | IScriptInstance instance = GetInstance(itemID); | 1578 | IScriptInstance instance = GetInstance(itemID); |
1576 | if (instance != null) | 1579 | if (instance != null) |
1577 | instance.Start(); | 1580 | instance.Start(); |
1581 | else | ||
1582 | m_runFlags.AddOrUpdate(itemID, true, 240); | ||
1578 | } | 1583 | } |
1579 | 1584 | ||
1580 | public void StopScript(UUID itemID) | 1585 | public void StopScript(UUID itemID) |
@@ -1586,6 +1591,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1586 | // cause issues on mono 2.6, 2.10 and possibly later where locks are not released properly on abort. | 1591 | // cause issues on mono 2.6, 2.10 and possibly later where locks are not released properly on abort. |
1587 | instance.Stop(1000); | 1592 | instance.Stop(1000); |
1588 | } | 1593 | } |
1594 | else | ||
1595 | { | ||
1596 | m_runFlags.AddOrUpdate(itemID, false, 240); | ||
1597 | } | ||
1589 | } | 1598 | } |
1590 | 1599 | ||
1591 | public DetectParams GetDetectParams(UUID itemID, int idx) | 1600 | public DetectParams GetDetectParams(UUID itemID, int idx) |