aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs28
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs14
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs22
3 files changed, 43 insertions, 21 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 7cb4a26..6dfd723 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -6887,22 +6887,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6887 if (folderID == UUID.Zero) 6887 if (folderID == UUID.Zero)
6888 return; 6888 return;
6889 6889
6890 byte[] bucket = new byte[1];
6891 bucket[0] = (byte)AssetType.Folder;
6892 //byte[] objBytes = folderID.GetBytes();
6893 //Array.Copy(objBytes, 0, bucket, 1, 16);
6894
6895 GridInstantMessage msg = new GridInstantMessage(World,
6896 m_host.OwnerID, m_host.Name, destID,
6897 (byte)InstantMessageDialog.TaskInventoryOffered,
6898 false, category+". "+m_host.Name+" is located at "+
6899 World.RegionInfo.RegionName+" "+
6900 m_host.AbsolutePosition.ToString(),
6901 folderID, true, m_host.AbsolutePosition,
6902 bucket);
6903
6904 if (m_TransferModule != null) 6890 if (m_TransferModule != null)
6891 {
6892 byte[] bucket = new byte[] { (byte)AssetType.Folder };
6893
6894 GridInstantMessage msg = new GridInstantMessage(World,
6895 m_host.UUID, m_host.Name + ", an object owned by " +
6896 resolveName(m_host.OwnerID) + ",", destID,
6897 (byte)InstantMessageDialog.TaskInventoryOffered,
6898 false, category + "\n" + m_host.Name + " is located at " +
6899 World.RegionInfo.RegionName + " " +
6900 m_host.AbsolutePosition.ToString(),
6901 folderID, true, m_host.AbsolutePosition,
6902 bucket);
6903
6905 m_TransferModule.SendInstantMessage(msg, delegate(bool success) {}); 6904 m_TransferModule.SendInstantMessage(msg, delegate(bool success) {});
6905 }
6906 } 6906 }
6907 6907
6908 public void llSetVehicleType(int type) 6908 public void llSetVehicleType(int type)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 983eed2..771db0c 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -312,11 +312,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
312 part.SetScriptEvents(ItemID, 312 part.SetScriptEvents(ItemID,
313 (int)m_Script.GetStateEventFlags(State)); 313 (int)m_Script.GetStateEventFlags(State));
314 314
315 Running = false; 315 if (!Running)
316
317 if (ShuttingDown)
318 m_startOnInit = false; 316 m_startOnInit = false;
319 317
318 Running = false;
319
320 // we get new rez events on sim restart, too 320 // we get new rez events on sim restart, too
321 // but if there is state, then we fire the change 321 // but if there is state, then we fire the change
322 // event 322 // event
@@ -352,12 +352,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
352 352
353 public void Init() 353 public void Init()
354 { 354 {
355 if (!m_startOnInit) 355 if (ShuttingDown)
356 return; 356 return;
357 357
358 if (m_startedFromSavedState) 358 if (m_startedFromSavedState)
359 { 359 {
360 Start(); 360 if (m_startOnInit)
361 Start();
361 if (m_postOnRez) 362 if (m_postOnRez)
362 { 363 {
363 PostEvent(new EventParams("on_rez", 364 PostEvent(new EventParams("on_rez",
@@ -389,7 +390,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
389 } 390 }
390 else 391 else
391 { 392 {
392 Start(); 393 if (m_startOnInit)
394 Start();
393 PostEvent(new EventParams("state_entry", 395 PostEvent(new EventParams("state_entry",
394 new Object[0], new DetectParams[0])); 396 new Object[0], new DetectParams[0]));
395 if (m_postOnRez) 397 if (m_postOnRez)
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 35a0200..79a6e09 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -109,6 +109,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
109 private bool m_KillTimedOutScripts; 109 private bool m_KillTimedOutScripts;
110 private string m_ScriptEnginesPath = null; 110 private string m_ScriptEnginesPath = null;
111 111
112 private ExpiringCache<UUID, bool> m_runFlags = new ExpiringCache<UUID, bool>();
113
112 /// <summary> 114 /// <summary>
113 /// Is the entire simulator in the process of shutting down? 115 /// Is the entire simulator in the process of shutting down?
114 /// </summary> 116 /// </summary>
@@ -715,6 +717,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
715 m_Scene.EventManager.OnGetScriptRunning += OnGetScriptRunning; 717 m_Scene.EventManager.OnGetScriptRunning += OnGetScriptRunning;
716 m_Scene.EventManager.OnShutdown += OnShutdown; 718 m_Scene.EventManager.OnShutdown += OnShutdown;
717 719
720 // If region ready has been triggered, then the region had no scripts to compile and completed its other
721 // work.
722 m_Scene.EventManager.OnRegionReady += s => m_InitialStartup = false;
723
718 if (m_SleepTime > 0) 724 if (m_SleepTime > 0)
719 { 725 {
720 m_ThreadPool.QueueWorkItem(new WorkItemCallback(this.DoMaintenance), 726 m_ThreadPool.QueueWorkItem(new WorkItemCallback(this.DoMaintenance),
@@ -1269,7 +1275,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1269 1275
1270 if (instance!=null) 1276 if (instance!=null)
1271 instance.Init(); 1277 instance.Init();
1272 1278
1279 bool runIt;
1280 if (m_runFlags.TryGetValue(itemID, out runIt))
1281 {
1282 if (!runIt)
1283 StopScript(itemID);
1284 m_runFlags.Remove(itemID);
1285 }
1286
1273 return true; 1287 return true;
1274 } 1288 }
1275 1289
@@ -1660,6 +1674,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1660 IScriptInstance instance = GetInstance(itemID); 1674 IScriptInstance instance = GetInstance(itemID);
1661 if (instance != null) 1675 if (instance != null)
1662 instance.Start(); 1676 instance.Start();
1677 else
1678 m_runFlags.AddOrUpdate(itemID, true, 240);
1663 } 1679 }
1664 1680
1665 public void StopScript(UUID itemID) 1681 public void StopScript(UUID itemID)
@@ -1671,6 +1687,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1671 // cause issues on mono 2.6, 2.10 and possibly later where locks are not released properly on abort. 1687 // cause issues on mono 2.6, 2.10 and possibly later where locks are not released properly on abort.
1672 instance.Stop(1000); 1688 instance.Stop(1000);
1673 } 1689 }
1690 else
1691 {
1692 m_runFlags.AddOrUpdate(itemID, false, 240);
1693 }
1674 } 1694 }
1675 1695
1676 public DetectParams GetDetectParams(UUID itemID, int idx) 1696 public DetectParams GetDetectParams(UUID itemID, int idx)