diff options
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/EventManager.cs | 56 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 248 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 34 |
3 files changed, 169 insertions, 169 deletions
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 76d5cb6..399379e 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -181,14 +181,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
181 | 181 | ||
182 | public delegate void ScriptNotAtTargetEvent(uint localID); | 182 | public delegate void ScriptNotAtTargetEvent(uint localID); |
183 | 183 | ||
184 | public event ScriptNotAtTargetEvent OnScriptNotAtTargetEvent; | 184 | public event ScriptNotAtTargetEvent OnScriptNotAtTargetEvent; |
185 | 185 | ||
186 | public delegate void ScriptAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion atrot); | 186 | public delegate void ScriptAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion atrot); |
187 | 187 | ||
188 | public event ScriptAtRotTargetEvent OnScriptAtRotTargetEvent; | 188 | public event ScriptAtRotTargetEvent OnScriptAtRotTargetEvent; |
189 | 189 | ||
190 | public delegate void ScriptNotAtRotTargetEvent(uint localID); | 190 | public delegate void ScriptNotAtRotTargetEvent(uint localID); |
191 | 191 | ||
192 | public event ScriptNotAtRotTargetEvent OnScriptNotAtRotTargetEvent; | 192 | public event ScriptNotAtRotTargetEvent OnScriptNotAtRotTargetEvent; |
193 | 193 | ||
194 | public delegate void ScriptColliding(uint localID, ColliderArgs colliders); | 194 | public delegate void ScriptColliding(uint localID, ColliderArgs colliders); |
@@ -391,8 +391,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
391 | 391 | ||
392 | private ScriptChangedEvent handlerScriptChangedEvent = null; //OnScriptChangedEvent; | 392 | private ScriptChangedEvent handlerScriptChangedEvent = null; //OnScriptChangedEvent; |
393 | private ScriptAtTargetEvent handlerScriptAtTargetEvent = null; | 393 | private ScriptAtTargetEvent handlerScriptAtTargetEvent = null; |
394 | private ScriptNotAtTargetEvent handlerScriptNotAtTargetEvent = null; | 394 | private ScriptNotAtTargetEvent handlerScriptNotAtTargetEvent = null; |
395 | private ScriptAtRotTargetEvent handlerScriptAtRotTargetEvent = null; | 395 | private ScriptAtRotTargetEvent handlerScriptAtRotTargetEvent = null; |
396 | private ScriptNotAtRotTargetEvent handlerScriptNotAtRotTargetEvent = null; | 396 | private ScriptNotAtRotTargetEvent handlerScriptNotAtRotTargetEvent = null; |
397 | private ClientMovement handlerClientMovement = null; //OnClientMovement; | 397 | private ClientMovement handlerClientMovement = null; //OnClientMovement; |
398 | private OnPermissionErrorDelegate handlerPermissionError = null; //OnPermissionError; | 398 | private OnPermissionErrorDelegate handlerPermissionError = null; //OnPermissionError; |
@@ -859,24 +859,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
859 | { | 859 | { |
860 | handlerScriptNotAtTargetEvent(localID); | 860 | handlerScriptNotAtTargetEvent(localID); |
861 | } | 861 | } |
862 | } | 862 | } |
863 | 863 | ||
864 | public void TriggerAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion currentrot) | 864 | public void TriggerAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion currentrot) |
865 | { | 865 | { |
866 | handlerScriptAtRotTargetEvent = OnScriptAtRotTargetEvent; | 866 | handlerScriptAtRotTargetEvent = OnScriptAtRotTargetEvent; |
867 | if (handlerScriptAtRotTargetEvent != null) | 867 | if (handlerScriptAtRotTargetEvent != null) |
868 | { | 868 | { |
869 | handlerScriptAtRotTargetEvent(localID, handle, targetrot, currentrot); | 869 | handlerScriptAtRotTargetEvent(localID, handle, targetrot, currentrot); |
870 | } | 870 | } |
871 | } | 871 | } |
872 | 872 | ||
873 | public void TriggerNotAtRotTargetEvent(uint localID) | 873 | public void TriggerNotAtRotTargetEvent(uint localID) |
874 | { | 874 | { |
875 | handlerScriptNotAtRotTargetEvent = OnScriptNotAtRotTargetEvent; | 875 | handlerScriptNotAtRotTargetEvent = OnScriptNotAtRotTargetEvent; |
876 | if (handlerScriptNotAtRotTargetEvent != null) | 876 | if (handlerScriptNotAtRotTargetEvent != null) |
877 | { | 877 | { |
878 | handlerScriptNotAtRotTargetEvent(localID); | 878 | handlerScriptNotAtRotTargetEvent(localID); |
879 | } | 879 | } |
880 | } | 880 | } |
881 | 881 | ||
882 | public void TriggerRequestChangeWaterHeight(float height) | 882 | public void TriggerRequestChangeWaterHeight(float height) |
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 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 177de47..56b2f13 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -4078,23 +4078,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
4078 | { | 4078 | { |
4079 | m_parentGroup.unregisterTargetWaypoint(handle); | 4079 | m_parentGroup.unregisterTargetWaypoint(handle); |
4080 | } | 4080 | } |
4081 | } | 4081 | } |
4082 | 4082 | ||
4083 | public int registerRotTargetWaypoint(Quaternion target, float tolerance) | 4083 | public int registerRotTargetWaypoint(Quaternion target, float tolerance) |
4084 | { | 4084 | { |
4085 | if (m_parentGroup != null) | 4085 | if (m_parentGroup != null) |
4086 | { | 4086 | { |
4087 | return m_parentGroup.registerRotTargetWaypoint(target, tolerance); | 4087 | return m_parentGroup.registerRotTargetWaypoint(target, tolerance); |
4088 | } | 4088 | } |
4089 | return 0; | 4089 | return 0; |
4090 | } | 4090 | } |
4091 | 4091 | ||
4092 | public void unregisterRotTargetWaypoint(int handle) | 4092 | public void unregisterRotTargetWaypoint(int handle) |
4093 | { | 4093 | { |
4094 | if (m_parentGroup != null) | 4094 | if (m_parentGroup != null) |
4095 | { | 4095 | { |
4096 | m_parentGroup.unregisterRotTargetWaypoint(handle); | 4096 | m_parentGroup.unregisterRotTargetWaypoint(handle); |
4097 | } | 4097 | } |
4098 | } | 4098 | } |
4099 | 4099 | ||
4100 | public void SetCameraAtOffset(Vector3 v) | 4100 | public void SetCameraAtOffset(Vector3 v) |