diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 161 |
1 files changed, 85 insertions, 76 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 59fd805..09c945b 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 | { |
@@ -709,6 +711,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
709 | // Tell the physics engines that this prim changed. | 711 | // Tell the physics engines that this prim changed. |
710 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); | 712 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); |
711 | } | 713 | } |
714 | |||
715 | List<ScenePresence> avs = ParentGroup.GetLinkedAvatars(); | ||
716 | foreach (ScenePresence av in avs) | ||
717 | { | ||
718 | av.SendFullUpdateToAllClients(); | ||
719 | } | ||
712 | } | 720 | } |
713 | } | 721 | } |
714 | } | 722 | } |
@@ -835,7 +843,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
835 | /// <summary></summary> | 843 | /// <summary></summary> |
836 | public Vector3 Acceleration | 844 | public Vector3 Acceleration |
837 | { | 845 | { |
838 | get { return m_acceleration; } | 846 | get |
847 | { | ||
848 | PhysicsActor actor = PhysActor; | ||
849 | if (actor != null) | ||
850 | { | ||
851 | m_acceleration = actor.Acceleration; | ||
852 | } | ||
853 | return m_acceleration; | ||
854 | } | ||
855 | |||
839 | set { m_acceleration = value; } | 856 | set { m_acceleration = value; } |
840 | } | 857 | } |
841 | 858 | ||
@@ -986,7 +1003,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
986 | if (IsAttachment) | 1003 | if (IsAttachment) |
987 | return GroupPosition; | 1004 | return GroupPosition; |
988 | 1005 | ||
989 | return m_offsetPosition + m_groupPosition; } | 1006 | // return m_offsetPosition + m_groupPosition; } |
1007 | return m_groupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset) ; } //KF: Rotation was ignored! | ||
990 | } | 1008 | } |
991 | 1009 | ||
992 | public SceneObjectGroup ParentGroup | 1010 | public SceneObjectGroup ParentGroup |
@@ -1137,6 +1155,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1137 | get { return _flags; } | 1155 | get { return _flags; } |
1138 | set { _flags = value; } | 1156 | set { _flags = value; } |
1139 | } | 1157 | } |
1158 | |||
1159 | [XmlIgnore] | ||
1160 | public bool IsOccupied // KF If an av is sittingon this prim | ||
1161 | { | ||
1162 | get { return m_occupied; } | ||
1163 | set { m_occupied = value; } | ||
1164 | } | ||
1140 | 1165 | ||
1141 | [XmlIgnore] | 1166 | [XmlIgnore] |
1142 | public UUID SitTargetAvatar | 1167 | public UUID SitTargetAvatar |
@@ -1212,14 +1237,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1212 | } | 1237 | } |
1213 | } | 1238 | } |
1214 | 1239 | ||
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) | 1240 | private void SendObjectPropertiesToClient(UUID AgentID) |
1224 | { | 1241 | { |
1225 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) | 1242 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) |
@@ -1731,7 +1748,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1731 | // which stops client-side interpolation of deactivated joint proxy objects. | 1748 | // which stops client-side interpolation of deactivated joint proxy objects. |
1732 | } | 1749 | } |
1733 | 1750 | ||
1734 | if (!UsePhysics && !isNew) | 1751 | if (!UsePhysics) |
1735 | { | 1752 | { |
1736 | // reset velocity to 0 on physics switch-off. Without that, the client thinks the | 1753 | // 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 | 1754 | // prim still has velocity and continues to interpolate its position along the old |
@@ -1966,12 +1983,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
1966 | public Vector3 GetWorldPosition() | 1983 | public Vector3 GetWorldPosition() |
1967 | { | 1984 | { |
1968 | Quaternion parentRot = ParentGroup.RootPart.RotationOffset; | 1985 | Quaternion parentRot = ParentGroup.RootPart.RotationOffset; |
1969 | |||
1970 | Vector3 axPos = OffsetPosition; | 1986 | Vector3 axPos = OffsetPosition; |
1971 | |||
1972 | axPos *= parentRot; | 1987 | axPos *= parentRot; |
1973 | Vector3 translationOffsetPosition = axPos; | 1988 | Vector3 translationOffsetPosition = axPos; |
1974 | return GroupPosition + translationOffsetPosition; | 1989 | if(_parentID == 0) |
1990 | { | ||
1991 | return GroupPosition; | ||
1992 | } | ||
1993 | else | ||
1994 | { | ||
1995 | return ParentGroup.AbsolutePosition + translationOffsetPosition; //KF: Fix child prim position | ||
1996 | } | ||
1975 | } | 1997 | } |
1976 | 1998 | ||
1977 | /// <summary> | 1999 | /// <summary> |
@@ -1982,7 +2004,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1982 | { | 2004 | { |
1983 | Quaternion newRot; | 2005 | Quaternion newRot; |
1984 | 2006 | ||
1985 | if (this.LinkNum == 0) | 2007 | if (this.LinkNum < 2) //KF Single or root prim |
1986 | { | 2008 | { |
1987 | newRot = RotationOffset; | 2009 | newRot = RotationOffset; |
1988 | } | 2010 | } |
@@ -2628,17 +2650,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2628 | //Trys to fetch sound id from prim's inventory. | 2650 | //Trys to fetch sound id from prim's inventory. |
2629 | //Prim's inventory doesn't support non script items yet | 2651 | //Prim's inventory doesn't support non script items yet |
2630 | 2652 | ||
2631 | lock (TaskInventory) | 2653 | TaskInventory.LockItemsForRead(true); |
2654 | |||
2655 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | ||
2632 | { | 2656 | { |
2633 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | 2657 | if (item.Value.Name == sound) |
2634 | { | 2658 | { |
2635 | if (item.Value.Name == sound) | 2659 | soundID = item.Value.ItemID; |
2636 | { | 2660 | break; |
2637 | soundID = item.Value.ItemID; | ||
2638 | break; | ||
2639 | } | ||
2640 | } | 2661 | } |
2641 | } | 2662 | } |
2663 | |||
2664 | TaskInventory.LockItemsForRead(false); | ||
2642 | } | 2665 | } |
2643 | 2666 | ||
2644 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) | 2667 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) |
@@ -2707,38 +2730,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2707 | 2730 | ||
2708 | public void RotLookAt(Quaternion target, float strength, float damping) | 2731 | public void RotLookAt(Quaternion target, float strength, float damping) |
2709 | { | 2732 | { |
2710 | rotLookAt(target, strength, damping); | 2733 | 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 | } | 2734 | } |
2743 | 2735 | ||
2744 | /// <summary> | 2736 | /// <summary> |
@@ -2750,7 +2742,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2750 | 2742 | ||
2751 | if (m_parentGroup != null) | 2743 | if (m_parentGroup != null) |
2752 | { | 2744 | { |
2753 | m_parentGroup.QueueForUpdateCheck(); | 2745 | if (!m_parentGroup.areUpdatesSuspended) |
2746 | { | ||
2747 | m_parentGroup.QueueForUpdateCheck(); | ||
2748 | } | ||
2754 | } | 2749 | } |
2755 | 2750 | ||
2756 | int timeNow = Util.UnixTimeSinceEpoch(); | 2751 | int timeNow = Util.UnixTimeSinceEpoch(); |
@@ -2967,8 +2962,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2967 | { | 2962 | { |
2968 | const float ROTATION_TOLERANCE = 0.01f; | 2963 | const float ROTATION_TOLERANCE = 0.01f; |
2969 | const float VELOCITY_TOLERANCE = 0.001f; | 2964 | const float VELOCITY_TOLERANCE = 0.001f; |
2970 | const float POSITION_TOLERANCE = 0.05f; | 2965 | const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary |
2971 | const int TIME_MS_TOLERANCE = 3000; | 2966 | const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds. |
2972 | 2967 | ||
2973 | if (m_updateFlag == 1) | 2968 | if (m_updateFlag == 1) |
2974 | { | 2969 | { |
@@ -2982,7 +2977,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2982 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) | 2977 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) |
2983 | { | 2978 | { |
2984 | AddTerseUpdateToAllAvatars(); | 2979 | AddTerseUpdateToAllAvatars(); |
2985 | ClearUpdateSchedule(); | 2980 | |
2986 | 2981 | ||
2987 | // This causes the Scene to 'poll' physical objects every couple of frames | 2982 | // This causes the Scene to 'poll' physical objects every couple of frames |
2988 | // bad, so it's been replaced by an event driven method. | 2983 | // bad, so it's been replaced by an event driven method. |
@@ -3000,16 +2995,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
3000 | m_lastAngularVelocity = AngularVelocity; | 2995 | m_lastAngularVelocity = AngularVelocity; |
3001 | m_lastTerseSent = Environment.TickCount; | 2996 | m_lastTerseSent = Environment.TickCount; |
3002 | } | 2997 | } |
2998 | //Moved this outside of the if clause so updates don't get blocked.. *sigh* | ||
2999 | m_updateFlag = 0; //Why were we calling a function to do this? Inefficient! *screams* | ||
3003 | } | 3000 | } |
3004 | else | 3001 | else |
3005 | { | 3002 | { |
3006 | if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes | 3003 | if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes |
3007 | { | 3004 | { |
3008 | AddFullUpdateToAllAvatars(); | 3005 | AddFullUpdateToAllAvatars(); |
3009 | ClearUpdateSchedule(); | 3006 | m_updateFlag = 0; //Same here |
3010 | } | 3007 | } |
3011 | } | 3008 | } |
3012 | ClearUpdateSchedule(); | 3009 | m_updateFlag = 0; |
3013 | } | 3010 | } |
3014 | 3011 | ||
3015 | /// <summary> | 3012 | /// <summary> |
@@ -3036,17 +3033,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3036 | if (!UUID.TryParse(sound, out soundID)) | 3033 | if (!UUID.TryParse(sound, out soundID)) |
3037 | { | 3034 | { |
3038 | // search sound file from inventory | 3035 | // search sound file from inventory |
3039 | lock (TaskInventory) | 3036 | TaskInventory.LockItemsForRead(true); |
3037 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | ||
3040 | { | 3038 | { |
3041 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | 3039 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) |
3042 | { | 3040 | { |
3043 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) | 3041 | soundID = item.Value.ItemID; |
3044 | { | 3042 | break; |
3045 | soundID = item.Value.ItemID; | ||
3046 | break; | ||
3047 | } | ||
3048 | } | 3043 | } |
3049 | } | 3044 | } |
3045 | TaskInventory.LockItemsForRead(false); | ||
3050 | } | 3046 | } |
3051 | 3047 | ||
3052 | if (soundID == UUID.Zero) | 3048 | if (soundID == UUID.Zero) |
@@ -3481,7 +3477,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3481 | 3477 | ||
3482 | public void StopLookAt() | 3478 | public void StopLookAt() |
3483 | { | 3479 | { |
3484 | m_parentGroup.stopLookAt(); | 3480 | m_parentGroup.stopLookAt(); // This calls method in SceneObjectGroup. |
3485 | 3481 | ||
3486 | m_parentGroup.ScheduleGroupForTerseUpdate(); | 3482 | m_parentGroup.ScheduleGroupForTerseUpdate(); |
3487 | } | 3483 | } |
@@ -4475,8 +4471,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
4475 | { | 4471 | { |
4476 | m_shape.TextureEntry = textureEntry; | 4472 | m_shape.TextureEntry = textureEntry; |
4477 | TriggerScriptChangedEvent(Changed.TEXTURE); | 4473 | TriggerScriptChangedEvent(Changed.TEXTURE); |
4478 | 4474 | m_updateFlag = 1; | |
4479 | ParentGroup.HasGroupChanged = true; | 4475 | ParentGroup.HasGroupChanged = true; |
4476 | |||
4480 | //This is madness.. | 4477 | //This is madness.. |
4481 | //ParentGroup.ScheduleGroupForFullUpdate(); | 4478 | //ParentGroup.ScheduleGroupForFullUpdate(); |
4482 | //This is sparta | 4479 | //This is sparta |
@@ -4721,5 +4718,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
4721 | Color color = Color; | 4718 | Color color = Color; |
4722 | return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A)); | 4719 | return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A)); |
4723 | } | 4720 | } |
4721 | |||
4722 | public void ResetOwnerChangeFlag() | ||
4723 | { | ||
4724 | List<UUID> inv = Inventory.GetInventoryList(); | ||
4725 | |||
4726 | foreach (UUID itemID in inv) | ||
4727 | { | ||
4728 | TaskInventoryItem item = Inventory.GetInventoryItem(itemID); | ||
4729 | item.OwnerChanged = false; | ||
4730 | Inventory.UpdateInventoryItem(item); | ||
4731 | } | ||
4732 | } | ||
4724 | } | 4733 | } |
4725 | } | 4734 | } |