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 19ff288..9862785 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>
@@ -2959,8 +2945,8 @@ namespace OpenSim.Region.Framework.Scenes
2959 { 2945 {
2960 const float ROTATION_TOLERANCE = 0.01f; 2946 const float ROTATION_TOLERANCE = 0.01f;
2961 const float VELOCITY_TOLERANCE = 0.001f; 2947 const float VELOCITY_TOLERANCE = 0.001f;
2962 const float POSITION_TOLERANCE = 0.05f; 2948 const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary
2963 const int TIME_MS_TOLERANCE = 3000; 2949 const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds.
2964 2950
2965 if (m_updateFlag == 1) 2951 if (m_updateFlag == 1)
2966 { 2952 {
@@ -2974,7 +2960,7 @@ namespace OpenSim.Region.Framework.Scenes
2974 Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) 2960 Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE)
2975 { 2961 {
2976 AddTerseUpdateToAllAvatars(); 2962 AddTerseUpdateToAllAvatars();
2977 ClearUpdateSchedule(); 2963
2978 2964
2979 // This causes the Scene to 'poll' physical objects every couple of frames 2965 // This causes the Scene to 'poll' physical objects every couple of frames
2980 // bad, so it's been replaced by an event driven method. 2966 // bad, so it's been replaced by an event driven method.
@@ -2992,6 +2978,8 @@ namespace OpenSim.Region.Framework.Scenes
2992 m_lastAngularVelocity = AngularVelocity; 2978 m_lastAngularVelocity = AngularVelocity;
2993 m_lastTerseSent = Environment.TickCount; 2979 m_lastTerseSent = Environment.TickCount;
2994 } 2980 }
2981 //Moved this outside of the if clause so updates don't get blocked.. *sigh*
2982 m_updateFlag = 0; //Why were we calling a function to do this? Inefficient! *screams*
2995 } 2983 }
2996 else 2984 else
2997 { 2985 {
@@ -3001,10 +2989,10 @@ namespace OpenSim.Region.Framework.Scenes
3001// m_log.DebugFormat("[SOP]: Sending scheduled full update for {0} {1}", Name, LocalId); 2989// m_log.DebugFormat("[SOP]: Sending scheduled full update for {0} {1}", Name, LocalId);
3002 2990
3003 AddFullUpdateToAllAvatars(); 2991 AddFullUpdateToAllAvatars();
3004 ClearUpdateSchedule(); 2992 m_updateFlag = 0; //Same here
3005 } 2993 }
3006 } 2994 }
3007 ClearUpdateSchedule(); 2995 m_updateFlag = 0;
3008 } 2996 }
3009 2997
3010 /// <summary> 2998 /// <summary>
@@ -3031,17 +3019,16 @@ namespace OpenSim.Region.Framework.Scenes
3031 if (!UUID.TryParse(sound, out soundID)) 3019 if (!UUID.TryParse(sound, out soundID))
3032 { 3020 {
3033 // search sound file from inventory 3021 // search sound file from inventory
3034 lock (TaskInventory) 3022 TaskInventory.LockItemsForRead(true);
3023 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
3035 { 3024 {
3036 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) 3025 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound)
3037 { 3026 {
3038 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) 3027 soundID = item.Value.ItemID;
3039 { 3028 break;
3040 soundID = item.Value.ItemID;
3041 break;
3042 }
3043 } 3029 }
3044 } 3030 }
3031 TaskInventory.LockItemsForRead(false);
3045 } 3032 }
3046 3033
3047 if (soundID == UUID.Zero) 3034 if (soundID == UUID.Zero)
@@ -3477,7 +3464,7 @@ namespace OpenSim.Region.Framework.Scenes
3477 3464
3478 public void StopLookAt() 3465 public void StopLookAt()
3479 { 3466 {
3480 m_parentGroup.stopLookAt(); 3467 m_parentGroup.stopLookAt(); // This calls method in SceneObjectGroup.
3481 3468
3482 m_parentGroup.ScheduleGroupForTerseUpdate(); 3469 m_parentGroup.ScheduleGroupForTerseUpdate();
3483 } 3470 }