diff options
author | Justin Clark-Casey (justincc) | 2011-08-27 00:15:21 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-08-27 00:15:21 +0100 |
commit | 33a894f3d2cc95a7a512b86f39f3c6a6afabb015 (patch) | |
tree | 064edbd623ea0bd7bb85c29dc28d2348feb8454b /OpenSim/Region/ScriptEngine/Shared/Api/Implementation | |
parent | refactor: simplify SOP.AttachedAvatar into SOG.AttachedAvatar (diff) | |
download | opensim-SC_OLD-33a894f3d2cc95a7a512b86f39f3c6a6afabb015.zip opensim-SC_OLD-33a894f3d2cc95a7a512b86f39f3c6a6afabb015.tar.gz opensim-SC_OLD-33a894f3d2cc95a7a512b86f39f3c6a6afabb015.tar.bz2 opensim-SC_OLD-33a894f3d2cc95a7a512b86f39f3c6a6afabb015.tar.xz |
refactor: move SOP.IsAttachment and AttachmentPoint up into SOG to avoid pointless duplication of identical values
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 20 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs | 8 |
2 files changed, 14 insertions, 14 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 81f1f38..a7f08d9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -1965,7 +1965,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1965 | 1965 | ||
1966 | if (part.ParentGroup.RootPart == part) | 1966 | if (part.ParentGroup.RootPart == part) |
1967 | { | 1967 | { |
1968 | if ((targetPos.z < ground) && disable_underground_movement && m_host.AttachmentPoint == 0) | 1968 | if ((targetPos.z < ground) && disable_underground_movement && m_host.ParentGroup.AttachmentPoint == 0) |
1969 | targetPos.z = ground; | 1969 | targetPos.z = ground; |
1970 | SceneObjectGroup parent = part.ParentGroup; | 1970 | SceneObjectGroup parent = part.ParentGroup; |
1971 | LSL_Vector real_vec = SetPosAdjust(currentPos, targetPos); | 1971 | LSL_Vector real_vec = SetPosAdjust(currentPos, targetPos); |
@@ -2097,7 +2097,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2097 | Quaternion q; | 2097 | Quaternion q; |
2098 | if (part.LinkNum == 0 || part.LinkNum == 1) // unlinked or root prim | 2098 | if (part.LinkNum == 0 || part.LinkNum == 1) // unlinked or root prim |
2099 | { | 2099 | { |
2100 | if (part.ParentGroup.RootPart.AttachmentPoint != 0) | 2100 | if (part.ParentGroup.AttachmentPoint != 0) |
2101 | { | 2101 | { |
2102 | ScenePresence avatar = World.GetScenePresence(part.ParentGroup.AttachedAvatar); | 2102 | ScenePresence avatar = World.GetScenePresence(part.ParentGroup.AttachedAvatar); |
2103 | if (avatar != null) | 2103 | if (avatar != null) |
@@ -2241,7 +2241,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2241 | 2241 | ||
2242 | Vector3 vel; | 2242 | Vector3 vel; |
2243 | 2243 | ||
2244 | if (m_host.IsAttachment) | 2244 | if (m_host.ParentGroup.IsAttachment) |
2245 | { | 2245 | { |
2246 | ScenePresence avatar = m_host.ParentGroup.Scene.GetScenePresence(m_host.ParentGroup.AttachedAvatar); | 2246 | ScenePresence avatar = m_host.ParentGroup.Scene.GetScenePresence(m_host.ParentGroup.AttachedAvatar); |
2247 | vel = avatar.Velocity; | 2247 | vel = avatar.Velocity; |
@@ -2997,7 +2997,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2997 | { | 2997 | { |
2998 | m_host.AddScriptLPS(1); | 2998 | m_host.AddScriptLPS(1); |
2999 | 2999 | ||
3000 | if (m_host.ParentGroup.RootPart.AttachmentPoint == 0) | 3000 | if (m_host.ParentGroup.AttachmentPoint == 0) |
3001 | return; | 3001 | return; |
3002 | 3002 | ||
3003 | TaskInventoryItem item; | 3003 | TaskInventoryItem item; |
@@ -3587,7 +3587,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3587 | 3587 | ||
3588 | SceneObjectPart targetPart = World.GetSceneObjectPart((UUID)targetID); | 3588 | SceneObjectPart targetPart = World.GetSceneObjectPart((UUID)targetID); |
3589 | 3589 | ||
3590 | if (targetPart.ParentGroup.RootPart.AttachmentPoint != 0) | 3590 | if (targetPart.ParentGroup.AttachmentPoint != 0) |
3591 | return; // Fail silently if attached | 3591 | return; // Fail silently if attached |
3592 | SceneObjectGroup parentPrim = null, childPrim = null; | 3592 | SceneObjectGroup parentPrim = null, childPrim = null; |
3593 | 3593 | ||
@@ -3640,7 +3640,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3640 | 3640 | ||
3641 | SceneObjectGroup parentPrim = m_host.ParentGroup; | 3641 | SceneObjectGroup parentPrim = m_host.ParentGroup; |
3642 | 3642 | ||
3643 | if (parentPrim.RootPart.AttachmentPoint != 0) | 3643 | if (parentPrim.AttachmentPoint != 0) |
3644 | return; // Fail silently if attached | 3644 | return; // Fail silently if attached |
3645 | SceneObjectPart childPrim = null; | 3645 | SceneObjectPart childPrim = null; |
3646 | 3646 | ||
@@ -3710,7 +3710,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3710 | { | 3710 | { |
3711 | m_host.AddScriptLPS(1); | 3711 | m_host.AddScriptLPS(1); |
3712 | SceneObjectGroup parentPrim = m_host.ParentGroup; | 3712 | SceneObjectGroup parentPrim = m_host.ParentGroup; |
3713 | if (parentPrim.RootPart.AttachmentPoint != 0) | 3713 | if (parentPrim.AttachmentPoint != 0) |
3714 | return; // Fail silently if attached | 3714 | return; // Fail silently if attached |
3715 | 3715 | ||
3716 | List<SceneObjectPart> parts = new List<SceneObjectPart>(parentPrim.Parts); | 3716 | List<SceneObjectPart> parts = new List<SceneObjectPart>(parentPrim.Parts); |
@@ -4349,7 +4349,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4349 | return; | 4349 | return; |
4350 | 4350 | ||
4351 | // Object not pushable. Not an attachment and has no physics component | 4351 | // Object not pushable. Not an attachment and has no physics component |
4352 | if (!pusheeob.IsAttachment && pusheeob.PhysActor == null) | 4352 | if (!pusheeob.ParentGroup.IsAttachment && pusheeob.PhysActor == null) |
4353 | return; | 4353 | return; |
4354 | 4354 | ||
4355 | PusheePos = pusheeob.AbsolutePosition; | 4355 | PusheePos = pusheeob.AbsolutePosition; |
@@ -5857,7 +5857,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5857 | public LSL_Integer llGetAttached() | 5857 | public LSL_Integer llGetAttached() |
5858 | { | 5858 | { |
5859 | m_host.AddScriptLPS(1); | 5859 | m_host.AddScriptLPS(1); |
5860 | return m_host.ParentGroup.RootPart.AttachmentPoint; | 5860 | return m_host.ParentGroup.AttachmentPoint; |
5861 | } | 5861 | } |
5862 | 5862 | ||
5863 | public LSL_Integer llGetFreeMemory() | 5863 | public LSL_Integer llGetFreeMemory() |
@@ -7458,7 +7458,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7458 | { | 7458 | { |
7459 | m_host.AddScriptLPS(1); | 7459 | m_host.AddScriptLPS(1); |
7460 | Quaternion q; | 7460 | Quaternion q; |
7461 | if (m_host.ParentGroup.RootPart.AttachmentPoint != 0) | 7461 | if (m_host.ParentGroup.AttachmentPoint != 0) |
7462 | { | 7462 | { |
7463 | ScenePresence avatar = World.GetScenePresence(m_host.ParentGroup.AttachedAvatar); | 7463 | ScenePresence avatar = World.GetScenePresence(m_host.ParentGroup.AttachedAvatar); |
7464 | if (avatar != null) | 7464 | if (avatar != null) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index bf74760..4ac7f8b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs | |||
@@ -303,7 +303,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
303 | float dz; | 303 | float dz; |
304 | 304 | ||
305 | Quaternion q = SensePoint.RotationOffset; | 305 | Quaternion q = SensePoint.RotationOffset; |
306 | if (SensePoint.ParentGroup.RootPart.IsAttachment) | 306 | if (SensePoint.ParentGroup.IsAttachment) |
307 | { | 307 | { |
308 | // In attachments, the sensor cone always orients with the | 308 | // In attachments, the sensor cone always orients with the |
309 | // avatar rotation. This may include a nonzero elevation if | 309 | // avatar rotation. This may include a nonzero elevation if |
@@ -352,7 +352,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
352 | objtype = 0; | 352 | objtype = 0; |
353 | 353 | ||
354 | part = ((SceneObjectGroup)ent).RootPart; | 354 | part = ((SceneObjectGroup)ent).RootPart; |
355 | if (part.AttachmentPoint != 0) // Attached so ignore | 355 | if (part.ParentGroup.AttachmentPoint != 0) // Attached so ignore |
356 | continue; | 356 | continue; |
357 | 357 | ||
358 | if (part.Inventory.ContainsScripts()) | 358 | if (part.Inventory.ContainsScripts()) |
@@ -423,7 +423,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
423 | Vector3 fromRegionPos = SensePoint.AbsolutePosition; | 423 | Vector3 fromRegionPos = SensePoint.AbsolutePosition; |
424 | 424 | ||
425 | Quaternion q = SensePoint.RotationOffset; | 425 | Quaternion q = SensePoint.RotationOffset; |
426 | if (SensePoint.ParentGroup.RootPart.IsAttachment) | 426 | if (SensePoint.ParentGroup.IsAttachment) |
427 | { | 427 | { |
428 | // In attachments, the sensor cone always orients with the | 428 | // In attachments, the sensor cone always orients with the |
429 | // avatar rotation. This may include a nonzero elevation if | 429 | // avatar rotation. This may include a nonzero elevation if |
@@ -435,7 +435,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
435 | LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); | 435 | LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); |
436 | LSL_Types.Vector3 forward_dir = (new LSL_Types.Vector3(1, 0, 0) * r); | 436 | LSL_Types.Vector3 forward_dir = (new LSL_Types.Vector3(1, 0, 0) * r); |
437 | double mag_fwd = LSL_Types.Vector3.Mag(forward_dir); | 437 | double mag_fwd = LSL_Types.Vector3.Mag(forward_dir); |
438 | bool attached = (SensePoint.AttachmentPoint != 0); | 438 | bool attached = (SensePoint.ParentGroup.AttachmentPoint != 0); |
439 | Vector3 toRegionPos; | 439 | Vector3 toRegionPos; |
440 | double dis; | 440 | double dis; |
441 | 441 | ||