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 ffbb427..3a101cc 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();
@@ -1939,12 +1950,17 @@ namespace OpenSim.Region.Framework.Scenes
1939 public Vector3 GetWorldPosition() 1950 public Vector3 GetWorldPosition()
1940 { 1951 {
1941 Quaternion parentRot = ParentGroup.RootPart.RotationOffset; 1952 Quaternion parentRot = ParentGroup.RootPart.RotationOffset;
1942
1943 Vector3 axPos = OffsetPosition; 1953 Vector3 axPos = OffsetPosition;
1944
1945 axPos *= parentRot; 1954 axPos *= parentRot;
1946 Vector3 translationOffsetPosition = axPos; 1955 Vector3 translationOffsetPosition = axPos;
1947 return GroupPosition + translationOffsetPosition; 1956 if(_parentID == 0)
1957 {
1958 return GroupPosition;
1959 }
1960 else
1961 {
1962 return ParentGroup.AbsolutePosition + translationOffsetPosition; //KF: Fix child prim position
1963 }
1948 } 1964 }
1949 1965
1950 /// <summary> 1966 /// <summary>
@@ -1955,7 +1971,7 @@ namespace OpenSim.Region.Framework.Scenes
1955 { 1971 {
1956 Quaternion newRot; 1972 Quaternion newRot;
1957 1973
1958 if (this.LinkNum == 0) 1974 if (this.LinkNum < 2) //KF Single or root prim
1959 { 1975 {
1960 newRot = RotationOffset; 1976 newRot = RotationOffset;
1961 } 1977 }
@@ -2612,17 +2628,18 @@ namespace OpenSim.Region.Framework.Scenes
2612 //Trys to fetch sound id from prim's inventory. 2628 //Trys to fetch sound id from prim's inventory.
2613 //Prim's inventory doesn't support non script items yet 2629 //Prim's inventory doesn't support non script items yet
2614 2630
2615 lock (TaskInventory) 2631 TaskInventory.LockItemsForRead(true);
2632
2633 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
2616 { 2634 {
2617 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) 2635 if (item.Value.Name == sound)
2618 { 2636 {
2619 if (item.Value.Name == sound) 2637 soundID = item.Value.ItemID;
2620 { 2638 break;
2621 soundID = item.Value.ItemID;
2622 break;
2623 }
2624 } 2639 }
2625 } 2640 }
2641
2642 TaskInventory.LockItemsForRead(false);
2626 } 2643 }
2627 2644
2628 List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); 2645 List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars();
@@ -2690,38 +2707,7 @@ namespace OpenSim.Region.Framework.Scenes
2690 2707
2691 public void RotLookAt(Quaternion target, float strength, float damping) 2708 public void RotLookAt(Quaternion target, float strength, float damping)
2692 { 2709 {
2693 rotLookAt(target, strength, damping); 2710 m_parentGroup.rotLookAt(target, strength, damping); // This calls method in SceneObjectGroup.
2694 }
2695
2696 public void rotLookAt(Quaternion target, float strength, float damping)
2697 {
2698 if (IsAttachment)
2699 {
2700 /*
2701 ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar);
2702 if (avatar != null)
2703 {
2704 Rotate the Av?
2705 } */
2706 }
2707 else
2708 {
2709 APIDDamp = damping;
2710 APIDStrength = strength;
2711 APIDTarget = target;
2712 }
2713 }
2714
2715 public void startLookAt(Quaternion rot, float damp, float strength)
2716 {
2717 APIDDamp = damp;
2718 APIDStrength = strength;
2719 APIDTarget = rot;
2720 }
2721
2722 public void stopLookAt()
2723 {
2724 APIDTarget = Quaternion.Identity;
2725 } 2711 }
2726 2712
2727 /// <summary> 2713 /// <summary>
@@ -2942,8 +2928,8 @@ namespace OpenSim.Region.Framework.Scenes
2942 { 2928 {
2943 const float ROTATION_TOLERANCE = 0.01f; 2929 const float ROTATION_TOLERANCE = 0.01f;
2944 const float VELOCITY_TOLERANCE = 0.001f; 2930 const float VELOCITY_TOLERANCE = 0.001f;
2945 const float POSITION_TOLERANCE = 0.05f; 2931 const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary
2946 const int TIME_MS_TOLERANCE = 3000; 2932 const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds.
2947 2933
2948 if (m_updateFlag == 1) 2934 if (m_updateFlag == 1)
2949 { 2935 {
@@ -2957,7 +2943,7 @@ namespace OpenSim.Region.Framework.Scenes
2957 Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) 2943 Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE)
2958 { 2944 {
2959 AddTerseUpdateToAllAvatars(); 2945 AddTerseUpdateToAllAvatars();
2960 ClearUpdateSchedule(); 2946
2961 2947
2962 // This causes the Scene to 'poll' physical objects every couple of frames 2948 // This causes the Scene to 'poll' physical objects every couple of frames
2963 // bad, so it's been replaced by an event driven method. 2949 // bad, so it's been replaced by an event driven method.
@@ -2975,6 +2961,8 @@ namespace OpenSim.Region.Framework.Scenes
2975 m_lastAngularVelocity = AngularVelocity; 2961 m_lastAngularVelocity = AngularVelocity;
2976 m_lastTerseSent = Environment.TickCount; 2962 m_lastTerseSent = Environment.TickCount;
2977 } 2963 }
2964 //Moved this outside of the if clause so updates don't get blocked.. *sigh*
2965 m_updateFlag = 0; //Why were we calling a function to do this? Inefficient! *screams*
2978 } 2966 }
2979 else 2967 else
2980 { 2968 {
@@ -2984,10 +2972,10 @@ namespace OpenSim.Region.Framework.Scenes
2984 m_log.DebugFormat("[SOP]: Sending scheduled full update for {0} {1}", Name, LocalId); 2972 m_log.DebugFormat("[SOP]: Sending scheduled full update for {0} {1}", Name, LocalId);
2985 2973
2986 AddFullUpdateToAllAvatars(); 2974 AddFullUpdateToAllAvatars();
2987 ClearUpdateSchedule(); 2975 m_updateFlag = 0; //Same here
2988 } 2976 }
2989 } 2977 }
2990 ClearUpdateSchedule(); 2978 m_updateFlag = 0;
2991 } 2979 }
2992 2980
2993 /// <summary> 2981 /// <summary>
@@ -3014,17 +3002,16 @@ namespace OpenSim.Region.Framework.Scenes
3014 if (!UUID.TryParse(sound, out soundID)) 3002 if (!UUID.TryParse(sound, out soundID))
3015 { 3003 {
3016 // search sound file from inventory 3004 // search sound file from inventory
3017 lock (TaskInventory) 3005 TaskInventory.LockItemsForRead(true);
3006 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
3018 { 3007 {
3019 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) 3008 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound)
3020 { 3009 {
3021 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) 3010 soundID = item.Value.ItemID;
3022 { 3011 break;
3023 soundID = item.Value.ItemID;
3024 break;
3025 }
3026 } 3012 }
3027 } 3013 }
3014 TaskInventory.LockItemsForRead(false);
3028 } 3015 }
3029 3016
3030 if (soundID == UUID.Zero) 3017 if (soundID == UUID.Zero)
@@ -3460,7 +3447,7 @@ namespace OpenSim.Region.Framework.Scenes
3460 3447
3461 public void StopLookAt() 3448 public void StopLookAt()
3462 { 3449 {
3463 m_parentGroup.stopLookAt(); 3450 m_parentGroup.stopLookAt(); // This calls method in SceneObjectGroup.
3464 3451
3465 m_parentGroup.ScheduleGroupForTerseUpdate(); 3452 m_parentGroup.ScheduleGroupForTerseUpdate();
3466 } 3453 }