aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/XEngine
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/XEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/EventManager.cs29
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs10
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs57
3 files changed, 34 insertions, 62 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
index 9405075..5c4174e 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
@@ -96,12 +96,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
96 if (part == null) 96 if (part == null)
97 return; 97 return;
98 98
99 if ((part.ScriptEvents & scriptEvents.money) == 0)
100 part = part.ParentGroup.RootPart;
101
102 m_log.Debug("Paid: " + objectID + " from " + agentID + ", amount " + amount); 99 m_log.Debug("Paid: " + objectID + " from " + agentID + ", amount " + amount);
103 100
104// part = part.ParentGroup.RootPart; 101 part = part.ParentGroup.RootPart;
105 money(part.LocalId, agentID, amount); 102 money(part.LocalId, agentID, amount);
106 } 103 }
107 104
@@ -155,7 +152,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
155 det[0] = new DetectParams(); 152 det[0] = new DetectParams();
156 det[0].Key = remoteClient.AgentId; 153 det[0].Key = remoteClient.AgentId;
157 det[0].Populate(myScriptEngine.World); 154 det[0].Populate(myScriptEngine.World);
158 det[0].OffsetPos = offsetPos; 155 det[0].OffsetPos = new LSL_Types.Vector3(offsetPos.X,
156 offsetPos.Y,
157 offsetPos.Z);
159 158
160 if (originalID == 0) 159 if (originalID == 0)
161 { 160 {
@@ -299,7 +298,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
299 foreach (DetectedObject detobj in col.Colliders) 298 foreach (DetectedObject detobj in col.Colliders)
300 { 299 {
301 DetectParams d = new DetectParams(); 300 DetectParams d = new DetectParams();
302 d.Position = detobj.posVector; 301 d.Position = new LSL_Types.Vector3(detobj.posVector.X,
302 detobj.posVector.Y,
303 detobj.posVector.Z);
303 d.Populate(myScriptEngine.World); 304 d.Populate(myScriptEngine.World);
304 det.Add(d); 305 det.Add(d);
305 myScriptEngine.PostObjectEvent(localID, new EventParams( 306 myScriptEngine.PostObjectEvent(localID, new EventParams(
@@ -317,7 +318,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
317 foreach (DetectedObject detobj in col.Colliders) 318 foreach (DetectedObject detobj in col.Colliders)
318 { 319 {
319 DetectParams d = new DetectParams(); 320 DetectParams d = new DetectParams();
320 d.Position = detobj.posVector; 321 d.Position = new LSL_Types.Vector3(detobj.posVector.X,
322 detobj.posVector.Y,
323 detobj.posVector.Z);
321 d.Populate(myScriptEngine.World); 324 d.Populate(myScriptEngine.World);
322 det.Add(d); 325 det.Add(d);
323 myScriptEngine.PostObjectEvent(localID, new EventParams( 326 myScriptEngine.PostObjectEvent(localID, new EventParams(
@@ -334,7 +337,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
334 foreach (DetectedObject detobj in col.Colliders) 337 foreach (DetectedObject detobj in col.Colliders)
335 { 338 {
336 DetectParams d = new DetectParams(); 339 DetectParams d = new DetectParams();
337 d.Position = detobj.posVector; 340 d.Position = new LSL_Types.Vector3(detobj.posVector.X,
341 detobj.posVector.Y,
342 detobj.posVector.Z);
338 d.Populate(myScriptEngine.World); 343 d.Populate(myScriptEngine.World);
339 det.Add(d); 344 det.Add(d);
340 myScriptEngine.PostObjectEvent(localID, new EventParams( 345 myScriptEngine.PostObjectEvent(localID, new EventParams(
@@ -376,8 +381,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
376 myScriptEngine.PostObjectEvent(localID, new EventParams( 381 myScriptEngine.PostObjectEvent(localID, new EventParams(
377 "at_target", new object[] { 382 "at_target", new object[] {
378 new LSL_Types.LSLInteger(handle), 383 new LSL_Types.LSLInteger(handle),
379 new LSL_Types.Vector3(targetpos), 384 new LSL_Types.Vector3(targetpos.X,targetpos.Y,targetpos.Z),
380 new LSL_Types.Vector3(atpos) }, 385 new LSL_Types.Vector3(atpos.X,atpos.Y,atpos.Z) },
381 new DetectParams[0])); 386 new DetectParams[0]));
382 } 387 }
383 388
@@ -394,8 +399,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
394 myScriptEngine.PostObjectEvent(localID, new EventParams( 399 myScriptEngine.PostObjectEvent(localID, new EventParams(
395 "at_rot_target", new object[] { 400 "at_rot_target", new object[] {
396 new LSL_Types.LSLInteger(handle), 401 new LSL_Types.LSLInteger(handle),
397 new LSL_Types.Quaternion(targetrot), 402 new LSL_Types.Quaternion(targetrot.X,targetrot.Y,targetrot.Z,targetrot.W),
398 new LSL_Types.Quaternion(atrot) }, 403 new LSL_Types.Quaternion(atrot.X,atrot.Y,atrot.Z,atrot.W) },
399 new DetectParams[0])); 404 new DetectParams[0]));
400 } 405 }
401 406
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs
index f331658..f247a0b 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs
@@ -90,7 +90,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Tests
90// log4net.Config.XmlConfigurator.Configure(); 90// log4net.Config.XmlConfigurator.Configure();
91 91
92 UUID userId = TestHelpers.ParseTail(0x1); 92 UUID userId = TestHelpers.ParseTail(0x1);
93// UUID objectId = TestHelpers.ParseTail(0x100); 93// UUID objectId = TestHelpers.ParseTail(0x2);
94// UUID itemId = TestHelpers.ParseTail(0x3); 94// UUID itemId = TestHelpers.ParseTail(0x3);
95 string itemName = "TestStartScript() Item"; 95 string itemName = "TestStartScript() Item";
96 96
@@ -105,18 +105,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Tests
105 105
106 m_scene.EventManager.OnChatFromWorld += OnChatFromWorld; 106 m_scene.EventManager.OnChatFromWorld += OnChatFromWorld;
107 107
108 SceneObjectPart partWhereRezzed = m_scene.RezNewScript(userId, itemTemplate); 108 m_scene.RezNewScript(userId, itemTemplate);
109 109
110 m_chatEvent.WaitOne(60000); 110 m_chatEvent.WaitOne(60000);
111 111
112 Assert.That(m_osChatMessageReceived, Is.Not.Null, "No chat message received in TestStartScript()"); 112 Assert.That(m_osChatMessageReceived, Is.Not.Null, "No chat message received in TestStartScript()");
113 Assert.That(m_osChatMessageReceived.Message, Is.EqualTo("Script running")); 113 Assert.That(m_osChatMessageReceived.Message, Is.EqualTo("Script running"));
114
115 bool running;
116 TaskInventoryItem scriptItem = partWhereRezzed.Inventory.GetInventoryItem(itemName);
117 Assert.That(
118 SceneObjectPartInventory.TryGetScriptInstanceRunning(m_scene, scriptItem, out running), Is.True);
119 Assert.That(running, Is.True);
120 } 114 }
121 115
122 private void OnChatFromWorld(object sender, OSChatMessage oscm) 116 private void OnChatFromWorld(object sender, OSChatMessage oscm)
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 9f05666..f6cb7df 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -656,19 +656,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
656 if (m_Assemblies.ContainsKey(instance.AssetID)) 656 if (m_Assemblies.ContainsKey(instance.AssetID))
657 { 657 {
658 string assembly = m_Assemblies[instance.AssetID]; 658 string assembly = m_Assemblies[instance.AssetID];
659 659 instance.SaveState(assembly);
660 try
661 {
662 instance.SaveState(assembly);
663 }
664 catch (Exception e)
665 {
666 m_log.Error(
667 string.Format(
668 "[XEngine]: Failed final state save for script {0}.{1}, item UUID {2}, prim UUID {3} in {4}. Exception ",
669 instance.PrimName, instance.ScriptName, instance.ItemID, instance.ObjectID, World.Name)
670 , e);
671 }
672 } 660 }
673 661
674 // Clear the event queue and abort the instance thread 662 // Clear the event queue and abort the instance thread
@@ -790,18 +778,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
790 assembly = m_Assemblies[i.AssetID]; 778 assembly = m_Assemblies[i.AssetID];
791 779
792 780
793 try 781 i.SaveState(assembly);
794 {
795 i.SaveState(assembly);
796 }
797 catch (Exception e)
798 {
799 m_log.Error(
800 string.Format(
801 "[XEngine]: Failed to save state of script {0}.{1}, item UUID {2}, prim UUID {3} in {4}. Exception ",
802 i.PrimName, i.ScriptName, i.ItemID, i.ObjectID, World.Name)
803 , e);
804 }
805 } 782 }
806 783
807 instances.Clear(); 784 instances.Clear();
@@ -994,8 +971,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
994 // This delay exists to stop mono problems where script compilation and startup would stop the sim 971 // This delay exists to stop mono problems where script compilation and startup would stop the sim
995 // working properly for the session. 972 // working properly for the session.
996 System.Threading.Thread.Sleep(m_StartDelay); 973 System.Threading.Thread.Sleep(m_StartDelay);
997
998 m_log.InfoFormat("[XEngine]: Performing initial script startup on {0}", m_Scene.Name);
999 } 974 }
1000 975
1001 object[] o; 976 object[] o;
@@ -1011,13 +986,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1011 if (m_InitialStartup) 986 if (m_InitialStartup)
1012 if (scriptsStarted % 50 == 0) 987 if (scriptsStarted % 50 == 0)
1013 m_log.InfoFormat( 988 m_log.InfoFormat(
1014 "[XEngine]: Started {0} scripts in {1}", scriptsStarted, m_Scene.Name); 989 "[XEngine]: Started {0} scripts in {1}", scriptsStarted, m_Scene.RegionInfo.RegionName);
1015 } 990 }
1016 } 991 }
1017 992
1018 if (m_InitialStartup) 993 if (m_InitialStartup)
1019 m_log.InfoFormat( 994 m_log.InfoFormat(
1020 "[XEngine]: Completed starting {0} scripts on {1}", scriptsStarted, m_Scene.Name); 995 "[XEngine]: Completed starting {0} scripts on {1}", scriptsStarted, m_Scene.RegionInfo.RegionName);
1021 996
1022 // NOTE: Despite having a lockless queue, this lock is required 997 // NOTE: Despite having a lockless queue, this lock is required
1023 // to make sure there is never no compile thread while there 998 // to make sure there is never no compile thread while there
@@ -1078,13 +1053,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1078 return false; 1053 return false;
1079 } 1054 }
1080 1055
1081 m_log.DebugFormat(
1082 "[XEngine] Loading script {0}.{1}, item UUID {2}, prim UUID {3} @ {4}.{5}",
1083 part.ParentGroup.RootPart.Name, item.Name, itemID, part.UUID,
1084 part.ParentGroup.RootPart.AbsolutePosition, part.ParentGroup.Scene.RegionInfo.RegionName);
1085
1086 UUID assetID = item.AssetID; 1056 UUID assetID = item.AssetID;
1087 1057
1058 //m_log.DebugFormat("[XEngine] Compiling script {0} ({1} on object {2})",
1059 // item.Name, itemID.ToString(), part.ParentGroup.RootPart.Name);
1060
1088 ScenePresence presence = m_Scene.GetScenePresence(item.OwnerID); 1061 ScenePresence presence = m_Scene.GetScenePresence(item.OwnerID);
1089 1062
1090 string assembly = ""; 1063 string assembly = "";
@@ -1262,10 +1235,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1262 item.Name, startParam, postOnRez, 1235 item.Name, startParam, postOnRez,
1263 stateSource, m_MaxScriptQueue); 1236 stateSource, m_MaxScriptQueue);
1264 1237
1265// m_log.DebugFormat( 1238 m_log.DebugFormat(
1266// "[XEngine] Loaded script {0}.{1}, script UUID {2}, prim UUID {3} @ {4}.{5}", 1239 "[XEngine] Loaded script {0}.{1}, script UUID {2}, prim UUID {3} @ {4}.{5}",
1267// part.ParentGroup.RootPart.Name, item.Name, assetID, part.UUID, 1240 part.ParentGroup.RootPart.Name, item.Name, assetID, part.UUID,
1268// part.ParentGroup.RootPart.AbsolutePosition, part.ParentGroup.Scene.RegionInfo.RegionName); 1241 part.ParentGroup.RootPart.AbsolutePosition, part.ParentGroup.Scene.RegionInfo.RegionName);
1269 1242
1270 if (presence != null) 1243 if (presence != null)
1271 { 1244 {
@@ -1581,9 +1554,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1581 else if (p[i] is string) 1554 else if (p[i] is string)
1582 lsl_p[i] = new LSL_Types.LSLString((string)p[i]); 1555 lsl_p[i] = new LSL_Types.LSLString((string)p[i]);
1583 else if (p[i] is Vector3) 1556 else if (p[i] is Vector3)
1584 lsl_p[i] = new LSL_Types.Vector3((Vector3)p[i]); 1557 lsl_p[i] = new LSL_Types.Vector3(((Vector3)p[i]).X, ((Vector3)p[i]).Y, ((Vector3)p[i]).Z);
1585 else if (p[i] is Quaternion) 1558 else if (p[i] is Quaternion)
1586 lsl_p[i] = new LSL_Types.Quaternion((Quaternion)p[i]); 1559 lsl_p[i] = new LSL_Types.Quaternion(((Quaternion)p[i]).X, ((Quaternion)p[i]).Y, ((Quaternion)p[i]).Z, ((Quaternion)p[i]).W);
1587 else if (p[i] is float) 1560 else if (p[i] is float)
1588 lsl_p[i] = new LSL_Types.LSLFloat((float)p[i]); 1561 lsl_p[i] = new LSL_Types.LSLFloat((float)p[i]);
1589 else 1562 else
@@ -1607,9 +1580,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1607 else if (p[i] is string) 1580 else if (p[i] is string)
1608 lsl_p[i] = new LSL_Types.LSLString((string)p[i]); 1581 lsl_p[i] = new LSL_Types.LSLString((string)p[i]);
1609 else if (p[i] is Vector3) 1582 else if (p[i] is Vector3)
1610 lsl_p[i] = new LSL_Types.Vector3((Vector3)p[i]); 1583 lsl_p[i] = new LSL_Types.Vector3(((Vector3)p[i]).X, ((Vector3)p[i]).Y, ((Vector3)p[i]).Z);
1611 else if (p[i] is Quaternion) 1584 else if (p[i] is Quaternion)
1612 lsl_p[i] = new LSL_Types.Quaternion((Quaternion)p[i]); 1585 lsl_p[i] = new LSL_Types.Quaternion(((Quaternion)p[i]).X, ((Quaternion)p[i]).Y, ((Quaternion)p[i]).Z, ((Quaternion)p[i]).W);
1613 else if (p[i] is float) 1586 else if (p[i] is float)
1614 lsl_p[i] = new LSL_Types.LSLFloat((float)p[i]); 1587 lsl_p[i] = new LSL_Types.LSLFloat((float)p[i]);
1615 else 1588 else