diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 103 |
1 files changed, 64 insertions, 39 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 5c283bc..57635f5 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 | { |
@@ -960,7 +962,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
960 | if (IsAttachment) | 962 | if (IsAttachment) |
961 | return GroupPosition; | 963 | return GroupPosition; |
962 | 964 | ||
963 | return m_offsetPosition + m_groupPosition; } | 965 | // return m_offsetPosition + m_groupPosition; } |
966 | return m_groupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset) ; } //KF: Rotation was ignored! | ||
964 | } | 967 | } |
965 | 968 | ||
966 | public SceneObjectGroup ParentGroup | 969 | public SceneObjectGroup ParentGroup |
@@ -1112,6 +1115,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1112 | get { return _flags; } | 1115 | get { return _flags; } |
1113 | set { _flags = value; } | 1116 | set { _flags = value; } |
1114 | } | 1117 | } |
1118 | |||
1119 | [XmlIgnore] | ||
1120 | public bool IsOccupied // KF If an av is sittingon this prim | ||
1121 | { | ||
1122 | get { return m_occupied; } | ||
1123 | set { m_occupied = value; } | ||
1124 | } | ||
1115 | 1125 | ||
1116 | [XmlIgnore] | 1126 | [XmlIgnore] |
1117 | public UUID SitTargetAvatar | 1127 | public UUID SitTargetAvatar |
@@ -1187,14 +1197,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1187 | } | 1197 | } |
1188 | } | 1198 | } |
1189 | 1199 | ||
1190 | /// <summary> | ||
1191 | /// Clear all pending updates of parts to clients | ||
1192 | /// </summary> | ||
1193 | private void ClearUpdateSchedule() | ||
1194 | { | ||
1195 | m_updateFlag = 0; | ||
1196 | } | ||
1197 | |||
1198 | private void SendObjectPropertiesToClient(UUID AgentID) | 1200 | private void SendObjectPropertiesToClient(UUID AgentID) |
1199 | { | 1201 | { |
1200 | ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); | 1202 | ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); |
@@ -1937,12 +1939,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
1937 | public Vector3 GetWorldPosition() | 1939 | public Vector3 GetWorldPosition() |
1938 | { | 1940 | { |
1939 | Quaternion parentRot = ParentGroup.RootPart.RotationOffset; | 1941 | Quaternion parentRot = ParentGroup.RootPart.RotationOffset; |
1940 | |||
1941 | Vector3 axPos = OffsetPosition; | 1942 | Vector3 axPos = OffsetPosition; |
1942 | |||
1943 | axPos *= parentRot; | 1943 | axPos *= parentRot; |
1944 | Vector3 translationOffsetPosition = axPos; | 1944 | Vector3 translationOffsetPosition = axPos; |
1945 | return GroupPosition + translationOffsetPosition; | 1945 | if(_parentID == 0) |
1946 | { | ||
1947 | return GroupPosition; | ||
1948 | } | ||
1949 | else | ||
1950 | { | ||
1951 | return ParentGroup.AbsolutePosition + translationOffsetPosition; //KF: Fix child prim position | ||
1952 | } | ||
1946 | } | 1953 | } |
1947 | 1954 | ||
1948 | /// <summary> | 1955 | /// <summary> |
@@ -1953,7 +1960,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1953 | { | 1960 | { |
1954 | Quaternion newRot; | 1961 | Quaternion newRot; |
1955 | 1962 | ||
1956 | if (this.LinkNum == 0) | 1963 | if (this.LinkNum < 2) //KF Single or root prim |
1957 | { | 1964 | { |
1958 | newRot = RotationOffset; | 1965 | newRot = RotationOffset; |
1959 | } | 1966 | } |
@@ -2610,17 +2617,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2610 | //Trys to fetch sound id from prim's inventory. | 2617 | //Trys to fetch sound id from prim's inventory. |
2611 | //Prim's inventory doesn't support non script items yet | 2618 | //Prim's inventory doesn't support non script items yet |
2612 | 2619 | ||
2613 | lock (TaskInventory) | 2620 | TaskInventory.LockItemsForRead(true); |
2621 | |||
2622 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | ||
2614 | { | 2623 | { |
2615 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | 2624 | if (item.Value.Name == sound) |
2616 | { | 2625 | { |
2617 | if (item.Value.Name == sound) | 2626 | soundID = item.Value.ItemID; |
2618 | { | 2627 | break; |
2619 | soundID = item.Value.ItemID; | ||
2620 | break; | ||
2621 | } | ||
2622 | } | 2628 | } |
2623 | } | 2629 | } |
2630 | |||
2631 | TaskInventory.LockItemsForRead(false); | ||
2624 | } | 2632 | } |
2625 | 2633 | ||
2626 | List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); | 2634 | List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); |
@@ -2927,8 +2935,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2927 | { | 2935 | { |
2928 | const float ROTATION_TOLERANCE = 0.01f; | 2936 | const float ROTATION_TOLERANCE = 0.01f; |
2929 | const float VELOCITY_TOLERANCE = 0.001f; | 2937 | const float VELOCITY_TOLERANCE = 0.001f; |
2930 | const float POSITION_TOLERANCE = 0.05f; | 2938 | const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary |
2931 | const int TIME_MS_TOLERANCE = 3000; | 2939 | const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds. |
2932 | 2940 | ||
2933 | if (m_updateFlag == 1) | 2941 | if (m_updateFlag == 1) |
2934 | { | 2942 | { |
@@ -2942,7 +2950,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2942 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) | 2950 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) |
2943 | { | 2951 | { |
2944 | AddTerseUpdateToAllAvatars(); | 2952 | AddTerseUpdateToAllAvatars(); |
2945 | ClearUpdateSchedule(); | 2953 | |
2946 | 2954 | ||
2947 | // This causes the Scene to 'poll' physical objects every couple of frames | 2955 | // This causes the Scene to 'poll' physical objects every couple of frames |
2948 | // bad, so it's been replaced by an event driven method. | 2956 | // bad, so it's been replaced by an event driven method. |
@@ -2960,16 +2968,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2960 | m_lastAngularVelocity = AngularVelocity; | 2968 | m_lastAngularVelocity = AngularVelocity; |
2961 | m_lastTerseSent = Environment.TickCount; | 2969 | m_lastTerseSent = Environment.TickCount; |
2962 | } | 2970 | } |
2971 | //Moved this outside of the if clause so updates don't get blocked.. *sigh* | ||
2972 | m_updateFlag = 0; //Why were we calling a function to do this? Inefficient! *screams* | ||
2963 | } | 2973 | } |
2964 | else | 2974 | else |
2965 | { | 2975 | { |
2966 | if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes | 2976 | if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes |
2967 | { | 2977 | { |
2968 | AddFullUpdateToAllAvatars(); | 2978 | AddFullUpdateToAllAvatars(); |
2969 | ClearUpdateSchedule(); | 2979 | m_updateFlag = 0; //Same here |
2970 | } | 2980 | } |
2971 | } | 2981 | } |
2972 | ClearUpdateSchedule(); | 2982 | m_updateFlag = 0; |
2973 | } | 2983 | } |
2974 | 2984 | ||
2975 | /// <summary> | 2985 | /// <summary> |
@@ -2996,17 +3006,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2996 | if (!UUID.TryParse(sound, out soundID)) | 3006 | if (!UUID.TryParse(sound, out soundID)) |
2997 | { | 3007 | { |
2998 | // search sound file from inventory | 3008 | // search sound file from inventory |
2999 | lock (TaskInventory) | 3009 | TaskInventory.LockItemsForRead(true); |
3010 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | ||
3000 | { | 3011 | { |
3001 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | 3012 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) |
3002 | { | 3013 | { |
3003 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) | 3014 | soundID = item.Value.ItemID; |
3004 | { | 3015 | break; |
3005 | soundID = item.Value.ItemID; | ||
3006 | break; | ||
3007 | } | ||
3008 | } | 3016 | } |
3009 | } | 3017 | } |
3018 | TaskInventory.LockItemsForRead(false); | ||
3010 | } | 3019 | } |
3011 | 3020 | ||
3012 | if (soundID == UUID.Zero) | 3021 | if (soundID == UUID.Zero) |
@@ -3189,6 +3198,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
3189 | PhysActor.VehicleRotationParam(param, rotation); | 3198 | PhysActor.VehicleRotationParam(param, rotation); |
3190 | } | 3199 | } |
3191 | } | 3200 | } |
3201 | |||
3202 | public void SetVehicleFlags(int flags) | ||
3203 | { | ||
3204 | if (PhysActor != null) | ||
3205 | { | ||
3206 | PhysActor.VehicleFlagsSet(flags); | ||
3207 | } | ||
3208 | } | ||
3209 | |||
3210 | public void RemoveVehicleFlags(int flags) | ||
3211 | { | ||
3212 | if (PhysActor != null) | ||
3213 | { | ||
3214 | PhysActor.VehicleFlagsRemove(flags); | ||
3215 | } | ||
3216 | } | ||
3192 | 3217 | ||
3193 | /// <summary> | 3218 | /// <summary> |
3194 | /// Set the color of prim faces | 3219 | /// Set the color of prim faces |