Readds llCollisionFilter and adds llPassCollision.

Applied with whitespace cleanup

Signed-off-by: Melanie <melanie@t-data.com>
slimupdates
Revolution 2009-12-31 11:41:07 -06:00 committed by Melanie
parent f4efa325bb
commit e6cd7f28de
3 changed files with 293 additions and 64 deletions

View File

@ -341,6 +341,17 @@ namespace OpenSim.Region.Framework.Scenes
get { return true; } get { return true; }
} }
private bool m_passCollision;
public bool PassCollision
{
get { return m_passCollision; }
set
{
m_passCollision = value;
HasGroupChanged = true;
}
}
public bool IsSelected public bool IsSelected
{ {
get { return m_isSelected; } get { return m_isSelected; }

View File

@ -141,6 +141,9 @@ namespace OpenSim.Region.Framework.Scenes
[XmlIgnore] [XmlIgnore]
public UUID FromItemID; public UUID FromItemID;
[XmlIgnore]
private Dictionary<int, string> m_CollisionFilter = new Dictionary<int, string>();
/// <value> /// <value>
/// The UUID of the user inventory item from which this object was rezzed if this is a root part. /// The UUID of the user inventory item from which this object was rezzed if this is a root part.
/// If UUID.Zero then either this is not a root part or there is no connection with a user inventory item. /// If UUID.Zero then either this is not a root part or there is no connection with a user inventory item.
@ -452,6 +455,17 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
[XmlIgnore]
public Dictionary<int, string> CollisionFilter
{
get { return m_CollisionFilter; }
set
{
m_CollisionFilter = value;
}
}
public ulong RegionHandle public ulong RegionHandle
{ {
get { return m_regionHandle; } get { return m_regionHandle; }
@ -1876,18 +1890,49 @@ namespace OpenSim.Region.Framework.Scenes
return; return;
SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId); SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId);
string data = "";
if (obj != null) if (obj != null)
{ {
DetectedObject detobj = new DetectedObject(); if(m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
detobj.keyUUID = obj.UUID; {
detobj.nameStr = obj.Name; bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
detobj.ownerUUID = obj._ownerID; //If it is 1, it is to accept ONLY collisions from this object
detobj.posVector = obj.AbsolutePosition; if(found)
detobj.rotQuat = obj.GetWorldRotation(); {
detobj.velVector = obj.Velocity; DetectedObject detobj = new DetectedObject();
detobj.colliderType = 0; detobj.keyUUID = obj.UUID;
detobj.groupUUID = obj._groupID; detobj.nameStr = obj.Name;
colliding.Add(detobj); detobj.ownerUUID = obj._ownerID;
detobj.posVector = obj.AbsolutePosition;
detobj.rotQuat = obj.GetWorldRotation();
detobj.velVector = obj.Velocity;
detobj.colliderType = 0;
detobj.groupUUID = obj._groupID;
colliding.Add(detobj);
}
//If it is 0, it is to not accept collisions from this object
else
{
}
}
else
{
bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
//If it is 1, it is to accept ONLY collisions from this object, so this other object will not work
if(found)
{
DetectedObject detobj = new DetectedObject();
detobj.keyUUID = obj.UUID;
detobj.nameStr = obj.Name;
detobj.ownerUUID = obj._ownerID;
detobj.posVector = obj.AbsolutePosition;
detobj.rotQuat = obj.GetWorldRotation();
detobj.velVector = obj.Velocity;
detobj.colliderType = 0;
detobj.groupUUID = obj._groupID;
colliding.Add(detobj);
}
}
} }
else else
{ {
@ -1899,16 +1944,47 @@ namespace OpenSim.Region.Framework.Scenes
if (av.LocalId == localId) if (av.LocalId == localId)
{ {
DetectedObject detobj = new DetectedObject(); if(m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
detobj.keyUUID = av.UUID; {
detobj.nameStr = av.ControllingClient.Name; bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
detobj.ownerUUID = av.UUID; //If it is 1, it is to accept ONLY collisions from this avatar
detobj.posVector = av.AbsolutePosition; if(found)
detobj.rotQuat = av.Rotation; {
detobj.velVector = av.Velocity; DetectedObject detobj = new DetectedObject();
detobj.colliderType = 0; detobj.keyUUID = av.UUID;
detobj.groupUUID = av.ControllingClient.ActiveGroupId; detobj.nameStr = av.ControllingClient.Name;
colliding.Add(detobj); detobj.ownerUUID = av.UUID;
detobj.posVector = av.AbsolutePosition;
detobj.rotQuat = av.Rotation;
detobj.velVector = av.Velocity;
detobj.colliderType = 0;
detobj.groupUUID = av.ControllingClient.ActiveGroupId;
colliding.Add(detobj);
}
//If it is 0, it is to not accept collisions from this avatar
else
{
}
}
else
{
bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
//If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work
if(found)
{
DetectedObject detobj = new DetectedObject();
detobj.keyUUID = av.UUID;
detobj.nameStr = av.ControllingClient.Name;
detobj.ownerUUID = av.UUID;
detobj.posVector = av.AbsolutePosition;
detobj.rotQuat = av.Rotation;
detobj.velVector = av.Velocity;
detobj.colliderType = 0;
detobj.groupUUID = av.ControllingClient.ActiveGroupId;
colliding.Add(detobj);
}
}
} }
} }
} }
@ -1922,7 +1998,10 @@ namespace OpenSim.Region.Framework.Scenes
if (m_parentGroup.Scene == null) if (m_parentGroup.Scene == null)
return; return;
if(m_parentGroup.PassCollision == true)
{
//TODO: Add pass to root prim!
}
m_parentGroup.Scene.EventManager.TriggerScriptCollidingStart(LocalId, StartCollidingMessage); m_parentGroup.Scene.EventManager.TriggerScriptCollidingStart(LocalId, StartCollidingMessage);
} }
} }
@ -1947,18 +2026,49 @@ namespace OpenSim.Region.Framework.Scenes
return; return;
SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId); SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId);
string data = "";
if (obj != null) if (obj != null)
{ {
DetectedObject detobj = new DetectedObject(); if(m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
detobj.keyUUID = obj.UUID; {
detobj.nameStr = obj.Name; bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
detobj.ownerUUID = obj._ownerID; //If it is 1, it is to accept ONLY collisions from this object
detobj.posVector = obj.AbsolutePosition; if(found)
detobj.rotQuat = obj.GetWorldRotation(); {
detobj.velVector = obj.Velocity; DetectedObject detobj = new DetectedObject();
detobj.colliderType = 0; detobj.keyUUID = obj.UUID;
detobj.groupUUID = obj._groupID; detobj.nameStr = obj.Name;
colliding.Add(detobj); detobj.ownerUUID = obj._ownerID;
detobj.posVector = obj.AbsolutePosition;
detobj.rotQuat = obj.GetWorldRotation();
detobj.velVector = obj.Velocity;
detobj.colliderType = 0;
detobj.groupUUID = obj._groupID;
colliding.Add(detobj);
}
//If it is 0, it is to not accept collisions from this object
else
{
}
}
else
{
bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
//If it is 1, it is to accept ONLY collisions from this object, so this other object will not work
if(found)
{
DetectedObject detobj = new DetectedObject();
detobj.keyUUID = obj.UUID;
detobj.nameStr = obj.Name;
detobj.ownerUUID = obj._ownerID;
detobj.posVector = obj.AbsolutePosition;
detobj.rotQuat = obj.GetWorldRotation();
detobj.velVector = obj.Velocity;
detobj.colliderType = 0;
detobj.groupUUID = obj._groupID;
colliding.Add(detobj);
}
}
} }
else else
{ {
@ -1970,16 +2080,47 @@ namespace OpenSim.Region.Framework.Scenes
if (av.LocalId == localId) if (av.LocalId == localId)
{ {
DetectedObject detobj = new DetectedObject(); if(m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
detobj.keyUUID = av.UUID; {
detobj.nameStr = av.Name; bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
detobj.ownerUUID = av.UUID; //If it is 1, it is to accept ONLY collisions from this avatar
detobj.posVector = av.AbsolutePosition; if(found)
detobj.rotQuat = av.Rotation; {
detobj.velVector = av.Velocity; DetectedObject detobj = new DetectedObject();
detobj.colliderType = 0; detobj.keyUUID = av.UUID;
detobj.groupUUID = av.ControllingClient.ActiveGroupId; detobj.nameStr = av.ControllingClient.Name;
colliding.Add(detobj); detobj.ownerUUID = av.UUID;
detobj.posVector = av.AbsolutePosition;
detobj.rotQuat = av.Rotation;
detobj.velVector = av.Velocity;
detobj.colliderType = 0;
detobj.groupUUID = av.ControllingClient.ActiveGroupId;
colliding.Add(detobj);
}
//If it is 0, it is to not accept collisions from this avatar
else
{
}
}
else
{
bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
//If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work
if(found)
{
DetectedObject detobj = new DetectedObject();
detobj.keyUUID = av.UUID;
detobj.nameStr = av.ControllingClient.Name;
detobj.ownerUUID = av.UUID;
detobj.posVector = av.AbsolutePosition;
detobj.rotQuat = av.Rotation;
detobj.velVector = av.Velocity;
detobj.colliderType = 0;
detobj.groupUUID = av.ControllingClient.ActiveGroupId;
colliding.Add(detobj);
}
}
} }
} }
} }
@ -2016,18 +2157,49 @@ namespace OpenSim.Region.Framework.Scenes
if (m_parentGroup.Scene == null) if (m_parentGroup.Scene == null)
return; return;
SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId); SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId);
string data = "";
if (obj != null) if (obj != null)
{ {
DetectedObject detobj = new DetectedObject(); if(m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
detobj.keyUUID = obj.UUID; {
detobj.nameStr = obj.Name; bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
detobj.ownerUUID = obj._ownerID; //If it is 1, it is to accept ONLY collisions from this object
detobj.posVector = obj.AbsolutePosition; if(found)
detobj.rotQuat = obj.GetWorldRotation(); {
detobj.velVector = obj.Velocity; DetectedObject detobj = new DetectedObject();
detobj.colliderType = 0; detobj.keyUUID = obj.UUID;
detobj.groupUUID = obj._groupID; detobj.nameStr = obj.Name;
colliding.Add(detobj); detobj.ownerUUID = obj._ownerID;
detobj.posVector = obj.AbsolutePosition;
detobj.rotQuat = obj.GetWorldRotation();
detobj.velVector = obj.Velocity;
detobj.colliderType = 0;
detobj.groupUUID = obj._groupID;
colliding.Add(detobj);
}
//If it is 0, it is to not accept collisions from this object
else
{
}
}
else
{
bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
//If it is 1, it is to accept ONLY collisions from this object, so this other object will not work
if(found)
{
DetectedObject detobj = new DetectedObject();
detobj.keyUUID = obj.UUID;
detobj.nameStr = obj.Name;
detobj.ownerUUID = obj._ownerID;
detobj.posVector = obj.AbsolutePosition;
detobj.rotQuat = obj.GetWorldRotation();
detobj.velVector = obj.Velocity;
detobj.colliderType = 0;
detobj.groupUUID = obj._groupID;
colliding.Add(detobj);
}
}
} }
else else
{ {
@ -2039,16 +2211,47 @@ namespace OpenSim.Region.Framework.Scenes
if (av.LocalId == localId) if (av.LocalId == localId)
{ {
DetectedObject detobj = new DetectedObject(); if(m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
detobj.keyUUID = av.UUID; {
detobj.nameStr = av.Name; bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
detobj.ownerUUID = av.UUID; //If it is 1, it is to accept ONLY collisions from this avatar
detobj.posVector = av.AbsolutePosition; if(found)
detobj.rotQuat = av.Rotation; {
detobj.velVector = av.Velocity; DetectedObject detobj = new DetectedObject();
detobj.colliderType = 0; detobj.keyUUID = av.UUID;
detobj.groupUUID = av.ControllingClient.ActiveGroupId; detobj.nameStr = av.ControllingClient.Name;
colliding.Add(detobj); detobj.ownerUUID = av.UUID;
detobj.posVector = av.AbsolutePosition;
detobj.rotQuat = av.Rotation;
detobj.velVector = av.Velocity;
detobj.colliderType = 0;
detobj.groupUUID = av.ControllingClient.ActiveGroupId;
colliding.Add(detobj);
}
//If it is 0, it is to not accept collisions from this avatar
else
{
}
}
else
{
bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
//If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work
if(found)
{
DetectedObject detobj = new DetectedObject();
detobj.keyUUID = av.UUID;
detobj.nameStr = av.ControllingClient.Name;
detobj.ownerUUID = av.UUID;
detobj.posVector = av.AbsolutePosition;
detobj.rotQuat = av.Rotation;
detobj.velVector = av.Velocity;
detobj.colliderType = 0;
detobj.groupUUID = av.ControllingClient.ActiveGroupId;
colliding.Add(detobj);
}
}
} }
} }
} }

View File

@ -2752,7 +2752,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llCollisionFilter(string name, string id, int accept) public void llCollisionFilter(string name, string id, int accept)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
NotImplemented("llCollisionFilter"); m_host.CollisionFilter.Clear();
if(id != null)
{
m_host.CollisionFilter.Add(accept,id);
}
else
{
m_host.CollisionFilter.Add(accept,name);
}
} }
public void llTakeControls(int controls, int accept, int pass_on) public void llTakeControls(int controls, int accept, int pass_on)
@ -4232,7 +4240,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llPassCollisions(int pass) public void llPassCollisions(int pass)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
NotImplemented("llPassCollisions"); if(pass == 0)
{
m_host.ParentGroup.PassCollision = false;
}
else
{
m_host.ParentGroup.PassCollision = true;
}
} }
public LSL_String llGetScriptName() public LSL_String llGetScriptName()