diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 133 |
1 files changed, 60 insertions, 73 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 46eadee..4b2641c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -147,7 +147,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
147 | 147 | ||
148 | // TODO: This needs to be persisted in next XML version update! | 148 | // TODO: This needs to be persisted in next XML version update! |
149 | [XmlIgnore] | 149 | [XmlIgnore] |
150 | public readonly int[] PayPrice = {-2,-2,-2,-2,-2}; | 150 | public int[] PayPrice = {-2,-2,-2,-2,-2}; |
151 | [XmlIgnore] | 151 | [XmlIgnore] |
152 | public PhysicsActor PhysActor; | 152 | public PhysicsActor PhysActor; |
153 | 153 | ||
@@ -274,6 +274,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
274 | private Quaternion m_sitTargetOrientation = Quaternion.Identity; | 274 | private Quaternion m_sitTargetOrientation = Quaternion.Identity; |
275 | private Vector3 m_sitTargetPosition; | 275 | private Vector3 m_sitTargetPosition; |
276 | private string m_sitAnimation = "SIT"; | 276 | private string m_sitAnimation = "SIT"; |
277 | private bool m_occupied; // KF if any av is sitting on this prim | ||
277 | private string m_text = String.Empty; | 278 | private string m_text = String.Empty; |
278 | private string m_touchName = String.Empty; | 279 | private string m_touchName = String.Empty; |
279 | private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5); | 280 | private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5); |
@@ -452,12 +453,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
452 | } | 453 | } |
453 | 454 | ||
454 | /// <value> | 455 | /// <value> |
455 | /// Access should be via Inventory directly - this property temporarily remains for xml serialization purposes | 456 | /// Get the inventory list |
456 | /// </value> | 457 | /// </value> |
457 | public TaskInventoryDictionary TaskInventory | 458 | public TaskInventoryDictionary TaskInventory |
458 | { | 459 | { |
459 | get { return m_inventory.Items; } | 460 | get { |
460 | set { m_inventory.Items = value; } | 461 | return m_inventory.Items; |
462 | } | ||
463 | set { | ||
464 | m_inventory.Items = value; | ||
465 | } | ||
461 | } | 466 | } |
462 | 467 | ||
463 | public uint ObjectFlags | 468 | public uint ObjectFlags |
@@ -586,14 +591,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
586 | set { m_LoopSoundSlavePrims = value; } | 591 | set { m_LoopSoundSlavePrims = value; } |
587 | } | 592 | } |
588 | 593 | ||
589 | [XmlIgnore] | ||
590 | public Byte[] TextureAnimation | 594 | public Byte[] TextureAnimation |
591 | { | 595 | { |
592 | get { return m_TextureAnimation; } | 596 | get { return m_TextureAnimation; } |
593 | set { m_TextureAnimation = value; } | 597 | set { m_TextureAnimation = value; } |
594 | } | 598 | } |
595 | 599 | ||
596 | [XmlIgnore] | ||
597 | public Byte[] ParticleSystem | 600 | public Byte[] ParticleSystem |
598 | { | 601 | { |
599 | get { return m_particleSystem; } | 602 | get { return m_particleSystem; } |
@@ -647,7 +650,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
647 | set | 650 | set |
648 | { | 651 | { |
649 | m_groupPosition = value; | 652 | m_groupPosition = value; |
650 | |||
651 | PhysicsActor actor = PhysActor; | 653 | PhysicsActor actor = PhysActor; |
652 | if (actor != null) | 654 | if (actor != null) |
653 | { | 655 | { |
@@ -816,7 +818,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
816 | /// <summary></summary> | 818 | /// <summary></summary> |
817 | public Vector3 Acceleration | 819 | public Vector3 Acceleration |
818 | { | 820 | { |
819 | get { return m_acceleration; } | 821 | get |
822 | { | ||
823 | PhysicsActor actor = PhysActor; | ||
824 | if (actor != null) | ||
825 | { | ||
826 | m_acceleration = actor.Acceleration; | ||
827 | } | ||
828 | return m_acceleration; | ||
829 | } | ||
830 | |||
820 | set { m_acceleration = value; } | 831 | set { m_acceleration = value; } |
821 | } | 832 | } |
822 | 833 | ||
@@ -960,7 +971,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
960 | if (IsAttachment) | 971 | if (IsAttachment) |
961 | return GroupPosition; | 972 | return GroupPosition; |
962 | 973 | ||
963 | return m_offsetPosition + m_groupPosition; } | 974 | // return m_offsetPosition + m_groupPosition; } |
975 | return m_groupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset) ; } //KF: Rotation was ignored! | ||
964 | } | 976 | } |
965 | 977 | ||
966 | public SceneObjectGroup ParentGroup | 978 | public SceneObjectGroup ParentGroup |
@@ -1112,6 +1124,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1112 | get { return _flags; } | 1124 | get { return _flags; } |
1113 | set { _flags = value; } | 1125 | set { _flags = value; } |
1114 | } | 1126 | } |
1127 | |||
1128 | [XmlIgnore] | ||
1129 | public bool IsOccupied // KF If an av is sittingon this prim | ||
1130 | { | ||
1131 | get { return m_occupied; } | ||
1132 | set { m_occupied = value; } | ||
1133 | } | ||
1115 | 1134 | ||
1116 | [XmlIgnore] | 1135 | [XmlIgnore] |
1117 | public UUID SitTargetAvatar | 1136 | public UUID SitTargetAvatar |
@@ -1187,14 +1206,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1187 | } | 1206 | } |
1188 | } | 1207 | } |
1189 | 1208 | ||
1190 | /// <summary> | ||
1191 | /// Clear all pending updates of parts to clients | ||
1192 | /// </summary> | ||
1193 | private void ClearUpdateSchedule() | ||
1194 | { | ||
1195 | m_updateFlag = 0; | ||
1196 | } | ||
1197 | |||
1198 | private void SendObjectPropertiesToClient(UUID AgentID) | 1209 | private void SendObjectPropertiesToClient(UUID AgentID) |
1199 | { | 1210 | { |
1200 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) | 1211 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) |
@@ -1934,12 +1945,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
1934 | public Vector3 GetWorldPosition() | 1945 | public Vector3 GetWorldPosition() |
1935 | { | 1946 | { |
1936 | Quaternion parentRot = ParentGroup.RootPart.RotationOffset; | 1947 | Quaternion parentRot = ParentGroup.RootPart.RotationOffset; |
1937 | |||
1938 | Vector3 axPos = OffsetPosition; | 1948 | Vector3 axPos = OffsetPosition; |
1939 | |||
1940 | axPos *= parentRot; | 1949 | axPos *= parentRot; |
1941 | Vector3 translationOffsetPosition = axPos; | 1950 | Vector3 translationOffsetPosition = axPos; |
1942 | return GroupPosition + translationOffsetPosition; | 1951 | if(_parentID == 0) |
1952 | { | ||
1953 | return GroupPosition; | ||
1954 | } | ||
1955 | else | ||
1956 | { | ||
1957 | return ParentGroup.AbsolutePosition + translationOffsetPosition; //KF: Fix child prim position | ||
1958 | } | ||
1943 | } | 1959 | } |
1944 | 1960 | ||
1945 | /// <summary> | 1961 | /// <summary> |
@@ -1950,7 +1966,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1950 | { | 1966 | { |
1951 | Quaternion newRot; | 1967 | Quaternion newRot; |
1952 | 1968 | ||
1953 | if (this.LinkNum == 0) | 1969 | if (this.LinkNum < 2) //KF Single or root prim |
1954 | { | 1970 | { |
1955 | newRot = RotationOffset; | 1971 | newRot = RotationOffset; |
1956 | } | 1972 | } |
@@ -2596,17 +2612,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2596 | //Trys to fetch sound id from prim's inventory. | 2612 | //Trys to fetch sound id from prim's inventory. |
2597 | //Prim's inventory doesn't support non script items yet | 2613 | //Prim's inventory doesn't support non script items yet |
2598 | 2614 | ||
2599 | lock (TaskInventory) | 2615 | TaskInventory.LockItemsForRead(true); |
2616 | |||
2617 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | ||
2600 | { | 2618 | { |
2601 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | 2619 | if (item.Value.Name == sound) |
2602 | { | 2620 | { |
2603 | if (item.Value.Name == sound) | 2621 | soundID = item.Value.ItemID; |
2604 | { | 2622 | break; |
2605 | soundID = item.Value.ItemID; | ||
2606 | break; | ||
2607 | } | ||
2608 | } | 2623 | } |
2609 | } | 2624 | } |
2625 | |||
2626 | TaskInventory.LockItemsForRead(false); | ||
2610 | } | 2627 | } |
2611 | 2628 | ||
2612 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) | 2629 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) |
@@ -2675,38 +2692,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2675 | 2692 | ||
2676 | public void RotLookAt(Quaternion target, float strength, float damping) | 2693 | public void RotLookAt(Quaternion target, float strength, float damping) |
2677 | { | 2694 | { |
2678 | rotLookAt(target, strength, damping); | 2695 | m_parentGroup.rotLookAt(target, strength, damping); // This calls method in SceneObjectGroup. |
2679 | } | ||
2680 | |||
2681 | public void rotLookAt(Quaternion target, float strength, float damping) | ||
2682 | { | ||
2683 | if (IsAttachment) | ||
2684 | { | ||
2685 | /* | ||
2686 | ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar); | ||
2687 | if (avatar != null) | ||
2688 | { | ||
2689 | Rotate the Av? | ||
2690 | } */ | ||
2691 | } | ||
2692 | else | ||
2693 | { | ||
2694 | APIDDamp = damping; | ||
2695 | APIDStrength = strength; | ||
2696 | APIDTarget = target; | ||
2697 | } | ||
2698 | } | ||
2699 | |||
2700 | public void startLookAt(Quaternion rot, float damp, float strength) | ||
2701 | { | ||
2702 | APIDDamp = damp; | ||
2703 | APIDStrength = strength; | ||
2704 | APIDTarget = rot; | ||
2705 | } | ||
2706 | |||
2707 | public void stopLookAt() | ||
2708 | { | ||
2709 | APIDTarget = Quaternion.Identity; | ||
2710 | } | 2696 | } |
2711 | 2697 | ||
2712 | /// <summary> | 2698 | /// <summary> |
@@ -2939,8 +2925,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2939 | { | 2925 | { |
2940 | const float ROTATION_TOLERANCE = 0.01f; | 2926 | const float ROTATION_TOLERANCE = 0.01f; |
2941 | const float VELOCITY_TOLERANCE = 0.001f; | 2927 | const float VELOCITY_TOLERANCE = 0.001f; |
2942 | const float POSITION_TOLERANCE = 0.05f; | 2928 | const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary |
2943 | const int TIME_MS_TOLERANCE = 3000; | 2929 | const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds. |
2944 | 2930 | ||
2945 | if (m_updateFlag == 1) | 2931 | if (m_updateFlag == 1) |
2946 | { | 2932 | { |
@@ -2954,7 +2940,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2954 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) | 2940 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) |
2955 | { | 2941 | { |
2956 | AddTerseUpdateToAllAvatars(); | 2942 | AddTerseUpdateToAllAvatars(); |
2957 | ClearUpdateSchedule(); | 2943 | |
2958 | 2944 | ||
2959 | // This causes the Scene to 'poll' physical objects every couple of frames | 2945 | // This causes the Scene to 'poll' physical objects every couple of frames |
2960 | // bad, so it's been replaced by an event driven method. | 2946 | // bad, so it's been replaced by an event driven method. |
@@ -2972,16 +2958,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2972 | m_lastAngularVelocity = AngularVelocity; | 2958 | m_lastAngularVelocity = AngularVelocity; |
2973 | m_lastTerseSent = Environment.TickCount; | 2959 | m_lastTerseSent = Environment.TickCount; |
2974 | } | 2960 | } |
2961 | //Moved this outside of the if clause so updates don't get blocked.. *sigh* | ||
2962 | m_updateFlag = 0; //Why were we calling a function to do this? Inefficient! *screams* | ||
2975 | } | 2963 | } |
2976 | else | 2964 | else |
2977 | { | 2965 | { |
2978 | if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes | 2966 | if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes |
2979 | { | 2967 | { |
2980 | AddFullUpdateToAllAvatars(); | 2968 | AddFullUpdateToAllAvatars(); |
2981 | ClearUpdateSchedule(); | 2969 | m_updateFlag = 0; //Same here |
2982 | } | 2970 | } |
2983 | } | 2971 | } |
2984 | ClearUpdateSchedule(); | 2972 | m_updateFlag = 0; |
2985 | } | 2973 | } |
2986 | 2974 | ||
2987 | /// <summary> | 2975 | /// <summary> |
@@ -3008,17 +2996,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3008 | if (!UUID.TryParse(sound, out soundID)) | 2996 | if (!UUID.TryParse(sound, out soundID)) |
3009 | { | 2997 | { |
3010 | // search sound file from inventory | 2998 | // search sound file from inventory |
3011 | lock (TaskInventory) | 2999 | TaskInventory.LockItemsForRead(true); |
3000 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | ||
3012 | { | 3001 | { |
3013 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | 3002 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) |
3014 | { | 3003 | { |
3015 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) | 3004 | soundID = item.Value.ItemID; |
3016 | { | 3005 | break; |
3017 | soundID = item.Value.ItemID; | ||
3018 | break; | ||
3019 | } | ||
3020 | } | 3006 | } |
3021 | } | 3007 | } |
3008 | TaskInventory.LockItemsForRead(false); | ||
3022 | } | 3009 | } |
3023 | 3010 | ||
3024 | if (soundID == UUID.Zero) | 3011 | if (soundID == UUID.Zero) |
@@ -3453,7 +3440,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3453 | 3440 | ||
3454 | public void StopLookAt() | 3441 | public void StopLookAt() |
3455 | { | 3442 | { |
3456 | m_parentGroup.stopLookAt(); | 3443 | m_parentGroup.stopLookAt(); // This calls method in SceneObjectGroup. |
3457 | 3444 | ||
3458 | m_parentGroup.ScheduleGroupForTerseUpdate(); | 3445 | m_parentGroup.ScheduleGroupForTerseUpdate(); |
3459 | } | 3446 | } |