diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 153 |
1 files changed, 78 insertions, 75 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 38b2dc2..e4a36ef 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) |
@@ -1962,12 +1973,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
1962 | public Vector3 GetWorldPosition() | 1973 | public Vector3 GetWorldPosition() |
1963 | { | 1974 | { |
1964 | Quaternion parentRot = ParentGroup.RootPart.RotationOffset; | 1975 | Quaternion parentRot = ParentGroup.RootPart.RotationOffset; |
1965 | |||
1966 | Vector3 axPos = OffsetPosition; | 1976 | Vector3 axPos = OffsetPosition; |
1967 | |||
1968 | axPos *= parentRot; | 1977 | axPos *= parentRot; |
1969 | Vector3 translationOffsetPosition = axPos; | 1978 | Vector3 translationOffsetPosition = axPos; |
1970 | return GroupPosition + translationOffsetPosition; | 1979 | if(_parentID == 0) |
1980 | { | ||
1981 | return GroupPosition; | ||
1982 | } | ||
1983 | else | ||
1984 | { | ||
1985 | return ParentGroup.AbsolutePosition + translationOffsetPosition; //KF: Fix child prim position | ||
1986 | } | ||
1971 | } | 1987 | } |
1972 | 1988 | ||
1973 | /// <summary> | 1989 | /// <summary> |
@@ -1978,7 +1994,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1978 | { | 1994 | { |
1979 | Quaternion newRot; | 1995 | Quaternion newRot; |
1980 | 1996 | ||
1981 | if (this.LinkNum == 0) | 1997 | if (this.LinkNum < 2) //KF Single or root prim |
1982 | { | 1998 | { |
1983 | newRot = RotationOffset; | 1999 | newRot = RotationOffset; |
1984 | } | 2000 | } |
@@ -2624,17 +2640,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2624 | //Trys to fetch sound id from prim's inventory. | 2640 | //Trys to fetch sound id from prim's inventory. |
2625 | //Prim's inventory doesn't support non script items yet | 2641 | //Prim's inventory doesn't support non script items yet |
2626 | 2642 | ||
2627 | lock (TaskInventory) | 2643 | TaskInventory.LockItemsForRead(true); |
2644 | |||
2645 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | ||
2628 | { | 2646 | { |
2629 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | 2647 | if (item.Value.Name == sound) |
2630 | { | 2648 | { |
2631 | if (item.Value.Name == sound) | 2649 | soundID = item.Value.ItemID; |
2632 | { | 2650 | break; |
2633 | soundID = item.Value.ItemID; | ||
2634 | break; | ||
2635 | } | ||
2636 | } | 2651 | } |
2637 | } | 2652 | } |
2653 | |||
2654 | TaskInventory.LockItemsForRead(false); | ||
2638 | } | 2655 | } |
2639 | 2656 | ||
2640 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) | 2657 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) |
@@ -2703,38 +2720,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2703 | 2720 | ||
2704 | public void RotLookAt(Quaternion target, float strength, float damping) | 2721 | public void RotLookAt(Quaternion target, float strength, float damping) |
2705 | { | 2722 | { |
2706 | rotLookAt(target, strength, damping); | 2723 | m_parentGroup.rotLookAt(target, strength, damping); // This calls method in SceneObjectGroup. |
2707 | } | ||
2708 | |||
2709 | public void rotLookAt(Quaternion target, float strength, float damping) | ||
2710 | { | ||
2711 | if (IsAttachment) | ||
2712 | { | ||
2713 | /* | ||
2714 | ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar); | ||
2715 | if (avatar != null) | ||
2716 | { | ||
2717 | Rotate the Av? | ||
2718 | } */ | ||
2719 | } | ||
2720 | else | ||
2721 | { | ||
2722 | APIDDamp = damping; | ||
2723 | APIDStrength = strength; | ||
2724 | APIDTarget = target; | ||
2725 | } | ||
2726 | } | ||
2727 | |||
2728 | public void startLookAt(Quaternion rot, float damp, float strength) | ||
2729 | { | ||
2730 | APIDDamp = damp; | ||
2731 | APIDStrength = strength; | ||
2732 | APIDTarget = rot; | ||
2733 | } | ||
2734 | |||
2735 | public void stopLookAt() | ||
2736 | { | ||
2737 | APIDTarget = Quaternion.Identity; | ||
2738 | } | 2724 | } |
2739 | 2725 | ||
2740 | /// <summary> | 2726 | /// <summary> |
@@ -2746,7 +2732,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2746 | 2732 | ||
2747 | if (m_parentGroup != null) | 2733 | if (m_parentGroup != null) |
2748 | { | 2734 | { |
2749 | m_parentGroup.QueueForUpdateCheck(); | 2735 | if (!m_parentGroup.areUpdatesSuspended) |
2736 | { | ||
2737 | m_parentGroup.QueueForUpdateCheck(); | ||
2738 | } | ||
2750 | } | 2739 | } |
2751 | 2740 | ||
2752 | int timeNow = Util.UnixTimeSinceEpoch(); | 2741 | int timeNow = Util.UnixTimeSinceEpoch(); |
@@ -2963,8 +2952,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2963 | { | 2952 | { |
2964 | const float ROTATION_TOLERANCE = 0.01f; | 2953 | const float ROTATION_TOLERANCE = 0.01f; |
2965 | const float VELOCITY_TOLERANCE = 0.001f; | 2954 | const float VELOCITY_TOLERANCE = 0.001f; |
2966 | const float POSITION_TOLERANCE = 0.05f; | 2955 | const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary |
2967 | const int TIME_MS_TOLERANCE = 3000; | 2956 | const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds. |
2968 | 2957 | ||
2969 | if (m_updateFlag == 1) | 2958 | if (m_updateFlag == 1) |
2970 | { | 2959 | { |
@@ -2978,7 +2967,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2978 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) | 2967 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) |
2979 | { | 2968 | { |
2980 | AddTerseUpdateToAllAvatars(); | 2969 | AddTerseUpdateToAllAvatars(); |
2981 | ClearUpdateSchedule(); | 2970 | |
2982 | 2971 | ||
2983 | // This causes the Scene to 'poll' physical objects every couple of frames | 2972 | // This causes the Scene to 'poll' physical objects every couple of frames |
2984 | // bad, so it's been replaced by an event driven method. | 2973 | // bad, so it's been replaced by an event driven method. |
@@ -2996,16 +2985,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2996 | m_lastAngularVelocity = AngularVelocity; | 2985 | m_lastAngularVelocity = AngularVelocity; |
2997 | m_lastTerseSent = Environment.TickCount; | 2986 | m_lastTerseSent = Environment.TickCount; |
2998 | } | 2987 | } |
2988 | //Moved this outside of the if clause so updates don't get blocked.. *sigh* | ||
2989 | m_updateFlag = 0; //Why were we calling a function to do this? Inefficient! *screams* | ||
2999 | } | 2990 | } |
3000 | else | 2991 | else |
3001 | { | 2992 | { |
3002 | if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes | 2993 | if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes |
3003 | { | 2994 | { |
3004 | AddFullUpdateToAllAvatars(); | 2995 | AddFullUpdateToAllAvatars(); |
3005 | ClearUpdateSchedule(); | 2996 | m_updateFlag = 0; //Same here |
3006 | } | 2997 | } |
3007 | } | 2998 | } |
3008 | ClearUpdateSchedule(); | 2999 | m_updateFlag = 0; |
3009 | } | 3000 | } |
3010 | 3001 | ||
3011 | /// <summary> | 3002 | /// <summary> |
@@ -3032,17 +3023,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3032 | if (!UUID.TryParse(sound, out soundID)) | 3023 | if (!UUID.TryParse(sound, out soundID)) |
3033 | { | 3024 | { |
3034 | // search sound file from inventory | 3025 | // search sound file from inventory |
3035 | lock (TaskInventory) | 3026 | TaskInventory.LockItemsForRead(true); |
3027 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | ||
3036 | { | 3028 | { |
3037 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | 3029 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) |
3038 | { | 3030 | { |
3039 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) | 3031 | soundID = item.Value.ItemID; |
3040 | { | 3032 | break; |
3041 | soundID = item.Value.ItemID; | ||
3042 | break; | ||
3043 | } | ||
3044 | } | 3033 | } |
3045 | } | 3034 | } |
3035 | TaskInventory.LockItemsForRead(false); | ||
3046 | } | 3036 | } |
3047 | 3037 | ||
3048 | if (soundID == UUID.Zero) | 3038 | if (soundID == UUID.Zero) |
@@ -3477,7 +3467,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3477 | 3467 | ||
3478 | public void StopLookAt() | 3468 | public void StopLookAt() |
3479 | { | 3469 | { |
3480 | m_parentGroup.stopLookAt(); | 3470 | m_parentGroup.stopLookAt(); // This calls method in SceneObjectGroup. |
3481 | 3471 | ||
3482 | m_parentGroup.ScheduleGroupForTerseUpdate(); | 3472 | m_parentGroup.ScheduleGroupForTerseUpdate(); |
3483 | } | 3473 | } |
@@ -4471,8 +4461,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
4471 | { | 4461 | { |
4472 | m_shape.TextureEntry = textureEntry; | 4462 | m_shape.TextureEntry = textureEntry; |
4473 | TriggerScriptChangedEvent(Changed.TEXTURE); | 4463 | TriggerScriptChangedEvent(Changed.TEXTURE); |
4474 | 4464 | m_updateFlag = 1; | |
4475 | ParentGroup.HasGroupChanged = true; | 4465 | ParentGroup.HasGroupChanged = true; |
4466 | |||
4476 | //This is madness.. | 4467 | //This is madness.. |
4477 | //ParentGroup.ScheduleGroupForFullUpdate(); | 4468 | //ParentGroup.ScheduleGroupForFullUpdate(); |
4478 | //This is sparta | 4469 | //This is sparta |
@@ -4717,5 +4708,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
4717 | Color color = Color; | 4708 | Color color = Color; |
4718 | return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A)); | 4709 | return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A)); |
4719 | } | 4710 | } |
4711 | |||
4712 | public void ResetOwnerChangeFlag() | ||
4713 | { | ||
4714 | List<UUID> inv = Inventory.GetInventoryList(); | ||
4715 | |||
4716 | foreach (UUID itemID in inv) | ||
4717 | { | ||
4718 | TaskInventoryItem item = Inventory.GetInventoryItem(itemID); | ||
4719 | item.OwnerChanged = false; | ||
4720 | Inventory.UpdateInventoryItem(item); | ||
4721 | } | ||
4722 | } | ||
4720 | } | 4723 | } |
4721 | } | 4724 | } |