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.cs97
1 files changed, 54 insertions, 43 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index c0243a5..6b562e5 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -212,6 +212,7 @@ namespace OpenSim.Region.Framework.Scenes
212 private Quaternion m_sitTargetOrientation = Quaternion.Identity; 212 private Quaternion m_sitTargetOrientation = Quaternion.Identity;
213 private Vector3 m_sitTargetPosition; 213 private Vector3 m_sitTargetPosition;
214 private string m_sitAnimation = "SIT"; 214 private string m_sitAnimation = "SIT";
215 private bool m_occupied; // KF if any av is sitting on this prim
215 private string m_text = String.Empty; 216 private string m_text = String.Empty;
216 private string m_touchName = String.Empty; 217 private string m_touchName = String.Empty;
217 private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5); 218 private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5);
@@ -389,12 +390,16 @@ namespace OpenSim.Region.Framework.Scenes
389 } 390 }
390 391
391 /// <value> 392 /// <value>
392 /// Access should be via Inventory directly - this property temporarily remains for xml serialization purposes 393 /// Get the inventory list
393 /// </value> 394 /// </value>
394 public TaskInventoryDictionary TaskInventory 395 public TaskInventoryDictionary TaskInventory
395 { 396 {
396 get { return m_inventory.Items; } 397 get {
397 set { m_inventory.Items = value; } 398 return m_inventory.Items;
399 }
400 set {
401 m_inventory.Items = value;
402 }
398 } 403 }
399 404
400 public uint ObjectFlags 405 public uint ObjectFlags
@@ -527,7 +532,6 @@ namespace OpenSim.Region.Framework.Scenes
527 StoreUndoState(); 532 StoreUndoState();
528 533
529 m_groupPosition = value; 534 m_groupPosition = value;
530
531 PhysicsActor actor = PhysActor; 535 PhysicsActor actor = PhysActor;
532 if (actor != null) 536 if (actor != null)
533 { 537 {
@@ -837,7 +841,8 @@ namespace OpenSim.Region.Framework.Scenes
837 if (IsAttachment) 841 if (IsAttachment)
838 return GroupPosition; 842 return GroupPosition;
839 843
840 return m_offsetPosition + m_groupPosition; } 844// return m_offsetPosition + m_groupPosition; }
845 return m_groupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset) ; } //KF: Rotation was ignored!
841 } 846 }
842 847
843 public SceneObjectGroup ParentGroup 848 public SceneObjectGroup ParentGroup
@@ -989,6 +994,13 @@ namespace OpenSim.Region.Framework.Scenes
989 get { return _flags; } 994 get { return _flags; }
990 set { _flags = value; } 995 set { _flags = value; }
991 } 996 }
997
998 [XmlIgnore]
999 public bool IsOccupied // KF If an av is sittingon this prim
1000 {
1001 get { return m_occupied; }
1002 set { m_occupied = value; }
1003 }
992 1004
993 [XmlIgnore] 1005 [XmlIgnore]
994 public UUID SitTargetAvatar 1006 public UUID SitTargetAvatar
@@ -1064,14 +1076,6 @@ namespace OpenSim.Region.Framework.Scenes
1064 } 1076 }
1065 } 1077 }
1066 1078
1067 /// <summary>
1068 /// Clear all pending updates of parts to clients
1069 /// </summary>
1070 private void ClearUpdateSchedule()
1071 {
1072 m_updateFlag = 0;
1073 }
1074
1075 private void SendObjectPropertiesToClient(UUID AgentID) 1079 private void SendObjectPropertiesToClient(UUID AgentID)
1076 { 1080 {
1077 ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); 1081 ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
@@ -1737,12 +1741,17 @@ namespace OpenSim.Region.Framework.Scenes
1737 public Vector3 GetWorldPosition() 1741 public Vector3 GetWorldPosition()
1738 { 1742 {
1739 Quaternion parentRot = ParentGroup.RootPart.RotationOffset; 1743 Quaternion parentRot = ParentGroup.RootPart.RotationOffset;
1740
1741 Vector3 axPos = OffsetPosition; 1744 Vector3 axPos = OffsetPosition;
1742
1743 axPos *= parentRot; 1745 axPos *= parentRot;
1744 Vector3 translationOffsetPosition = axPos; 1746 Vector3 translationOffsetPosition = axPos;
1745 return GroupPosition + translationOffsetPosition; 1747 if(_parentID == 0)
1748 {
1749 return GroupPosition;
1750 }
1751 else
1752 {
1753 return ParentGroup.AbsolutePosition + translationOffsetPosition; //KF: Fix child prim position
1754 }
1746 } 1755 }
1747 1756
1748 /// <summary> 1757 /// <summary>
@@ -1753,7 +1762,7 @@ namespace OpenSim.Region.Framework.Scenes
1753 { 1762 {
1754 Quaternion newRot; 1763 Quaternion newRot;
1755 1764
1756 if (this.LinkNum == 0) 1765 if (this.LinkNum < 2) //KF Single or root prim
1757 { 1766 {
1758 newRot = RotationOffset; 1767 newRot = RotationOffset;
1759 } 1768 }
@@ -2109,17 +2118,18 @@ namespace OpenSim.Region.Framework.Scenes
2109 //Trys to fetch sound id from prim's inventory. 2118 //Trys to fetch sound id from prim's inventory.
2110 //Prim's inventory doesn't support non script items yet 2119 //Prim's inventory doesn't support non script items yet
2111 2120
2112 lock (TaskInventory) 2121 TaskInventory.LockItemsForRead(true);
2122
2123 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
2113 { 2124 {
2114 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) 2125 if (item.Value.Name == sound)
2115 { 2126 {
2116 if (item.Value.Name == sound) 2127 soundID = item.Value.ItemID;
2117 { 2128 break;
2118 soundID = item.Value.ItemID;
2119 break;
2120 }
2121 } 2129 }
2122 } 2130 }
2131
2132 TaskInventory.LockItemsForRead(false);
2123 } 2133 }
2124 2134
2125 List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); 2135 List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars();
@@ -2394,8 +2404,8 @@ namespace OpenSim.Region.Framework.Scenes
2394 { 2404 {
2395 const float ROTATION_TOLERANCE = 0.01f; 2405 const float ROTATION_TOLERANCE = 0.01f;
2396 const float VELOCITY_TOLERANCE = 0.001f; 2406 const float VELOCITY_TOLERANCE = 0.001f;
2397 const float POSITION_TOLERANCE = 0.05f; 2407 const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary
2398 const int TIME_MS_TOLERANCE = 3000; 2408 const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds.
2399 2409
2400 if (m_updateFlag == 1) 2410 if (m_updateFlag == 1)
2401 { 2411 {
@@ -2409,7 +2419,7 @@ namespace OpenSim.Region.Framework.Scenes
2409 Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) 2419 Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE)
2410 { 2420 {
2411 AddTerseUpdateToAllAvatars(); 2421 AddTerseUpdateToAllAvatars();
2412 ClearUpdateSchedule(); 2422
2413 2423
2414 // This causes the Scene to 'poll' physical objects every couple of frames 2424 // This causes the Scene to 'poll' physical objects every couple of frames
2415 // bad, so it's been replaced by an event driven method. 2425 // bad, so it's been replaced by an event driven method.
@@ -2427,16 +2437,18 @@ namespace OpenSim.Region.Framework.Scenes
2427 m_lastAngularVelocity = AngularVelocity; 2437 m_lastAngularVelocity = AngularVelocity;
2428 m_lastTerseSent = Environment.TickCount; 2438 m_lastTerseSent = Environment.TickCount;
2429 } 2439 }
2440 //Moved this outside of the if clause so updates don't get blocked.. *sigh*
2441 m_updateFlag = 0; //Why were we calling a function to do this? Inefficient! *screams*
2430 } 2442 }
2431 else 2443 else
2432 { 2444 {
2433 if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes 2445 if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes
2434 { 2446 {
2435 AddFullUpdateToAllAvatars(); 2447 AddFullUpdateToAllAvatars();
2436 ClearUpdateSchedule(); 2448 m_updateFlag = 0; //Same here
2437 } 2449 }
2438 } 2450 }
2439 ClearUpdateSchedule(); 2451 m_updateFlag = 0;
2440 } 2452 }
2441 2453
2442 /// <summary> 2454 /// <summary>
@@ -2463,17 +2475,16 @@ namespace OpenSim.Region.Framework.Scenes
2463 if (!UUID.TryParse(sound, out soundID)) 2475 if (!UUID.TryParse(sound, out soundID))
2464 { 2476 {
2465 // search sound file from inventory 2477 // search sound file from inventory
2466 lock (TaskInventory) 2478 TaskInventory.LockItemsForRead(true);
2479 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
2467 { 2480 {
2468 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) 2481 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound)
2469 { 2482 {
2470 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) 2483 soundID = item.Value.ItemID;
2471 { 2484 break;
2472 soundID = item.Value.ItemID;
2473 break;
2474 }
2475 } 2485 }
2476 } 2486 }
2487 TaskInventory.LockItemsForRead(false);
2477 } 2488 }
2478 2489
2479 if (soundID == UUID.Zero) 2490 if (soundID == UUID.Zero)
@@ -2674,13 +2685,6 @@ namespace OpenSim.Region.Framework.Scenes
2674 ScheduleFullUpdate(); 2685 ScheduleFullUpdate();
2675 } 2686 }
2676 2687
2677 public void StopLookAt()
2678 {
2679 m_parentGroup.stopLookAt();
2680
2681 m_parentGroup.ScheduleGroupForTerseUpdate();
2682 }
2683
2684 /// <summary> 2688 /// <summary>
2685 /// Set the text displayed for this part. 2689 /// Set the text displayed for this part.
2686 /// </summary> 2690 /// </summary>
@@ -2696,6 +2700,13 @@ namespace OpenSim.Region.Framework.Scenes
2696 SetText(text); 2700 SetText(text);
2697 } 2701 }
2698 2702
2703 public void StopLookAt()
2704 {
2705 m_parentGroup.stopLookAt();
2706
2707 m_parentGroup.ScheduleGroupForTerseUpdate();
2708 }
2709
2699 public void StopMoveToTarget() 2710 public void StopMoveToTarget()
2700 { 2711 {
2701 m_parentGroup.stopMoveToTarget(); 2712 m_parentGroup.stopMoveToTarget();