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.cs145
1 files changed, 72 insertions, 73 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index b36b9bf..c84596b 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 {
@@ -834,7 +836,16 @@ namespace OpenSim.Region.Framework.Scenes
834 /// <summary></summary> 836 /// <summary></summary>
835 public Vector3 Acceleration 837 public Vector3 Acceleration
836 { 838 {
837 get { return m_acceleration; } 839 get
840 {
841 PhysicsActor actor = PhysActor;
842 if (actor != null)
843 {
844 m_acceleration = actor.Acceleration;
845 }
846 return m_acceleration;
847 }
848
838 set { m_acceleration = value; } 849 set { m_acceleration = value; }
839 } 850 }
840 851
@@ -978,7 +989,8 @@ namespace OpenSim.Region.Framework.Scenes
978 if (IsAttachment) 989 if (IsAttachment)
979 return GroupPosition; 990 return GroupPosition;
980 991
981 return m_offsetPosition + m_groupPosition; } 992// return m_offsetPosition + m_groupPosition; }
993 return m_groupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset) ; } //KF: Rotation was ignored!
982 } 994 }
983 995
984 public SceneObjectGroup ParentGroup 996 public SceneObjectGroup ParentGroup
@@ -1129,6 +1141,13 @@ namespace OpenSim.Region.Framework.Scenes
1129 get { return _flags; } 1141 get { return _flags; }
1130 set { _flags = value; } 1142 set { _flags = value; }
1131 } 1143 }
1144
1145 [XmlIgnore]
1146 public bool IsOccupied // KF If an av is sittingon this prim
1147 {
1148 get { return m_occupied; }
1149 set { m_occupied = value; }
1150 }
1132 1151
1133 [XmlIgnore] 1152 [XmlIgnore]
1134 public UUID SitTargetAvatar 1153 public UUID SitTargetAvatar
@@ -1204,14 +1223,6 @@ namespace OpenSim.Region.Framework.Scenes
1204 } 1223 }
1205 } 1224 }
1206 1225
1207 /// <summary>
1208 /// Clear all pending updates of parts to clients
1209 /// </summary>
1210 private void ClearUpdateSchedule()
1211 {
1212 m_updateFlag = 0;
1213 }
1214
1215 private void SendObjectPropertiesToClient(UUID AgentID) 1226 private void SendObjectPropertiesToClient(UUID AgentID)
1216 { 1227 {
1217 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) 1228 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
@@ -1954,12 +1965,17 @@ namespace OpenSim.Region.Framework.Scenes
1954 public Vector3 GetWorldPosition() 1965 public Vector3 GetWorldPosition()
1955 { 1966 {
1956 Quaternion parentRot = ParentGroup.RootPart.RotationOffset; 1967 Quaternion parentRot = ParentGroup.RootPart.RotationOffset;
1957
1958 Vector3 axPos = OffsetPosition; 1968 Vector3 axPos = OffsetPosition;
1959
1960 axPos *= parentRot; 1969 axPos *= parentRot;
1961 Vector3 translationOffsetPosition = axPos; 1970 Vector3 translationOffsetPosition = axPos;
1962 return GroupPosition + translationOffsetPosition; 1971 if(_parentID == 0)
1972 {
1973 return GroupPosition;
1974 }
1975 else
1976 {
1977 return ParentGroup.AbsolutePosition + translationOffsetPosition; //KF: Fix child prim position
1978 }
1963 } 1979 }
1964 1980
1965 /// <summary> 1981 /// <summary>
@@ -1970,7 +1986,7 @@ namespace OpenSim.Region.Framework.Scenes
1970 { 1986 {
1971 Quaternion newRot; 1987 Quaternion newRot;
1972 1988
1973 if (this.LinkNum == 0) 1989 if (this.LinkNum < 2) //KF Single or root prim
1974 { 1990 {
1975 newRot = RotationOffset; 1991 newRot = RotationOffset;
1976 } 1992 }
@@ -2616,17 +2632,18 @@ namespace OpenSim.Region.Framework.Scenes
2616 //Trys to fetch sound id from prim's inventory. 2632 //Trys to fetch sound id from prim's inventory.
2617 //Prim's inventory doesn't support non script items yet 2633 //Prim's inventory doesn't support non script items yet
2618 2634
2619 lock (TaskInventory) 2635 TaskInventory.LockItemsForRead(true);
2636
2637 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
2620 { 2638 {
2621 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) 2639 if (item.Value.Name == sound)
2622 { 2640 {
2623 if (item.Value.Name == sound) 2641 soundID = item.Value.ItemID;
2624 { 2642 break;
2625 soundID = item.Value.ItemID;
2626 break;
2627 }
2628 } 2643 }
2629 } 2644 }
2645
2646 TaskInventory.LockItemsForRead(false);
2630 } 2647 }
2631 2648
2632 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) 2649 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp)
@@ -2695,38 +2712,7 @@ namespace OpenSim.Region.Framework.Scenes
2695 2712
2696 public void RotLookAt(Quaternion target, float strength, float damping) 2713 public void RotLookAt(Quaternion target, float strength, float damping)
2697 { 2714 {
2698 rotLookAt(target, strength, damping); 2715 m_parentGroup.rotLookAt(target, strength, damping); // This calls method in SceneObjectGroup.
2699 }
2700
2701 public void rotLookAt(Quaternion target, float strength, float damping)
2702 {
2703 if (IsAttachment)
2704 {
2705 /*
2706 ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar);
2707 if (avatar != null)
2708 {
2709 Rotate the Av?
2710 } */
2711 }
2712 else
2713 {
2714 APIDDamp = damping;
2715 APIDStrength = strength;
2716 APIDTarget = target;
2717 }
2718 }
2719
2720 public void startLookAt(Quaternion rot, float damp, float strength)
2721 {
2722 APIDDamp = damp;
2723 APIDStrength = strength;
2724 APIDTarget = rot;
2725 }
2726
2727 public void stopLookAt()
2728 {
2729 APIDTarget = Quaternion.Identity;
2730 } 2716 }
2731 2717
2732 /// <summary> 2718 /// <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)
@@ -3469,7 +3456,7 @@ namespace OpenSim.Region.Framework.Scenes
3469 3456
3470 public void StopLookAt() 3457 public void StopLookAt()
3471 { 3458 {
3472 m_parentGroup.stopLookAt(); 3459 m_parentGroup.stopLookAt(); // This calls method in SceneObjectGroup.
3473 3460
3474 m_parentGroup.ScheduleGroupForTerseUpdate(); 3461 m_parentGroup.ScheduleGroupForTerseUpdate();
3475 } 3462 }
@@ -4709,5 +4696,17 @@ namespace OpenSim.Region.Framework.Scenes
4709 Color color = Color; 4696 Color color = Color;
4710 return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A)); 4697 return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A));
4711 } 4698 }
4699
4700 public void ResetOwnerChangeFlag()
4701 {
4702 List<UUID> inv = Inventory.GetInventoryList();
4703
4704 foreach (UUID itemID in inv)
4705 {
4706 TaskInventoryItem item = Inventory.GetInventoryItem(itemID);
4707 item.OwnerChanged = false;
4708 Inventory.UpdateInventoryItem(item);
4709 }
4710 }
4712 } 4711 }
4713} 4712}