aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs248
1 files changed, 124 insertions, 124 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 8050bf6..ec41ac7 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -56,7 +56,7 @@ namespace OpenSim.Region.Framework.Scenes
56 land_collision = 2048, 56 land_collision = 2048,
57 land_collision_end = 4096, 57 land_collision_end = 4096,
58 land_collision_start = 8192, 58 land_collision_start = 8192,
59 at_target = 16384, 59 at_target = 16384,
60 at_rot_target = 16777216, 60 at_rot_target = 16777216,
61 listen = 32768, 61 listen = 32768,
62 money = 65536, 62 money = 65536,
@@ -80,13 +80,13 @@ namespace OpenSim.Region.Framework.Scenes
80 public Vector3 targetPos; 80 public Vector3 targetPos;
81 public float tolerance; 81 public float tolerance;
82 public uint handle; 82 public uint handle;
83 } 83 }
84 84
85 struct scriptRotTarget 85 struct scriptRotTarget
86 { 86 {
87 public Quaternion targetRot; 87 public Quaternion targetRot;
88 public float tolerance; 88 public float tolerance;
89 public uint handle; 89 public uint handle;
90 } 90 }
91 91
92 public delegate void PrimCountTaintedDelegate(); 92 public delegate void PrimCountTaintedDelegate();
@@ -173,13 +173,13 @@ namespace OpenSim.Region.Framework.Scenes
173 protected SceneObjectPart m_rootPart; 173 protected SceneObjectPart m_rootPart;
174 // private Dictionary<UUID, scriptEvents> m_scriptEvents = new Dictionary<UUID, scriptEvents>(); 174 // private Dictionary<UUID, scriptEvents> m_scriptEvents = new Dictionary<UUID, scriptEvents>();
175 175
176 private Dictionary<uint, scriptPosTarget> m_targets = new Dictionary<uint, scriptPosTarget>(); 176 private Dictionary<uint, scriptPosTarget> m_targets = new Dictionary<uint, scriptPosTarget>();
177 private Dictionary<uint, scriptRotTarget> m_rotTargets = new Dictionary<uint, scriptRotTarget>(); 177 private Dictionary<uint, scriptRotTarget> m_rotTargets = new Dictionary<uint, scriptRotTarget>();
178 178
179 private bool m_scriptListens_atTarget = false; 179 private bool m_scriptListens_atTarget = false;
180 private bool m_scriptListens_notAtTarget = false; 180 private bool m_scriptListens_notAtTarget = false;
181 181
182 private bool m_scriptListens_atRotTarget = false; 182 private bool m_scriptListens_atRotTarget = false;
183 private bool m_scriptListens_notAtRotTarget = false; 183 private bool m_scriptListens_notAtRotTarget = false;
184 184
185 internal Dictionary<UUID, string> m_savedScriptState = null; 185 internal Dictionary<UUID, string> m_savedScriptState = null;
@@ -1273,15 +1273,15 @@ namespace OpenSim.Region.Framework.Scenes
1273 lock (m_targets) 1273 lock (m_targets)
1274 m_targets.Clear(); 1274 m_targets.Clear();
1275 m_scene.RemoveGroupTarget(this); 1275 m_scene.RemoveGroupTarget(this);
1276 } 1276 }
1277 m_scriptListens_atRotTarget = ((aggregateScriptEvents & scriptEvents.at_rot_target) != 0); 1277 m_scriptListens_atRotTarget = ((aggregateScriptEvents & scriptEvents.at_rot_target) != 0);
1278 m_scriptListens_notAtRotTarget = ((aggregateScriptEvents & scriptEvents.not_at_rot_target) != 0); 1278 m_scriptListens_notAtRotTarget = ((aggregateScriptEvents & scriptEvents.not_at_rot_target) != 0);
1279 1279
1280 if (!m_scriptListens_atRotTarget && !m_scriptListens_notAtRotTarget) 1280 if (!m_scriptListens_atRotTarget && !m_scriptListens_notAtRotTarget)
1281 { 1281 {
1282 lock (m_rotTargets) 1282 lock (m_rotTargets)
1283 m_rotTargets.Clear(); 1283 m_rotTargets.Clear();
1284 m_scene.RemoveGroupTarget(this); 1284 m_scene.RemoveGroupTarget(this);
1285 } 1285 }
1286 1286
1287 ScheduleGroupForFullUpdate(); 1287 ScheduleGroupForFullUpdate();
@@ -3178,30 +3178,30 @@ namespace OpenSim.Region.Framework.Scenes
3178 } 3178 }
3179 3179
3180 } 3180 }
3181 } 3181 }
3182 public int registerRotTargetWaypoint(Quaternion target, float tolerance) 3182 public int registerRotTargetWaypoint(Quaternion target, float tolerance)
3183 { 3183 {
3184 scriptRotTarget waypoint = new scriptRotTarget(); 3184 scriptRotTarget waypoint = new scriptRotTarget();
3185 waypoint.targetRot = target; 3185 waypoint.targetRot = target;
3186 waypoint.tolerance = tolerance; 3186 waypoint.tolerance = tolerance;
3187 uint handle = m_scene.AllocateLocalId(); 3187 uint handle = m_scene.AllocateLocalId();
3188 waypoint.handle = handle; 3188 waypoint.handle = handle;
3189 lock (m_rotTargets) 3189 lock (m_rotTargets)
3190 { 3190 {
3191 m_rotTargets.Add(handle, waypoint); 3191 m_rotTargets.Add(handle, waypoint);
3192 } 3192 }
3193 m_scene.AddGroupTarget(this); 3193 m_scene.AddGroupTarget(this);
3194 return (int)handle; 3194 return (int)handle;
3195 } 3195 }
3196 3196
3197 public void unregisterRotTargetWaypoint(int handle) 3197 public void unregisterRotTargetWaypoint(int handle)
3198 { 3198 {
3199 lock (m_targets) 3199 lock (m_targets)
3200 { 3200 {
3201 m_rotTargets.Remove((uint)handle); 3201 m_rotTargets.Remove((uint)handle);
3202 if (m_targets.Count == 0) 3202 if (m_targets.Count == 0)
3203 m_scene.RemoveGroupTarget(this); 3203 m_scene.RemoveGroupTarget(this);
3204 } 3204 }
3205 } 3205 }
3206 3206
3207 public int registerTargetWaypoint(Vector3 target, float tolerance) 3207 public int registerTargetWaypoint(Vector3 target, float tolerance)
@@ -3308,85 +3308,85 @@ namespace OpenSim.Region.Framework.Scenes
3308 } 3308 }
3309 } 3309 }
3310 } 3310 }
3311 } 3311 }
3312 if (m_scriptListens_atRotTarget || m_scriptListens_notAtRotTarget) 3312 if (m_scriptListens_atRotTarget || m_scriptListens_notAtRotTarget)
3313 { 3313 {
3314 if (m_rotTargets.Count > 0) 3314 if (m_rotTargets.Count > 0)
3315 { 3315 {
3316 bool at_Rottarget = false; 3316 bool at_Rottarget = false;
3317 Dictionary<uint, scriptRotTarget> atRotTargets = new Dictionary<uint, scriptRotTarget>(); 3317 Dictionary<uint, scriptRotTarget> atRotTargets = new Dictionary<uint, scriptRotTarget>();
3318 lock (m_rotTargets) 3318 lock (m_rotTargets)
3319 { 3319 {
3320 foreach (uint idx in m_rotTargets.Keys) 3320 foreach (uint idx in m_rotTargets.Keys)
3321 { 3321 {
3322 scriptRotTarget target = m_rotTargets[idx]; 3322 scriptRotTarget target = m_rotTargets[idx];
3323 double angle = Math.Acos(target.targetRot.X * m_rootPart.RotationOffset.X + target.targetRot.Y * m_rootPart.RotationOffset.Y + target.targetRot.Z * m_rootPart.RotationOffset.Z + target.targetRot.W * m_rootPart.RotationOffset.W) * 2; 3323 double angle = Math.Acos(target.targetRot.X * m_rootPart.RotationOffset.X + target.targetRot.Y * m_rootPart.RotationOffset.Y + target.targetRot.Z * m_rootPart.RotationOffset.Z + target.targetRot.W * m_rootPart.RotationOffset.W) * 2;
3324 if (angle < 0) angle = -angle; 3324 if (angle < 0) angle = -angle;
3325 if (angle > Math.PI) angle = (Math.PI * 2 - angle); 3325 if (angle > Math.PI) angle = (Math.PI * 2 - angle);
3326 if (angle <= target.tolerance) 3326 if (angle <= target.tolerance)
3327 { 3327 {
3328 // trigger at_rot_target 3328 // trigger at_rot_target
3329 if (m_scriptListens_atRotTarget) 3329 if (m_scriptListens_atRotTarget)
3330 { 3330 {
3331 at_Rottarget = true; 3331 at_Rottarget = true;
3332 scriptRotTarget att = new scriptRotTarget(); 3332 scriptRotTarget att = new scriptRotTarget();
3333 att.targetRot = target.targetRot; 3333 att.targetRot = target.targetRot;
3334 att.tolerance = target.tolerance; 3334 att.tolerance = target.tolerance;
3335 att.handle = target.handle; 3335 att.handle = target.handle;
3336 atRotTargets.Add(idx, att); 3336 atRotTargets.Add(idx, att);
3337 } 3337 }
3338 } 3338 }
3339 } 3339 }
3340 } 3340 }
3341 3341
3342 if (atRotTargets.Count > 0) 3342 if (atRotTargets.Count > 0)
3343 { 3343 {
3344 uint[] localids = new uint[0]; 3344 uint[] localids = new uint[0];
3345 lock (m_parts) 3345 lock (m_parts)
3346 { 3346 {
3347 localids = new uint[m_parts.Count]; 3347 localids = new uint[m_parts.Count];
3348 int cntr = 0; 3348 int cntr = 0;
3349 foreach (SceneObjectPart part in m_parts.Values) 3349 foreach (SceneObjectPart part in m_parts.Values)
3350 { 3350 {
3351 localids[cntr] = part.LocalId; 3351 localids[cntr] = part.LocalId;
3352 cntr++; 3352 cntr++;
3353 } 3353 }
3354 } 3354 }
3355 3355
3356 for (int ctr = 0; ctr < localids.Length; ctr++) 3356 for (int ctr = 0; ctr < localids.Length; ctr++)
3357 { 3357 {
3358 foreach (uint target in atRotTargets.Keys) 3358 foreach (uint target in atRotTargets.Keys)
3359 { 3359 {
3360 scriptRotTarget att = atRotTargets[target]; 3360 scriptRotTarget att = atRotTargets[target];
3361 m_scene.EventManager.TriggerAtRotTargetEvent( 3361 m_scene.EventManager.TriggerAtRotTargetEvent(
3362 localids[ctr], att.handle, att.targetRot, m_rootPart.RotationOffset); 3362 localids[ctr], att.handle, att.targetRot, m_rootPart.RotationOffset);
3363 } 3363 }
3364 } 3364 }
3365 3365
3366 return; 3366 return;
3367 } 3367 }
3368 3368
3369 if (m_scriptListens_notAtRotTarget && !at_Rottarget) 3369 if (m_scriptListens_notAtRotTarget && !at_Rottarget)
3370 { 3370 {
3371 //trigger not_at_target 3371 //trigger not_at_target
3372 uint[] localids = new uint[0]; 3372 uint[] localids = new uint[0];
3373 lock (m_parts) 3373 lock (m_parts)
3374 { 3374 {
3375 localids = new uint[m_parts.Count]; 3375 localids = new uint[m_parts.Count];
3376 int cntr = 0; 3376 int cntr = 0;
3377 foreach (SceneObjectPart part in m_parts.Values) 3377 foreach (SceneObjectPart part in m_parts.Values)
3378 { 3378 {
3379 localids[cntr] = part.LocalId; 3379 localids[cntr] = part.LocalId;
3380 cntr++; 3380 cntr++;
3381 } 3381 }
3382 } 3382 }
3383 3383
3384 for (int ctr = 0; ctr < localids.Length; ctr++) 3384 for (int ctr = 0; ctr < localids.Length; ctr++)
3385 { 3385 {
3386 m_scene.EventManager.TriggerNotAtRotTargetEvent(localids[ctr]); 3386 m_scene.EventManager.TriggerNotAtRotTargetEvent(localids[ctr]);
3387 } 3387 }
3388 } 3388 }
3389 } 3389 }
3390 } 3390 }
3391 } 3391 }
3392 3392