diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 101 |
1 files changed, 64 insertions, 37 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index dd797fc..11682d9 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -135,7 +135,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
135 | 135 | ||
136 | // TODO: This needs to be persisted in next XML version update! | 136 | // TODO: This needs to be persisted in next XML version update! |
137 | [XmlIgnore] | 137 | [XmlIgnore] |
138 | public readonly int[] PayPrice = {-2,-2,-2,-2,-2}; | 138 | public int[] PayPrice = {-2,-2,-2,-2,-2}; |
139 | [XmlIgnore] | 139 | [XmlIgnore] |
140 | public PhysicsActor PhysActor; | 140 | public PhysicsActor PhysActor; |
141 | 141 | ||
@@ -250,6 +250,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
250 | private Quaternion m_sitTargetOrientation = Quaternion.Identity; | 250 | private Quaternion m_sitTargetOrientation = Quaternion.Identity; |
251 | private Vector3 m_sitTargetPosition; | 251 | private Vector3 m_sitTargetPosition; |
252 | private string m_sitAnimation = "SIT"; | 252 | private string m_sitAnimation = "SIT"; |
253 | private bool m_occupied; // KF if any av is sitting on this prim | ||
253 | private string m_text = String.Empty; | 254 | private string m_text = String.Empty; |
254 | private string m_touchName = String.Empty; | 255 | private string m_touchName = String.Empty; |
255 | private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5); | 256 | private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5); |
@@ -427,12 +428,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
427 | } | 428 | } |
428 | 429 | ||
429 | /// <value> | 430 | /// <value> |
430 | /// Access should be via Inventory directly - this property temporarily remains for xml serialization purposes | 431 | /// Get the inventory list |
431 | /// </value> | 432 | /// </value> |
432 | public TaskInventoryDictionary TaskInventory | 433 | public TaskInventoryDictionary TaskInventory |
433 | { | 434 | { |
434 | get { return m_inventory.Items; } | 435 | get { |
435 | set { m_inventory.Items = value; } | 436 | return m_inventory.Items; |
437 | } | ||
438 | set { | ||
439 | m_inventory.Items = value; | ||
440 | } | ||
436 | } | 441 | } |
437 | 442 | ||
438 | public uint ObjectFlags | 443 | public uint ObjectFlags |
@@ -576,7 +581,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
576 | StoreUndoState(); | 581 | StoreUndoState(); |
577 | 582 | ||
578 | m_groupPosition = value; | 583 | m_groupPosition = value; |
579 | |||
580 | PhysicsActor actor = PhysActor; | 584 | PhysicsActor actor = PhysActor; |
581 | if (actor != null) | 585 | if (actor != null) |
582 | { | 586 | { |
@@ -889,7 +893,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
889 | if (IsAttachment) | 893 | if (IsAttachment) |
890 | return GroupPosition; | 894 | return GroupPosition; |
891 | 895 | ||
892 | return m_offsetPosition + m_groupPosition; } | 896 | // return m_offsetPosition + m_groupPosition; } |
897 | return m_groupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset) ; } //KF: Rotation was ignored! | ||
893 | } | 898 | } |
894 | 899 | ||
895 | public SceneObjectGroup ParentGroup | 900 | public SceneObjectGroup ParentGroup |
@@ -1041,6 +1046,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1041 | get { return _flags; } | 1046 | get { return _flags; } |
1042 | set { _flags = value; } | 1047 | set { _flags = value; } |
1043 | } | 1048 | } |
1049 | |||
1050 | [XmlIgnore] | ||
1051 | public bool IsOccupied // KF If an av is sittingon this prim | ||
1052 | { | ||
1053 | get { return m_occupied; } | ||
1054 | set { m_occupied = value; } | ||
1055 | } | ||
1044 | 1056 | ||
1045 | [XmlIgnore] | 1057 | [XmlIgnore] |
1046 | public UUID SitTargetAvatar | 1058 | public UUID SitTargetAvatar |
@@ -1116,14 +1128,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1116 | } | 1128 | } |
1117 | } | 1129 | } |
1118 | 1130 | ||
1119 | /// <summary> | ||
1120 | /// Clear all pending updates of parts to clients | ||
1121 | /// </summary> | ||
1122 | private void ClearUpdateSchedule() | ||
1123 | { | ||
1124 | m_updateFlag = 0; | ||
1125 | } | ||
1126 | |||
1127 | private void SendObjectPropertiesToClient(UUID AgentID) | 1131 | private void SendObjectPropertiesToClient(UUID AgentID) |
1128 | { | 1132 | { |
1129 | ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); | 1133 | ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); |
@@ -1802,12 +1806,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
1802 | public Vector3 GetWorldPosition() | 1806 | public Vector3 GetWorldPosition() |
1803 | { | 1807 | { |
1804 | Quaternion parentRot = ParentGroup.RootPart.RotationOffset; | 1808 | Quaternion parentRot = ParentGroup.RootPart.RotationOffset; |
1805 | |||
1806 | Vector3 axPos = OffsetPosition; | 1809 | Vector3 axPos = OffsetPosition; |
1807 | |||
1808 | axPos *= parentRot; | 1810 | axPos *= parentRot; |
1809 | Vector3 translationOffsetPosition = axPos; | 1811 | Vector3 translationOffsetPosition = axPos; |
1810 | return GroupPosition + translationOffsetPosition; | 1812 | if(_parentID == 0) |
1813 | { | ||
1814 | return GroupPosition; | ||
1815 | } | ||
1816 | else | ||
1817 | { | ||
1818 | return ParentGroup.AbsolutePosition + translationOffsetPosition; //KF: Fix child prim position | ||
1819 | } | ||
1811 | } | 1820 | } |
1812 | 1821 | ||
1813 | /// <summary> | 1822 | /// <summary> |
@@ -1818,7 +1827,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1818 | { | 1827 | { |
1819 | Quaternion newRot; | 1828 | Quaternion newRot; |
1820 | 1829 | ||
1821 | if (this.LinkNum == 0) | 1830 | if (this.LinkNum < 2) //KF Single or root prim |
1822 | { | 1831 | { |
1823 | newRot = RotationOffset; | 1832 | newRot = RotationOffset; |
1824 | } | 1833 | } |
@@ -2475,17 +2484,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2475 | //Trys to fetch sound id from prim's inventory. | 2484 | //Trys to fetch sound id from prim's inventory. |
2476 | //Prim's inventory doesn't support non script items yet | 2485 | //Prim's inventory doesn't support non script items yet |
2477 | 2486 | ||
2478 | lock (TaskInventory) | 2487 | TaskInventory.LockItemsForRead(true); |
2488 | |||
2489 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | ||
2479 | { | 2490 | { |
2480 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | 2491 | if (item.Value.Name == sound) |
2481 | { | 2492 | { |
2482 | if (item.Value.Name == sound) | 2493 | soundID = item.Value.ItemID; |
2483 | { | 2494 | break; |
2484 | soundID = item.Value.ItemID; | ||
2485 | break; | ||
2486 | } | ||
2487 | } | 2495 | } |
2488 | } | 2496 | } |
2497 | |||
2498 | TaskInventory.LockItemsForRead(false); | ||
2489 | } | 2499 | } |
2490 | 2500 | ||
2491 | List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); | 2501 | List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); |
@@ -2762,8 +2772,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2762 | { | 2772 | { |
2763 | const float ROTATION_TOLERANCE = 0.01f; | 2773 | const float ROTATION_TOLERANCE = 0.01f; |
2764 | const float VELOCITY_TOLERANCE = 0.001f; | 2774 | const float VELOCITY_TOLERANCE = 0.001f; |
2765 | const float POSITION_TOLERANCE = 0.05f; | 2775 | const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary |
2766 | const int TIME_MS_TOLERANCE = 3000; | 2776 | const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds. |
2767 | 2777 | ||
2768 | if (m_updateFlag == 1) | 2778 | if (m_updateFlag == 1) |
2769 | { | 2779 | { |
@@ -2777,7 +2787,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2777 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) | 2787 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) |
2778 | { | 2788 | { |
2779 | AddTerseUpdateToAllAvatars(); | 2789 | AddTerseUpdateToAllAvatars(); |
2780 | ClearUpdateSchedule(); | 2790 | |
2781 | 2791 | ||
2782 | // This causes the Scene to 'poll' physical objects every couple of frames | 2792 | // This causes the Scene to 'poll' physical objects every couple of frames |
2783 | // bad, so it's been replaced by an event driven method. | 2793 | // bad, so it's been replaced by an event driven method. |
@@ -2795,16 +2805,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2795 | m_lastAngularVelocity = AngularVelocity; | 2805 | m_lastAngularVelocity = AngularVelocity; |
2796 | m_lastTerseSent = Environment.TickCount; | 2806 | m_lastTerseSent = Environment.TickCount; |
2797 | } | 2807 | } |
2808 | //Moved this outside of the if clause so updates don't get blocked.. *sigh* | ||
2809 | m_updateFlag = 0; //Why were we calling a function to do this? Inefficient! *screams* | ||
2798 | } | 2810 | } |
2799 | else | 2811 | else |
2800 | { | 2812 | { |
2801 | if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes | 2813 | if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes |
2802 | { | 2814 | { |
2803 | AddFullUpdateToAllAvatars(); | 2815 | AddFullUpdateToAllAvatars(); |
2804 | ClearUpdateSchedule(); | 2816 | m_updateFlag = 0; //Same here |
2805 | } | 2817 | } |
2806 | } | 2818 | } |
2807 | ClearUpdateSchedule(); | 2819 | m_updateFlag = 0; |
2808 | } | 2820 | } |
2809 | 2821 | ||
2810 | /// <summary> | 2822 | /// <summary> |
@@ -2831,17 +2843,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2831 | if (!UUID.TryParse(sound, out soundID)) | 2843 | if (!UUID.TryParse(sound, out soundID)) |
2832 | { | 2844 | { |
2833 | // search sound file from inventory | 2845 | // search sound file from inventory |
2834 | lock (TaskInventory) | 2846 | TaskInventory.LockItemsForRead(true); |
2847 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | ||
2835 | { | 2848 | { |
2836 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | 2849 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) |
2837 | { | 2850 | { |
2838 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) | 2851 | soundID = item.Value.ItemID; |
2839 | { | 2852 | break; |
2840 | soundID = item.Value.ItemID; | ||
2841 | break; | ||
2842 | } | ||
2843 | } | 2853 | } |
2844 | } | 2854 | } |
2855 | TaskInventory.LockItemsForRead(false); | ||
2845 | } | 2856 | } |
2846 | 2857 | ||
2847 | if (soundID == UUID.Zero) | 2858 | if (soundID == UUID.Zero) |
@@ -2983,6 +2994,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
2983 | PhysActor.VehicleRotationParam(param, rotation); | 2994 | PhysActor.VehicleRotationParam(param, rotation); |
2984 | } | 2995 | } |
2985 | } | 2996 | } |
2997 | |||
2998 | public void SetVehicleFlags(int flags) | ||
2999 | { | ||
3000 | if (PhysActor != null) | ||
3001 | { | ||
3002 | PhysActor.VehicleFlagsSet(flags); | ||
3003 | } | ||
3004 | } | ||
3005 | |||
3006 | public void RemoveVehicleFlags(int flags) | ||
3007 | { | ||
3008 | if (PhysActor != null) | ||
3009 | { | ||
3010 | PhysActor.VehicleFlagsRemove(flags); | ||
3011 | } | ||
3012 | } | ||
2986 | 3013 | ||
2987 | /// <summary> | 3014 | /// <summary> |
2988 | /// Set the color of prim faces | 3015 | /// Set the color of prim faces |