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.cs95
1 files changed, 59 insertions, 36 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index b6916f2..0eddbfd 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();
@@ -2185,6 +2195,11 @@ namespace OpenSim.Region.Framework.Scenes
2185 ParentGroup.HasGroupChanged = true; 2195 ParentGroup.HasGroupChanged = true;
2186 ScheduleFullUpdate(); 2196 ScheduleFullUpdate();
2187 } 2197 }
2198
2199 public void RotLookAt(Quaternion target, float strength, float damping)
2200 {
2201 m_parentGroup.rotLookAt(target, strength, damping);
2202 }
2188 2203
2189 /// <summary> 2204 /// <summary>
2190 /// Schedules this prim for a full update 2205 /// Schedules this prim for a full update
@@ -2389,8 +2404,8 @@ namespace OpenSim.Region.Framework.Scenes
2389 { 2404 {
2390 const float ROTATION_TOLERANCE = 0.01f; 2405 const float ROTATION_TOLERANCE = 0.01f;
2391 const float VELOCITY_TOLERANCE = 0.001f; 2406 const float VELOCITY_TOLERANCE = 0.001f;
2392 const float POSITION_TOLERANCE = 0.05f; 2407 const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary
2393 const int TIME_MS_TOLERANCE = 3000; 2408 const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds.
2394 2409
2395 if (m_updateFlag == 1) 2410 if (m_updateFlag == 1)
2396 { 2411 {
@@ -2404,7 +2419,7 @@ namespace OpenSim.Region.Framework.Scenes
2404 Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) 2419 Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE)
2405 { 2420 {
2406 AddTerseUpdateToAllAvatars(); 2421 AddTerseUpdateToAllAvatars();
2407 ClearUpdateSchedule(); 2422
2408 2423
2409 // 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
2410 // bad, so it's been replaced by an event driven method. 2425 // bad, so it's been replaced by an event driven method.
@@ -2422,16 +2437,18 @@ namespace OpenSim.Region.Framework.Scenes
2422 m_lastAngularVelocity = AngularVelocity; 2437 m_lastAngularVelocity = AngularVelocity;
2423 m_lastTerseSent = Environment.TickCount; 2438 m_lastTerseSent = Environment.TickCount;
2424 } 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*
2425 } 2442 }
2426 else 2443 else
2427 { 2444 {
2428 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
2429 { 2446 {
2430 AddFullUpdateToAllAvatars(); 2447 AddFullUpdateToAllAvatars();
2431 ClearUpdateSchedule(); 2448 m_updateFlag = 0; //Same here
2432 } 2449 }
2433 } 2450 }
2434 ClearUpdateSchedule(); 2451 m_updateFlag = 0;
2435 } 2452 }
2436 2453
2437 /// <summary> 2454 /// <summary>
@@ -2458,17 +2475,16 @@ namespace OpenSim.Region.Framework.Scenes
2458 if (!UUID.TryParse(sound, out soundID)) 2475 if (!UUID.TryParse(sound, out soundID))
2459 { 2476 {
2460 // search sound file from inventory 2477 // search sound file from inventory
2461 lock (TaskInventory) 2478 TaskInventory.LockItemsForRead(true);
2479 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
2462 { 2480 {
2463 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) 2481 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound)
2464 { 2482 {
2465 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) 2483 soundID = item.Value.ItemID;
2466 { 2484 break;
2467 soundID = item.Value.ItemID;
2468 break;
2469 }
2470 } 2485 }
2471 } 2486 }
2487 TaskInventory.LockItemsForRead(false);
2472 } 2488 }
2473 2489
2474 if (soundID == UUID.Zero) 2490 if (soundID == UUID.Zero)
@@ -2684,6 +2700,13 @@ namespace OpenSim.Region.Framework.Scenes
2684 SetText(text); 2700 SetText(text);
2685 } 2701 }
2686 2702
2703 public void StopLookAt()
2704 {
2705 m_parentGroup.stopLookAt();
2706
2707 m_parentGroup.ScheduleGroupForTerseUpdate();
2708 }
2709
2687 public void StopMoveToTarget() 2710 public void StopMoveToTarget()
2688 { 2711 {
2689 m_parentGroup.stopMoveToTarget(); 2712 m_parentGroup.stopMoveToTarget();