Tevarus' patch for object flags & implemented Phantom edits

afrisby
dan miller 2007-10-30 23:38:56 +00:00
parent 6a8d8f54e8
commit f5195a453c
5 changed files with 129 additions and 5 deletions

View File

@ -36,7 +36,7 @@ namespace OpenSim.Region.Environment.Scenes
{
protected List<EntityBase> m_children;
protected Scene m_scene;
public Scene m_scene;
public LLUUID m_uuid;

View File

@ -327,6 +327,22 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="remoteClient"></param>
public void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient)
{
bool hasprim = false;
foreach (EntityBase ent in Entities.Values)
{
if (ent is SceneObjectGroup)
{
hasprim = ((SceneObjectGroup)ent).HasChildPrim(localID);
if (hasprim != false)
{
((SceneObjectGroup)ent).UpdatePrimFlags(localID, (ushort)packet.Type, true, packet.ToBytes());
}
}
}
//System.Console.WriteLine("Got primupdate packet: " + packet.UsePhysics.ToString());
}
/// <summary>

View File

@ -817,6 +817,7 @@ namespace OpenSim.Region.Environment.Scenes
client.OnObjectName += PrimName;
client.OnLinkObjects += LinkObjects;
client.OnObjectDuplicate += DuplicateObject;
client.OnUpdatePrimFlags += UpdatePrimFlags;
client.OnParcelPropertiesRequest += new ParcelPropertiesRequest(m_LandManager.handleParcelPropertiesRequest);
client.OnParcelDivideRequest += new ParcelDivideRequest(m_LandManager.handleParcelDivideRequest);

View File

@ -910,6 +910,15 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="type"></param>
/// <param name="inUse"></param>
/// <param name="data"></param>
///
public void UpdatePrimFlags(uint localID, ushort type, bool inUse, byte[] data)
{
SceneObjectPart part = GetChildPart(localID);
if (part != null)
{
part.UpdatePrimFlags(type, inUse, data);
}
}
public void UpdateExtraParam(uint localID, ushort type, bool inUse, byte[] data)
{
SceneObjectPart part = GetChildPart(localID);

View File

@ -308,9 +308,9 @@ namespace OpenSim.Region.Environment.Scenes
m_flags = 0;
m_flags |= LLObject.ObjectFlags.ObjectModify |
LLObject.ObjectFlags.ObjectCopy |
LLObject.ObjectFlags.ObjectYouOwner |
LLObject.ObjectFlags.Touch |
LLObject.ObjectFlags.ObjectMove |
LLObject.ObjectFlags.ObjectYouOwner |
LLObject.ObjectFlags.Touch |
LLObject.ObjectFlags.ObjectMove |
LLObject.ObjectFlags.AllowInventoryDrop |
LLObject.ObjectFlags.ObjectTransfer |
LLObject.ObjectFlags.ObjectOwnerModify;
@ -441,6 +441,30 @@ namespace OpenSim.Region.Environment.Scenes
TimeStampFull = (uint) Util.UnixTimeSinceEpoch();
m_updateFlag = 2;
}
public void AddFlag(LLObject.ObjectFlags flag)
{
LLObject.ObjectFlags prevflag = m_flags;
//uint objflags = m_flags;
if ((this.ObjectFlags & (uint)flag) == 0)
{
//Console.WriteLine("Adding flag: " + ((LLObject.ObjectFlags) flag).ToString());
m_flags |= flag;
}
uint currflag = (uint)m_flags;
//System.Console.WriteLine("Aprev: " + prevflag.ToString() + " curr: " + m_flags.ToString());
//ScheduleFullUpdate();
}
public void RemFlag(LLObject.ObjectFlags flag)
{
LLObject.ObjectFlags prevflag = m_flags;
if ((this.ObjectFlags & (uint) flag) != 0)
{
//Console.WriteLine("Removing flag: " + ((LLObject.ObjectFlags)flag).ToString());
m_flags &= ~flag;
}
//System.Console.WriteLine("prev: " + prevflag.ToString() + " curr: " + m_flags.ToString());
//ScheduleFullUpdate();
}
/// <summary>
///
@ -610,6 +634,80 @@ namespace OpenSim.Region.Environment.Scenes
#endregion
#region ExtraParams
public void UpdatePrimFlags(ushort type, bool inUse, byte[] data)
{
bool hasPrim = false;
bool UsePhysics = false;
bool IsTemporary = false;
bool IsPhantom = false;
bool CastsShadows = false;
//bool IsLocked = false;
int i = 0;
try
{
i += 46;
//IsLocked = (data[i++] != 0) ? true : false;
UsePhysics = (data[i++] != 0) ? true : false;
//System.Console.WriteLine("U" + packet.ToBytes().Length.ToString());
IsTemporary = (data[i++] != 0) ? true : false;
IsPhantom = (data[i++] != 0) ? true : false;
CastsShadows = (data[i++] != 0) ? true : false;
}
catch (System.Exception e)
{
System.Console.WriteLine("Ignoring invalid Packet:");
//Silently ignore it - TODO: FIXME Quick
}
if (IsPhantom)
{
AddFlag(LLObject.ObjectFlags.Phantom);
if(this.PhysActor != null) {
this.m_parentGroup.m_scene.PhysScene.RemovePrim(this.PhysActor); /// that's not wholesome. Had to make m_scene public
this.PhysActor = null;
}
}
else
{
RemFlag(LLObject.ObjectFlags.Phantom);
if (this.PhysActor == null)
{
this.PhysActor = this.m_parentGroup.m_scene.PhysScene.AddPrimShape(
this.Name,
this.Shape,
new PhysicsVector(this.AbsolutePosition.X, this.AbsolutePosition.Y,
this.AbsolutePosition.Z),
new PhysicsVector(this.Scale.X, this.Scale.Y, this.Scale.Z),
new Quaternion(this.RotationOffset.W, this.RotationOffset.X,
this.RotationOffset.Y, this.RotationOffset.Z));
}
}
if (UsePhysics)
{
AddFlag(LLObject.ObjectFlags.Physics);
}
else
{
RemFlag(LLObject.ObjectFlags.Physics);
}
if (IsTemporary)
{
AddFlag(LLObject.ObjectFlags.TemporaryOnRez);
}
else
{
RemFlag(LLObject.ObjectFlags.TemporaryOnRez);
}
// System.Console.WriteLine("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString());
ScheduleFullUpdate();
}
public void UpdateExtraParam(ushort type, bool inUse, byte[] data)
{
@ -922,4 +1020,4 @@ namespace OpenSim.Region.Environment.Scenes
}
}
}
}
}