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.cs98
1 files changed, 64 insertions, 34 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index b6916f2..a23c11e 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
@@ -508,9 +513,16 @@ namespace OpenSim.Region.Framework.Scenes
508 { 513 {
509 // If this is a linkset, we don't want the physics engine mucking up our group position here. 514 // If this is a linkset, we don't want the physics engine mucking up our group position here.
510 PhysicsActor actor = PhysActor; 515 PhysicsActor actor = PhysActor;
511 if (actor != null && _parentID == 0) 516 if (actor != null)
512 { 517 {
513 m_groupPosition = actor.Position; 518 if (_parentID == 0)
519 {
520 m_groupPosition = actor.Position;
521 }
522 else
523 {
524 m_groupPosition = ParentGroup.AbsolutePosition; // KF+Casper Update Child prims too!
525 }
514 } 526 }
515 527
516 if (IsAttachment) 528 if (IsAttachment)
@@ -837,7 +849,8 @@ namespace OpenSim.Region.Framework.Scenes
837 if (IsAttachment) 849 if (IsAttachment)
838 return GroupPosition; 850 return GroupPosition;
839 851
840 return m_offsetPosition + m_groupPosition; } 852// return m_offsetPosition + m_groupPosition; }
853 return m_groupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset) ; } //KF: Rotation was ignored!
841 } 854 }
842 855
843 public SceneObjectGroup ParentGroup 856 public SceneObjectGroup ParentGroup
@@ -989,6 +1002,13 @@ namespace OpenSim.Region.Framework.Scenes
989 get { return _flags; } 1002 get { return _flags; }
990 set { _flags = value; } 1003 set { _flags = value; }
991 } 1004 }
1005
1006 [XmlIgnore]
1007 public bool IsOccupied // KF If an av is sittingon this prim
1008 {
1009 get { return m_occupied; }
1010 set { m_occupied = value; }
1011 }
992 1012
993 [XmlIgnore] 1013 [XmlIgnore]
994 public UUID SitTargetAvatar 1014 public UUID SitTargetAvatar
@@ -1064,14 +1084,6 @@ namespace OpenSim.Region.Framework.Scenes
1064 } 1084 }
1065 } 1085 }
1066 1086
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) 1087 private void SendObjectPropertiesToClient(UUID AgentID)
1076 { 1088 {
1077 ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); 1089 ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
@@ -1739,9 +1751,13 @@ namespace OpenSim.Region.Framework.Scenes
1739 Quaternion parentRot = ParentGroup.RootPart.RotationOffset; 1751 Quaternion parentRot = ParentGroup.RootPart.RotationOffset;
1740 1752
1741 Vector3 axPos = OffsetPosition; 1753 Vector3 axPos = OffsetPosition;
1742
1743 axPos *= parentRot; 1754 axPos *= parentRot;
1744 Vector3 translationOffsetPosition = axPos; 1755 Vector3 translationOffsetPosition = axPos;
1756
1757 int tx = (int)GroupPosition.X;
1758 int ty = (int)GroupPosition.Y;
1759 int tz = (int)GroupPosition.Z;
1760
1745 return GroupPosition + translationOffsetPosition; 1761 return GroupPosition + translationOffsetPosition;
1746 } 1762 }
1747 1763
@@ -2109,17 +2125,18 @@ namespace OpenSim.Region.Framework.Scenes
2109 //Trys to fetch sound id from prim's inventory. 2125 //Trys to fetch sound id from prim's inventory.
2110 //Prim's inventory doesn't support non script items yet 2126 //Prim's inventory doesn't support non script items yet
2111 2127
2112 lock (TaskInventory) 2128 TaskInventory.LockItemsForRead(true);
2129
2130 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
2113 { 2131 {
2114 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) 2132 if (item.Value.Name == sound)
2115 { 2133 {
2116 if (item.Value.Name == sound) 2134 soundID = item.Value.ItemID;
2117 { 2135 break;
2118 soundID = item.Value.ItemID;
2119 break;
2120 }
2121 } 2136 }
2122 } 2137 }
2138
2139 TaskInventory.LockItemsForRead(false);
2123 } 2140 }
2124 2141
2125 List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); 2142 List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars();
@@ -2185,6 +2202,11 @@ namespace OpenSim.Region.Framework.Scenes
2185 ParentGroup.HasGroupChanged = true; 2202 ParentGroup.HasGroupChanged = true;
2186 ScheduleFullUpdate(); 2203 ScheduleFullUpdate();
2187 } 2204 }
2205
2206 public void RotLookAt(Quaternion target, float strength, float damping)
2207 {
2208 m_parentGroup.rotLookAt(target, strength, damping);
2209 }
2188 2210
2189 /// <summary> 2211 /// <summary>
2190 /// Schedules this prim for a full update 2212 /// Schedules this prim for a full update
@@ -2389,8 +2411,8 @@ namespace OpenSim.Region.Framework.Scenes
2389 { 2411 {
2390 const float ROTATION_TOLERANCE = 0.01f; 2412 const float ROTATION_TOLERANCE = 0.01f;
2391 const float VELOCITY_TOLERANCE = 0.001f; 2413 const float VELOCITY_TOLERANCE = 0.001f;
2392 const float POSITION_TOLERANCE = 0.05f; 2414 const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary
2393 const int TIME_MS_TOLERANCE = 3000; 2415 const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds.
2394 2416
2395 if (m_updateFlag == 1) 2417 if (m_updateFlag == 1)
2396 { 2418 {
@@ -2404,7 +2426,7 @@ namespace OpenSim.Region.Framework.Scenes
2404 Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) 2426 Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE)
2405 { 2427 {
2406 AddTerseUpdateToAllAvatars(); 2428 AddTerseUpdateToAllAvatars();
2407 ClearUpdateSchedule(); 2429
2408 2430
2409 // This causes the Scene to 'poll' physical objects every couple of frames 2431 // This causes the Scene to 'poll' physical objects every couple of frames
2410 // bad, so it's been replaced by an event driven method. 2432 // bad, so it's been replaced by an event driven method.
@@ -2422,16 +2444,18 @@ namespace OpenSim.Region.Framework.Scenes
2422 m_lastAngularVelocity = AngularVelocity; 2444 m_lastAngularVelocity = AngularVelocity;
2423 m_lastTerseSent = Environment.TickCount; 2445 m_lastTerseSent = Environment.TickCount;
2424 } 2446 }
2447 //Moved this outside of the if clause so updates don't get blocked.. *sigh*
2448 m_updateFlag = 0; //Why were we calling a function to do this? Inefficient! *screams*
2425 } 2449 }
2426 else 2450 else
2427 { 2451 {
2428 if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes 2452 if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes
2429 { 2453 {
2430 AddFullUpdateToAllAvatars(); 2454 AddFullUpdateToAllAvatars();
2431 ClearUpdateSchedule(); 2455 m_updateFlag = 0; //Same here
2432 } 2456 }
2433 } 2457 }
2434 ClearUpdateSchedule(); 2458 m_updateFlag = 0;
2435 } 2459 }
2436 2460
2437 /// <summary> 2461 /// <summary>
@@ -2458,17 +2482,16 @@ namespace OpenSim.Region.Framework.Scenes
2458 if (!UUID.TryParse(sound, out soundID)) 2482 if (!UUID.TryParse(sound, out soundID))
2459 { 2483 {
2460 // search sound file from inventory 2484 // search sound file from inventory
2461 lock (TaskInventory) 2485 TaskInventory.LockItemsForRead(true);
2486 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
2462 { 2487 {
2463 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) 2488 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound)
2464 { 2489 {
2465 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) 2490 soundID = item.Value.ItemID;
2466 { 2491 break;
2467 soundID = item.Value.ItemID;
2468 break;
2469 }
2470 } 2492 }
2471 } 2493 }
2494 TaskInventory.LockItemsForRead(false);
2472 } 2495 }
2473 2496
2474 if (soundID == UUID.Zero) 2497 if (soundID == UUID.Zero)
@@ -2684,6 +2707,13 @@ namespace OpenSim.Region.Framework.Scenes
2684 SetText(text); 2707 SetText(text);
2685 } 2708 }
2686 2709
2710 public void StopLookAt()
2711 {
2712 m_parentGroup.stopLookAt();
2713
2714 m_parentGroup.ScheduleGroupForTerseUpdate();
2715 }
2716
2687 public void StopMoveToTarget() 2717 public void StopMoveToTarget()
2688 { 2718 {
2689 m_parentGroup.stopMoveToTarget(); 2719 m_parentGroup.stopMoveToTarget();