aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorTeravus Ovares2008-06-08 22:53:52 +0000
committerTeravus Ovares2008-06-08 22:53:52 +0000
commit6ecb7c05b348800e2148f1dad43c41b8ccd44a9b (patch)
tree3efec2d74a7932ab2a7cd8d9afe4640083e31a2a /OpenSim/Region/ScriptEngine
parent* Added compiler pre-processor, #if SPAM to SensorRepeat... so if you really... (diff)
downloadopensim-SC_OLD-6ecb7c05b348800e2148f1dad43c41b8ccd44a9b.zip
opensim-SC_OLD-6ecb7c05b348800e2148f1dad43c41b8ccd44a9b.tar.gz
opensim-SC_OLD-6ecb7c05b348800e2148f1dad43c41b8ccd44a9b.tar.bz2
opensim-SC_OLD-6ecb7c05b348800e2148f1dad43c41b8ccd44a9b.tar.xz
* Fixed it so you can do a lot more llDetected* methods in many additional situations and have it work.
* script Collision reporting works now in DotNetEngine
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs64
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs62
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs3
3 files changed, 124 insertions, 5 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
index 2ac074f..688354c 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
@@ -563,6 +563,32 @@ namespace OpenSim.Region.ScriptEngine.Common
563 return resolveName(SensedUUID); 563 return resolveName(SensedUUID);
564 } 564 }
565 } 565 }
566 else
567 {
568 ScriptManager sm;
569 IScript script = null;
570
571 if ((sm = m_ScriptEngine.m_ScriptManager) != null)
572 {
573 if (sm.Scripts.ContainsKey(m_localID))
574 {
575 if ((script = sm.GetScript(m_localID, m_itemID)) != null)
576 {
577 //System.Console.WriteLine(number + " - " + script.llDetectParams._key.Length);
578 if (script.llDetectParams._string != null)
579 {
580 if (script.llDetectParams._string.Length > number)
581 {
582 if (script.llDetectParams._string[number] != null)
583 {
584 return script.llDetectParams._string[number];
585 }
586 }
587 }
588 }
589 }
590 }
591 }
566 return String.Empty; 592 return String.Empty;
567 } 593 }
568 594
@@ -588,9 +614,13 @@ namespace OpenSim.Region.ScriptEngine.Common
588 { 614 {
589 if ((script = sm.GetScript(m_localID, m_itemID)) != null) 615 if ((script = sm.GetScript(m_localID, m_itemID)) != null)
590 { 616 {
591 if (script.llDetectParams._key[0]) 617 //System.Console.WriteLine(number + " - " + script.llDetectParams._key.Length);
618 if (script.llDetectParams._key.Length > number)
592 { 619 {
593 return new LLUUID(script.llDetectParams._key[0]); 620 if (script.llDetectParams._key[number])
621 {
622 return new LLUUID(script.llDetectParams._key[number]);
623 }
594 } 624 }
595 } 625 }
596 } 626 }
@@ -615,6 +645,36 @@ namespace OpenSim.Region.ScriptEngine.Common
615 return SensedObject; 645 return SensedObject;
616 } 646 }
617 } 647 }
648 else
649 {
650 ScriptManager sm;
651 IScript script = null;
652
653 if ((sm = m_ScriptEngine.m_ScriptManager) != null)
654 {
655 if (sm.Scripts.ContainsKey(m_localID))
656 {
657 if ((script = sm.GetScript(m_localID, m_itemID)) != null)
658 {
659 //System.Console.WriteLine(number + " - " + script.llDetectParams._key.Length);
660 if (script.llDetectParams._key.Length > number)
661 {
662 if (script.llDetectParams._key[number])
663 {
664 LLUUID SensedUUID = new LLUUID(script.llDetectParams._key[number]);
665 EntityBase SensedObject = null;
666 lock (World.Entities)
667 {
668 World.Entities.TryGetValue(SensedUUID, out SensedObject);
669 }
670 return SensedObject;
671 }
672 }
673 }
674 }
675 }
676 }
677
618 return null; 678 return null;
619 } 679 }
620 680
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs
index ae84f65..c51e66b 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs
@@ -121,7 +121,33 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
121 // Add to queue for all scripts in ObjectID object 121 // Add to queue for all scripts in ObjectID object
122 EventQueueManager.Queue_llDetectParams_Struct detstruct = new EventQueueManager.Queue_llDetectParams_Struct(); 122 EventQueueManager.Queue_llDetectParams_Struct detstruct = new EventQueueManager.Queue_llDetectParams_Struct();
123 detstruct._key = new LSL_Types.key[1]; 123 detstruct._key = new LSL_Types.key[1];
124 detstruct._key[0] = new LSL_Types.key(remoteClient.AgentId.ToString()); 124 detstruct._key2 = new LSL_Types.key[1];
125 detstruct._string = new string[1];
126 detstruct._Vector3 = new LSL_Types.Vector3[1];
127 detstruct._Vector32 = new LSL_Types.Vector3[1];
128 detstruct._Quaternion = new LSL_Types.Quaternion[1];
129 detstruct._int = new int[1];
130 ScenePresence av = myScriptEngine.World.GetScenePresence(remoteClient.AgentId);
131 if (av != null)
132 {
133 detstruct._key[0] = new LSL_Types.key(remoteClient.AgentId.ToString());
134 detstruct._key2[0] = new LSL_Types.key(remoteClient.AgentId.ToString());
135 detstruct._string[0] = remoteClient.Name;
136 detstruct._int[0] = 0;
137 detstruct._Quaternion[0] = new LSL_Types.Quaternion(av.Rotation.x,av.Rotation.y,av.Rotation.z,av.Rotation.w);
138 detstruct._Vector3[0] = new LSL_Types.Vector3(av.AbsolutePosition.X,av.AbsolutePosition.Y,av.AbsolutePosition.Z);
139 detstruct._Vector32[0] = new LSL_Types.Vector3(av.Velocity.X,av.Velocity.Y,av.Velocity.Z);
140 }
141 else
142 {
143 detstruct._key[0] = new LSL_Types.key(remoteClient.AgentId.ToString());
144 detstruct._key2[0] = new LSL_Types.key(remoteClient.AgentId.ToString());
145 detstruct._string[0] = remoteClient.Name;
146 detstruct._int[0] = 0;
147 detstruct._Quaternion[0] = new LSL_Types.Quaternion(0, 0, 0, 1);
148 detstruct._Vector3[0] = new LSL_Types.Vector3(0, 0, 0);
149 detstruct._Vector32[0] = new LSL_Types.Vector3(0, 0, 0);
150 }
125 myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "touch_start", detstruct, new object[] { new LSL_Types.LSLInteger(1) }); 151 myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "touch_start", detstruct, new object[] { new LSL_Types.LSLInteger(1) });
126 } 152 }
127 153
@@ -130,7 +156,33 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
130 // Add to queue for all scripts in ObjectID object 156 // Add to queue for all scripts in ObjectID object
131 EventQueueManager.Queue_llDetectParams_Struct detstruct = new EventQueueManager.Queue_llDetectParams_Struct(); 157 EventQueueManager.Queue_llDetectParams_Struct detstruct = new EventQueueManager.Queue_llDetectParams_Struct();
132 detstruct._key = new LSL_Types.key[1]; 158 detstruct._key = new LSL_Types.key[1];
133 detstruct._key[0] = new LSL_Types.key(remoteClient.AgentId.ToString()); 159 detstruct._key2 = new LSL_Types.key[1];
160 detstruct._string = new string[1];
161 detstruct._Vector3 = new LSL_Types.Vector3[1];
162 detstruct._Vector32 = new LSL_Types.Vector3[1];
163 detstruct._Quaternion = new LSL_Types.Quaternion[1];
164 detstruct._int = new int[1];
165 ScenePresence av = myScriptEngine.World.GetScenePresence(remoteClient.AgentId);
166 if (av != null)
167 {
168 detstruct._key[0] = new LSL_Types.key(remoteClient.AgentId.ToString());
169 detstruct._key2[0] = new LSL_Types.key(remoteClient.AgentId.ToString());
170 detstruct._string[0] = remoteClient.Name;
171 detstruct._int[0] = 0;
172 detstruct._Quaternion[0] = new LSL_Types.Quaternion(av.Rotation.x, av.Rotation.y, av.Rotation.z, av.Rotation.w);
173 detstruct._Vector3[0] = new LSL_Types.Vector3(av.AbsolutePosition.X, av.AbsolutePosition.Y, av.AbsolutePosition.Z);
174 detstruct._Vector32[0] = new LSL_Types.Vector3(av.Velocity.X, av.Velocity.Y, av.Velocity.Z);
175 }
176 else
177 {
178 detstruct._key[0] = new LSL_Types.key(remoteClient.AgentId.ToString());
179 detstruct._key2[0] = new LSL_Types.key(remoteClient.AgentId.ToString());
180 detstruct._string[0] = remoteClient.Name;
181 detstruct._int[0] = 0;
182 detstruct._Quaternion[0] = new LSL_Types.Quaternion(0, 0, 0, 1);
183 detstruct._Vector3[0] = new LSL_Types.Vector3(0, 0, 0);
184 detstruct._Vector32[0] = new LSL_Types.Vector3(0, 0, 0);
185 }
134 myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "touch_end", detstruct, new object[] { new LSL_Types.LSLInteger(1) }); 186 myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "touch_end", detstruct, new object[] { new LSL_Types.LSLInteger(1) });
135 } 187 }
136 188
@@ -184,6 +236,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
184 detstruct._Quaternion = new LSL_Types.Quaternion[col.Colliders.Count]; 236 detstruct._Quaternion = new LSL_Types.Quaternion[col.Colliders.Count];
185 detstruct._int = new int[col.Colliders.Count]; 237 detstruct._int = new int[col.Colliders.Count];
186 detstruct._key = new LSL_Types.key[col.Colliders.Count]; 238 detstruct._key = new LSL_Types.key[col.Colliders.Count];
239 detstruct._key2 = new LSL_Types.key[col.Colliders.Count];
187 detstruct._Vector3 = new LSL_Types.Vector3[col.Colliders.Count]; 240 detstruct._Vector3 = new LSL_Types.Vector3[col.Colliders.Count];
188 detstruct._Vector32 = new LSL_Types.Vector3[col.Colliders.Count]; 241 detstruct._Vector32 = new LSL_Types.Vector3[col.Colliders.Count];
189 detstruct._bool = new bool[col.Colliders.Count]; 242 detstruct._bool = new bool[col.Colliders.Count];
@@ -192,6 +245,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
192 foreach (DetectedObject detobj in col.Colliders) 245 foreach (DetectedObject detobj in col.Colliders)
193 { 246 {
194 detstruct._key[i] = new LSL_Types.key(detobj.keyUUID.ToString()); 247 detstruct._key[i] = new LSL_Types.key(detobj.keyUUID.ToString());
248 detstruct._key2[i] = new LSL_Types.key(detobj.ownerUUID.ToString());
195 detstruct._Quaternion[i] = new LSL_Types.Quaternion(detobj.rotQuat.X, detobj.rotQuat.Y, detobj.rotQuat.Z, detobj.rotQuat.W); 249 detstruct._Quaternion[i] = new LSL_Types.Quaternion(detobj.rotQuat.X, detobj.rotQuat.Y, detobj.rotQuat.Z, detobj.rotQuat.W);
196 detstruct._string[i] = detobj.nameStr; 250 detstruct._string[i] = detobj.nameStr;
197 detstruct._int[i] = detobj.colliderType; 251 detstruct._int[i] = detobj.colliderType;
@@ -211,6 +265,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
211 detstruct._Quaternion = new LSL_Types.Quaternion[col.Colliders.Count]; 265 detstruct._Quaternion = new LSL_Types.Quaternion[col.Colliders.Count];
212 detstruct._int = new int[col.Colliders.Count]; 266 detstruct._int = new int[col.Colliders.Count];
213 detstruct._key = new LSL_Types.key[col.Colliders.Count]; 267 detstruct._key = new LSL_Types.key[col.Colliders.Count];
268 detstruct._key2 = new LSL_Types.key[col.Colliders.Count];
214 detstruct._Vector3 = new LSL_Types.Vector3[col.Colliders.Count]; 269 detstruct._Vector3 = new LSL_Types.Vector3[col.Colliders.Count];
215 detstruct._Vector32 = new LSL_Types.Vector3[col.Colliders.Count]; 270 detstruct._Vector32 = new LSL_Types.Vector3[col.Colliders.Count];
216 detstruct._bool = new bool[col.Colliders.Count]; 271 detstruct._bool = new bool[col.Colliders.Count];
@@ -219,6 +274,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
219 foreach (DetectedObject detobj in col.Colliders) 274 foreach (DetectedObject detobj in col.Colliders)
220 { 275 {
221 detstruct._key[i] = new LSL_Types.key(detobj.keyUUID.ToString()); 276 detstruct._key[i] = new LSL_Types.key(detobj.keyUUID.ToString());
277 detstruct._key2[i] = new LSL_Types.key(detobj.ownerUUID.ToString());
222 detstruct._Quaternion[i] = new LSL_Types.Quaternion(detobj.rotQuat.X, detobj.rotQuat.Y, detobj.rotQuat.Z, detobj.rotQuat.W); 278 detstruct._Quaternion[i] = new LSL_Types.Quaternion(detobj.rotQuat.X, detobj.rotQuat.Y, detobj.rotQuat.Z, detobj.rotQuat.W);
223 detstruct._string[i] = detobj.nameStr; 279 detstruct._string[i] = detobj.nameStr;
224 detstruct._int[i] = detobj.colliderType; 280 detstruct._int[i] = detobj.colliderType;
@@ -236,6 +292,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
236 detstruct._Quaternion = new LSL_Types.Quaternion[col.Colliders.Count]; 292 detstruct._Quaternion = new LSL_Types.Quaternion[col.Colliders.Count];
237 detstruct._int = new int[col.Colliders.Count]; 293 detstruct._int = new int[col.Colliders.Count];
238 detstruct._key = new LSL_Types.key[col.Colliders.Count]; 294 detstruct._key = new LSL_Types.key[col.Colliders.Count];
295 detstruct._key2 = new LSL_Types.key[col.Colliders.Count];
239 detstruct._Vector3 = new LSL_Types.Vector3[col.Colliders.Count]; 296 detstruct._Vector3 = new LSL_Types.Vector3[col.Colliders.Count];
240 detstruct._Vector32 = new LSL_Types.Vector3[col.Colliders.Count]; 297 detstruct._Vector32 = new LSL_Types.Vector3[col.Colliders.Count];
241 detstruct._bool = new bool[col.Colliders.Count]; 298 detstruct._bool = new bool[col.Colliders.Count];
@@ -244,6 +301,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
244 foreach (DetectedObject detobj in col.Colliders) 301 foreach (DetectedObject detobj in col.Colliders)
245 { 302 {
246 detstruct._key[i] = new LSL_Types.key(detobj.keyUUID.ToString()); 303 detstruct._key[i] = new LSL_Types.key(detobj.keyUUID.ToString());
304 detstruct._key2[i] = new LSL_Types.key(detobj.ownerUUID.ToString());
247 detstruct._Quaternion[i] = new LSL_Types.Quaternion(detobj.rotQuat.X, detobj.rotQuat.Y, detobj.rotQuat.Z, detobj.rotQuat.W); 305 detstruct._Quaternion[i] = new LSL_Types.Quaternion(detobj.rotQuat.X, detobj.rotQuat.Y, detobj.rotQuat.Z, detobj.rotQuat.W);
248 detstruct._string[i] = detobj.nameStr; 306 detstruct._string[i] = detobj.nameStr;
249 detstruct._int[i] = detobj.colliderType; 307 detstruct._int[i] = detobj.colliderType;
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs
index c6eebf1..79c1dde 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs
@@ -153,7 +153,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
153 { 153 {
154 // More or less just a placeholder for the actual moving of additional data 154 // More or less just a placeholder for the actual moving of additional data
155 // should be fixed to something better :) 155 // should be fixed to something better :)
156 public LSL_Types.key[] _key; 156 public LSL_Types.key[] _key; // detected key
157 public LSL_Types.key[] _key2; // ownerkey
157 public LSL_Types.Quaternion[] _Quaternion; 158 public LSL_Types.Quaternion[] _Quaternion;
158 public LSL_Types.Vector3[] _Vector3; // Pos 159 public LSL_Types.Vector3[] _Vector3; // Pos
159 public LSL_Types.Vector3[] _Vector32; // Vel 160 public LSL_Types.Vector3[] _Vector32; // Vel