Readds llCollisionFilter and adds llPassCollision.

Applied with whitespace cleanup

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

View File

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

View File

@ -141,6 +141,9 @@ namespace OpenSim.Region.Framework.Scenes
[XmlIgnore]
public UUID FromItemID;
[XmlIgnore]
private Dictionary<int, string> m_CollisionFilter = new Dictionary<int, string>();
/// <value>
/// 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.
@ -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
{
get { return m_regionHandle; }
@ -1876,7 +1890,14 @@ namespace OpenSim.Region.Framework.Scenes
return;
SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId);
string data = "";
if (obj != null)
{
if(m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
{
bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
//If it is 1, it is to accept ONLY collisions from this object
if(found)
{
DetectedObject detobj = new DetectedObject();
detobj.keyUUID = obj.UUID;
@ -1889,6 +1910,30 @@ namespace OpenSim.Region.Framework.Scenes
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
{
ScenePresence[] avlist = m_parentGroup.Scene.GetScenePresences();
@ -1898,6 +1943,34 @@ namespace OpenSim.Region.Framework.Scenes
ScenePresence av = avlist[i];
if (av.LocalId == localId)
{
if(m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
{
bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
//If it is 1, it is to accept ONLY collisions from this avatar
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);
}
//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;
@ -1911,6 +1984,9 @@ namespace OpenSim.Region.Framework.Scenes
colliding.Add(detobj);
}
}
}
}
}
}
if (colliding.Count > 0)
@ -1922,7 +1998,10 @@ namespace OpenSim.Region.Framework.Scenes
if (m_parentGroup.Scene == null)
return;
if(m_parentGroup.PassCollision == true)
{
//TODO: Add pass to root prim!
}
m_parentGroup.Scene.EventManager.TriggerScriptCollidingStart(LocalId, StartCollidingMessage);
}
}
@ -1947,7 +2026,14 @@ namespace OpenSim.Region.Framework.Scenes
return;
SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId);
string data = "";
if (obj != null)
{
if(m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
{
bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
//If it is 1, it is to accept ONLY collisions from this object
if(found)
{
DetectedObject detobj = new DetectedObject();
detobj.keyUUID = obj.UUID;
@ -1960,6 +2046,30 @@ namespace OpenSim.Region.Framework.Scenes
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
{
ScenePresence[] avlist = m_parentGroup.Scene.GetScenePresences();
@ -1969,10 +2079,16 @@ namespace OpenSim.Region.Framework.Scenes
ScenePresence av = avlist[i];
if (av.LocalId == localId)
{
if(m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
{
bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
//If it is 1, it is to accept ONLY collisions from this avatar
if(found)
{
DetectedObject detobj = new DetectedObject();
detobj.keyUUID = av.UUID;
detobj.nameStr = av.Name;
detobj.nameStr = av.ControllingClient.Name;
detobj.ownerUUID = av.UUID;
detobj.posVector = av.AbsolutePosition;
detobj.rotQuat = av.Rotation;
@ -1981,6 +2097,31 @@ namespace OpenSim.Region.Framework.Scenes
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,7 +2157,14 @@ namespace OpenSim.Region.Framework.Scenes
if (m_parentGroup.Scene == null)
return;
SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId);
string data = "";
if (obj != null)
{
if(m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
{
bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
//If it is 1, it is to accept ONLY collisions from this object
if(found)
{
DetectedObject detobj = new DetectedObject();
detobj.keyUUID = obj.UUID;
@ -2029,6 +2177,30 @@ namespace OpenSim.Region.Framework.Scenes
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
{
ScenePresence[] avlist = m_parentGroup.Scene.GetScenePresences();
@ -2038,10 +2210,16 @@ namespace OpenSim.Region.Framework.Scenes
ScenePresence av = avlist[i];
if (av.LocalId == localId)
{
if(m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
{
bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
//If it is 1, it is to accept ONLY collisions from this avatar
if(found)
{
DetectedObject detobj = new DetectedObject();
detobj.keyUUID = av.UUID;
detobj.nameStr = av.Name;
detobj.nameStr = av.ControllingClient.Name;
detobj.ownerUUID = av.UUID;
detobj.posVector = av.AbsolutePosition;
detobj.rotQuat = av.Rotation;
@ -2050,6 +2228,31 @@ namespace OpenSim.Region.Framework.Scenes
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)
{
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)
@ -4232,7 +4240,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llPassCollisions(int pass)
{
m_host.AddScriptLPS(1);
NotImplemented("llPassCollisions");
if(pass == 0)
{
m_host.ParentGroup.PassCollision = false;
}
else
{
m_host.ParentGroup.PassCollision = true;
}
}
public LSL_String llGetScriptName()