aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authordan miller2007-10-30 23:38:56 +0000
committerdan miller2007-10-30 23:38:56 +0000
commitf5195a453c265891858fbdcbed02dd768e7cb80f (patch)
tree5c97b620135b9e659d6205ffcb839056ab3851fd
parentStep one on the long march towards grid based inventory. Introduction of an I... (diff)
downloadopensim-SC_OLD-f5195a453c265891858fbdcbed02dd768e7cb80f.zip
opensim-SC_OLD-f5195a453c265891858fbdcbed02dd768e7cb80f.tar.gz
opensim-SC_OLD-f5195a453c265891858fbdcbed02dd768e7cb80f.tar.bz2
opensim-SC_OLD-f5195a453c265891858fbdcbed02dd768e7cb80f.tar.xz
Tevarus' patch for object flags & implemented Phantom edits
-rw-r--r--OpenSim/Region/Environment/Scenes/EntityBase.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs16
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs1
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs9
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs106
5 files changed, 129 insertions, 5 deletions
diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs
index b8bae57..d0cbcf6 100644
--- a/OpenSim/Region/Environment/Scenes/EntityBase.cs
+++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs
@@ -36,7 +36,7 @@ namespace OpenSim.Region.Environment.Scenes
36 { 36 {
37 protected List<EntityBase> m_children; 37 protected List<EntityBase> m_children;
38 38
39 protected Scene m_scene; 39 public Scene m_scene;
40 40
41 public LLUUID m_uuid; 41 public LLUUID m_uuid;
42 42
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index 69bd310..73954d0 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -327,6 +327,22 @@ namespace OpenSim.Region.Environment.Scenes
327 /// <param name="remoteClient"></param> 327 /// <param name="remoteClient"></param>
328 public void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient) 328 public void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient)
329 { 329 {
330 bool hasprim = false;
331 foreach (EntityBase ent in Entities.Values)
332 {
333 if (ent is SceneObjectGroup)
334 {
335 hasprim = ((SceneObjectGroup)ent).HasChildPrim(localID);
336 if (hasprim != false)
337 {
338
339 ((SceneObjectGroup)ent).UpdatePrimFlags(localID, (ushort)packet.Type, true, packet.ToBytes());
340
341 }
342 }
343 }
344
345 //System.Console.WriteLine("Got primupdate packet: " + packet.UsePhysics.ToString());
330 } 346 }
331 347
332 /// <summary> 348 /// <summary>
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index db4d230..0a2a5a3 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -817,6 +817,7 @@ namespace OpenSim.Region.Environment.Scenes
817 client.OnObjectName += PrimName; 817 client.OnObjectName += PrimName;
818 client.OnLinkObjects += LinkObjects; 818 client.OnLinkObjects += LinkObjects;
819 client.OnObjectDuplicate += DuplicateObject; 819 client.OnObjectDuplicate += DuplicateObject;
820 client.OnUpdatePrimFlags += UpdatePrimFlags;
820 821
821 client.OnParcelPropertiesRequest += new ParcelPropertiesRequest(m_LandManager.handleParcelPropertiesRequest); 822 client.OnParcelPropertiesRequest += new ParcelPropertiesRequest(m_LandManager.handleParcelPropertiesRequest);
822 client.OnParcelDivideRequest += new ParcelDivideRequest(m_LandManager.handleParcelDivideRequest); 823 client.OnParcelDivideRequest += new ParcelDivideRequest(m_LandManager.handleParcelDivideRequest);
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 4d439b2..2f86d2f 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -910,6 +910,15 @@ namespace OpenSim.Region.Environment.Scenes
910 /// <param name="type"></param> 910 /// <param name="type"></param>
911 /// <param name="inUse"></param> 911 /// <param name="inUse"></param>
912 /// <param name="data"></param> 912 /// <param name="data"></param>
913 ///
914 public void UpdatePrimFlags(uint localID, ushort type, bool inUse, byte[] data)
915 {
916 SceneObjectPart part = GetChildPart(localID);
917 if (part != null)
918 {
919 part.UpdatePrimFlags(type, inUse, data);
920 }
921 }
913 public void UpdateExtraParam(uint localID, ushort type, bool inUse, byte[] data) 922 public void UpdateExtraParam(uint localID, ushort type, bool inUse, byte[] data)
914 { 923 {
915 SceneObjectPart part = GetChildPart(localID); 924 SceneObjectPart part = GetChildPart(localID);
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 387f573..f0d6916 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -308,9 +308,9 @@ namespace OpenSim.Region.Environment.Scenes
308 m_flags = 0; 308 m_flags = 0;
309 m_flags |= LLObject.ObjectFlags.ObjectModify | 309 m_flags |= LLObject.ObjectFlags.ObjectModify |
310 LLObject.ObjectFlags.ObjectCopy | 310 LLObject.ObjectFlags.ObjectCopy |
311 LLObject.ObjectFlags.ObjectYouOwner | 311 LLObject.ObjectFlags.ObjectYouOwner |
312 LLObject.ObjectFlags.Touch | 312 LLObject.ObjectFlags.Touch |
313 LLObject.ObjectFlags.ObjectMove | 313 LLObject.ObjectFlags.ObjectMove |
314 LLObject.ObjectFlags.AllowInventoryDrop | 314 LLObject.ObjectFlags.AllowInventoryDrop |
315 LLObject.ObjectFlags.ObjectTransfer | 315 LLObject.ObjectFlags.ObjectTransfer |
316 LLObject.ObjectFlags.ObjectOwnerModify; 316 LLObject.ObjectFlags.ObjectOwnerModify;
@@ -441,6 +441,30 @@ namespace OpenSim.Region.Environment.Scenes
441 TimeStampFull = (uint) Util.UnixTimeSinceEpoch(); 441 TimeStampFull = (uint) Util.UnixTimeSinceEpoch();
442 m_updateFlag = 2; 442 m_updateFlag = 2;
443 } 443 }
444 public void AddFlag(LLObject.ObjectFlags flag)
445 {
446 LLObject.ObjectFlags prevflag = m_flags;
447 //uint objflags = m_flags;
448 if ((this.ObjectFlags & (uint)flag) == 0)
449 {
450 //Console.WriteLine("Adding flag: " + ((LLObject.ObjectFlags) flag).ToString());
451 m_flags |= flag;
452 }
453 uint currflag = (uint)m_flags;
454 //System.Console.WriteLine("Aprev: " + prevflag.ToString() + " curr: " + m_flags.ToString());
455 //ScheduleFullUpdate();
456 }
457 public void RemFlag(LLObject.ObjectFlags flag)
458 {
459 LLObject.ObjectFlags prevflag = m_flags;
460 if ((this.ObjectFlags & (uint) flag) != 0)
461 {
462 //Console.WriteLine("Removing flag: " + ((LLObject.ObjectFlags)flag).ToString());
463 m_flags &= ~flag;
464 }
465 //System.Console.WriteLine("prev: " + prevflag.ToString() + " curr: " + m_flags.ToString());
466 //ScheduleFullUpdate();
467 }
444 468
445 /// <summary> 469 /// <summary>
446 /// 470 ///
@@ -610,6 +634,80 @@ namespace OpenSim.Region.Environment.Scenes
610 #endregion 634 #endregion
611 635
612 #region ExtraParams 636 #region ExtraParams
637 public void UpdatePrimFlags(ushort type, bool inUse, byte[] data)
638 {
639 bool hasPrim = false;
640 bool UsePhysics = false;
641 bool IsTemporary = false;
642 bool IsPhantom = false;
643 bool CastsShadows = false;
644 //bool IsLocked = false;
645 int i = 0;
646
647
648 try
649 {
650 i += 46;
651 //IsLocked = (data[i++] != 0) ? true : false;
652 UsePhysics = (data[i++] != 0) ? true : false;
653 //System.Console.WriteLine("U" + packet.ToBytes().Length.ToString());
654 IsTemporary = (data[i++] != 0) ? true : false;
655 IsPhantom = (data[i++] != 0) ? true : false;
656 CastsShadows = (data[i++] != 0) ? true : false;
657 }
658 catch (System.Exception e)
659 {
660 System.Console.WriteLine("Ignoring invalid Packet:");
661 //Silently ignore it - TODO: FIXME Quick
662 }
663
664 if (IsPhantom)
665 {
666 AddFlag(LLObject.ObjectFlags.Phantom);
667 if(this.PhysActor != null) {
668 this.m_parentGroup.m_scene.PhysScene.RemovePrim(this.PhysActor); /// that's not wholesome. Had to make m_scene public
669 this.PhysActor = null;
670 }
671 }
672 else
673 {
674 RemFlag(LLObject.ObjectFlags.Phantom);
675 if (this.PhysActor == null)
676 {
677 this.PhysActor = this.m_parentGroup.m_scene.PhysScene.AddPrimShape(
678 this.Name,
679 this.Shape,
680 new PhysicsVector(this.AbsolutePosition.X, this.AbsolutePosition.Y,
681 this.AbsolutePosition.Z),
682 new PhysicsVector(this.Scale.X, this.Scale.Y, this.Scale.Z),
683 new Quaternion(this.RotationOffset.W, this.RotationOffset.X,
684 this.RotationOffset.Y, this.RotationOffset.Z));
685 }
686 }
687
688 if (UsePhysics)
689 {
690 AddFlag(LLObject.ObjectFlags.Physics);
691
692 }
693 else
694 {
695 RemFlag(LLObject.ObjectFlags.Physics);
696 }
697 if (IsTemporary)
698 {
699 AddFlag(LLObject.ObjectFlags.TemporaryOnRez);
700 }
701 else
702 {
703 RemFlag(LLObject.ObjectFlags.TemporaryOnRez);
704 }
705// System.Console.WriteLine("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString());
706 ScheduleFullUpdate();
707
708
709
710 }
613 711
614 public void UpdateExtraParam(ushort type, bool inUse, byte[] data) 712 public void UpdateExtraParam(ushort type, bool inUse, byte[] data)
615 { 713 {
@@ -922,4 +1020,4 @@ namespace OpenSim.Region.Environment.Scenes
922 } 1020 }
923 } 1021 }
924 } 1022 }
925} \ No newline at end of file 1023}