diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 83 |
1 files changed, 47 insertions, 36 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 56b2f13..a7c14cf 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -224,6 +224,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
224 | private Quaternion m_sitTargetOrientation = Quaternion.Identity; | 224 | private Quaternion m_sitTargetOrientation = Quaternion.Identity; |
225 | private Vector3 m_sitTargetPosition; | 225 | private Vector3 m_sitTargetPosition; |
226 | private string m_sitAnimation = "SIT"; | 226 | private string m_sitAnimation = "SIT"; |
227 | private bool m_occupied; // KF if any av is sitting on this prim | ||
227 | private string m_text = String.Empty; | 228 | private string m_text = String.Empty; |
228 | private string m_touchName = String.Empty; | 229 | private string m_touchName = String.Empty; |
229 | private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5); | 230 | private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5); |
@@ -401,12 +402,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
401 | } | 402 | } |
402 | 403 | ||
403 | /// <value> | 404 | /// <value> |
404 | /// Access should be via Inventory directly - this property temporarily remains for xml serialization purposes | 405 | /// Get the inventory list |
405 | /// </value> | 406 | /// </value> |
406 | public TaskInventoryDictionary TaskInventory | 407 | public TaskInventoryDictionary TaskInventory |
407 | { | 408 | { |
408 | get { return m_inventory.Items; } | 409 | get { |
409 | set { m_inventory.Items = value; } | 410 | return m_inventory.Items; |
411 | } | ||
412 | set { | ||
413 | m_inventory.Items = value; | ||
414 | } | ||
410 | } | 415 | } |
411 | 416 | ||
412 | public uint ObjectFlags | 417 | public uint ObjectFlags |
@@ -550,7 +555,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
550 | StoreUndoState(); | 555 | StoreUndoState(); |
551 | 556 | ||
552 | m_groupPosition = value; | 557 | m_groupPosition = value; |
553 | |||
554 | PhysicsActor actor = PhysActor; | 558 | PhysicsActor actor = PhysActor; |
555 | if (actor != null) | 559 | if (actor != null) |
556 | { | 560 | { |
@@ -860,7 +864,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
860 | if (IsAttachment) | 864 | if (IsAttachment) |
861 | return GroupPosition; | 865 | return GroupPosition; |
862 | 866 | ||
863 | return m_offsetPosition + m_groupPosition; } | 867 | // return m_offsetPosition + m_groupPosition; } |
868 | return m_groupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset) ; } //KF: Rotation was ignored! | ||
864 | } | 869 | } |
865 | 870 | ||
866 | public SceneObjectGroup ParentGroup | 871 | public SceneObjectGroup ParentGroup |
@@ -1012,6 +1017,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1012 | get { return _flags; } | 1017 | get { return _flags; } |
1013 | set { _flags = value; } | 1018 | set { _flags = value; } |
1014 | } | 1019 | } |
1020 | |||
1021 | [XmlIgnore] | ||
1022 | public bool IsOccupied // KF If an av is sittingon this prim | ||
1023 | { | ||
1024 | get { return m_occupied; } | ||
1025 | set { m_occupied = value; } | ||
1026 | } | ||
1015 | 1027 | ||
1016 | [XmlIgnore] | 1028 | [XmlIgnore] |
1017 | public UUID SitTargetAvatar | 1029 | public UUID SitTargetAvatar |
@@ -1087,14 +1099,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1087 | } | 1099 | } |
1088 | } | 1100 | } |
1089 | 1101 | ||
1090 | /// <summary> | ||
1091 | /// Clear all pending updates of parts to clients | ||
1092 | /// </summary> | ||
1093 | private void ClearUpdateSchedule() | ||
1094 | { | ||
1095 | m_updateFlag = 0; | ||
1096 | } | ||
1097 | |||
1098 | private void SendObjectPropertiesToClient(UUID AgentID) | 1102 | private void SendObjectPropertiesToClient(UUID AgentID) |
1099 | { | 1103 | { |
1100 | ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); | 1104 | ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); |
@@ -1773,12 +1777,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
1773 | public Vector3 GetWorldPosition() | 1777 | public Vector3 GetWorldPosition() |
1774 | { | 1778 | { |
1775 | Quaternion parentRot = ParentGroup.RootPart.RotationOffset; | 1779 | Quaternion parentRot = ParentGroup.RootPart.RotationOffset; |
1776 | |||
1777 | Vector3 axPos = OffsetPosition; | 1780 | Vector3 axPos = OffsetPosition; |
1778 | |||
1779 | axPos *= parentRot; | 1781 | axPos *= parentRot; |
1780 | Vector3 translationOffsetPosition = axPos; | 1782 | Vector3 translationOffsetPosition = axPos; |
1781 | return GroupPosition + translationOffsetPosition; | 1783 | if(_parentID == 0) |
1784 | { | ||
1785 | return GroupPosition; | ||
1786 | } | ||
1787 | else | ||
1788 | { | ||
1789 | return ParentGroup.AbsolutePosition + translationOffsetPosition; //KF: Fix child prim position | ||
1790 | } | ||
1782 | } | 1791 | } |
1783 | 1792 | ||
1784 | /// <summary> | 1793 | /// <summary> |
@@ -1789,7 +1798,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1789 | { | 1798 | { |
1790 | Quaternion newRot; | 1799 | Quaternion newRot; |
1791 | 1800 | ||
1792 | if (this.LinkNum == 0) | 1801 | if (this.LinkNum < 2) //KF Single or root prim |
1793 | { | 1802 | { |
1794 | newRot = RotationOffset; | 1803 | newRot = RotationOffset; |
1795 | } | 1804 | } |
@@ -2446,17 +2455,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2446 | //Trys to fetch sound id from prim's inventory. | 2455 | //Trys to fetch sound id from prim's inventory. |
2447 | //Prim's inventory doesn't support non script items yet | 2456 | //Prim's inventory doesn't support non script items yet |
2448 | 2457 | ||
2449 | lock (TaskInventory) | 2458 | TaskInventory.LockItemsForRead(true); |
2459 | |||
2460 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | ||
2450 | { | 2461 | { |
2451 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | 2462 | if (item.Value.Name == sound) |
2452 | { | 2463 | { |
2453 | if (item.Value.Name == sound) | 2464 | soundID = item.Value.ItemID; |
2454 | { | 2465 | break; |
2455 | soundID = item.Value.ItemID; | ||
2456 | break; | ||
2457 | } | ||
2458 | } | 2466 | } |
2459 | } | 2467 | } |
2468 | |||
2469 | TaskInventory.LockItemsForRead(false); | ||
2460 | } | 2470 | } |
2461 | 2471 | ||
2462 | List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); | 2472 | List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); |
@@ -2731,8 +2741,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2731 | { | 2741 | { |
2732 | const float ROTATION_TOLERANCE = 0.01f; | 2742 | const float ROTATION_TOLERANCE = 0.01f; |
2733 | const float VELOCITY_TOLERANCE = 0.001f; | 2743 | const float VELOCITY_TOLERANCE = 0.001f; |
2734 | const float POSITION_TOLERANCE = 0.05f; | 2744 | const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary |
2735 | const int TIME_MS_TOLERANCE = 3000; | 2745 | const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds. |
2736 | 2746 | ||
2737 | if (m_updateFlag == 1) | 2747 | if (m_updateFlag == 1) |
2738 | { | 2748 | { |
@@ -2746,7 +2756,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2746 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) | 2756 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) |
2747 | { | 2757 | { |
2748 | AddTerseUpdateToAllAvatars(); | 2758 | AddTerseUpdateToAllAvatars(); |
2749 | ClearUpdateSchedule(); | 2759 | |
2750 | 2760 | ||
2751 | // This causes the Scene to 'poll' physical objects every couple of frames | 2761 | // This causes the Scene to 'poll' physical objects every couple of frames |
2752 | // bad, so it's been replaced by an event driven method. | 2762 | // bad, so it's been replaced by an event driven method. |
@@ -2764,16 +2774,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2764 | m_lastAngularVelocity = AngularVelocity; | 2774 | m_lastAngularVelocity = AngularVelocity; |
2765 | m_lastTerseSent = Environment.TickCount; | 2775 | m_lastTerseSent = Environment.TickCount; |
2766 | } | 2776 | } |
2777 | //Moved this outside of the if clause so updates don't get blocked.. *sigh* | ||
2778 | m_updateFlag = 0; //Why were we calling a function to do this? Inefficient! *screams* | ||
2767 | } | 2779 | } |
2768 | else | 2780 | else |
2769 | { | 2781 | { |
2770 | if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes | 2782 | if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes |
2771 | { | 2783 | { |
2772 | AddFullUpdateToAllAvatars(); | 2784 | AddFullUpdateToAllAvatars(); |
2773 | ClearUpdateSchedule(); | 2785 | m_updateFlag = 0; //Same here |
2774 | } | 2786 | } |
2775 | } | 2787 | } |
2776 | ClearUpdateSchedule(); | 2788 | m_updateFlag = 0; |
2777 | } | 2789 | } |
2778 | 2790 | ||
2779 | /// <summary> | 2791 | /// <summary> |
@@ -2800,17 +2812,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2800 | if (!UUID.TryParse(sound, out soundID)) | 2812 | if (!UUID.TryParse(sound, out soundID)) |
2801 | { | 2813 | { |
2802 | // search sound file from inventory | 2814 | // search sound file from inventory |
2803 | lock (TaskInventory) | 2815 | TaskInventory.LockItemsForRead(true); |
2816 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | ||
2804 | { | 2817 | { |
2805 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | 2818 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) |
2806 | { | 2819 | { |
2807 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) | 2820 | soundID = item.Value.ItemID; |
2808 | { | 2821 | break; |
2809 | soundID = item.Value.ItemID; | ||
2810 | break; | ||
2811 | } | ||
2812 | } | 2822 | } |
2813 | } | 2823 | } |
2824 | TaskInventory.LockItemsForRead(false); | ||
2814 | } | 2825 | } |
2815 | 2826 | ||
2816 | if (soundID == UUID.Zero) | 2827 | if (soundID == UUID.Zero) |