aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/SensorRepeat.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/SensorRepeat.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/SensorRepeat.cs42
1 files changed, 21 insertions, 21 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/SensorRepeat.cs
index 9b636fd..0fce1f2 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/SensorRepeat.cs
@@ -27,7 +27,7 @@
27//#define SPAM 27//#define SPAM
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using libsecondlife; 30using OpenMetaverse;
31using OpenSim.Framework; 31using OpenSim.Framework;
32using OpenSim.Region.Environment.Scenes; 32using OpenSim.Region.Environment.Scenes;
33using OpenSim.Framework.Communications.Cache; 33using OpenSim.Framework.Communications.Cache;
@@ -43,8 +43,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugin
43 m_CmdManager = CmdManager; 43 m_CmdManager = CmdManager;
44 } 44 }
45 45
46 public Dictionary<uint, Dictionary<LLUUID, LSL_Types.list>> SenseEvents = 46 public Dictionary<uint, Dictionary<UUID, LSL_Types.list>> SenseEvents =
47 new Dictionary<uint, Dictionary<LLUUID, LSL_Types.list>>(); 47 new Dictionary<uint, Dictionary<UUID, LSL_Types.list>>();
48 private Object SenseLock = new Object(); 48 private Object SenseLock = new Object();
49 49
50 // 50 //
@@ -53,12 +53,12 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugin
53 private class SenseRepeatClass 53 private class SenseRepeatClass
54 { 54 {
55 public uint localID; 55 public uint localID;
56 public LLUUID itemID; 56 public UUID itemID;
57 public double interval; 57 public double interval;
58 public DateTime next; 58 public DateTime next;
59 59
60 public string name; 60 public string name;
61 public LLUUID keyID; 61 public UUID keyID;
62 public int type; 62 public int type;
63 public double range; 63 public double range;
64 public double arc; 64 public double arc;
@@ -68,8 +68,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugin
68 private List<SenseRepeatClass> SenseRepeaters = new List<SenseRepeatClass>(); 68 private List<SenseRepeatClass> SenseRepeaters = new List<SenseRepeatClass>();
69 private object SenseRepeatListLock = new object(); 69 private object SenseRepeatListLock = new object();
70 70
71 public void SetSenseRepeatEvent(uint m_localID, LLUUID m_itemID, 71 public void SetSenseRepeatEvent(uint m_localID, UUID m_itemID,
72 string name, LLUUID keyID, int type, double range, double arc, double sec, SceneObjectPart host) 72 string name, UUID keyID, int type, double range, double arc, double sec, SceneObjectPart host)
73 { 73 {
74 #if SPAM 74 #if SPAM
75 Console.WriteLine("SetSensorEvent"); 75 Console.WriteLine("SetSensorEvent");
@@ -98,7 +98,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugin
98 } 98 }
99 } 99 }
100 100
101 public void UnSetSenseRepeaterEvents(uint m_localID, LLUUID m_itemID) 101 public void UnSetSenseRepeaterEvents(uint m_localID, UUID m_itemID)
102 { 102 {
103 // Remove from timer 103 // Remove from timer
104 lock (SenseRepeatListLock) 104 lock (SenseRepeatListLock)
@@ -138,8 +138,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugin
138 } // lock 138 } // lock
139 } 139 }
140 140
141 public void SenseOnce(uint m_localID, LLUUID m_itemID, 141 public void SenseOnce(uint m_localID, UUID m_itemID,
142 string name, LLUUID keyID, int type, 142 string name, UUID keyID, int type,
143 double range, double arc, SceneObjectPart host) 143 double range, double arc, SceneObjectPart host)
144 { 144 {
145 // Add to timer 145 // Add to timer
@@ -156,11 +156,11 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugin
156 SensorSweep(ts); 156 SensorSweep(ts);
157 } 157 }
158 158
159 public LSL_Types.list GetSensorList(uint m_localID, LLUUID m_itemID) 159 public LSL_Types.list GetSensorList(uint m_localID, UUID m_itemID)
160 { 160 {
161 lock (SenseLock) 161 lock (SenseLock)
162 { 162 {
163 Dictionary<LLUUID, LSL_Types.list> Obj = null; 163 Dictionary<UUID, LSL_Types.list> Obj = null;
164 if (!SenseEvents.TryGetValue(m_localID, out Obj)) 164 if (!SenseEvents.TryGetValue(m_localID, out Obj))
165 { 165 {
166 #if SPAM 166 #if SPAM
@@ -199,11 +199,11 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugin
199 } 199 }
200 //m_ScriptEngine.Log.Info("[AsyncLSL]: Enter SensorSweep Scan"); 200 //m_ScriptEngine.Log.Info("[AsyncLSL]: Enter SensorSweep Scan");
201 201
202 LLVector3 sensorPos = SensePoint.AbsolutePosition; 202 Vector3 sensorPos = SensePoint.AbsolutePosition;
203 LLVector3 regionPos = new LLVector3(m_CmdManager.m_ScriptEngine.World.RegionInfo.RegionLocX * Constants.RegionSize, m_CmdManager.m_ScriptEngine.World.RegionInfo.RegionLocY * Constants.RegionSize, 0); 203 Vector3 regionPos = new Vector3(m_CmdManager.m_ScriptEngine.World.RegionInfo.RegionLocX * Constants.RegionSize, m_CmdManager.m_ScriptEngine.World.RegionInfo.RegionLocY * Constants.RegionSize, 0);
204 LLVector3 fromRegionPos = sensorPos + regionPos; 204 Vector3 fromRegionPos = sensorPos + regionPos;
205 205
206 LLQuaternion q = SensePoint.RotationOffset; 206 Quaternion q = SensePoint.RotationOffset;
207 LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); 207 LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W);
208 LSL_Types.Vector3 forward_dir = (new LSL_Types.Vector3(1, 0, 0) * r); 208 LSL_Types.Vector3 forward_dir = (new LSL_Types.Vector3(1, 0, 0) * r);
209 double mag_fwd = LSL_Types.Vector3.Mag(forward_dir); 209 double mag_fwd = LSL_Types.Vector3.Mag(forward_dir);
@@ -215,7 +215,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugin
215 215
216 foreach (EntityBase ent in m_CmdManager.m_ScriptEngine.World.Entities.Values) 216 foreach (EntityBase ent in m_CmdManager.m_ScriptEngine.World.Entities.Values)
217 { 217 {
218 LLVector3 toRegionPos = ent.AbsolutePosition + regionPos; 218 Vector3 toRegionPos = ent.AbsolutePosition + regionPos;
219 double dis = Math.Abs((double)Util.GetDistanceTo(toRegionPos, fromRegionPos)); 219 double dis = Math.Abs((double)Util.GetDistanceTo(toRegionPos, fromRegionPos));
220 if (dis <= ts.range) 220 if (dis <= ts.range)
221 { 221 {
@@ -248,7 +248,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugin
248 double ang_obj = 0; 248 double ang_obj = 0;
249 try 249 try
250 { 250 {
251 LLVector3 diff = toRegionPos - fromRegionPos; 251 Vector3 diff = toRegionPos - fromRegionPos;
252 LSL_Types.Vector3 obj_dir = new LSL_Types.Vector3(diff.X, diff.Y, diff.Z); 252 LSL_Types.Vector3 obj_dir = new LSL_Types.Vector3(diff.X, diff.Y, diff.Z);
253 double dot = LSL_Types.Vector3.Dot(forward_dir, obj_dir); 253 double dot = LSL_Types.Vector3.Dot(forward_dir, obj_dir);
254 double mag_obj = LSL_Types.Vector3.Mag(obj_dir); 254 double mag_obj = LSL_Types.Vector3.Mag(obj_dir);
@@ -261,7 +261,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugin
261 if (ang_obj > ts.arc) keep = false; 261 if (ang_obj > ts.arc) keep = false;
262 } 262 }
263 263
264 if (keep && (ts.keyID != LLUUID.Zero) && (ts.keyID != ent.UUID)) 264 if (keep && (ts.keyID != UUID.Zero) && (ts.keyID != ent.UUID))
265 { 265 {
266 keep = false; 266 keep = false;
267 } 267 }
@@ -303,10 +303,10 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugin
303 // Create object if it doesn't exist 303 // Create object if it doesn't exist
304 if (SenseEvents.ContainsKey(ts.localID) == false) 304 if (SenseEvents.ContainsKey(ts.localID) == false)
305 { 305 {
306 SenseEvents.Add(ts.localID, new Dictionary<LLUUID, LSL_Types.list>()); 306 SenseEvents.Add(ts.localID, new Dictionary<UUID, LSL_Types.list>());
307 } 307 }
308 // clear if previous traces exist 308 // clear if previous traces exist
309 Dictionary<LLUUID, LSL_Types.list> Obj; 309 Dictionary<UUID, LSL_Types.list> Obj;
310 SenseEvents.TryGetValue(ts.localID, out Obj); 310 SenseEvents.TryGetValue(ts.localID, out Obj);
311 if (Obj.ContainsKey(ts.itemID) == true) 311 if (Obj.ContainsKey(ts.itemID) == true)
312 Obj.Remove(ts.itemID); 312 Obj.Remove(ts.itemID);