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.cs155
1 files changed, 79 insertions, 76 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 59fd805..7403fed 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);
@@ -453,12 +454,16 @@ namespace OpenSim.Region.Framework.Scenes
453 } 454 }
454 455
455 /// <value> 456 /// <value>
456 /// Access should be via Inventory directly - this property temporarily remains for xml serialization purposes 457 /// Get the inventory list
457 /// </value> 458 /// </value>
458 public TaskInventoryDictionary TaskInventory 459 public TaskInventoryDictionary TaskInventory
459 { 460 {
460 get { return m_inventory.Items; } 461 get {
461 set { m_inventory.Items = value; } 462 return m_inventory.Items;
463 }
464 set {
465 m_inventory.Items = value;
466 }
462 } 467 }
463 468
464 public uint ObjectFlags 469 public uint ObjectFlags
@@ -587,14 +592,12 @@ namespace OpenSim.Region.Framework.Scenes
587 set { m_LoopSoundSlavePrims = value; } 592 set { m_LoopSoundSlavePrims = value; }
588 } 593 }
589 594
590 [XmlIgnore]
591 public Byte[] TextureAnimation 595 public Byte[] TextureAnimation
592 { 596 {
593 get { return m_TextureAnimation; } 597 get { return m_TextureAnimation; }
594 set { m_TextureAnimation = value; } 598 set { m_TextureAnimation = value; }
595 } 599 }
596 600
597 [XmlIgnore]
598 public Byte[] ParticleSystem 601 public Byte[] ParticleSystem
599 { 602 {
600 get { return m_particleSystem; } 603 get { return m_particleSystem; }
@@ -648,7 +651,6 @@ namespace OpenSim.Region.Framework.Scenes
648 set 651 set
649 { 652 {
650 m_groupPosition = value; 653 m_groupPosition = value;
651
652 PhysicsActor actor = PhysActor; 654 PhysicsActor actor = PhysActor;
653 if (actor != null) 655 if (actor != null)
654 { 656 {
@@ -835,7 +837,16 @@ namespace OpenSim.Region.Framework.Scenes
835 /// <summary></summary> 837 /// <summary></summary>
836 public Vector3 Acceleration 838 public Vector3 Acceleration
837 { 839 {
838 get { return m_acceleration; } 840 get
841 {
842 PhysicsActor actor = PhysActor;
843 if (actor != null)
844 {
845 m_acceleration = actor.Acceleration;
846 }
847 return m_acceleration;
848 }
849
839 set { m_acceleration = value; } 850 set { m_acceleration = value; }
840 } 851 }
841 852
@@ -986,7 +997,8 @@ namespace OpenSim.Region.Framework.Scenes
986 if (IsAttachment) 997 if (IsAttachment)
987 return GroupPosition; 998 return GroupPosition;
988 999
989 return m_offsetPosition + m_groupPosition; } 1000// return m_offsetPosition + m_groupPosition; }
1001 return m_groupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset) ; } //KF: Rotation was ignored!
990 } 1002 }
991 1003
992 public SceneObjectGroup ParentGroup 1004 public SceneObjectGroup ParentGroup
@@ -1137,6 +1149,13 @@ namespace OpenSim.Region.Framework.Scenes
1137 get { return _flags; } 1149 get { return _flags; }
1138 set { _flags = value; } 1150 set { _flags = value; }
1139 } 1151 }
1152
1153 [XmlIgnore]
1154 public bool IsOccupied // KF If an av is sittingon this prim
1155 {
1156 get { return m_occupied; }
1157 set { m_occupied = value; }
1158 }
1140 1159
1141 [XmlIgnore] 1160 [XmlIgnore]
1142 public UUID SitTargetAvatar 1161 public UUID SitTargetAvatar
@@ -1212,14 +1231,6 @@ namespace OpenSim.Region.Framework.Scenes
1212 } 1231 }
1213 } 1232 }
1214 1233
1215 /// <summary>
1216 /// Clear all pending updates of parts to clients
1217 /// </summary>
1218 private void ClearUpdateSchedule()
1219 {
1220 m_updateFlag = 0;
1221 }
1222
1223 private void SendObjectPropertiesToClient(UUID AgentID) 1234 private void SendObjectPropertiesToClient(UUID AgentID)
1224 { 1235 {
1225 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) 1236 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
@@ -1731,7 +1742,7 @@ namespace OpenSim.Region.Framework.Scenes
1731 // which stops client-side interpolation of deactivated joint proxy objects. 1742 // which stops client-side interpolation of deactivated joint proxy objects.
1732 } 1743 }
1733 1744
1734 if (!UsePhysics && !isNew) 1745 if (!UsePhysics)
1735 { 1746 {
1736 // reset velocity to 0 on physics switch-off. Without that, the client thinks the 1747 // reset velocity to 0 on physics switch-off. Without that, the client thinks the
1737 // prim still has velocity and continues to interpolate its position along the old 1748 // prim still has velocity and continues to interpolate its position along the old
@@ -1966,12 +1977,17 @@ namespace OpenSim.Region.Framework.Scenes
1966 public Vector3 GetWorldPosition() 1977 public Vector3 GetWorldPosition()
1967 { 1978 {
1968 Quaternion parentRot = ParentGroup.RootPart.RotationOffset; 1979 Quaternion parentRot = ParentGroup.RootPart.RotationOffset;
1969
1970 Vector3 axPos = OffsetPosition; 1980 Vector3 axPos = OffsetPosition;
1971
1972 axPos *= parentRot; 1981 axPos *= parentRot;
1973 Vector3 translationOffsetPosition = axPos; 1982 Vector3 translationOffsetPosition = axPos;
1974 return GroupPosition + translationOffsetPosition; 1983 if(_parentID == 0)
1984 {
1985 return GroupPosition;
1986 }
1987 else
1988 {
1989 return ParentGroup.AbsolutePosition + translationOffsetPosition; //KF: Fix child prim position
1990 }
1975 } 1991 }
1976 1992
1977 /// <summary> 1993 /// <summary>
@@ -1982,7 +1998,7 @@ namespace OpenSim.Region.Framework.Scenes
1982 { 1998 {
1983 Quaternion newRot; 1999 Quaternion newRot;
1984 2000
1985 if (this.LinkNum == 0) 2001 if (this.LinkNum < 2) //KF Single or root prim
1986 { 2002 {
1987 newRot = RotationOffset; 2003 newRot = RotationOffset;
1988 } 2004 }
@@ -2628,17 +2644,18 @@ namespace OpenSim.Region.Framework.Scenes
2628 //Trys to fetch sound id from prim's inventory. 2644 //Trys to fetch sound id from prim's inventory.
2629 //Prim's inventory doesn't support non script items yet 2645 //Prim's inventory doesn't support non script items yet
2630 2646
2631 lock (TaskInventory) 2647 TaskInventory.LockItemsForRead(true);
2648
2649 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
2632 { 2650 {
2633 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) 2651 if (item.Value.Name == sound)
2634 { 2652 {
2635 if (item.Value.Name == sound) 2653 soundID = item.Value.ItemID;
2636 { 2654 break;
2637 soundID = item.Value.ItemID;
2638 break;
2639 }
2640 } 2655 }
2641 } 2656 }
2657
2658 TaskInventory.LockItemsForRead(false);
2642 } 2659 }
2643 2660
2644 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) 2661 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp)
@@ -2707,38 +2724,7 @@ namespace OpenSim.Region.Framework.Scenes
2707 2724
2708 public void RotLookAt(Quaternion target, float strength, float damping) 2725 public void RotLookAt(Quaternion target, float strength, float damping)
2709 { 2726 {
2710 rotLookAt(target, strength, damping); 2727 m_parentGroup.rotLookAt(target, strength, damping); // This calls method in SceneObjectGroup.
2711 }
2712
2713 public void rotLookAt(Quaternion target, float strength, float damping)
2714 {
2715 if (IsAttachment)
2716 {
2717 /*
2718 ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar);
2719 if (avatar != null)
2720 {
2721 Rotate the Av?
2722 } */
2723 }
2724 else
2725 {
2726 APIDDamp = damping;
2727 APIDStrength = strength;
2728 APIDTarget = target;
2729 }
2730 }
2731
2732 public void startLookAt(Quaternion rot, float damp, float strength)
2733 {
2734 APIDDamp = damp;
2735 APIDStrength = strength;
2736 APIDTarget = rot;
2737 }
2738
2739 public void stopLookAt()
2740 {
2741 APIDTarget = Quaternion.Identity;
2742 } 2728 }
2743 2729
2744 /// <summary> 2730 /// <summary>
@@ -2750,7 +2736,10 @@ namespace OpenSim.Region.Framework.Scenes
2750 2736
2751 if (m_parentGroup != null) 2737 if (m_parentGroup != null)
2752 { 2738 {
2753 m_parentGroup.QueueForUpdateCheck(); 2739 if (!m_parentGroup.areUpdatesSuspended)
2740 {
2741 m_parentGroup.QueueForUpdateCheck();
2742 }
2754 } 2743 }
2755 2744
2756 int timeNow = Util.UnixTimeSinceEpoch(); 2745 int timeNow = Util.UnixTimeSinceEpoch();
@@ -2967,8 +2956,8 @@ namespace OpenSim.Region.Framework.Scenes
2967 { 2956 {
2968 const float ROTATION_TOLERANCE = 0.01f; 2957 const float ROTATION_TOLERANCE = 0.01f;
2969 const float VELOCITY_TOLERANCE = 0.001f; 2958 const float VELOCITY_TOLERANCE = 0.001f;
2970 const float POSITION_TOLERANCE = 0.05f; 2959 const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary
2971 const int TIME_MS_TOLERANCE = 3000; 2960 const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds.
2972 2961
2973 if (m_updateFlag == 1) 2962 if (m_updateFlag == 1)
2974 { 2963 {
@@ -2982,7 +2971,7 @@ namespace OpenSim.Region.Framework.Scenes
2982 Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) 2971 Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE)
2983 { 2972 {
2984 AddTerseUpdateToAllAvatars(); 2973 AddTerseUpdateToAllAvatars();
2985 ClearUpdateSchedule(); 2974
2986 2975
2987 // This causes the Scene to 'poll' physical objects every couple of frames 2976 // This causes the Scene to 'poll' physical objects every couple of frames
2988 // bad, so it's been replaced by an event driven method. 2977 // bad, so it's been replaced by an event driven method.
@@ -3000,16 +2989,18 @@ namespace OpenSim.Region.Framework.Scenes
3000 m_lastAngularVelocity = AngularVelocity; 2989 m_lastAngularVelocity = AngularVelocity;
3001 m_lastTerseSent = Environment.TickCount; 2990 m_lastTerseSent = Environment.TickCount;
3002 } 2991 }
2992 //Moved this outside of the if clause so updates don't get blocked.. *sigh*
2993 m_updateFlag = 0; //Why were we calling a function to do this? Inefficient! *screams*
3003 } 2994 }
3004 else 2995 else
3005 { 2996 {
3006 if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes 2997 if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes
3007 { 2998 {
3008 AddFullUpdateToAllAvatars(); 2999 AddFullUpdateToAllAvatars();
3009 ClearUpdateSchedule(); 3000 m_updateFlag = 0; //Same here
3010 } 3001 }
3011 } 3002 }
3012 ClearUpdateSchedule(); 3003 m_updateFlag = 0;
3013 } 3004 }
3014 3005
3015 /// <summary> 3006 /// <summary>
@@ -3036,17 +3027,16 @@ namespace OpenSim.Region.Framework.Scenes
3036 if (!UUID.TryParse(sound, out soundID)) 3027 if (!UUID.TryParse(sound, out soundID))
3037 { 3028 {
3038 // search sound file from inventory 3029 // search sound file from inventory
3039 lock (TaskInventory) 3030 TaskInventory.LockItemsForRead(true);
3031 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
3040 { 3032 {
3041 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) 3033 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound)
3042 { 3034 {
3043 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) 3035 soundID = item.Value.ItemID;
3044 { 3036 break;
3045 soundID = item.Value.ItemID;
3046 break;
3047 }
3048 } 3037 }
3049 } 3038 }
3039 TaskInventory.LockItemsForRead(false);
3050 } 3040 }
3051 3041
3052 if (soundID == UUID.Zero) 3042 if (soundID == UUID.Zero)
@@ -3481,7 +3471,7 @@ namespace OpenSim.Region.Framework.Scenes
3481 3471
3482 public void StopLookAt() 3472 public void StopLookAt()
3483 { 3473 {
3484 m_parentGroup.stopLookAt(); 3474 m_parentGroup.stopLookAt(); // This calls method in SceneObjectGroup.
3485 3475
3486 m_parentGroup.ScheduleGroupForTerseUpdate(); 3476 m_parentGroup.ScheduleGroupForTerseUpdate();
3487 } 3477 }
@@ -4475,8 +4465,9 @@ namespace OpenSim.Region.Framework.Scenes
4475 { 4465 {
4476 m_shape.TextureEntry = textureEntry; 4466 m_shape.TextureEntry = textureEntry;
4477 TriggerScriptChangedEvent(Changed.TEXTURE); 4467 TriggerScriptChangedEvent(Changed.TEXTURE);
4478 4468 m_updateFlag = 1;
4479 ParentGroup.HasGroupChanged = true; 4469 ParentGroup.HasGroupChanged = true;
4470
4480 //This is madness.. 4471 //This is madness..
4481 //ParentGroup.ScheduleGroupForFullUpdate(); 4472 //ParentGroup.ScheduleGroupForFullUpdate();
4482 //This is sparta 4473 //This is sparta
@@ -4721,5 +4712,17 @@ namespace OpenSim.Region.Framework.Scenes
4721 Color color = Color; 4712 Color color = Color;
4722 return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A)); 4713 return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A));
4723 } 4714 }
4715
4716 public void ResetOwnerChangeFlag()
4717 {
4718 List<UUID> inv = Inventory.GetInventoryList();
4719
4720 foreach (UUID itemID in inv)
4721 {
4722 TaskInventoryItem item = Inventory.GetInventoryItem(itemID);
4723 item.OwnerChanged = false;
4724 Inventory.UpdateInventoryItem(item);
4725 }
4726 }
4724 } 4727 }
4725} 4728}