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 a2b98b9..48e34ee 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 }
@@ -2611,17 +2627,18 @@ namespace OpenSim.Region.Framework.Scenes
2611 //Trys to fetch sound id from prim's inventory. 2627 //Trys to fetch sound id from prim's inventory.
2612 //Prim's inventory doesn't support non script items yet 2628 //Prim's inventory doesn't support non script items yet
2613 2629
2614 lock (TaskInventory) 2630 TaskInventory.LockItemsForRead(true);
2631
2632 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
2615 { 2633 {
2616 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) 2634 if (item.Value.Name == sound)
2617 { 2635 {
2618 if (item.Value.Name == sound) 2636 soundID = item.Value.ItemID;
2619 { 2637 break;
2620 soundID = item.Value.ItemID;
2621 break;
2622 }
2623 } 2638 }
2624 } 2639 }
2640
2641 TaskInventory.LockItemsForRead(false);
2625 } 2642 }
2626 2643
2627 List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); 2644 List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars();
@@ -2689,38 +2706,7 @@ namespace OpenSim.Region.Framework.Scenes
2689 2706
2690 public void RotLookAt(Quaternion target, float strength, float damping) 2707 public void RotLookAt(Quaternion target, float strength, float damping)
2691 { 2708 {
2692 rotLookAt(target, strength, damping); 2709 m_parentGroup.rotLookAt(target, strength, damping); // This calls method in SceneObjectGroup.
2693 }
2694
2695 public void rotLookAt(Quaternion target, float strength, float damping)
2696 {
2697 if (IsAttachment)
2698 {
2699 /*
2700 ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar);
2701 if (avatar != null)
2702 {
2703 Rotate the Av?
2704 } */
2705 }
2706 else
2707 {
2708 APIDDamp = damping;
2709 APIDStrength = strength;
2710 APIDTarget = target;
2711 }
2712 }
2713
2714 public void startLookAt(Quaternion rot, float damp, float strength)
2715 {
2716 APIDDamp = damp;
2717 APIDStrength = strength;
2718 APIDTarget = rot;
2719 }
2720
2721 public void stopLookAt()
2722 {
2723 APIDTarget = Quaternion.Identity;
2724 } 2710 }
2725 2711
2726 /// <summary> 2712 /// <summary>
@@ -2955,8 +2941,8 @@ namespace OpenSim.Region.Framework.Scenes
2955 { 2941 {
2956 const float ROTATION_TOLERANCE = 0.01f; 2942 const float ROTATION_TOLERANCE = 0.01f;
2957 const float VELOCITY_TOLERANCE = 0.001f; 2943 const float VELOCITY_TOLERANCE = 0.001f;
2958 const float POSITION_TOLERANCE = 0.05f; 2944 const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary
2959 const int TIME_MS_TOLERANCE = 3000; 2945 const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds.
2960 2946
2961 if (m_updateFlag == 1) 2947 if (m_updateFlag == 1)
2962 { 2948 {
@@ -2970,7 +2956,7 @@ namespace OpenSim.Region.Framework.Scenes
2970 Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) 2956 Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE)
2971 { 2957 {
2972 AddTerseUpdateToAllAvatars(); 2958 AddTerseUpdateToAllAvatars();
2973 ClearUpdateSchedule(); 2959
2974 2960
2975 // This causes the Scene to 'poll' physical objects every couple of frames 2961 // This causes the Scene to 'poll' physical objects every couple of frames
2976 // bad, so it's been replaced by an event driven method. 2962 // bad, so it's been replaced by an event driven method.
@@ -2988,16 +2974,18 @@ namespace OpenSim.Region.Framework.Scenes
2988 m_lastAngularVelocity = AngularVelocity; 2974 m_lastAngularVelocity = AngularVelocity;
2989 m_lastTerseSent = Environment.TickCount; 2975 m_lastTerseSent = Environment.TickCount;
2990 } 2976 }
2977 //Moved this outside of the if clause so updates don't get blocked.. *sigh*
2978 m_updateFlag = 0; //Why were we calling a function to do this? Inefficient! *screams*
2991 } 2979 }
2992 else 2980 else
2993 { 2981 {
2994 if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes 2982 if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes
2995 { 2983 {
2996 AddFullUpdateToAllAvatars(); 2984 AddFullUpdateToAllAvatars();
2997 ClearUpdateSchedule(); 2985 m_updateFlag = 0; //Same here
2998 } 2986 }
2999 } 2987 }
3000 ClearUpdateSchedule(); 2988 m_updateFlag = 0;
3001 } 2989 }
3002 2990
3003 /// <summary> 2991 /// <summary>
@@ -3024,17 +3012,16 @@ namespace OpenSim.Region.Framework.Scenes
3024 if (!UUID.TryParse(sound, out soundID)) 3012 if (!UUID.TryParse(sound, out soundID))
3025 { 3013 {
3026 // search sound file from inventory 3014 // search sound file from inventory
3027 lock (TaskInventory) 3015 TaskInventory.LockItemsForRead(true);
3016 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
3028 { 3017 {
3029 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) 3018 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound)
3030 { 3019 {
3031 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) 3020 soundID = item.Value.ItemID;
3032 { 3021 break;
3033 soundID = item.Value.ItemID;
3034 break;
3035 }
3036 } 3022 }
3037 } 3023 }
3024 TaskInventory.LockItemsForRead(false);
3038 } 3025 }
3039 3026
3040 if (soundID == UUID.Zero) 3027 if (soundID == UUID.Zero)
@@ -3470,7 +3457,7 @@ namespace OpenSim.Region.Framework.Scenes
3470 3457
3471 public void StopLookAt() 3458 public void StopLookAt()
3472 { 3459 {
3473 m_parentGroup.stopLookAt(); 3460 m_parentGroup.stopLookAt(); // This calls method in SceneObjectGroup.
3474 3461
3475 m_parentGroup.ScheduleGroupForTerseUpdate(); 3462 m_parentGroup.ScheduleGroupForTerseUpdate();
3476 } 3463 }