aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs50
1 files changed, 25 insertions, 25 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
index eaf4bd0..d1e3921 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
@@ -27,7 +27,7 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using libsecondlife; 30using OpenMetaverse;
31using OpenSim.Framework; 31using OpenSim.Framework;
32using OpenSim.Framework.Communications.Cache; 32using OpenSim.Framework.Communications.Cache;
33using OpenSim.Region.Environment.Scenes; 33using OpenSim.Region.Environment.Scenes;
@@ -45,8 +45,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
45 m_CmdManager = CmdManager; 45 m_CmdManager = CmdManager;
46 } 46 }
47 47
48 public Dictionary<uint, Dictionary<LLUUID, LSL_Types.list>> SenseEvents = 48 public Dictionary<uint, Dictionary<UUID, LSL_Types.list>> SenseEvents =
49 new Dictionary<uint, Dictionary<LLUUID, LSL_Types.list>>(); 49 new Dictionary<uint, Dictionary<UUID, LSL_Types.list>>();
50 private Object SenseLock = new Object(); 50 private Object SenseLock = new Object();
51 51
52 // 52 //
@@ -55,12 +55,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
55 private class SenseRepeatClass 55 private class SenseRepeatClass
56 { 56 {
57 public uint localID; 57 public uint localID;
58 public LLUUID itemID; 58 public UUID itemID;
59 public double interval; 59 public double interval;
60 public DateTime next; 60 public DateTime next;
61 61
62 public string name; 62 public string name;
63 public LLUUID keyID; 63 public UUID keyID;
64 public int type; 64 public int type;
65 public double range; 65 public double range;
66 public double arc; 66 public double arc;
@@ -70,8 +70,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
70 private List<SenseRepeatClass> SenseRepeaters = new List<SenseRepeatClass>(); 70 private List<SenseRepeatClass> SenseRepeaters = new List<SenseRepeatClass>();
71 private object SenseRepeatListLock = new object(); 71 private object SenseRepeatListLock = new object();
72 72
73 public void SetSenseRepeatEvent(uint m_localID, LLUUID m_itemID, 73 public void SetSenseRepeatEvent(uint m_localID, UUID m_itemID,
74 string name, LLUUID keyID, int type, double range, 74 string name, UUID keyID, int type, double range,
75 double arc, double sec, SceneObjectPart host) 75 double arc, double sec, SceneObjectPart host)
76 { 76 {
77 // Always remove first, in case this is a re-set 77 // Always remove first, in case this is a re-set
@@ -98,7 +98,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
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.Shared.Api.Plugins
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.Shared.Api.Plugins
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 return null; 166 return null;
@@ -187,11 +187,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
187 return; 187 return;
188 } 188 }
189 189
190 LLVector3 sensorPos = SensePoint.AbsolutePosition; 190 Vector3 sensorPos = SensePoint.AbsolutePosition;
191 LLVector3 regionPos = new LLVector3(m_CmdManager.m_ScriptEngine.World.RegionInfo.RegionLocX * Constants.RegionSize, m_CmdManager.m_ScriptEngine.World.RegionInfo.RegionLocY * Constants.RegionSize, 0); 191 Vector3 regionPos = new Vector3(m_CmdManager.m_ScriptEngine.World.RegionInfo.RegionLocX * Constants.RegionSize, m_CmdManager.m_ScriptEngine.World.RegionInfo.RegionLocY * Constants.RegionSize, 0);
192 LLVector3 fromRegionPos = sensorPos + regionPos; 192 Vector3 fromRegionPos = sensorPos + regionPos;
193 193
194 LLQuaternion q = SensePoint.RotationOffset; 194 Quaternion q = SensePoint.RotationOffset;
195 LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); 195 LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W);
196 LSL_Types.Vector3 forward_dir = (new LSL_Types.Vector3(1, 0, 0) * r); 196 LSL_Types.Vector3 forward_dir = (new LSL_Types.Vector3(1, 0, 0) * r);
197 double mag_fwd = LSL_Types.Vector3.Mag(forward_dir); 197 double mag_fwd = LSL_Types.Vector3.Mag(forward_dir);
@@ -203,7 +203,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
203 203
204 foreach (EntityBase ent in m_CmdManager.m_ScriptEngine.World.Entities.Values) 204 foreach (EntityBase ent in m_CmdManager.m_ScriptEngine.World.Entities.Values)
205 { 205 {
206 LLVector3 toRegionPos = ent.AbsolutePosition + regionPos; 206 Vector3 toRegionPos = ent.AbsolutePosition + regionPos;
207 double dis = Math.Abs((double)Util.GetDistanceTo(toRegionPos, fromRegionPos)); 207 double dis = Math.Abs((double)Util.GetDistanceTo(toRegionPos, fromRegionPos));
208 if (dis <= ts.range) 208 if (dis <= ts.range)
209 { 209 {
@@ -239,7 +239,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
239 double ang_obj = 0; 239 double ang_obj = 0;
240 try 240 try
241 { 241 {
242 LLVector3 diff = toRegionPos - fromRegionPos; 242 Vector3 diff = toRegionPos - fromRegionPos;
243 LSL_Types.Vector3 obj_dir = new LSL_Types.Vector3(diff.X, diff.Y, diff.Z); 243 LSL_Types.Vector3 obj_dir = new LSL_Types.Vector3(diff.X, diff.Y, diff.Z);
244 double dot = LSL_Types.Vector3.Dot(forward_dir, obj_dir); 244 double dot = LSL_Types.Vector3.Dot(forward_dir, obj_dir);
245 double mag_obj = LSL_Types.Vector3.Mag(obj_dir); 245 double mag_obj = LSL_Types.Vector3.Mag(obj_dir);
@@ -252,7 +252,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
252 if (ang_obj > ts.arc) keep = false; 252 if (ang_obj > ts.arc) keep = false;
253 } 253 }
254 254
255 if (keep && (ts.keyID != LLUUID.Zero) && (ts.keyID != ent.UUID)) 255 if (keep && (ts.keyID != UUID.Zero) && (ts.keyID != ent.UUID))
256 { 256 {
257 keep = false; 257 keep = false;
258 } 258 }
@@ -292,10 +292,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
292 // Create object if it doesn't exist 292 // Create object if it doesn't exist
293 if (SenseEvents.ContainsKey(ts.localID) == false) 293 if (SenseEvents.ContainsKey(ts.localID) == false)
294 { 294 {
295 SenseEvents.Add(ts.localID, new Dictionary<LLUUID, LSL_Types.list>()); 295 SenseEvents.Add(ts.localID, new Dictionary<UUID, LSL_Types.list>());
296 } 296 }
297 // clear if previous traces exist 297 // clear if previous traces exist
298 Dictionary<LLUUID, LSL_Types.list> Obj; 298 Dictionary<UUID, LSL_Types.list> Obj;
299 SenseEvents.TryGetValue(ts.localID, out Obj); 299 SenseEvents.TryGetValue(ts.localID, out Obj);
300 if (Obj.ContainsKey(ts.itemID) == true) 300 if (Obj.ContainsKey(ts.itemID) == true)
301 Obj.Remove(ts.itemID); 301 Obj.Remove(ts.itemID);
@@ -320,7 +320,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
320 for (idx = 0; idx < SensedObjects.Length; idx++) 320 for (idx = 0; idx < SensedObjects.Length; idx++)
321 { 321 {
322 detect[idx] = new DetectParams(); 322 detect[idx] = new DetectParams();
323 detect[idx].Key=(LLUUID)(SensedObjects.Data[idx]); 323 detect[idx].Key=(UUID)(SensedObjects.Data[idx]);
324 detect[idx].Populate(m_CmdManager.m_ScriptEngine.World); 324 detect[idx].Populate(m_CmdManager.m_ScriptEngine.World);
325 } 325 }
326 326
@@ -333,7 +333,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
333 } 333 }
334 } 334 }
335 335
336 public Object[] GetSerializationData(LLUUID itemID) 336 public Object[] GetSerializationData(UUID itemID)
337 { 337 {
338 List<Object> data = new List<Object>(); 338 List<Object> data = new List<Object>();
339 339
@@ -352,7 +352,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
352 return data.ToArray(); 352 return data.ToArray();
353 } 353 }
354 354
355 public void CreateFromData(uint localID, LLUUID itemID, LLUUID objectID, 355 public void CreateFromData(uint localID, UUID itemID, UUID objectID,
356 Object[] data) 356 Object[] data)
357 { 357 {
358 SceneObjectPart part = 358 SceneObjectPart part =
@@ -373,7 +373,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
373 373
374 ts.interval = (double)data[idx]; 374 ts.interval = (double)data[idx];
375 ts.name = (string)data[idx+1]; 375 ts.name = (string)data[idx+1];
376 ts.keyID = (LLUUID)data[idx+2]; 376 ts.keyID = (UUID)data[idx+2];
377 ts.type = (int)data[idx+3]; 377 ts.type = (int)data[idx+3];
378 ts.range = (double)data[idx+4]; 378 ts.range = (double)data[idx+4];
379 ts.arc = (double)data[idx+5]; 379 ts.arc = (double)data[idx+5];