diff options
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectPart.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 102 |
1 files changed, 52 insertions, 50 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index dacac4b..38eaf90 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -272,9 +272,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
272 | } | 272 | } |
273 | 273 | ||
274 | public SceneObjectPart(ulong regionHandle, SceneObjectGroup parent, LLUUID ownerID, uint localID, | 274 | public SceneObjectPart(ulong regionHandle, SceneObjectGroup parent, LLUUID ownerID, uint localID, |
275 | PrimitiveBaseShape shape, LLVector3 groupPosition, LLVector3 offsetPosition):this(regionHandle, parent, ownerID, localID, shape, groupPosition, LLQuaternion.Identity, offsetPosition) | 275 | PrimitiveBaseShape shape, LLVector3 groupPosition, LLVector3 offsetPosition) |
276 | { | 276 | : this(regionHandle, parent, ownerID, localID, shape, groupPosition, LLQuaternion.Identity, offsetPosition) |
277 | } | 277 | { |
278 | } | ||
278 | 279 | ||
279 | /// <summary> | 280 | /// <summary> |
280 | /// Create a completely new SceneObjectPart (prim) | 281 | /// Create a completely new SceneObjectPart (prim) |
@@ -286,7 +287,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
286 | /// <param name="shape"></param> | 287 | /// <param name="shape"></param> |
287 | /// <param name="position"></param> | 288 | /// <param name="position"></param> |
288 | public SceneObjectPart(ulong regionHandle, SceneObjectGroup parent, LLUUID ownerID, uint localID, | 289 | public SceneObjectPart(ulong regionHandle, SceneObjectGroup parent, LLUUID ownerID, uint localID, |
289 | PrimitiveBaseShape shape, LLVector3 groupPosition, LLQuaternion rotationOffset, LLVector3 offsetPosition) | 290 | PrimitiveBaseShape shape, LLVector3 groupPosition, LLQuaternion rotationOffset, |
291 | LLVector3 offsetPosition) | ||
290 | { | 292 | { |
291 | m_name = "Primitive"; | 293 | m_name = "Primitive"; |
292 | m_regionHandle = regionHandle; | 294 | m_regionHandle = regionHandle; |
@@ -313,12 +315,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
313 | m_flags = 0; | 315 | m_flags = 0; |
314 | m_flags |= LLObject.ObjectFlags.ObjectModify | | 316 | m_flags |= LLObject.ObjectFlags.ObjectModify | |
315 | LLObject.ObjectFlags.ObjectCopy | | 317 | LLObject.ObjectFlags.ObjectCopy | |
316 | LLObject.ObjectFlags.ObjectYouOwner | | 318 | LLObject.ObjectFlags.ObjectYouOwner | |
317 | LLObject.ObjectFlags.Touch | | 319 | LLObject.ObjectFlags.Touch | |
318 | LLObject.ObjectFlags.ObjectMove | | 320 | LLObject.ObjectFlags.ObjectMove | |
319 | LLObject.ObjectFlags.AllowInventoryDrop | | 321 | LLObject.ObjectFlags.AllowInventoryDrop | |
320 | LLObject.ObjectFlags.ObjectTransfer | | 322 | LLObject.ObjectFlags.ObjectTransfer | |
321 | LLObject.ObjectFlags.CreateSelected | | 323 | LLObject.ObjectFlags.CreateSelected | |
322 | LLObject.ObjectFlags.ObjectOwnerModify; | 324 | LLObject.ObjectFlags.ObjectOwnerModify; |
323 | 325 | ||
324 | ScheduleFullUpdate(); | 326 | ScheduleFullUpdate(); |
@@ -447,23 +449,25 @@ namespace OpenSim.Region.Environment.Scenes | |||
447 | TimeStampFull = (uint) Util.UnixTimeSinceEpoch(); | 449 | TimeStampFull = (uint) Util.UnixTimeSinceEpoch(); |
448 | m_updateFlag = 2; | 450 | m_updateFlag = 2; |
449 | } | 451 | } |
452 | |||
450 | public void AddFlag(LLObject.ObjectFlags flag) | 453 | public void AddFlag(LLObject.ObjectFlags flag) |
451 | { | 454 | { |
452 | LLObject.ObjectFlags prevflag = m_flags; | 455 | LLObject.ObjectFlags prevflag = m_flags; |
453 | //uint objflags = m_flags; | 456 | //uint objflags = m_flags; |
454 | if ((this.ObjectFlags & (uint)flag) == 0) | 457 | if ((ObjectFlags & (uint) flag) == 0) |
455 | { | 458 | { |
456 | //Console.WriteLine("Adding flag: " + ((LLObject.ObjectFlags) flag).ToString()); | 459 | //Console.WriteLine("Adding flag: " + ((LLObject.ObjectFlags) flag).ToString()); |
457 | m_flags |= flag; | 460 | m_flags |= flag; |
458 | } | 461 | } |
459 | uint currflag = (uint)m_flags; | 462 | uint currflag = (uint) m_flags; |
460 | //System.Console.WriteLine("Aprev: " + prevflag.ToString() + " curr: " + m_flags.ToString()); | 463 | //System.Console.WriteLine("Aprev: " + prevflag.ToString() + " curr: " + m_flags.ToString()); |
461 | //ScheduleFullUpdate(); | 464 | //ScheduleFullUpdate(); |
462 | } | 465 | } |
466 | |||
463 | public void RemFlag(LLObject.ObjectFlags flag) | 467 | public void RemFlag(LLObject.ObjectFlags flag) |
464 | { | 468 | { |
465 | LLObject.ObjectFlags prevflag = m_flags; | 469 | LLObject.ObjectFlags prevflag = m_flags; |
466 | if ((this.ObjectFlags & (uint) flag) != 0) | 470 | if ((ObjectFlags & (uint) flag) != 0) |
467 | { | 471 | { |
468 | //Console.WriteLine("Removing flag: " + ((LLObject.ObjectFlags)flag).ToString()); | 472 | //Console.WriteLine("Removing flag: " + ((LLObject.ObjectFlags)flag).ToString()); |
469 | m_flags &= ~flag; | 473 | m_flags &= ~flag; |
@@ -640,6 +644,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
640 | #endregion | 644 | #endregion |
641 | 645 | ||
642 | #region ExtraParams | 646 | #region ExtraParams |
647 | |||
643 | public void UpdatePrimFlags(ushort type, bool inUse, byte[] data) | 648 | public void UpdatePrimFlags(ushort type, bool inUse, byte[] data) |
644 | { | 649 | { |
645 | bool hasPrim = false; | 650 | bool hasPrim = false; |
@@ -649,8 +654,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
649 | bool CastsShadows = false; | 654 | bool CastsShadows = false; |
650 | //bool IsLocked = false; | 655 | //bool IsLocked = false; |
651 | int i = 0; | 656 | int i = 0; |
652 | 657 | ||
653 | 658 | ||
654 | try | 659 | try |
655 | { | 660 | { |
656 | i += 46; | 661 | i += 46; |
@@ -661,40 +666,41 @@ namespace OpenSim.Region.Environment.Scenes | |||
661 | IsPhantom = (data[i++] != 0) ? true : false; | 666 | IsPhantom = (data[i++] != 0) ? true : false; |
662 | CastsShadows = (data[i++] != 0) ? true : false; | 667 | CastsShadows = (data[i++] != 0) ? true : false; |
663 | } | 668 | } |
664 | catch (System.Exception e) | 669 | catch (Exception e) |
665 | { | 670 | { |
666 | System.Console.WriteLine("Ignoring invalid Packet:"); | 671 | Console.WriteLine("Ignoring invalid Packet:"); |
667 | //Silently ignore it - TODO: FIXME Quick | 672 | //Silently ignore it - TODO: FIXME Quick |
668 | } | 673 | } |
669 | 674 | ||
670 | if (IsPhantom) | 675 | if (IsPhantom) |
671 | { | 676 | { |
672 | AddFlag(LLObject.ObjectFlags.Phantom); | 677 | AddFlag(LLObject.ObjectFlags.Phantom); |
673 | if(this.PhysActor != null) { | 678 | if (PhysActor != null) |
674 | this.m_parentGroup.m_scene.PhysScene.RemovePrim(this.PhysActor); /// that's not wholesome. Had to make m_scene public | 679 | { |
675 | this.PhysActor = null; | 680 | m_parentGroup.m_scene.PhysScene.RemovePrim(PhysActor); |
681 | /// that's not wholesome. Had to make m_scene public | ||
682 | PhysActor = null; | ||
676 | } | 683 | } |
677 | } | 684 | } |
678 | else | 685 | else |
679 | { | 686 | { |
680 | RemFlag(LLObject.ObjectFlags.Phantom); | 687 | RemFlag(LLObject.ObjectFlags.Phantom); |
681 | if (this.PhysActor == null) | 688 | if (PhysActor == null) |
682 | { | 689 | { |
683 | this.PhysActor = this.m_parentGroup.m_scene.PhysScene.AddPrimShape( | 690 | PhysActor = m_parentGroup.m_scene.PhysScene.AddPrimShape( |
684 | this.Name, | 691 | Name, |
685 | this.Shape, | 692 | Shape, |
686 | new PhysicsVector(this.AbsolutePosition.X, this.AbsolutePosition.Y, | 693 | new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, |
687 | this.AbsolutePosition.Z), | 694 | AbsolutePosition.Z), |
688 | new PhysicsVector(this.Scale.X, this.Scale.Y, this.Scale.Z), | 695 | new PhysicsVector(Scale.X, Scale.Y, Scale.Z), |
689 | new Quaternion(this.RotationOffset.W, this.RotationOffset.X, | 696 | new Quaternion(RotationOffset.W, RotationOffset.X, |
690 | this.RotationOffset.Y, this.RotationOffset.Z)); | 697 | RotationOffset.Y, RotationOffset.Z)); |
691 | } | 698 | } |
692 | } | 699 | } |
693 | 700 | ||
694 | if (UsePhysics) | 701 | if (UsePhysics) |
695 | { | 702 | { |
696 | AddFlag(LLObject.ObjectFlags.Physics); | 703 | AddFlag(LLObject.ObjectFlags.Physics); |
697 | |||
698 | } | 704 | } |
699 | else | 705 | else |
700 | { | 706 | { |
@@ -710,9 +716,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
710 | } | 716 | } |
711 | // System.Console.WriteLine("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString()); | 717 | // System.Console.WriteLine("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString()); |
712 | ScheduleFullUpdate(); | 718 | ScheduleFullUpdate(); |
713 | |||
714 | |||
715 | |||
716 | } | 719 | } |
717 | 720 | ||
718 | public void UpdateExtraParam(ushort type, bool inUse, byte[] data) | 721 | public void UpdateExtraParam(ushort type, bool inUse, byte[] data) |
@@ -861,22 +864,21 @@ namespace OpenSim.Region.Environment.Scenes | |||
861 | { | 864 | { |
862 | LLQuaternion lRot; | 865 | LLQuaternion lRot; |
863 | lRot = RotationOffset; | 866 | lRot = RotationOffset; |
864 | uint clientFlags = ObjectFlags & ~(uint)LLObject.ObjectFlags.CreateSelected; | 867 | uint clientFlags = ObjectFlags & ~(uint) LLObject.ObjectFlags.CreateSelected; |
865 | 868 | ||
866 | List<ScenePresence> avatars=m_parentGroup.GetScenePresences(); | 869 | List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); |
867 | foreach(ScenePresence s in avatars) | 870 | foreach (ScenePresence s in avatars) |
868 | { | 871 | { |
869 | if(s.m_uuid == OwnerID) | 872 | if (s.m_uuid == OwnerID) |
870 | { | 873 | { |
871 | if(s.ControllingClient == remoteClient) | 874 | if (s.ControllingClient == remoteClient) |
872 | { | 875 | { |
873 | clientFlags = ObjectFlags; | 876 | clientFlags = ObjectFlags; |
874 | m_flags &= ~LLObject.ObjectFlags.CreateSelected; | 877 | m_flags &= ~LLObject.ObjectFlags.CreateSelected; |
875 | 878 | } | |
876 | } | 879 | break; |
877 | break; | 880 | } |
878 | } | 881 | } |
879 | } | ||
880 | 882 | ||
881 | remoteClient.SendPrimitiveToClient(m_regionHandle, 64096, LocalID, m_shape, lPos, clientFlags, m_uuid, | 883 | remoteClient.SendPrimitiveToClient(m_regionHandle, 64096, LocalID, m_shape, lPos, clientFlags, m_uuid, |
882 | OwnerID, | 884 | OwnerID, |
@@ -1042,4 +1044,4 @@ namespace OpenSim.Region.Environment.Scenes | |||
1042 | } | 1044 | } |
1043 | } | 1045 | } |
1044 | } | 1046 | } |
1045 | } | 1047 | } \ No newline at end of file |