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.cs133
1 files changed, 60 insertions, 73 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index a85a4b3..548a64f 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -147,7 +147,7 @@ namespace OpenSim.Region.Framework.Scenes
147 147
148 // TODO: This needs to be persisted in next XML version update! 148 // TODO: This needs to be persisted in next XML version update!
149 [XmlIgnore] 149 [XmlIgnore]
150 public readonly int[] PayPrice = {-2,-2,-2,-2,-2}; 150 public int[] PayPrice = {-2,-2,-2,-2,-2};
151 [XmlIgnore] 151 [XmlIgnore]
152 public PhysicsActor PhysActor; 152 public PhysicsActor PhysActor;
153 153
@@ -274,6 +274,7 @@ namespace OpenSim.Region.Framework.Scenes
274 private Quaternion m_sitTargetOrientation = Quaternion.Identity; 274 private Quaternion m_sitTargetOrientation = Quaternion.Identity;
275 private Vector3 m_sitTargetPosition; 275 private Vector3 m_sitTargetPosition;
276 private string m_sitAnimation = "SIT"; 276 private string m_sitAnimation = "SIT";
277 private bool m_occupied; // KF if any av is sitting on this prim
277 private string m_text = String.Empty; 278 private string m_text = String.Empty;
278 private string m_touchName = String.Empty; 279 private string m_touchName = String.Empty;
279 private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5); 280 private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5);
@@ -452,12 +453,16 @@ namespace OpenSim.Region.Framework.Scenes
452 } 453 }
453 454
454 /// <value> 455 /// <value>
455 /// Access should be via Inventory directly - this property temporarily remains for xml serialization purposes 456 /// Get the inventory list
456 /// </value> 457 /// </value>
457 public TaskInventoryDictionary TaskInventory 458 public TaskInventoryDictionary TaskInventory
458 { 459 {
459 get { return m_inventory.Items; } 460 get {
460 set { m_inventory.Items = value; } 461 return m_inventory.Items;
462 }
463 set {
464 m_inventory.Items = value;
465 }
461 } 466 }
462 467
463 public uint ObjectFlags 468 public uint ObjectFlags
@@ -586,14 +591,12 @@ namespace OpenSim.Region.Framework.Scenes
586 set { m_LoopSoundSlavePrims = value; } 591 set { m_LoopSoundSlavePrims = value; }
587 } 592 }
588 593
589 [XmlIgnore]
590 public Byte[] TextureAnimation 594 public Byte[] TextureAnimation
591 { 595 {
592 get { return m_TextureAnimation; } 596 get { return m_TextureAnimation; }
593 set { m_TextureAnimation = value; } 597 set { m_TextureAnimation = value; }
594 } 598 }
595 599
596 [XmlIgnore]
597 public Byte[] ParticleSystem 600 public Byte[] ParticleSystem
598 { 601 {
599 get { return m_particleSystem; } 602 get { return m_particleSystem; }
@@ -647,7 +650,6 @@ namespace OpenSim.Region.Framework.Scenes
647 set 650 set
648 { 651 {
649 m_groupPosition = value; 652 m_groupPosition = value;
650
651 PhysicsActor actor = PhysActor; 653 PhysicsActor actor = PhysActor;
652 if (actor != null) 654 if (actor != null)
653 { 655 {
@@ -816,7 +818,16 @@ namespace OpenSim.Region.Framework.Scenes
816 /// <summary></summary> 818 /// <summary></summary>
817 public Vector3 Acceleration 819 public Vector3 Acceleration
818 { 820 {
819 get { return m_acceleration; } 821 get
822 {
823 PhysicsActor actor = PhysActor;
824 if (actor != null)
825 {
826 m_acceleration = actor.Acceleration;
827 }
828 return m_acceleration;
829 }
830
820 set { m_acceleration = value; } 831 set { m_acceleration = value; }
821 } 832 }
822 833
@@ -960,7 +971,8 @@ namespace OpenSim.Region.Framework.Scenes
960 if (IsAttachment) 971 if (IsAttachment)
961 return GroupPosition; 972 return GroupPosition;
962 973
963 return m_offsetPosition + m_groupPosition; } 974// return m_offsetPosition + m_groupPosition; }
975 return m_groupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset) ; } //KF: Rotation was ignored!
964 } 976 }
965 977
966 public SceneObjectGroup ParentGroup 978 public SceneObjectGroup ParentGroup
@@ -1112,6 +1124,13 @@ namespace OpenSim.Region.Framework.Scenes
1112 get { return _flags; } 1124 get { return _flags; }
1113 set { _flags = value; } 1125 set { _flags = value; }
1114 } 1126 }
1127
1128 [XmlIgnore]
1129 public bool IsOccupied // KF If an av is sittingon this prim
1130 {
1131 get { return m_occupied; }
1132 set { m_occupied = value; }
1133 }
1115 1134
1116 [XmlIgnore] 1135 [XmlIgnore]
1117 public UUID SitTargetAvatar 1136 public UUID SitTargetAvatar
@@ -1187,14 +1206,6 @@ namespace OpenSim.Region.Framework.Scenes
1187 } 1206 }
1188 } 1207 }
1189 1208
1190 /// <summary>
1191 /// Clear all pending updates of parts to clients
1192 /// </summary>
1193 private void ClearUpdateSchedule()
1194 {
1195 m_updateFlag = 0;
1196 }
1197
1198 private void SendObjectPropertiesToClient(UUID AgentID) 1209 private void SendObjectPropertiesToClient(UUID AgentID)
1199 { 1210 {
1200 ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); 1211 ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
@@ -1937,12 +1948,17 @@ namespace OpenSim.Region.Framework.Scenes
1937 public Vector3 GetWorldPosition() 1948 public Vector3 GetWorldPosition()
1938 { 1949 {
1939 Quaternion parentRot = ParentGroup.RootPart.RotationOffset; 1950 Quaternion parentRot = ParentGroup.RootPart.RotationOffset;
1940
1941 Vector3 axPos = OffsetPosition; 1951 Vector3 axPos = OffsetPosition;
1942
1943 axPos *= parentRot; 1952 axPos *= parentRot;
1944 Vector3 translationOffsetPosition = axPos; 1953 Vector3 translationOffsetPosition = axPos;
1945 return GroupPosition + translationOffsetPosition; 1954 if(_parentID == 0)
1955 {
1956 return GroupPosition;
1957 }
1958 else
1959 {
1960 return ParentGroup.AbsolutePosition + translationOffsetPosition; //KF: Fix child prim position
1961 }
1946 } 1962 }
1947 1963
1948 /// <summary> 1964 /// <summary>
@@ -1953,7 +1969,7 @@ namespace OpenSim.Region.Framework.Scenes
1953 { 1969 {
1954 Quaternion newRot; 1970 Quaternion newRot;
1955 1971
1956 if (this.LinkNum == 0) 1972 if (this.LinkNum < 2) //KF Single or root prim
1957 { 1973 {
1958 newRot = RotationOffset; 1974 newRot = RotationOffset;
1959 } 1975 }
@@ -2610,17 +2626,18 @@ namespace OpenSim.Region.Framework.Scenes
2610 //Trys to fetch sound id from prim's inventory. 2626 //Trys to fetch sound id from prim's inventory.
2611 //Prim's inventory doesn't support non script items yet 2627 //Prim's inventory doesn't support non script items yet
2612 2628
2613 lock (TaskInventory) 2629 TaskInventory.LockItemsForRead(true);
2630
2631 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
2614 { 2632 {
2615 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) 2633 if (item.Value.Name == sound)
2616 { 2634 {
2617 if (item.Value.Name == sound) 2635 soundID = item.Value.ItemID;
2618 { 2636 break;
2619 soundID = item.Value.ItemID;
2620 break;
2621 }
2622 } 2637 }
2623 } 2638 }
2639
2640 TaskInventory.LockItemsForRead(false);
2624 } 2641 }
2625 2642
2626 List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); 2643 List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars();
@@ -2688,38 +2705,7 @@ namespace OpenSim.Region.Framework.Scenes
2688 2705
2689 public void RotLookAt(Quaternion target, float strength, float damping) 2706 public void RotLookAt(Quaternion target, float strength, float damping)
2690 { 2707 {
2691 rotLookAt(target, strength, damping); 2708 m_parentGroup.rotLookAt(target, strength, damping); // This calls method in SceneObjectGroup.
2692 }
2693
2694 public void rotLookAt(Quaternion target, float strength, float damping)
2695 {
2696 if (IsAttachment)
2697 {
2698 /*
2699 ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar);
2700 if (avatar != null)
2701 {
2702 Rotate the Av?
2703 } */
2704 }
2705 else
2706 {
2707 APIDDamp = damping;
2708 APIDStrength = strength;
2709 APIDTarget = target;
2710 }
2711 }
2712
2713 public void startLookAt(Quaternion rot, float damp, float strength)
2714 {
2715 APIDDamp = damp;
2716 APIDStrength = strength;
2717 APIDTarget = rot;
2718 }
2719
2720 public void stopLookAt()
2721 {
2722 APIDTarget = Quaternion.Identity;
2723 } 2709 }
2724 2710
2725 /// <summary> 2711 /// <summary>
@@ -2927,8 +2913,8 @@ namespace OpenSim.Region.Framework.Scenes
2927 { 2913 {
2928 const float ROTATION_TOLERANCE = 0.01f; 2914 const float ROTATION_TOLERANCE = 0.01f;
2929 const float VELOCITY_TOLERANCE = 0.001f; 2915 const float VELOCITY_TOLERANCE = 0.001f;
2930 const float POSITION_TOLERANCE = 0.05f; 2916 const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary
2931 const int TIME_MS_TOLERANCE = 3000; 2917 const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds.
2932 2918
2933 if (m_updateFlag == 1) 2919 if (m_updateFlag == 1)
2934 { 2920 {
@@ -2942,7 +2928,7 @@ namespace OpenSim.Region.Framework.Scenes
2942 Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) 2928 Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE)
2943 { 2929 {
2944 AddTerseUpdateToAllAvatars(); 2930 AddTerseUpdateToAllAvatars();
2945 ClearUpdateSchedule(); 2931
2946 2932
2947 // This causes the Scene to 'poll' physical objects every couple of frames 2933 // This causes the Scene to 'poll' physical objects every couple of frames
2948 // bad, so it's been replaced by an event driven method. 2934 // bad, so it's been replaced by an event driven method.
@@ -2960,16 +2946,18 @@ namespace OpenSim.Region.Framework.Scenes
2960 m_lastAngularVelocity = AngularVelocity; 2946 m_lastAngularVelocity = AngularVelocity;
2961 m_lastTerseSent = Environment.TickCount; 2947 m_lastTerseSent = Environment.TickCount;
2962 } 2948 }
2949 //Moved this outside of the if clause so updates don't get blocked.. *sigh*
2950 m_updateFlag = 0; //Why were we calling a function to do this? Inefficient! *screams*
2963 } 2951 }
2964 else 2952 else
2965 { 2953 {
2966 if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes 2954 if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes
2967 { 2955 {
2968 AddFullUpdateToAllAvatars(); 2956 AddFullUpdateToAllAvatars();
2969 ClearUpdateSchedule(); 2957 m_updateFlag = 0; //Same here
2970 } 2958 }
2971 } 2959 }
2972 ClearUpdateSchedule(); 2960 m_updateFlag = 0;
2973 } 2961 }
2974 2962
2975 /// <summary> 2963 /// <summary>
@@ -2996,17 +2984,16 @@ namespace OpenSim.Region.Framework.Scenes
2996 if (!UUID.TryParse(sound, out soundID)) 2984 if (!UUID.TryParse(sound, out soundID))
2997 { 2985 {
2998 // search sound file from inventory 2986 // search sound file from inventory
2999 lock (TaskInventory) 2987 TaskInventory.LockItemsForRead(true);
2988 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
3000 { 2989 {
3001 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) 2990 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound)
3002 { 2991 {
3003 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) 2992 soundID = item.Value.ItemID;
3004 { 2993 break;
3005 soundID = item.Value.ItemID;
3006 break;
3007 }
3008 } 2994 }
3009 } 2995 }
2996 TaskInventory.LockItemsForRead(false);
3010 } 2997 }
3011 2998
3012 if (soundID == UUID.Zero) 2999 if (soundID == UUID.Zero)
@@ -3442,7 +3429,7 @@ namespace OpenSim.Region.Framework.Scenes
3442 3429
3443 public void StopLookAt() 3430 public void StopLookAt()
3444 { 3431 {
3445 m_parentGroup.stopLookAt(); 3432 m_parentGroup.stopLookAt(); // This calls method in SceneObjectGroup.
3446 3433
3447 m_parentGroup.ScheduleGroupForTerseUpdate(); 3434 m_parentGroup.ScheduleGroupForTerseUpdate();
3448 } 3435 }