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.cs334
1 files changed, 251 insertions, 83 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 65905a0..dd9431b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -62,7 +62,8 @@ namespace OpenSim.Region.Framework.Scenes
62 TELEPORT = 512, 62 TELEPORT = 512,
63 REGION_RESTART = 1024, 63 REGION_RESTART = 1024,
64 MEDIA = 2048, 64 MEDIA = 2048,
65 ANIMATION = 16384 65 ANIMATION = 16384,
66 POSITION = 32768
66 } 67 }
67 68
68 // I don't really know where to put this except here. 69 // I don't really know where to put this except here.
@@ -184,6 +185,15 @@ namespace OpenSim.Region.Framework.Scenes
184 185
185 public UUID FromFolderID; 186 public UUID FromFolderID;
186 187
188 // The following two are to hold the attachment data
189 // while an object is inworld
190 [XmlIgnore]
191 public byte AttachPoint = 0;
192
193 [XmlIgnore]
194 public Vector3 AttachOffset = Vector3.Zero;
195
196 [XmlIgnore]
187 public int STATUS_ROTATE_X; 197 public int STATUS_ROTATE_X;
188 198
189 public int STATUS_ROTATE_Y; 199 public int STATUS_ROTATE_Y;
@@ -210,8 +220,7 @@ namespace OpenSim.Region.Framework.Scenes
210 220
211 public Vector3 RotationAxis = Vector3.One; 221 public Vector3 RotationAxis = Vector3.One;
212 222
213 public bool VolumeDetectActive; // XmlIgnore set to avoid problems with persistance until I come to care for this 223 public bool VolumeDetectActive;
214 // Certainly this must be a persistant setting finally
215 224
216 public bool IsWaitingForFirstSpinUpdatePacket; 225 public bool IsWaitingForFirstSpinUpdatePacket;
217 226
@@ -251,6 +260,7 @@ namespace OpenSim.Region.Framework.Scenes
251 private Quaternion m_sitTargetOrientation = Quaternion.Identity; 260 private Quaternion m_sitTargetOrientation = Quaternion.Identity;
252 private Vector3 m_sitTargetPosition; 261 private Vector3 m_sitTargetPosition;
253 private string m_sitAnimation = "SIT"; 262 private string m_sitAnimation = "SIT";
263 private bool m_occupied; // KF if any av is sitting on this prim
254 private string m_text = String.Empty; 264 private string m_text = String.Empty;
255 private string m_touchName = String.Empty; 265 private string m_touchName = String.Empty;
256 private readonly Stack<UndoState> m_undo = new Stack<UndoState>(5); 266 private readonly Stack<UndoState> m_undo = new Stack<UndoState>(5);
@@ -283,6 +293,7 @@ namespace OpenSim.Region.Framework.Scenes
283 protected Vector3 m_lastAcceleration; 293 protected Vector3 m_lastAcceleration;
284 protected Vector3 m_lastAngularVelocity; 294 protected Vector3 m_lastAngularVelocity;
285 protected int m_lastTerseSent; 295 protected int m_lastTerseSent;
296 protected float m_buoyancy = 0.0f;
286 297
287 /// <summary> 298 /// <summary>
288 /// Stores media texture data 299 /// Stores media texture data
@@ -299,6 +310,9 @@ namespace OpenSim.Region.Framework.Scenes
299 private UUID m_collisionSound; 310 private UUID m_collisionSound;
300 private float m_collisionSoundVolume; 311 private float m_collisionSoundVolume;
301 312
313
314 private SOPVehicle m_vehicle = null;
315
302 #endregion Fields 316 #endregion Fields
303 317
304// ~SceneObjectPart() 318// ~SceneObjectPart()
@@ -341,7 +355,7 @@ namespace OpenSim.Region.Framework.Scenes
341 UUID ownerID, PrimitiveBaseShape shape, Vector3 groupPosition, 355 UUID ownerID, PrimitiveBaseShape shape, Vector3 groupPosition,
342 Quaternion rotationOffset, Vector3 offsetPosition) : this() 356 Quaternion rotationOffset, Vector3 offsetPosition) : this()
343 { 357 {
344 m_name = "Primitive"; 358 m_name = "Object";
345 359
346 CreationDate = (int)Utils.DateTimeToUnixTime(Rezzed); 360 CreationDate = (int)Utils.DateTimeToUnixTime(Rezzed);
347 LastOwnerID = CreatorID = OwnerID = ownerID; 361 LastOwnerID = CreatorID = OwnerID = ownerID;
@@ -381,7 +395,7 @@ namespace OpenSim.Region.Framework.Scenes
381 private uint _ownerMask = (uint)PermissionMask.All; 395 private uint _ownerMask = (uint)PermissionMask.All;
382 private uint _groupMask = (uint)PermissionMask.None; 396 private uint _groupMask = (uint)PermissionMask.None;
383 private uint _everyoneMask = (uint)PermissionMask.None; 397 private uint _everyoneMask = (uint)PermissionMask.None;
384 private uint _nextOwnerMask = (uint)PermissionMask.All; 398 private uint _nextOwnerMask = (uint)(PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer);
385 private PrimFlags _flags = PrimFlags.None; 399 private PrimFlags _flags = PrimFlags.None;
386 private DateTime m_expires; 400 private DateTime m_expires;
387 private DateTime m_rezzed; 401 private DateTime m_rezzed;
@@ -475,12 +489,16 @@ namespace OpenSim.Region.Framework.Scenes
475 } 489 }
476 490
477 /// <value> 491 /// <value>
478 /// Access should be via Inventory directly - this property temporarily remains for xml serialization purposes 492 /// Get the inventory list
479 /// </value> 493 /// </value>
480 public TaskInventoryDictionary TaskInventory 494 public TaskInventoryDictionary TaskInventory
481 { 495 {
482 get { return m_inventory.Items; } 496 get {
483 set { m_inventory.Items = value; } 497 return m_inventory.Items;
498 }
499 set {
500 m_inventory.Items = value;
501 }
484 } 502 }
485 503
486 /// <summary> 504 /// <summary>
@@ -624,14 +642,12 @@ namespace OpenSim.Region.Framework.Scenes
624 set { m_LoopSoundSlavePrims = value; } 642 set { m_LoopSoundSlavePrims = value; }
625 } 643 }
626 644
627
628 public Byte[] TextureAnimation 645 public Byte[] TextureAnimation
629 { 646 {
630 get { return m_TextureAnimation; } 647 get { return m_TextureAnimation; }
631 set { m_TextureAnimation = value; } 648 set { m_TextureAnimation = value; }
632 } 649 }
633 650
634
635 public Byte[] ParticleSystem 651 public Byte[] ParticleSystem
636 { 652 {
637 get { return m_particleSystem; } 653 get { return m_particleSystem; }
@@ -668,9 +684,11 @@ namespace OpenSim.Region.Framework.Scenes
668 { 684 {
669 // If this is a linkset, we don't want the physics engine mucking up our group position here. 685 // If this is a linkset, we don't want the physics engine mucking up our group position here.
670 PhysicsActor actor = PhysActor; 686 PhysicsActor actor = PhysActor;
671 if (actor != null && ParentID == 0) 687 if (ParentID == 0)
672 { 688 {
673 m_groupPosition = actor.Position; 689 if (actor != null)
690 m_groupPosition = actor.Position;
691 return m_groupPosition;
674 } 692 }
675 693
676 if (ParentGroup.IsAttachment) 694 if (ParentGroup.IsAttachment)
@@ -680,12 +698,14 @@ namespace OpenSim.Region.Framework.Scenes
680 return sp.AbsolutePosition; 698 return sp.AbsolutePosition;
681 } 699 }
682 700
701 // use root prim's group position. Physics may have updated it
702 if (ParentGroup.RootPart != this)
703 m_groupPosition = ParentGroup.RootPart.GroupPosition;
683 return m_groupPosition; 704 return m_groupPosition;
684 } 705 }
685 set 706 set
686 { 707 {
687 m_groupPosition = value; 708 m_groupPosition = value;
688
689 PhysicsActor actor = PhysActor; 709 PhysicsActor actor = PhysActor;
690 if (actor != null) 710 if (actor != null)
691 { 711 {
@@ -711,16 +731,6 @@ namespace OpenSim.Region.Framework.Scenes
711 m_log.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message); 731 m_log.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message);
712 } 732 }
713 } 733 }
714
715 // TODO if we decide to do sitting in a more SL compatible way (multiple avatars per prim), this has to be fixed, too
716 if (SitTargetAvatar != UUID.Zero)
717 {
718 ScenePresence avatar;
719 if (ParentGroup.Scene.TryGetScenePresence(SitTargetAvatar, out avatar))
720 {
721 avatar.ParentPosition = GetWorldPosition();
722 }
723 }
724 } 734 }
725 } 735 }
726 736
@@ -729,7 +739,7 @@ namespace OpenSim.Region.Framework.Scenes
729 get { return m_offsetPosition; } 739 get { return m_offsetPosition; }
730 set 740 set
731 { 741 {
732// StoreUndoState(); 742 Vector3 oldpos = m_offsetPosition;
733 m_offsetPosition = value; 743 m_offsetPosition = value;
734 744
735 if (ParentGroup != null && !ParentGroup.IsDeleted) 745 if (ParentGroup != null && !ParentGroup.IsDeleted)
@@ -744,7 +754,22 @@ namespace OpenSim.Region.Framework.Scenes
744 if (ParentGroup.Scene != null) 754 if (ParentGroup.Scene != null)
745 ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); 755 ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
746 } 756 }
757
758 if (!m_parentGroup.m_dupeInProgress)
759 {
760 List<ScenePresence> avs = ParentGroup.GetLinkedAvatars();
761 foreach (ScenePresence av in avs)
762 {
763 if (av.ParentID == m_localId)
764 {
765 Vector3 offset = (m_offsetPosition - oldpos);
766 av.AbsolutePosition += offset;
767 av.SendAvatarDataToAllAgents();
768 }
769 }
770 }
747 } 771 }
772 TriggerScriptChangedEvent(Changed.POSITION);
748 } 773 }
749 } 774 }
750 775
@@ -893,7 +918,16 @@ namespace OpenSim.Region.Framework.Scenes
893 /// <summary></summary> 918 /// <summary></summary>
894 public Vector3 Acceleration 919 public Vector3 Acceleration
895 { 920 {
896 get { return m_acceleration; } 921 get
922 {
923 PhysicsActor actor = PhysActor;
924 if (actor != null)
925 {
926 m_acceleration = actor.Acceleration;
927 }
928 return m_acceleration;
929 }
930
897 set { m_acceleration = value; } 931 set { m_acceleration = value; }
898 } 932 }
899 933
@@ -1030,10 +1064,7 @@ namespace OpenSim.Region.Framework.Scenes
1030 { 1064 {
1031 get 1065 get
1032 { 1066 {
1033 if (ParentGroup.IsAttachment) 1067 return GroupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset);
1034 return GroupPosition;
1035
1036 return m_offsetPosition + m_groupPosition;
1037 } 1068 }
1038 } 1069 }
1039 1070
@@ -1203,6 +1234,13 @@ namespace OpenSim.Region.Framework.Scenes
1203 _flags = value; 1234 _flags = value;
1204 } 1235 }
1205 } 1236 }
1237
1238 [XmlIgnore]
1239 public bool IsOccupied // KF If an av is sittingon this prim
1240 {
1241 get { return m_occupied; }
1242 set { m_occupied = value; }
1243 }
1206 1244
1207 /// <summary> 1245 /// <summary>
1208 /// ID of the avatar that is sat on us. If there is no such avatar then is UUID.Zero 1246 /// ID of the avatar that is sat on us. If there is no such avatar then is UUID.Zero
@@ -1262,6 +1300,19 @@ namespace OpenSim.Region.Framework.Scenes
1262 set { m_collisionSoundVolume = value; } 1300 set { m_collisionSoundVolume = value; }
1263 } 1301 }
1264 1302
1303 public float Buoyancy
1304 {
1305 get { return m_buoyancy; }
1306 set
1307 {
1308 m_buoyancy = value;
1309 if (PhysActor != null)
1310 {
1311 PhysActor.Buoyancy = value;
1312 }
1313 }
1314 }
1315
1265 #endregion Public Properties with only Get 1316 #endregion Public Properties with only Get
1266 1317
1267 private uint ApplyMask(uint val, bool set, uint mask) 1318 private uint ApplyMask(uint val, bool set, uint mask)
@@ -1458,7 +1509,8 @@ namespace OpenSim.Region.Framework.Scenes
1458 /// </summary> 1509 /// </summary>
1459 /// <param name="rootObjectFlags"></param> 1510 /// <param name="rootObjectFlags"></param>
1460 /// <param name="VolumeDetectActive"></param> 1511 /// <param name="VolumeDetectActive"></param>
1461 public void ApplyPhysics(uint rootObjectFlags, bool VolumeDetectActive) 1512// public void ApplyPhysics(uint rootObjectFlags, bool VolumeDetectActive)
1513 public void ApplyPhysics(uint rootObjectFlags, bool VolumeDetectActive, bool building)
1462 { 1514 {
1463 if (!ParentGroup.Scene.CollidablePrims) 1515 if (!ParentGroup.Scene.CollidablePrims)
1464 return; 1516 return;
@@ -1487,6 +1539,8 @@ namespace OpenSim.Region.Framework.Scenes
1487 // or flexible 1539 // or flexible
1488 if (!isPhantom && !ParentGroup.IsAttachment && !(Shape.PathCurve == (byte)Extrusion.Flexible)) 1540 if (!isPhantom && !ParentGroup.IsAttachment && !(Shape.PathCurve == (byte)Extrusion.Flexible))
1489 { 1541 {
1542 Vector3 velocity = Velocity;
1543 Vector3 rotationalVelocity = AngularVelocity;
1490 try 1544 try
1491 { 1545 {
1492 PhysActor = ParentGroup.Scene.PhysicsScene.AddPrimShape( 1546 PhysActor = ParentGroup.Scene.PhysicsScene.AddPrimShape(
@@ -1494,7 +1548,8 @@ namespace OpenSim.Region.Framework.Scenes
1494 Shape, 1548 Shape,
1495 AbsolutePosition, 1549 AbsolutePosition,
1496 Scale, 1550 Scale,
1497 RotationOffset, 1551// RotationOffset,
1552 GetWorldRotation(), // physics wants world rotation
1498 RigidBody, 1553 RigidBody,
1499 m_localId); 1554 m_localId);
1500 } 1555 }
@@ -1509,8 +1564,21 @@ namespace OpenSim.Region.Framework.Scenes
1509 { 1564 {
1510 PhysActor.SOPName = this.Name; // save object into the PhysActor so ODE internals know the joint/body info 1565 PhysActor.SOPName = this.Name; // save object into the PhysActor so ODE internals know the joint/body info
1511 PhysActor.SetMaterial(Material); 1566 PhysActor.SetMaterial(Material);
1567
1568 // if root part apply vehicle
1569 if (m_vehicle != null && LocalId == ParentGroup.RootPart.LocalId)
1570 m_vehicle.SetVehicle(PhysActor);
1571
1512 DoPhysicsPropertyUpdate(RigidBody, true); 1572 DoPhysicsPropertyUpdate(RigidBody, true);
1513 PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0); 1573 PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0);
1574
1575 Velocity = velocity;
1576 AngularVelocity = rotationalVelocity;
1577 PhysActor.Velocity = velocity;
1578 PhysActor.RotationalVelocity = rotationalVelocity;
1579
1580 if (!building)
1581 PhysActor.Building = false;
1514 } 1582 }
1515 } 1583 }
1516 } 1584 }
@@ -1582,6 +1650,9 @@ namespace OpenSim.Region.Framework.Scenes
1582 1650
1583 // Move afterwards ResetIDs as it clears the localID 1651 // Move afterwards ResetIDs as it clears the localID
1584 dupe.LocalId = localID; 1652 dupe.LocalId = localID;
1653 if(dupe.PhysActor != null)
1654 dupe.PhysActor.LocalID = localID;
1655
1585 // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. 1656 // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated.
1586 dupe.LastOwnerID = OwnerID; 1657 dupe.LastOwnerID = OwnerID;
1587 1658
@@ -1743,6 +1814,10 @@ namespace OpenSim.Region.Framework.Scenes
1743 if (!isNew) 1814 if (!isNew)
1744 ParentGroup.Scene.RemovePhysicalPrim(1); 1815 ParentGroup.Scene.RemovePhysicalPrim(1);
1745 1816
1817 Velocity = new Vector3(0, 0, 0);
1818 Acceleration = new Vector3(0, 0, 0);
1819 AngularVelocity = new Vector3(0, 0, 0);
1820
1746 PhysActor.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate; 1821 PhysActor.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate;
1747 PhysActor.OnOutOfBounds -= PhysicsOutOfBounds; 1822 PhysActor.OnOutOfBounds -= PhysicsOutOfBounds;
1748 PhysActor.delink(); 1823 PhysActor.delink();
@@ -2564,9 +2639,9 @@ namespace OpenSim.Region.Framework.Scenes
2564 Vector3 newpos = new Vector3(PhysActor.Position.GetBytes(), 0); 2639 Vector3 newpos = new Vector3(PhysActor.Position.GetBytes(), 0);
2565 2640
2566 if (ParentGroup.Scene.TestBorderCross(newpos, Cardinals.N) 2641 if (ParentGroup.Scene.TestBorderCross(newpos, Cardinals.N)
2567 | ParentGroup.Scene.TestBorderCross(newpos, Cardinals.S) 2642 || ParentGroup.Scene.TestBorderCross(newpos, Cardinals.S)
2568 | ParentGroup.Scene.TestBorderCross(newpos, Cardinals.E) 2643 || ParentGroup.Scene.TestBorderCross(newpos, Cardinals.E)
2569 | ParentGroup.Scene.TestBorderCross(newpos, Cardinals.W)) 2644 || ParentGroup.Scene.TestBorderCross(newpos, Cardinals.W))
2570 { 2645 {
2571 ParentGroup.AbsolutePosition = newpos; 2646 ParentGroup.AbsolutePosition = newpos;
2572 return; 2647 return;
@@ -2587,17 +2662,18 @@ namespace OpenSim.Region.Framework.Scenes
2587 //Trys to fetch sound id from prim's inventory. 2662 //Trys to fetch sound id from prim's inventory.
2588 //Prim's inventory doesn't support non script items yet 2663 //Prim's inventory doesn't support non script items yet
2589 2664
2590 lock (TaskInventory) 2665 TaskInventory.LockItemsForRead(true);
2666
2667 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
2591 { 2668 {
2592 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) 2669 if (item.Value.Name == sound)
2593 { 2670 {
2594 if (item.Value.Name == sound) 2671 soundID = item.Value.ItemID;
2595 { 2672 break;
2596 soundID = item.Value.ItemID;
2597 break;
2598 }
2599 } 2673 }
2600 } 2674 }
2675
2676 TaskInventory.LockItemsForRead(false);
2601 } 2677 }
2602 2678
2603 ParentGroup.Scene.ForEachRootScenePresence(delegate(ScenePresence sp) 2679 ParentGroup.Scene.ForEachRootScenePresence(delegate(ScenePresence sp)
@@ -2917,8 +2993,8 @@ namespace OpenSim.Region.Framework.Scenes
2917 { 2993 {
2918 const float ROTATION_TOLERANCE = 0.01f; 2994 const float ROTATION_TOLERANCE = 0.01f;
2919 const float VELOCITY_TOLERANCE = 0.001f; 2995 const float VELOCITY_TOLERANCE = 0.001f;
2920 const float POSITION_TOLERANCE = 0.05f; 2996 const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary
2921 const int TIME_MS_TOLERANCE = 3000; 2997 const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds.
2922 2998
2923 switch (UpdateFlag) 2999 switch (UpdateFlag)
2924 { 3000 {
@@ -2980,17 +3056,16 @@ namespace OpenSim.Region.Framework.Scenes
2980 if (!UUID.TryParse(sound, out soundID)) 3056 if (!UUID.TryParse(sound, out soundID))
2981 { 3057 {
2982 // search sound file from inventory 3058 // search sound file from inventory
2983 lock (TaskInventory) 3059 TaskInventory.LockItemsForRead(true);
3060 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
2984 { 3061 {
2985 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) 3062 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound)
2986 { 3063 {
2987 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) 3064 soundID = item.Value.ItemID;
2988 { 3065 break;
2989 soundID = item.Value.ItemID;
2990 break;
2991 }
2992 } 3066 }
2993 } 3067 }
3068 TaskInventory.LockItemsForRead(false);
2994 } 3069 }
2995 3070
2996 if (soundID == UUID.Zero) 3071 if (soundID == UUID.Zero)
@@ -3112,17 +3187,74 @@ namespace OpenSim.Region.Framework.Scenes
3112 } 3187 }
3113 } 3188 }
3114 3189
3190 public SOPVehicle sopVehicle
3191 {
3192 get
3193 {
3194 return m_vehicle;
3195 }
3196 set
3197 {
3198 m_vehicle = value;
3199 }
3200 }
3201
3202
3203 public int VehicleType
3204 {
3205 get
3206 {
3207 if (m_vehicle == null)
3208 return (int)Vehicle.TYPE_NONE;
3209 else
3210 return (int)m_vehicle.Type;
3211 }
3212 set
3213 {
3214 SetVehicleType(value);
3215 }
3216 }
3217
3115 public void SetVehicleType(int type) 3218 public void SetVehicleType(int type)
3116 { 3219 {
3117 if (PhysActor != null) 3220 m_vehicle = null;
3221
3222 if (type == (int)Vehicle.TYPE_NONE)
3223 {
3224 if (_parentID ==0 && PhysActor != null)
3225 PhysActor.VehicleType = (int)Vehicle.TYPE_NONE;
3226 return;
3227 }
3228 m_vehicle = new SOPVehicle();
3229 m_vehicle.ProcessTypeChange((Vehicle)type);
3230 {
3231 if (_parentID ==0 && PhysActor != null)
3232 PhysActor.VehicleType = type;
3233 return;
3234 }
3235 }
3236
3237 public void SetVehicleFlags(int param, bool remove)
3238 {
3239 if (m_vehicle == null)
3240 return;
3241
3242 m_vehicle.ProcessVehicleFlags(param, remove);
3243
3244 if (_parentID ==0 && PhysActor != null)
3118 { 3245 {
3119 PhysActor.VehicleType = type; 3246 PhysActor.VehicleFlags(param, remove);
3120 } 3247 }
3121 } 3248 }
3122 3249
3123 public void SetVehicleFloatParam(int param, float value) 3250 public void SetVehicleFloatParam(int param, float value)
3124 { 3251 {
3125 if (PhysActor != null) 3252 if (m_vehicle == null)
3253 return;
3254
3255 m_vehicle.ProcessFloatVehicleParam((Vehicle)param, value);
3256
3257 if (_parentID == 0 && PhysActor != null)
3126 { 3258 {
3127 PhysActor.VehicleFloatParam(param, value); 3259 PhysActor.VehicleFloatParam(param, value);
3128 } 3260 }
@@ -3130,7 +3262,12 @@ namespace OpenSim.Region.Framework.Scenes
3130 3262
3131 public void SetVehicleVectorParam(int param, Vector3 value) 3263 public void SetVehicleVectorParam(int param, Vector3 value)
3132 { 3264 {
3133 if (PhysActor != null) 3265 if (m_vehicle == null)
3266 return;
3267
3268 m_vehicle.ProcessVectorVehicleParam((Vehicle)param, value);
3269
3270 if (_parentID == 0 && PhysActor != null)
3134 { 3271 {
3135 PhysActor.VehicleVectorParam(param, value); 3272 PhysActor.VehicleVectorParam(param, value);
3136 } 3273 }
@@ -3138,7 +3275,12 @@ namespace OpenSim.Region.Framework.Scenes
3138 3275
3139 public void SetVehicleRotationParam(int param, Quaternion rotation) 3276 public void SetVehicleRotationParam(int param, Quaternion rotation)
3140 { 3277 {
3141 if (PhysActor != null) 3278 if (m_vehicle == null)
3279 return;
3280
3281 m_vehicle.ProcessRotationVehicleParam((Vehicle)param, rotation);
3282
3283 if (_parentID == 0 && PhysActor != null)
3142 { 3284 {
3143 PhysActor.VehicleRotationParam(param, rotation); 3285 PhysActor.VehicleRotationParam(param, rotation);
3144 } 3286 }
@@ -3325,13 +3467,6 @@ namespace OpenSim.Region.Framework.Scenes
3325 hasProfileCut = hasDimple; // is it the same thing? 3467 hasProfileCut = hasDimple; // is it the same thing?
3326 } 3468 }
3327 3469
3328 public void SetVehicleFlags(int param, bool remove)
3329 {
3330 if (PhysActor != null)
3331 {
3332 PhysActor.VehicleFlags(param, remove);
3333 }
3334 }
3335 3470
3336 public void SetGroup(UUID groupID, IClientAPI client) 3471 public void SetGroup(UUID groupID, IClientAPI client)
3337 { 3472 {
@@ -3457,10 +3592,10 @@ namespace OpenSim.Region.Framework.Scenes
3457 // TODO: May need to fix for group comparison 3592 // TODO: May need to fix for group comparison
3458 if (last.Compare(this)) 3593 if (last.Compare(this))
3459 { 3594 {
3460 // m_log.DebugFormat( 3595 // m_log.DebugFormat(
3461 // "[SCENE OBJECT PART]: Not storing undo for {0} {1} since current state is same as last undo state, initial stack size {2}", 3596 // "[SCENE OBJECT PART]: Not storing undo for {0} {1} since current state is same as last undo state, initial stack size {2}",
3462 // Name, LocalId, m_undo.Count); 3597 // Name, LocalId, m_undo.Count);
3463 3598
3464 return; 3599 return;
3465 } 3600 }
3466 } 3601 }
@@ -3473,29 +3608,29 @@ namespace OpenSim.Region.Framework.Scenes
3473 if (ParentGroup.GetSceneMaxUndo() > 0) 3608 if (ParentGroup.GetSceneMaxUndo() > 0)
3474 { 3609 {
3475 UndoState nUndo = new UndoState(this, forGroup); 3610 UndoState nUndo = new UndoState(this, forGroup);
3476 3611
3477 m_undo.Push(nUndo); 3612 m_undo.Push(nUndo);
3478 3613
3479 if (m_redo.Count > 0) 3614 if (m_redo.Count > 0)
3480 m_redo.Clear(); 3615 m_redo.Clear();
3481 3616
3482 // m_log.DebugFormat( 3617 // m_log.DebugFormat(
3483 // "[SCENE OBJECT PART]: Stored undo state for {0} {1}, forGroup {2}, stack size now {3}", 3618 // "[SCENE OBJECT PART]: Stored undo state for {0} {1}, forGroup {2}, stack size now {3}",
3484 // Name, LocalId, forGroup, m_undo.Count); 3619 // Name, LocalId, forGroup, m_undo.Count);
3485 } 3620 }
3486 } 3621 }
3487 } 3622 }
3488 } 3623 }
3489// else 3624 // else
3490// { 3625 // {
3491// m_log.DebugFormat("[SCENE OBJECT PART]: Ignoring undo store for {0} {1}", Name, LocalId); 3626 // m_log.DebugFormat("[SCENE OBJECT PART]: Ignoring undo store for {0} {1}", Name, LocalId);
3492// } 3627 // }
3493 } 3628 }
3494// else 3629 // else
3495// { 3630 // {
3496// m_log.DebugFormat( 3631 // m_log.DebugFormat(
3497// "[SCENE OBJECT PART]: Ignoring undo store for {0} {1} since already undoing", Name, LocalId); 3632 // "[SCENE OBJECT PART]: Ignoring undo store for {0} {1} since already undoing", Name, LocalId);
3498// } 3633 // }
3499 } 3634 }
3500 3635
3501 /// <summary> 3636 /// <summary>
@@ -4219,13 +4354,17 @@ namespace OpenSim.Region.Framework.Scenes
4219 /// <param name="SetTemporary"></param> 4354 /// <param name="SetTemporary"></param>
4220 /// <param name="SetPhantom"></param> 4355 /// <param name="SetPhantom"></param>
4221 /// <param name="SetVD"></param> 4356 /// <param name="SetVD"></param>
4222 public void UpdatePrimFlags(bool UsePhysics, bool SetTemporary, bool SetPhantom, bool SetVD) 4357// public void UpdatePrimFlags(bool UsePhysics, bool SetTemporary, bool SetPhantom, bool SetVD)
4358 public void UpdatePrimFlags(bool UsePhysics, bool SetTemporary, bool SetPhantom, bool SetVD, bool building)
4223 { 4359 {
4224 bool wasUsingPhysics = ((Flags & PrimFlags.Physics) != 0); 4360 bool wasUsingPhysics = ((Flags & PrimFlags.Physics) != 0);
4225 bool wasTemporary = ((Flags & PrimFlags.TemporaryOnRez) != 0); 4361 bool wasTemporary = ((Flags & PrimFlags.TemporaryOnRez) != 0);
4226 bool wasPhantom = ((Flags & PrimFlags.Phantom) != 0); 4362 bool wasPhantom = ((Flags & PrimFlags.Phantom) != 0);
4227 bool wasVD = VolumeDetectActive; 4363 bool wasVD = VolumeDetectActive;
4228 4364
4365// m_log.DebugFormat("[SOP]: Old states: phys: {0} temp: {1} phan: {2} vd: {3}", wasUsingPhysics, wasTemporary, wasPhantom, wasVD);
4366// m_log.DebugFormat("[SOP]: New states: phys: {0} temp: {1} phan: {2} vd: {3}", UsePhysics, SetTemporary, SetPhantom, SetVD);
4367
4229 if ((UsePhysics == wasUsingPhysics) && (wasTemporary == SetTemporary) && (wasPhantom == SetPhantom) && (SetVD == wasVD)) 4368 if ((UsePhysics == wasUsingPhysics) && (wasTemporary == SetTemporary) && (wasPhantom == SetPhantom) && (SetVD == wasVD))
4230 return; 4369 return;
4231 4370
@@ -4234,6 +4373,9 @@ namespace OpenSim.Region.Framework.Scenes
4234 // that... 4373 // that...
4235 // ... if VD is changed, all others are not. 4374 // ... if VD is changed, all others are not.
4236 // ... if one of the others is changed, VD is not. 4375 // ... if one of the others is changed, VD is not.
4376 // do this first
4377 if (building && PhysActor != null && PhysActor.Building != building)
4378 PhysActor.Building = building;
4237 if (SetVD) // VD is active, special logic applies 4379 if (SetVD) // VD is active, special logic applies
4238 { 4380 {
4239 // State machine logic for VolumeDetect 4381 // State machine logic for VolumeDetect
@@ -4255,6 +4397,11 @@ namespace OpenSim.Region.Framework.Scenes
4255 SetPhantom = false; 4397 SetPhantom = false;
4256 } 4398 }
4257 } 4399 }
4400 else if (wasVD)
4401 {
4402 // Correspondingly, if VD is turned off, also turn off phantom
4403 SetPhantom = false;
4404 }
4258 4405
4259 if (UsePhysics && IsJoint()) 4406 if (UsePhysics && IsJoint())
4260 { 4407 {
@@ -4310,11 +4457,17 @@ namespace OpenSim.Region.Framework.Scenes
4310 Shape, 4457 Shape,
4311 AbsolutePosition, 4458 AbsolutePosition,
4312 Scale, 4459 Scale,
4313 RotationOffset, 4460// RotationOffset,
4461 GetWorldRotation(), //physics wants world rotation like all other functions send
4314 UsePhysics, 4462 UsePhysics,
4315 m_localId); 4463 m_localId);
4316 4464
4317 PhysActor.SetMaterial(Material); 4465 PhysActor.SetMaterial(Material);
4466
4467 // if root part apply vehicle
4468 if (m_vehicle != null && LocalId == ParentGroup.RootPart.LocalId)
4469 m_vehicle.SetVehicle(PhysActor);
4470
4318 DoPhysicsPropertyUpdate(UsePhysics, true); 4471 DoPhysicsPropertyUpdate(UsePhysics, true);
4319 4472
4320 if (!ParentGroup.IsDeleted) 4473 if (!ParentGroup.IsDeleted)
@@ -4390,6 +4543,9 @@ namespace OpenSim.Region.Framework.Scenes
4390 } 4543 }
4391 // m_log.Debug("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString()); 4544 // m_log.Debug("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString());
4392 4545
4546 // and last in case we have a new actor and not building
4547 if (PhysActor != null && PhysActor.Building != building)
4548 PhysActor.Building = building;
4393 if (ParentGroup != null) 4549 if (ParentGroup != null)
4394 { 4550 {
4395 ParentGroup.HasGroupChanged = true; 4551 ParentGroup.HasGroupChanged = true;
@@ -4753,5 +4909,17 @@ namespace OpenSim.Region.Framework.Scenes
4753 Color color = Color; 4909 Color color = Color;
4754 return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A)); 4910 return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A));
4755 } 4911 }
4912
4913 public void ResetOwnerChangeFlag()
4914 {
4915 List<UUID> inv = Inventory.GetInventoryList();
4916
4917 foreach (UUID itemID in inv)
4918 {
4919 TaskInventoryItem item = Inventory.GetInventoryItem(itemID);
4920 item.OwnerChanged = false;
4921 Inventory.UpdateInventoryItem(item, false, false);
4922 }
4923 }
4756 } 4924 }
4757} 4925}