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 71c8018..d174d04 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)
@@ -1951,12 +1962,17 @@ namespace OpenSim.Region.Framework.Scenes
1951 public Vector3 GetWorldPosition() 1962 public Vector3 GetWorldPosition()
1952 { 1963 {
1953 Quaternion parentRot = ParentGroup.RootPart.RotationOffset; 1964 Quaternion parentRot = ParentGroup.RootPart.RotationOffset;
1954
1955 Vector3 axPos = OffsetPosition; 1965 Vector3 axPos = OffsetPosition;
1956
1957 axPos *= parentRot; 1966 axPos *= parentRot;
1958 Vector3 translationOffsetPosition = axPos; 1967 Vector3 translationOffsetPosition = axPos;
1959 return GroupPosition + translationOffsetPosition; 1968 if(_parentID == 0)
1969 {
1970 return GroupPosition;
1971 }
1972 else
1973 {
1974 return ParentGroup.AbsolutePosition + translationOffsetPosition; //KF: Fix child prim position
1975 }
1960 } 1976 }
1961 1977
1962 /// <summary> 1978 /// <summary>
@@ -1967,7 +1983,7 @@ namespace OpenSim.Region.Framework.Scenes
1967 { 1983 {
1968 Quaternion newRot; 1984 Quaternion newRot;
1969 1985
1970 if (this.LinkNum == 0) 1986 if (this.LinkNum < 2) //KF Single or root prim
1971 { 1987 {
1972 newRot = RotationOffset; 1988 newRot = RotationOffset;
1973 } 1989 }
@@ -2613,17 +2629,18 @@ namespace OpenSim.Region.Framework.Scenes
2613 //Trys to fetch sound id from prim's inventory. 2629 //Trys to fetch sound id from prim's inventory.
2614 //Prim's inventory doesn't support non script items yet 2630 //Prim's inventory doesn't support non script items yet
2615 2631
2616 lock (TaskInventory) 2632 TaskInventory.LockItemsForRead(true);
2633
2634 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
2617 { 2635 {
2618 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) 2636 if (item.Value.Name == sound)
2619 { 2637 {
2620 if (item.Value.Name == sound) 2638 soundID = item.Value.ItemID;
2621 { 2639 break;
2622 soundID = item.Value.ItemID;
2623 break;
2624 }
2625 } 2640 }
2626 } 2641 }
2642
2643 TaskInventory.LockItemsForRead(false);
2627 } 2644 }
2628 2645
2629 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) 2646 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp)
@@ -2692,38 +2709,7 @@ namespace OpenSim.Region.Framework.Scenes
2692 2709
2693 public void RotLookAt(Quaternion target, float strength, float damping) 2710 public void RotLookAt(Quaternion target, float strength, float damping)
2694 { 2711 {
2695 rotLookAt(target, strength, damping); 2712 m_parentGroup.rotLookAt(target, strength, damping); // This calls method in SceneObjectGroup.
2696 }
2697
2698 public void rotLookAt(Quaternion target, float strength, float damping)
2699 {
2700 if (IsAttachment)
2701 {
2702 /*
2703 ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar);
2704 if (avatar != null)
2705 {
2706 Rotate the Av?
2707 } */
2708 }
2709 else
2710 {
2711 APIDDamp = damping;
2712 APIDStrength = strength;
2713 APIDTarget = target;
2714 }
2715 }
2716
2717 public void startLookAt(Quaternion rot, float damp, float strength)
2718 {
2719 APIDDamp = damp;
2720 APIDStrength = strength;
2721 APIDTarget = rot;
2722 }
2723
2724 public void stopLookAt()
2725 {
2726 APIDTarget = Quaternion.Identity;
2727 } 2713 }
2728 2714
2729 /// <summary> 2715 /// <summary>
@@ -2952,8 +2938,8 @@ namespace OpenSim.Region.Framework.Scenes
2952 { 2938 {
2953 const float ROTATION_TOLERANCE = 0.01f; 2939 const float ROTATION_TOLERANCE = 0.01f;
2954 const float VELOCITY_TOLERANCE = 0.001f; 2940 const float VELOCITY_TOLERANCE = 0.001f;
2955 const float POSITION_TOLERANCE = 0.05f; 2941 const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary
2956 const int TIME_MS_TOLERANCE = 3000; 2942 const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds.
2957 2943
2958 if (m_updateFlag == 1) 2944 if (m_updateFlag == 1)
2959 { 2945 {
@@ -2967,7 +2953,7 @@ namespace OpenSim.Region.Framework.Scenes
2967 Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) 2953 Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE)
2968 { 2954 {
2969 AddTerseUpdateToAllAvatars(); 2955 AddTerseUpdateToAllAvatars();
2970 ClearUpdateSchedule(); 2956
2971 2957
2972 // This causes the Scene to 'poll' physical objects every couple of frames 2958 // This causes the Scene to 'poll' physical objects every couple of frames
2973 // bad, so it's been replaced by an event driven method. 2959 // bad, so it's been replaced by an event driven method.
@@ -2985,16 +2971,18 @@ namespace OpenSim.Region.Framework.Scenes
2985 m_lastAngularVelocity = AngularVelocity; 2971 m_lastAngularVelocity = AngularVelocity;
2986 m_lastTerseSent = Environment.TickCount; 2972 m_lastTerseSent = Environment.TickCount;
2987 } 2973 }
2974 //Moved this outside of the if clause so updates don't get blocked.. *sigh*
2975 m_updateFlag = 0; //Why were we calling a function to do this? Inefficient! *screams*
2988 } 2976 }
2989 else 2977 else
2990 { 2978 {
2991 if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes 2979 if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes
2992 { 2980 {
2993 AddFullUpdateToAllAvatars(); 2981 AddFullUpdateToAllAvatars();
2994 ClearUpdateSchedule(); 2982 m_updateFlag = 0; //Same here
2995 } 2983 }
2996 } 2984 }
2997 ClearUpdateSchedule(); 2985 m_updateFlag = 0;
2998 } 2986 }
2999 2987
3000 /// <summary> 2988 /// <summary>
@@ -3021,17 +3009,16 @@ namespace OpenSim.Region.Framework.Scenes
3021 if (!UUID.TryParse(sound, out soundID)) 3009 if (!UUID.TryParse(sound, out soundID))
3022 { 3010 {
3023 // search sound file from inventory 3011 // search sound file from inventory
3024 lock (TaskInventory) 3012 TaskInventory.LockItemsForRead(true);
3013 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
3025 { 3014 {
3026 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) 3015 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound)
3027 { 3016 {
3028 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) 3017 soundID = item.Value.ItemID;
3029 { 3018 break;
3030 soundID = item.Value.ItemID;
3031 break;
3032 }
3033 } 3019 }
3034 } 3020 }
3021 TaskInventory.LockItemsForRead(false);
3035 } 3022 }
3036 3023
3037 if (soundID == UUID.Zero) 3024 if (soundID == UUID.Zero)
@@ -3466,7 +3453,7 @@ namespace OpenSim.Region.Framework.Scenes
3466 3453
3467 public void StopLookAt() 3454 public void StopLookAt()
3468 { 3455 {
3469 m_parentGroup.stopLookAt(); 3456 m_parentGroup.stopLookAt(); // This calls method in SceneObjectGroup.
3470 3457
3471 m_parentGroup.ScheduleGroupForTerseUpdate(); 3458 m_parentGroup.ScheduleGroupForTerseUpdate();
3472 } 3459 }
@@ -4706,5 +4693,17 @@ namespace OpenSim.Region.Framework.Scenes
4706 Color color = Color; 4693 Color color = Color;
4707 return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A)); 4694 return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A));
4708 } 4695 }
4696
4697 public void ResetOwnerChangeFlag()
4698 {
4699 List<UUID> inv = Inventory.GetInventoryList();
4700
4701 foreach (UUID itemID in inv)
4702 {
4703 TaskInventoryItem item = Inventory.GetInventoryItem(itemID);
4704 item.OwnerChanged = false;
4705 Inventory.UpdateInventoryItem(item);
4706 }
4707 }
4709 } 4708 }
4710} 4709}