diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
4 files changed, 137 insertions, 15 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 663ac0c..4c58e36 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | |||
@@ -562,6 +562,25 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
562 | return resolveName(SensedUUID); | 562 | return resolveName(SensedUUID); |
563 | } | 563 | } |
564 | } | 564 | } |
565 | else | ||
566 | { | ||
567 | ScriptManager sm; | ||
568 | IScript script = null; | ||
569 | |||
570 | if ((sm = m_ScriptEngine.m_ScriptManager) != null) | ||
571 | { | ||
572 | if (sm.Scripts.ContainsKey(m_localID)) | ||
573 | { | ||
574 | if ((script = sm.GetScript(m_localID, m_itemID)) != null) | ||
575 | { | ||
576 | if (script.llDetectParams._bool.Length > number && script.llDetectParams._bool[number]) | ||
577 | { | ||
578 | return script.llDetectParams._string[number]; | ||
579 | } | ||
580 | } | ||
581 | } | ||
582 | } | ||
583 | } | ||
565 | return String.Empty; | 584 | return String.Empty; |
566 | } | 585 | } |
567 | 586 | ||
@@ -587,9 +606,12 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
587 | { | 606 | { |
588 | if ((script = sm.GetScript(m_localID, m_itemID)) != null) | 607 | if ((script = sm.GetScript(m_localID, m_itemID)) != null) |
589 | { | 608 | { |
590 | if (script.llDetectParams._key[0]) | 609 | if (script.llDetectParams._bool.Length > number && script.llDetectParams._bool[number]) |
591 | { | 610 | { |
592 | return new LLUUID(script.llDetectParams._key[0]); | 611 | LLUUID returnUUID = LLUUID.Zero; |
612 | Helpers.TryParse(script.llDetectParams._key[number], out returnUUID); | ||
613 | |||
614 | return returnUUID; | ||
593 | } | 615 | } |
594 | } | 616 | } |
595 | } | 617 | } |
@@ -614,6 +636,35 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
614 | return SensedObject; | 636 | return SensedObject; |
615 | } | 637 | } |
616 | } | 638 | } |
639 | else | ||
640 | { | ||
641 | ScriptManager sm; | ||
642 | IScript script = null; | ||
643 | |||
644 | if ((sm = m_ScriptEngine.m_ScriptManager) != null) | ||
645 | { | ||
646 | if (sm.Scripts.ContainsKey(m_localID)) | ||
647 | { | ||
648 | if ((script = sm.GetScript(m_localID, m_itemID)) != null) | ||
649 | { | ||
650 | if (script.llDetectParams._key[number]) | ||
651 | { | ||
652 | EntityBase SensedObject = null; | ||
653 | LLUUID SensedUUID = LLUUID.Zero; | ||
654 | Helpers.TryParse(script.llDetectParams._key.ToString(), out SensedUUID); | ||
655 | if (SensedUUID == LLUUID.Zero) | ||
656 | return null; | ||
657 | lock (World.Entities) | ||
658 | { | ||
659 | World.Entities.TryGetValue(SensedUUID, out SensedObject); | ||
660 | } | ||
661 | return SensedObject; | ||
662 | |||
663 | } | ||
664 | } | ||
665 | } | ||
666 | } | ||
667 | } | ||
617 | return null; | 668 | return null; |
618 | } | 669 | } |
619 | 670 | ||
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs index 5ef4a6b..ae84f65 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs | |||
@@ -26,9 +26,12 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
29 | using libsecondlife; | 30 | using libsecondlife; |
30 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
31 | using OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney; | 32 | using OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney; |
33 | using OpenSim.Region.Environment; | ||
34 | using OpenSim.Region; | ||
32 | using OpenSim.Region.Environment.Scenes; | 35 | using OpenSim.Region.Environment.Scenes; |
33 | using OpenSim.Region.Environment.Interfaces; | 36 | using OpenSim.Region.Environment.Interfaces; |
34 | 37 | ||
@@ -74,6 +77,9 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
74 | myScriptEngine.World.EventManager.OnScriptAtTargetEvent += at_target; | 77 | myScriptEngine.World.EventManager.OnScriptAtTargetEvent += at_target; |
75 | myScriptEngine.World.EventManager.OnScriptNotAtTargetEvent += not_at_target; | 78 | myScriptEngine.World.EventManager.OnScriptNotAtTargetEvent += not_at_target; |
76 | myScriptEngine.World.EventManager.OnScriptControlEvent += control; | 79 | myScriptEngine.World.EventManager.OnScriptControlEvent += control; |
80 | myScriptEngine.World.EventManager.OnScriptColliderStart += collision_start; | ||
81 | myScriptEngine.World.EventManager.OnScriptColliding += collision; | ||
82 | myScriptEngine.World.EventManager.OnScriptCollidingEnd += collision_end; | ||
77 | 83 | ||
78 | // TODO: HOOK ALL EVENTS UP TO SERVER! | 84 | // TODO: HOOK ALL EVENTS UP TO SERVER! |
79 | IMoneyModule money=myScriptEngine.World.RequestModuleInterface<IMoneyModule>(); | 85 | IMoneyModule money=myScriptEngine.World.RequestModuleInterface<IMoneyModule>(); |
@@ -171,19 +177,82 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
171 | myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "touch_end", EventQueueManager.llDetectNull, new object[] { new LSL_Types.LSLInteger(1) }); | 177 | myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "touch_end", EventQueueManager.llDetectNull, new object[] { new LSL_Types.LSLInteger(1) }); |
172 | } | 178 | } |
173 | 179 | ||
174 | public void collision_start(uint localID, LLUUID itemID) | 180 | public void collision_start(uint localID, ColliderArgs col) |
175 | { | 181 | { |
176 | myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "collision_start", EventQueueManager.llDetectNull, new object[] { new LSL_Types.LSLInteger(1) }); | 182 | EventQueueManager.Queue_llDetectParams_Struct detstruct = new EventQueueManager.Queue_llDetectParams_Struct(); |
183 | detstruct._string = new string[col.Colliders.Count]; | ||
184 | detstruct._Quaternion = new LSL_Types.Quaternion[col.Colliders.Count]; | ||
185 | detstruct._int = new int[col.Colliders.Count]; | ||
186 | detstruct._key = new LSL_Types.key[col.Colliders.Count]; | ||
187 | detstruct._Vector3 = new LSL_Types.Vector3[col.Colliders.Count]; | ||
188 | detstruct._Vector32 = new LSL_Types.Vector3[col.Colliders.Count]; | ||
189 | detstruct._bool = new bool[col.Colliders.Count]; | ||
190 | |||
191 | int i = 0; | ||
192 | foreach (DetectedObject detobj in col.Colliders) | ||
193 | { | ||
194 | detstruct._key[i] = new LSL_Types.key(detobj.keyUUID.ToString()); | ||
195 | 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; | ||
197 | detstruct._int[i] = detobj.colliderType; | ||
198 | detstruct._Vector3[i] = new LSL_Types.Vector3(detobj.posVector.X, detobj.posVector.Y, detobj.posVector.Z); | ||
199 | detstruct._Vector32[i] = new LSL_Types.Vector3(detobj.velVector.X, detobj.velVector.Y, detobj.velVector.Z); | ||
200 | detstruct._bool[i] = true; // Apparently the script engine uses this to see if this is a valid entry... | ||
201 | i++; | ||
202 | } | ||
203 | |||
204 | myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "collision_start", detstruct, new object[] { new LSL_Types.LSLInteger(col.Colliders.Count) }); | ||
177 | } | 205 | } |
178 | 206 | ||
179 | public void collision(uint localID, LLUUID itemID) | 207 | public void collision(uint localID, ColliderArgs col) |
180 | { | 208 | { |
181 | myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "collision", EventQueueManager.llDetectNull, new object[] { new LSL_Types.LSLInteger(1) }); | 209 | EventQueueManager.Queue_llDetectParams_Struct detstruct = new EventQueueManager.Queue_llDetectParams_Struct(); |
210 | detstruct._string = new string[col.Colliders.Count]; | ||
211 | detstruct._Quaternion = new LSL_Types.Quaternion[col.Colliders.Count]; | ||
212 | detstruct._int = new int[col.Colliders.Count]; | ||
213 | detstruct._key = new LSL_Types.key[col.Colliders.Count]; | ||
214 | detstruct._Vector3 = new LSL_Types.Vector3[col.Colliders.Count]; | ||
215 | detstruct._Vector32 = new LSL_Types.Vector3[col.Colliders.Count]; | ||
216 | detstruct._bool = new bool[col.Colliders.Count]; | ||
217 | |||
218 | int i = 0; | ||
219 | foreach (DetectedObject detobj in col.Colliders) | ||
220 | { | ||
221 | detstruct._key[i] = new LSL_Types.key(detobj.keyUUID.ToString()); | ||
222 | 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; | ||
224 | detstruct._int[i] = detobj.colliderType; | ||
225 | detstruct._Vector3[i] = new LSL_Types.Vector3(detobj.posVector.X, detobj.posVector.Y, detobj.posVector.Z); | ||
226 | detstruct._Vector32[i] = new LSL_Types.Vector3(detobj.velVector.X, detobj.velVector.Y, detobj.velVector.Z); | ||
227 | detstruct._bool[i] = true; // Apparently the script engine uses this to see if this is a valid entry... i++; | ||
228 | } | ||
229 | myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "collision", detstruct, new object[] { new LSL_Types.LSLInteger(col.Colliders.Count) }); | ||
182 | } | 230 | } |
183 | 231 | ||
184 | public void collision_end(uint localID, LLUUID itemID) | 232 | public void collision_end(uint localID, ColliderArgs col) |
185 | { | 233 | { |
186 | myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "collision_end", EventQueueManager.llDetectNull, new object[] { new LSL_Types.LSLInteger(1) }); | 234 | EventQueueManager.Queue_llDetectParams_Struct detstruct = new EventQueueManager.Queue_llDetectParams_Struct(); |
235 | detstruct._string = new string[col.Colliders.Count]; | ||
236 | detstruct._Quaternion = new LSL_Types.Quaternion[col.Colliders.Count]; | ||
237 | detstruct._int = new int[col.Colliders.Count]; | ||
238 | detstruct._key = new LSL_Types.key[col.Colliders.Count]; | ||
239 | detstruct._Vector3 = new LSL_Types.Vector3[col.Colliders.Count]; | ||
240 | detstruct._Vector32 = new LSL_Types.Vector3[col.Colliders.Count]; | ||
241 | detstruct._bool = new bool[col.Colliders.Count]; | ||
242 | |||
243 | int i = 0; | ||
244 | foreach (DetectedObject detobj in col.Colliders) | ||
245 | { | ||
246 | detstruct._key[i] = new LSL_Types.key(detobj.keyUUID.ToString()); | ||
247 | 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; | ||
249 | detstruct._int[i] = detobj.colliderType; | ||
250 | detstruct._Vector3[i] = new LSL_Types.Vector3(detobj.posVector.X, detobj.posVector.Y, detobj.posVector.Z); | ||
251 | detstruct._Vector32[i] = new LSL_Types.Vector3(detobj.velVector.X, detobj.velVector.Y, detobj.velVector.Z); | ||
252 | detstruct._bool[i] = true; // Apparently the script engine uses this to see if this is a valid entry... | ||
253 | i++; | ||
254 | } | ||
255 | myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "collision_end", EventQueueManager.llDetectNull, new object[] { new LSL_Types.LSLInteger(col.Colliders.Count) }); | ||
187 | } | 256 | } |
188 | 257 | ||
189 | public void land_collision_start(uint localID, LLUUID itemID) | 258 | public void land_collision_start(uint localID, LLUUID itemID) |
@@ -191,9 +260,9 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
191 | myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "land_collision_start", EventQueueManager.llDetectNull); | 260 | myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "land_collision_start", EventQueueManager.llDetectNull); |
192 | } | 261 | } |
193 | 262 | ||
194 | public void land_collision(uint localID, LLUUID itemID) | 263 | public void land_collision(uint localID, ColliderArgs col) |
195 | { | 264 | { |
196 | myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "land_collision", EventQueueManager.llDetectNull); | 265 | myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "land_collision", EventQueueManager.llDetectNull); |
197 | } | 266 | } |
198 | 267 | ||
199 | public void land_collision_end(uint localID, LLUUID itemID) | 268 | public void land_collision_end(uint localID, LLUUID itemID) |
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs index 7cbbd4f..c6eebf1 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs | |||
@@ -155,7 +155,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
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; |
157 | public LSL_Types.Quaternion[] _Quaternion; | 157 | public LSL_Types.Quaternion[] _Quaternion; |
158 | public LSL_Types.Vector3[] _Vector3; | 158 | public LSL_Types.Vector3[] _Vector3; // Pos |
159 | public LSL_Types.Vector3[] _Vector32; // Vel | ||
159 | public bool[] _bool; | 160 | public bool[] _bool; |
160 | public int[] _int; | 161 | public int[] _int; |
161 | public string[] _string; | 162 | public string[] _string; |
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs b/OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs index be42539..59f828d 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs | |||
@@ -31,6 +31,7 @@ using OpenSim.Framework; | |||
31 | using OpenSim.Region.Environment.Scenes; | 31 | using OpenSim.Region.Environment.Scenes; |
32 | using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase; | 32 | using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase; |
33 | 33 | ||
34 | |||
34 | namespace OpenSim.Region.ScriptEngine.Common | 35 | namespace OpenSim.Region.ScriptEngine.Common |
35 | { | 36 | { |
36 | public class ScriptServerInterfaces | 37 | public class ScriptServerInterfaces |
@@ -43,11 +44,11 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
43 | void state_exit(uint localID); | 44 | void state_exit(uint localID); |
44 | void touch(uint localID, LLUUID itemID); | 45 | void touch(uint localID, LLUUID itemID); |
45 | void touch_end(uint localID, LLUUID itemID); | 46 | void touch_end(uint localID, LLUUID itemID); |
46 | void collision_start(uint localID, LLUUID itemID); | 47 | void collision_start(uint localID, ColliderArgs col); |
47 | void collision(uint localID, LLUUID itemID); | 48 | void collision(uint localID, ColliderArgs col); |
48 | void collision_end(uint localID, LLUUID itemID); | 49 | void collision_end(uint localID, ColliderArgs col); |
49 | void land_collision_start(uint localID, LLUUID itemID); | 50 | void land_collision_start(uint localID, LLUUID itemID); |
50 | void land_collision(uint localID, LLUUID itemID); | 51 | void land_collision(uint localID, ColliderArgs col); |
51 | void land_collision_end(uint localID, LLUUID itemID); | 52 | void land_collision_end(uint localID, LLUUID itemID); |
52 | void timer(uint localID, LLUUID itemID); | 53 | void timer(uint localID, LLUUID itemID); |
53 | void listen(uint localID, LLUUID itemID); | 54 | void listen(uint localID, LLUUID itemID); |