aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorCharles Krinke2008-06-07 22:37:48 +0000
committerCharles Krinke2008-06-07 22:37:48 +0000
commit0e5f2b329361e8e3c911e6171d639720e800a490 (patch)
tree64aa88bd43bd049dd0f64e6471cfc5a4777e5ee2
parentMantis#1495. Thank you kindly, Kinoc for: (diff)
downloadopensim-SC-0e5f2b329361e8e3c911e6171d639720e800a490.zip
opensim-SC-0e5f2b329361e8e3c911e6171d639720e800a490.tar.gz
opensim-SC-0e5f2b329361e8e3c911e6171d639720e800a490.tar.bz2
opensim-SC-0e5f2b329361e8e3c911e6171d639720e800a490.tar.xz
Mantis#1496. Thank you kindly, Melanie for a patch that:
Adds full implementation of all llDetected* functions for sensors, collisions and touches. Adds changed(CHANGED_REGION_RESTART) event to allow restarting of eye-candy functionality not currently persisted with the prim.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/SensorRepeat.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/EventManager.cs59
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/LSL_ScriptCommands.cs117
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/Script/BuiltIn_Commands_BaseClass.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs211
5 files changed, 283 insertions, 106 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/SensorRepeat.cs
index 3906c54..8a25098 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/SensorRepeat.cs
@@ -324,6 +324,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
324 { 324 {
325 detect[idx] = new XDetectParams(); 325 detect[idx] = new XDetectParams();
326 detect[idx].Key=(LLUUID)(SensedObjects.Data[idx]); 326 detect[idx].Key=(LLUUID)(SensedObjects.Data[idx]);
327 detect[idx].Populate(m_CmdManager.m_ScriptEngine.World);
327 } 328 }
328 329
329 m_CmdManager.m_ScriptEngine.PostScriptEvent(ts.itemID, 330 m_CmdManager.m_ScriptEngine.PostScriptEvent(ts.itemID,
diff --git a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
index 06277a1..c226a7e 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
@@ -26,6 +26,8 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections;
30using System.Collections.Generic;
29using libsecondlife; 31using libsecondlife;
30using OpenSim.Framework; 32using OpenSim.Framework;
31using OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney; 33using OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney;
@@ -55,6 +57,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
55 myScriptEngine.World.EventManager.OnScriptAtTargetEvent += at_target; 57 myScriptEngine.World.EventManager.OnScriptAtTargetEvent += at_target;
56 myScriptEngine.World.EventManager.OnScriptNotAtTargetEvent += not_at_target; 58 myScriptEngine.World.EventManager.OnScriptNotAtTargetEvent += not_at_target;
57 myScriptEngine.World.EventManager.OnScriptControlEvent += control; 59 myScriptEngine.World.EventManager.OnScriptControlEvent += control;
60 myScriptEngine.World.EventManager.OnScriptColliderStart += collision_start;
61 myScriptEngine.World.EventManager.OnScriptColliding += collision;
62 myScriptEngine.World.EventManager.OnScriptCollidingEnd += collision_end;
58 IMoneyModule money=myScriptEngine.World.RequestModuleInterface<IMoneyModule>(); 63 IMoneyModule money=myScriptEngine.World.RequestModuleInterface<IMoneyModule>();
59 if (money != null) 64 if (money != null)
60 { 65 {
@@ -81,6 +86,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
81 XDetectParams[] det = new XDetectParams[1]; 86 XDetectParams[] det = new XDetectParams[1];
82 det[0] = new XDetectParams(); 87 det[0] = new XDetectParams();
83 det[0].Key = remoteClient.AgentId; 88 det[0].Key = remoteClient.AgentId;
89 det[0].Populate(myScriptEngine.World);
84 90
85 SceneObjectPart part = myScriptEngine.World.GetSceneObjectPart( 91 SceneObjectPart part = myScriptEngine.World.GetSceneObjectPart(
86 localID); 92 localID);
@@ -103,6 +109,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
103 XDetectParams[] det = new XDetectParams[1]; 109 XDetectParams[] det = new XDetectParams[1];
104 det[0] = new XDetectParams(); 110 det[0] = new XDetectParams();
105 det[0].Key = remoteClient.AgentId; 111 det[0].Key = remoteClient.AgentId;
112 det[0].Populate(myScriptEngine.World);
106 det[0].OffsetPos = new LSL_Types.Vector3(offsetPos.X, 113 det[0].OffsetPos = new LSL_Types.Vector3(offsetPos.X,
107 offsetPos.Y, 114 offsetPos.Y,
108 offsetPos.Z); 115 offsetPos.Z);
@@ -127,6 +134,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
127 XDetectParams[] det = new XDetectParams[1]; 134 XDetectParams[] det = new XDetectParams[1];
128 det[0] = new XDetectParams(); 135 det[0] = new XDetectParams();
129 det[0].Key = remoteClient.AgentId; 136 det[0].Key = remoteClient.AgentId;
137 det[0].Populate(myScriptEngine.World);
130 138
131 SceneObjectPart part = myScriptEngine.World.GetSceneObjectPart( 139 SceneObjectPart part = myScriptEngine.World.GetSceneObjectPart(
132 localID); 140 localID);
@@ -162,45 +170,60 @@ namespace OpenSim.Region.ScriptEngine.XEngine
162 new XDetectParams[0])); 170 new XDetectParams[0]));
163 } 171 }
164 172
165 public void collision_start(uint localID, LLUUID itemID, 173 public void collision_start(uint localID, ColliderArgs col)
166 IClientAPI remoteClient)
167 { 174 {
168 // Add to queue for all scripts in ObjectID object 175 // Add to queue for all scripts in ObjectID object
169 XDetectParams[] det = new XDetectParams[1]; 176 List<XDetectParams> det = new List<XDetectParams>();
170 det[0] = new XDetectParams(); 177
171 det[0].Key = remoteClient.AgentId; 178 foreach (DetectedObject detobj in col.Colliders)
179 {
180 XDetectParams d = new XDetectParams();
181 d.Key =detobj.keyUUID;
182 d.Populate(myScriptEngine.World);
183 det.Add(d);
184 }
172 185
173 myScriptEngine.PostObjectEvent(localID, new XEventParams( 186 myScriptEngine.PostObjectEvent(localID, new XEventParams(
174 "collision_start", 187 "collision_start",
175 new Object[] { new LSL_Types.LSLInteger(1) }, 188 new Object[] { new LSL_Types.LSLInteger(1) },
176 det)); 189 det.ToArray()));
177 } 190 }
178 191
179 public void collision(uint localID, LLUUID itemID, 192 public void collision(uint localID, ColliderArgs col)
180 IClientAPI remoteClient)
181 { 193 {
182 // Add to queue for all scripts in ObjectID object 194 // Add to queue for all scripts in ObjectID object
183 XDetectParams[] det = new XDetectParams[1]; 195 List<XDetectParams> det = new List<XDetectParams>();
184 det[0] = new XDetectParams(); 196
185 det[0].Key = remoteClient.AgentId; 197 foreach (DetectedObject detobj in col.Colliders)
198 {
199 XDetectParams d = new XDetectParams();
200 d.Key =detobj.keyUUID;
201 d.Populate(myScriptEngine.World);
202 det.Add(d);
203 }
186 204
187 myScriptEngine.PostObjectEvent(localID, new XEventParams( 205 myScriptEngine.PostObjectEvent(localID, new XEventParams(
188 "collision", new Object[] { new LSL_Types.LSLInteger(1) }, 206 "collision", new Object[] { new LSL_Types.LSLInteger(1) },
189 det)); 207 det.ToArray()));
190 } 208 }
191 209
192 public void collision_end(uint localID, LLUUID itemID, 210 public void collision_end(uint localID, ColliderArgs col)
193 IClientAPI remoteClient)
194 { 211 {
195 // Add to queue for all scripts in ObjectID object 212 // Add to queue for all scripts in ObjectID object
196 XDetectParams[] det = new XDetectParams[1]; 213 List<XDetectParams> det = new List<XDetectParams>();
197 det[0] = new XDetectParams(); 214
198 det[0].Key = remoteClient.AgentId; 215 foreach (DetectedObject detobj in col.Colliders)
216 {
217 XDetectParams d = new XDetectParams();
218 d.Key =detobj.keyUUID;
219 d.Populate(myScriptEngine.World);
220 det.Add(d);
221 }
199 222
200 myScriptEngine.PostObjectEvent(localID, new XEventParams( 223 myScriptEngine.PostObjectEvent(localID, new XEventParams(
201 "collision_end", 224 "collision_end",
202 new Object[] { new LSL_Types.LSLInteger(1) }, 225 new Object[] { new LSL_Types.LSLInteger(1) },
203 det)); 226 det.ToArray()));
204 } 227 }
205 228
206 public void land_collision_start(uint localID, LLUUID itemID) 229 public void land_collision_start(uint localID, LLUUID itemID)
diff --git a/OpenSim/Region/ScriptEngine/XEngine/LSL_ScriptCommands.cs b/OpenSim/Region/ScriptEngine/XEngine/LSL_ScriptCommands.cs
index bf0e14e..46c6c33 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/LSL_ScriptCommands.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/LSL_ScriptCommands.cs
@@ -550,113 +550,55 @@ namespace OpenSim.Region.ScriptEngine.XEngine
550 public string llDetectedName(int number) 550 public string llDetectedName(int number)
551 { 551 {
552 m_host.AddScriptLPS(1); 552 m_host.AddScriptLPS(1);
553 LLUUID sensedUUID = m_ScriptEngine.GetDetectID(m_itemID, number); 553 XDetectParams d = m_ScriptEngine.GetDetectParams(m_itemID, number);
554 if (sensedUUID != LLUUID.Zero) 554 if (d == null)
555 return resolveName(sensedUUID); 555 return String.Empty;
556 return String.Empty; 556 return d.Name;
557 }
558
559 public LLUUID uuidDetectedKey(int number)
560 {
561 return m_ScriptEngine.GetDetectID(m_itemID, number);
562 }
563
564 public EntityBase entityDetectedKey(int number)
565 {
566 LLUUID sensedUUID = m_ScriptEngine.GetDetectID(m_itemID, number);
567 if (sensedUUID != LLUUID.Zero)
568 {
569 EntityBase SensedObject = null;
570 lock (World.Entities)
571 {
572 World.Entities.TryGetValue(sensedUUID, out SensedObject);
573 }
574 return SensedObject;
575 }
576 return null;
577 } 557 }
578 558
579 public string llDetectedKey(int number) 559 public string llDetectedKey(int number)
580 { 560 {
581 m_host.AddScriptLPS(1); 561 m_host.AddScriptLPS(1);
582 LLUUID SensedUUID = uuidDetectedKey(number); 562 XDetectParams d = m_ScriptEngine.GetDetectParams(m_itemID, number);
583 if (SensedUUID == LLUUID.Zero) 563 if (d == null)
584 return String.Empty; 564 return String.Empty;
585 565 return d.Key.ToString();
586 return SensedUUID.ToString();
587 } 566 }
588 567
589 public string llDetectedOwner(int number) 568 public string llDetectedOwner(int number)
590 { 569 {
591 // returns UUID of owner of object detected
592 m_host.AddScriptLPS(1); 570 m_host.AddScriptLPS(1);
593 EntityBase SensedObject = entityDetectedKey(number); 571 XDetectParams d = m_ScriptEngine.GetDetectParams(m_itemID, number);
594 if (SensedObject == null) 572 if (d == null)
595 return String.Empty; 573 return String.Empty;
596 LLUUID SensedUUID = uuidDetectedKey(number); 574 return d.Owner.ToString();
597 if (World.GetScenePresence(SensedUUID) == null) 575 }
598 {
599 // sensed object is not an avatar
600 // so get the owner of the sensed object
601 SceneObjectPart SOP = World.GetSceneObjectPart(SensedUUID);
602 if (SOP != null)
603 {
604 return SOP.ObjectOwner.ToString();
605 }
606 }
607 else
608 {
609 // sensed object is an avatar, and so must be its own owner
610 return SensedUUID.ToString();
611 }
612
613 return String.Empty;
614 }
615 576
616 public LSL_Types.LSLInteger llDetectedType(int number) 577 public LSL_Types.LSLInteger llDetectedType(int number)
617 { 578 {
618 m_host.AddScriptLPS(1); 579 m_host.AddScriptLPS(1);
619 EntityBase SensedObject = entityDetectedKey(number); 580 XDetectParams d = m_ScriptEngine.GetDetectParams(m_itemID, number);
620 if (SensedObject == null) 581 if (d == null)
621 return 0; 582 return 0;
622 int mask = 0; 583 return new LSL_Types.LSLInteger(d.Type);
623
624 LLUUID SensedUUID = uuidDetectedKey(number);
625 LSL_Types.Vector3 ZeroVector = new LSL_Types.Vector3(0, 0, 0);
626
627 if (World.GetScenePresence(SensedUUID) != null)
628 mask |= 0x01; // actor
629
630 if (SensedObject.Velocity.Equals(ZeroVector))
631 mask |= 0x04; // passive non-moving
632 else
633 mask |= 0x02; // active moving
634
635 if (SensedObject is IScript)
636 mask |= 0x08; // Scripted. It COULD have one hidden ...
637
638 return mask;
639 } 584 }
640 585
641 public LSL_Types.Vector3 llDetectedPos(int number) 586 public LSL_Types.Vector3 llDetectedPos(int number)
642 { 587 {
643 m_host.AddScriptLPS(1); 588 m_host.AddScriptLPS(1);
644 EntityBase SensedObject = entityDetectedKey(number); 589 XDetectParams d = m_ScriptEngine.GetDetectParams(m_itemID, number);
645 if (SensedObject == null) 590 if (d == null)
646 return new LSL_Types.Vector3(0, 0, 0); 591 return new LSL_Types.Vector3();
647 592 return d.Position;
648 return new LSL_Types.Vector3(SensedObject.AbsolutePosition.X,SensedObject.AbsolutePosition.Y,SensedObject.AbsolutePosition.Z);
649 } 593 }
650 594
651 public LSL_Types.Vector3 llDetectedVel(int number) 595 public LSL_Types.Vector3 llDetectedVel(int number)
652 { 596 {
653 m_host.AddScriptLPS(1); 597 m_host.AddScriptLPS(1);
654 EntityBase SensedObject = entityDetectedKey(number); 598 XDetectParams d = m_ScriptEngine.GetDetectParams(m_itemID, number);
655 if (SensedObject == null) 599 if (d == null)
656 return new LSL_Types.Vector3(0, 0, 0); 600 return new LSL_Types.Vector3();
657 601 return d.Velocity;
658 return new LSL_Types.Vector3(SensedObject.Velocity.X, SensedObject.Velocity.Y, SensedObject.Velocity.Z);
659 // return new LSL_Types.Vector3();
660 } 602 }
661 603
662 public LSL_Types.Vector3 llDetectedGrab(int number) 604 public LSL_Types.Vector3 llDetectedGrab(int number)
@@ -672,18 +614,21 @@ namespace OpenSim.Region.ScriptEngine.XEngine
672 public LSL_Types.Quaternion llDetectedRot(int number) 614 public LSL_Types.Quaternion llDetectedRot(int number)
673 { 615 {
674 m_host.AddScriptLPS(1); 616 m_host.AddScriptLPS(1);
675 EntityBase SensedObject = entityDetectedKey(number); 617 XDetectParams d = m_ScriptEngine.GetDetectParams(m_itemID, number);
676 if (SensedObject == null) 618 if (d == null)
677 return new LSL_Types.Quaternion(); 619 return new LSL_Types.Quaternion();
678 620 return d.Rotation;
679 return new LSL_Types.Quaternion(SensedObject.Rotation.x, SensedObject.Rotation.y, SensedObject.Rotation.z, SensedObject.Rotation.w);
680 } 621 }
681 622
682 public LSL_Types.LSLInteger llDetectedGroup(int number) 623 public LSL_Types.LSLInteger llDetectedGroup(int number)
683 { 624 {
684 m_host.AddScriptLPS(1); 625 m_host.AddScriptLPS(1);
685 NotImplemented("llDetectedGroup"); 626 XDetectParams d = m_ScriptEngine.GetDetectParams(m_itemID, number);
686 return 0; 627 if (d == null)
628 return new LSL_Types.LSLInteger(0);
629 if(m_host.GroupID == d.Group)
630 return new LSL_Types.LSLInteger(1);
631 return new LSL_Types.LSLInteger(0);
687 } 632 }
688 633
689 public LSL_Types.LSLInteger llDetectedLinkNumber(int number) 634 public LSL_Types.LSLInteger llDetectedLinkNumber(int number)
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Script/BuiltIn_Commands_BaseClass.cs b/OpenSim/Region/ScriptEngine/XEngine/Script/BuiltIn_Commands_BaseClass.cs
index f43eab8..fc9f8fc 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/Script/BuiltIn_Commands_BaseClass.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/Script/BuiltIn_Commands_BaseClass.cs
@@ -2080,6 +2080,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Script
2080 public const int CHANGED_LINK = 32; 2080 public const int CHANGED_LINK = 32;
2081 public const int CHANGED_ALLOWED_DROP = 64; 2081 public const int CHANGED_ALLOWED_DROP = 64;
2082 public const int CHANGED_OWNER = 128; 2082 public const int CHANGED_OWNER = 128;
2083 public const int CHANGED_REGION_RESTART = 256;
2083 public const int TYPE_INVALID = 0; 2084 public const int TYPE_INVALID = 0;
2084 public const int TYPE_INTEGER = 1; 2085 public const int TYPE_INTEGER = 1;
2085 public const int TYPE_double = 2; 2086 public const int TYPE_double = 2;
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 1b49baa..ae13516 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -388,7 +388,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
388 part.UUID, itemID, assetID, assembly, 388 part.UUID, itemID, assetID, assembly,
389 m_AppDomains[appDomain], 389 m_AppDomains[appDomain],
390 part.ParentGroup.RootPart.Name, 390 part.ParentGroup.RootPart.Name,
391 item.Name); 391 item.Name, XScriptInstance.StateSource.NewRez);
392 392
393 m_log.DebugFormat("[XEngine] Loaded script {0}.{1}", 393 m_log.DebugFormat("[XEngine] Loaded script {0}.{1}",
394 part.ParentGroup.RootPart.Name, item.Name); 394 part.ParentGroup.RootPart.Name, item.Name);
@@ -673,9 +673,97 @@ namespace OpenSim.Region.ScriptEngine.XEngine
673 673
674 public class XDetectParams 674 public class XDetectParams
675 { 675 {
676 public XDetectParams()
677 {
678 Key = LLUUID.Zero;
679 OffsetPos = new LSL_Types.Vector3();
680 LinkNum = 0;
681 Group = LLUUID.Zero;
682 Name = String.Empty;
683 Owner = LLUUID.Zero;
684 Position = new LSL_Types.Vector3();
685 Rotation = new LSL_Types.Quaternion();
686 Type = 0;
687 Velocity = new LSL_Types.Vector3();
688 }
689
676 public LLUUID Key; 690 public LLUUID Key;
677 public LSL_Types.Vector3 OffsetPos; 691 public LSL_Types.Vector3 OffsetPos;
678 public int LinkNum; 692 public int LinkNum;
693 public LLUUID Group;
694 public string Name;
695 public LLUUID Owner;
696 public LSL_Types.Vector3 Position;
697 public LSL_Types.Quaternion Rotation;
698 public int Type;
699 public LSL_Types.Vector3 Velocity;
700
701 public void Populate(Scene scene)
702 {
703 SceneObjectPart part = scene.GetSceneObjectPart(Key);
704 if(part == null) // Avatar, maybe?
705 {
706 ScenePresence presence = scene.GetScenePresence(Key);
707 if(presence == null)
708 return;
709
710 Name = presence.Firstname + " " + presence.Lastname;
711 Owner = Key;
712 Position = new LSL_Types.Vector3(
713 presence.AbsolutePosition.X,
714 presence.AbsolutePosition.X,
715 presence.AbsolutePosition.Z);
716 Rotation = new LSL_Types.Quaternion(
717 presence.Rotation.x,
718 presence.Rotation.y,
719 presence.Rotation.z,
720 presence.Rotation.w);
721 Velocity = new LSL_Types.Vector3(
722 presence.Velocity.X,
723 presence.Velocity.X,
724 presence.Velocity.Z);
725
726 Type = 0x01; // Avatar
727 if(presence.Velocity != LLVector3.Zero)
728 Type |= 0x02; // Active
729
730 Group = presence.ControllingClient.ActiveGroupId;
731
732 return;
733 }
734
735 part=part.ParentGroup.RootPart; // We detect objects only
736
737 LinkNum = 0; // Not relevant
738
739 Group = part.GroupID;
740 Name = part.Name;
741 Owner = part.OwnerID;
742 if(part.Velocity == LLVector3.Zero)
743 Type = 0x04; // Passive
744 else
745 Type = 0x02; // Passive
746
747 foreach (SceneObjectPart p in part.ParentGroup.Children.Values)
748 {
749 if(part.ContainsScripts())
750 {
751 Type |= 0x08; // Scripted
752 break;
753 }
754 }
755
756 Position = new LSL_Types.Vector3(part.AbsolutePosition.X,
757 part.AbsolutePosition.Y,
758 part.AbsolutePosition.Z);
759
760 LLQuaternion wr = part.GetWorldRotation();
761 Rotation = new LSL_Types.Quaternion(wr.X, wr.Y, wr.Z, wr.W);
762
763 Velocity = new LSL_Types.Vector3(part.Velocity.X,
764 part.Velocity.Y,
765 part.Velocity.Z);
766 }
679 } 767 }
680 768
681 public class XEventParams 769 public class XEventParams
@@ -715,6 +803,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine
715 private string m_ScriptName; 803 private string m_ScriptName;
716 private string m_Assembly; 804 private string m_Assembly;
717 805
806 public enum StateSource
807 {
808 NewRez = 0,
809 PrimCrossing = 1,
810 AttachmentCrossing = 2
811 }
812
718 // Script state 813 // Script state
719 private string m_State="default"; 814 private string m_State="default";
720 815
@@ -786,7 +881,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
786 881
787 public XScriptInstance(XEngine engine, uint localID, LLUUID objectID, 882 public XScriptInstance(XEngine engine, uint localID, LLUUID objectID,
788 LLUUID itemID, LLUUID assetID, string assembly, AppDomain dom, 883 LLUUID itemID, LLUUID assetID, string assembly, AppDomain dom,
789 string primName, string scriptName) 884 string primName, string scriptName, StateSource stateSource)
790 { 885 {
791 m_Engine = engine; 886 m_Engine = engine;
792 887
@@ -874,6 +969,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine
874 m_RunEvents = false; 969 m_RunEvents = false;
875 Start(); 970 Start();
876 } 971 }
972
973 // we get new rez events on sim restart, too
974 // but if there is state, then we fire the change
975 // event
976 if(stateSource == StateSource.NewRez)
977 PostEvent(new XEventParams("changed",
978 new Object[] {256}, new XDetectParams[0]));
877 } 979 }
878 } 980 }
879 else 981 else
@@ -1286,6 +1388,47 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1286 XmlAttribute pos = xmldoc.CreateAttribute("", "pos", ""); 1388 XmlAttribute pos = xmldoc.CreateAttribute("", "pos", "");
1287 pos.Value = det.OffsetPos.ToString(); 1389 pos.Value = det.OffsetPos.ToString();
1288 objectElem.Attributes.Append(pos); 1390 objectElem.Attributes.Append(pos);
1391
1392 XmlAttribute d_linkNum = xmldoc.CreateAttribute("",
1393 "linkNum", "");
1394 d_linkNum.Value = det.LinkNum.ToString();
1395 objectElem.Attributes.Append(d_linkNum);
1396
1397 XmlAttribute d_group = xmldoc.CreateAttribute("",
1398 "group", "");
1399 d_group.Value = det.Group.ToString();
1400 objectElem.Attributes.Append(d_group);
1401
1402 XmlAttribute d_name = xmldoc.CreateAttribute("",
1403 "name", "");
1404 d_name.Value = det.Name.ToString();
1405 objectElem.Attributes.Append(d_name);
1406
1407 XmlAttribute d_owner = xmldoc.CreateAttribute("",
1408 "owner", "");
1409 d_owner.Value = det.Owner.ToString();
1410 objectElem.Attributes.Append(d_owner);
1411
1412 XmlAttribute d_position = xmldoc.CreateAttribute("",
1413 "position", "");
1414 d_position.Value = det.Position.ToString();
1415 objectElem.Attributes.Append(d_position);
1416
1417 XmlAttribute d_rotation = xmldoc.CreateAttribute("",
1418 "rotation", "");
1419 d_rotation.Value = det.Rotation.ToString();
1420 objectElem.Attributes.Append(d_rotation);
1421
1422 XmlAttribute d_type = xmldoc.CreateAttribute("",
1423 "type", "");
1424 d_type.Value = det.Type.ToString();
1425 objectElem.Attributes.Append(d_type);
1426
1427 XmlAttribute d_velocity = xmldoc.CreateAttribute("",
1428 "velocity", "");
1429 d_velocity.Value = det.Velocity.ToString();
1430 objectElem.Attributes.Append(d_velocity);
1431
1289 objectElem.AppendChild( 1432 objectElem.AppendChild(
1290 xmldoc.CreateTextNode(det.Key.ToString())); 1433 xmldoc.CreateTextNode(det.Key.ToString()));
1291 1434
@@ -1385,6 +1528,62 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1385 "pos").Value; 1528 "pos").Value;
1386 LSL_Types.Vector3 v = 1529 LSL_Types.Vector3 v =
1387 new LSL_Types.Vector3(vect); 1530 new LSL_Types.Vector3(vect);
1531
1532 int d_linkNum=0;
1533 LLUUID d_group = LLUUID.Zero;
1534 string d_name = String.Empty;
1535 LLUUID d_owner = LLUUID.Zero;
1536 LSL_Types.Vector3 d_position =
1537 new LSL_Types.Vector3();
1538 LSL_Types.Quaternion d_rotation =
1539 new LSL_Types.Quaternion();
1540 int d_type = 0;
1541 LSL_Types.Vector3 d_velocity =
1542 new LSL_Types.Vector3();
1543
1544 try
1545 {
1546 string tmp;
1547
1548 tmp = det.Attributes.GetNamedItem(
1549 "linkNum").Value;
1550 int.TryParse(tmp, out d_linkNum);
1551
1552 tmp = det.Attributes.GetNamedItem(
1553 "group").Value;
1554 LLUUID.TryParse(tmp, out d_group);
1555
1556 d_name = det.Attributes.GetNamedItem(
1557 "name").Value;
1558
1559 tmp = det.Attributes.GetNamedItem(
1560 "owner").Value;
1561 LLUUID.TryParse(tmp, out d_owner);
1562
1563 tmp = det.Attributes.GetNamedItem(
1564 "position").Value;
1565 d_position =
1566 new LSL_Types.Vector3(tmp);
1567
1568 tmp = det.Attributes.GetNamedItem(
1569 "rotation").Value;
1570 d_rotation =
1571 new LSL_Types.Quaternion(tmp);
1572
1573 tmp = det.Attributes.GetNamedItem(
1574 "type").Value;
1575 int.TryParse(tmp, out d_type);
1576
1577 tmp = det.Attributes.GetNamedItem(
1578 "velocity").Value;
1579 d_velocity =
1580 new LSL_Types.Vector3(tmp);
1581
1582 }
1583 catch (Exception) // Old version XML
1584 {
1585 }
1586
1388 LLUUID uuid = new LLUUID(); 1587 LLUUID uuid = new LLUUID();
1389 LLUUID.TryParse(det.InnerText, 1588 LLUUID.TryParse(det.InnerText,
1390 out uuid); 1589 out uuid);
@@ -1392,6 +1591,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1392 XDetectParams d = new XDetectParams(); 1591 XDetectParams d = new XDetectParams();
1393 d.Key = uuid; 1592 d.Key = uuid;
1394 d.OffsetPos = v; 1593 d.OffsetPos = v;
1594 d.LinkNum = d_linkNum;
1595 d.Group = d_group;
1596 d.Name = d_name;
1597 d.Owner = d_owner;
1598 d.Position = d_position;
1599 d.Rotation = d_rotation;
1600 d.Type = d_type;
1601 d.Velocity = d_velocity;
1395 1602
1396 detected.Add(d); 1603 detected.Add(d);
1397 } 1604 }