aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs83
1 files changed, 47 insertions, 36 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index cadb19f..ff4abf9 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 }
@@ -2334,17 +2343,18 @@ namespace OpenSim.Region.Framework.Scenes
2334 //Trys to fetch sound id from prim's inventory. 2343 //Trys to fetch sound id from prim's inventory.
2335 //Prim's inventory doesn't support non script items yet 2344 //Prim's inventory doesn't support non script items yet
2336 2345
2337 lock (TaskInventory) 2346 TaskInventory.LockItemsForRead(true);
2347
2348 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
2338 { 2349 {
2339 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) 2350 if (item.Value.Name == sound)
2340 { 2351 {
2341 if (item.Value.Name == sound) 2352 soundID = item.Value.ItemID;
2342 { 2353 break;
2343 soundID = item.Value.ItemID;
2344 break;
2345 }
2346 } 2354 }
2347 } 2355 }
2356
2357 TaskInventory.LockItemsForRead(false);
2348 } 2358 }
2349 2359
2350 List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); 2360 List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars();
@@ -2619,8 +2629,8 @@ namespace OpenSim.Region.Framework.Scenes
2619 { 2629 {
2620 const float ROTATION_TOLERANCE = 0.01f; 2630 const float ROTATION_TOLERANCE = 0.01f;
2621 const float VELOCITY_TOLERANCE = 0.001f; 2631 const float VELOCITY_TOLERANCE = 0.001f;
2622 const float POSITION_TOLERANCE = 0.05f; 2632 const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary
2623 const int TIME_MS_TOLERANCE = 3000; 2633 const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds.
2624 2634
2625 if (m_updateFlag == 1) 2635 if (m_updateFlag == 1)
2626 { 2636 {
@@ -2634,7 +2644,7 @@ namespace OpenSim.Region.Framework.Scenes
2634 Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) 2644 Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE)
2635 { 2645 {
2636 AddTerseUpdateToAllAvatars(); 2646 AddTerseUpdateToAllAvatars();
2637 ClearUpdateSchedule(); 2647
2638 2648
2639 // This causes the Scene to 'poll' physical objects every couple of frames 2649 // This causes the Scene to 'poll' physical objects every couple of frames
2640 // bad, so it's been replaced by an event driven method. 2650 // bad, so it's been replaced by an event driven method.
@@ -2652,16 +2662,18 @@ namespace OpenSim.Region.Framework.Scenes
2652 m_lastAngularVelocity = AngularVelocity; 2662 m_lastAngularVelocity = AngularVelocity;
2653 m_lastTerseSent = Environment.TickCount; 2663 m_lastTerseSent = Environment.TickCount;
2654 } 2664 }
2665 //Moved this outside of the if clause so updates don't get blocked.. *sigh*
2666 m_updateFlag = 0; //Why were we calling a function to do this? Inefficient! *screams*
2655 } 2667 }
2656 else 2668 else
2657 { 2669 {
2658 if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes 2670 if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes
2659 { 2671 {
2660 AddFullUpdateToAllAvatars(); 2672 AddFullUpdateToAllAvatars();
2661 ClearUpdateSchedule(); 2673 m_updateFlag = 0; //Same here
2662 } 2674 }
2663 } 2675 }
2664 ClearUpdateSchedule(); 2676 m_updateFlag = 0;
2665 } 2677 }
2666 2678
2667 /// <summary> 2679 /// <summary>
@@ -2688,17 +2700,16 @@ namespace OpenSim.Region.Framework.Scenes
2688 if (!UUID.TryParse(sound, out soundID)) 2700 if (!UUID.TryParse(sound, out soundID))
2689 { 2701 {
2690 // search sound file from inventory 2702 // search sound file from inventory
2691 lock (TaskInventory) 2703 TaskInventory.LockItemsForRead(true);
2704 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
2692 { 2705 {
2693 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) 2706 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound)
2694 { 2707 {
2695 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) 2708 soundID = item.Value.ItemID;
2696 { 2709 break;
2697 soundID = item.Value.ItemID;
2698 break;
2699 }
2700 } 2710 }
2701 } 2711 }
2712 TaskInventory.LockItemsForRead(false);
2702 } 2713 }
2703 2714
2704 if (soundID == UUID.Zero) 2715 if (soundID == UUID.Zero)