diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 90 |
1 files changed, 54 insertions, 36 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 22a8ca1..eda3d60 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -215,6 +215,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
215 | private Quaternion m_sitTargetOrientation = Quaternion.Identity; | 215 | private Quaternion m_sitTargetOrientation = Quaternion.Identity; |
216 | private Vector3 m_sitTargetPosition; | 216 | private Vector3 m_sitTargetPosition; |
217 | private string m_sitAnimation = "SIT"; | 217 | private string m_sitAnimation = "SIT"; |
218 | private bool m_occupied; // KF if any av is sitting on this prim | ||
218 | private string m_text = String.Empty; | 219 | private string m_text = String.Empty; |
219 | private string m_touchName = String.Empty; | 220 | private string m_touchName = String.Empty; |
220 | private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5); | 221 | private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5); |
@@ -392,12 +393,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
392 | } | 393 | } |
393 | 394 | ||
394 | /// <value> | 395 | /// <value> |
395 | /// Access should be via Inventory directly - this property temporarily remains for xml serialization purposes | 396 | /// Get the inventory list |
396 | /// </value> | 397 | /// </value> |
397 | public TaskInventoryDictionary TaskInventory | 398 | public TaskInventoryDictionary TaskInventory |
398 | { | 399 | { |
399 | get { return m_inventory.Items; } | 400 | get { |
400 | set { m_inventory.Items = value; } | 401 | return m_inventory.Items; |
402 | } | ||
403 | set { | ||
404 | m_inventory.Items = value; | ||
405 | } | ||
401 | } | 406 | } |
402 | 407 | ||
403 | public uint ObjectFlags | 408 | public uint ObjectFlags |
@@ -541,7 +546,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
541 | StoreUndoState(); | 546 | StoreUndoState(); |
542 | 547 | ||
543 | m_groupPosition = value; | 548 | m_groupPosition = value; |
544 | |||
545 | PhysicsActor actor = PhysActor; | 549 | PhysicsActor actor = PhysActor; |
546 | if (actor != null) | 550 | if (actor != null) |
547 | { | 551 | { |
@@ -851,7 +855,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
851 | if (IsAttachment) | 855 | if (IsAttachment) |
852 | return GroupPosition; | 856 | return GroupPosition; |
853 | 857 | ||
854 | return m_offsetPosition + m_groupPosition; } | 858 | // return m_offsetPosition + m_groupPosition; } |
859 | return m_groupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset) ; } //KF: Rotation was ignored! | ||
855 | } | 860 | } |
856 | 861 | ||
857 | public SceneObjectGroup ParentGroup | 862 | public SceneObjectGroup ParentGroup |
@@ -1003,6 +1008,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1003 | get { return _flags; } | 1008 | get { return _flags; } |
1004 | set { _flags = value; } | 1009 | set { _flags = value; } |
1005 | } | 1010 | } |
1011 | |||
1012 | [XmlIgnore] | ||
1013 | public bool IsOccupied // KF If an av is sittingon this prim | ||
1014 | { | ||
1015 | get { return m_occupied; } | ||
1016 | set { m_occupied = value; } | ||
1017 | } | ||
1006 | 1018 | ||
1007 | [XmlIgnore] | 1019 | [XmlIgnore] |
1008 | public UUID SitTargetAvatar | 1020 | public UUID SitTargetAvatar |
@@ -1078,14 +1090,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1078 | } | 1090 | } |
1079 | } | 1091 | } |
1080 | 1092 | ||
1081 | /// <summary> | ||
1082 | /// Clear all pending updates of parts to clients | ||
1083 | /// </summary> | ||
1084 | private void ClearUpdateSchedule() | ||
1085 | { | ||
1086 | m_updateFlag = 0; | ||
1087 | } | ||
1088 | |||
1089 | private void SendObjectPropertiesToClient(UUID AgentID) | 1093 | private void SendObjectPropertiesToClient(UUID AgentID) |
1090 | { | 1094 | { |
1091 | ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); | 1095 | ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); |
@@ -1751,12 +1755,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
1751 | public Vector3 GetWorldPosition() | 1755 | public Vector3 GetWorldPosition() |
1752 | { | 1756 | { |
1753 | Quaternion parentRot = ParentGroup.RootPart.RotationOffset; | 1757 | Quaternion parentRot = ParentGroup.RootPart.RotationOffset; |
1754 | |||
1755 | Vector3 axPos = OffsetPosition; | 1758 | Vector3 axPos = OffsetPosition; |
1756 | |||
1757 | axPos *= parentRot; | 1759 | axPos *= parentRot; |
1758 | Vector3 translationOffsetPosition = axPos; | 1760 | Vector3 translationOffsetPosition = axPos; |
1759 | return GroupPosition + translationOffsetPosition; | 1761 | if(_parentID == 0) |
1762 | { | ||
1763 | return GroupPosition; | ||
1764 | } | ||
1765 | else | ||
1766 | { | ||
1767 | return ParentGroup.AbsolutePosition + translationOffsetPosition; //KF: Fix child prim position | ||
1768 | } | ||
1760 | } | 1769 | } |
1761 | 1770 | ||
1762 | /// <summary> | 1771 | /// <summary> |
@@ -1767,7 +1776,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1767 | { | 1776 | { |
1768 | Quaternion newRot; | 1777 | Quaternion newRot; |
1769 | 1778 | ||
1770 | if (this.LinkNum == 0) | 1779 | if (this.LinkNum < 2) //KF Single or root prim |
1771 | { | 1780 | { |
1772 | newRot = RotationOffset; | 1781 | newRot = RotationOffset; |
1773 | } | 1782 | } |
@@ -2312,17 +2321,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2312 | //Trys to fetch sound id from prim's inventory. | 2321 | //Trys to fetch sound id from prim's inventory. |
2313 | //Prim's inventory doesn't support non script items yet | 2322 | //Prim's inventory doesn't support non script items yet |
2314 | 2323 | ||
2315 | lock (TaskInventory) | 2324 | TaskInventory.LockItemsForRead(true); |
2325 | |||
2326 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | ||
2316 | { | 2327 | { |
2317 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | 2328 | if (item.Value.Name == sound) |
2318 | { | 2329 | { |
2319 | if (item.Value.Name == sound) | 2330 | soundID = item.Value.ItemID; |
2320 | { | 2331 | break; |
2321 | soundID = item.Value.ItemID; | ||
2322 | break; | ||
2323 | } | ||
2324 | } | 2332 | } |
2325 | } | 2333 | } |
2334 | |||
2335 | TaskInventory.LockItemsForRead(false); | ||
2326 | } | 2336 | } |
2327 | 2337 | ||
2328 | List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); | 2338 | List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); |
@@ -2597,8 +2607,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2597 | { | 2607 | { |
2598 | const float ROTATION_TOLERANCE = 0.01f; | 2608 | const float ROTATION_TOLERANCE = 0.01f; |
2599 | const float VELOCITY_TOLERANCE = 0.001f; | 2609 | const float VELOCITY_TOLERANCE = 0.001f; |
2600 | const float POSITION_TOLERANCE = 0.05f; | 2610 | const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary |
2601 | const int TIME_MS_TOLERANCE = 3000; | 2611 | const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds. |
2602 | 2612 | ||
2603 | if (m_updateFlag == 1) | 2613 | if (m_updateFlag == 1) |
2604 | { | 2614 | { |
@@ -2612,7 +2622,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2612 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) | 2622 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) |
2613 | { | 2623 | { |
2614 | AddTerseUpdateToAllAvatars(); | 2624 | AddTerseUpdateToAllAvatars(); |
2615 | ClearUpdateSchedule(); | 2625 | |
2616 | 2626 | ||
2617 | // This causes the Scene to 'poll' physical objects every couple of frames | 2627 | // This causes the Scene to 'poll' physical objects every couple of frames |
2618 | // bad, so it's been replaced by an event driven method. | 2628 | // bad, so it's been replaced by an event driven method. |
@@ -2630,16 +2640,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2630 | m_lastAngularVelocity = AngularVelocity; | 2640 | m_lastAngularVelocity = AngularVelocity; |
2631 | m_lastTerseSent = Environment.TickCount; | 2641 | m_lastTerseSent = Environment.TickCount; |
2632 | } | 2642 | } |
2643 | //Moved this outside of the if clause so updates don't get blocked.. *sigh* | ||
2644 | m_updateFlag = 0; //Why were we calling a function to do this? Inefficient! *screams* | ||
2633 | } | 2645 | } |
2634 | else | 2646 | else |
2635 | { | 2647 | { |
2636 | if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes | 2648 | if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes |
2637 | { | 2649 | { |
2638 | AddFullUpdateToAllAvatars(); | 2650 | AddFullUpdateToAllAvatars(); |
2639 | ClearUpdateSchedule(); | 2651 | m_updateFlag = 0; //Same here |
2640 | } | 2652 | } |
2641 | } | 2653 | } |
2642 | ClearUpdateSchedule(); | 2654 | m_updateFlag = 0; |
2643 | } | 2655 | } |
2644 | 2656 | ||
2645 | /// <summary> | 2657 | /// <summary> |
@@ -2666,17 +2678,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2666 | if (!UUID.TryParse(sound, out soundID)) | 2678 | if (!UUID.TryParse(sound, out soundID)) |
2667 | { | 2679 | { |
2668 | // search sound file from inventory | 2680 | // search sound file from inventory |
2669 | lock (TaskInventory) | 2681 | TaskInventory.LockItemsForRead(true); |
2682 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | ||
2670 | { | 2683 | { |
2671 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | 2684 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) |
2672 | { | 2685 | { |
2673 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) | 2686 | soundID = item.Value.ItemID; |
2674 | { | 2687 | break; |
2675 | soundID = item.Value.ItemID; | ||
2676 | break; | ||
2677 | } | ||
2678 | } | 2688 | } |
2679 | } | 2689 | } |
2690 | TaskInventory.LockItemsForRead(false); | ||
2680 | } | 2691 | } |
2681 | 2692 | ||
2682 | if (soundID == UUID.Zero) | 2693 | if (soundID == UUID.Zero) |
@@ -2899,6 +2910,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2899 | SetText(text); | 2910 | SetText(text); |
2900 | } | 2911 | } |
2901 | 2912 | ||
2913 | public void StopLookAt() | ||
2914 | { | ||
2915 | m_parentGroup.stopLookAt(); | ||
2916 | |||
2917 | m_parentGroup.ScheduleGroupForTerseUpdate(); | ||
2918 | } | ||
2919 | |||
2902 | public void StopMoveToTarget() | 2920 | public void StopMoveToTarget() |
2903 | { | 2921 | { |
2904 | m_parentGroup.stopMoveToTarget(); | 2922 | m_parentGroup.stopMoveToTarget(); |