Merge branch 'master' into careminster

avinationmerge
Melanie 2010-01-10 19:59:49 +00:00
commit 511481e8d9
3 changed files with 277 additions and 94 deletions

View File

@ -189,6 +189,10 @@ namespace OpenSim.Region.Framework.Scenes
public event ScriptColliding OnScriptColliding;
public event ScriptColliding OnScriptCollidingEnd;
public event ScriptColliding OnScriptLandColliderStart;
public event ScriptColliding OnScriptLandColliding;
public event ScriptColliding OnScriptLandColliderEnd;
public delegate void OnMakeChildAgentDelegate(ScenePresence presence);
public event OnMakeChildAgentDelegate OnMakeChildAgent;
@ -445,6 +449,9 @@ namespace OpenSim.Region.Framework.Scenes
private ScriptColliding handlerCollidingStart = null;
private ScriptColliding handlerColliding = null;
private ScriptColliding handlerCollidingEnd = null;
private ScriptColliding handlerLandCollidingStart = null;
private ScriptColliding handlerLandColliding = null;
private ScriptColliding handlerLandCollidingEnd = null;
private GetScriptRunning handlerGetScriptRunning = null;
private SunLindenHour handlerCurrentTimeAsLindenSunHour = null;
@ -1058,6 +1065,27 @@ namespace OpenSim.Region.Framework.Scenes
handlerCollidingEnd(localId, colliders);
}
public void TriggerScriptLandCollidingStart(uint localId, ColliderArgs colliders)
{
handlerLandCollidingStart = OnScriptLandColliderStart;
if (handlerLandCollidingStart != null)
handlerLandCollidingStart(localId, colliders);
}
public void TriggerScriptLandColliding(uint localId, ColliderArgs colliders)
{
handlerLandColliding = OnScriptLandColliding;
if (handlerLandColliding != null)
handlerLandColliding(localId, colliders);
}
public void TriggerScriptLandCollidingEnd(uint localId, ColliderArgs colliders)
{
handlerLandCollidingEnd = OnScriptLandColliderEnd;
if (handlerLandCollidingEnd != null)
handlerLandCollidingEnd(localId, colliders);
}
public void TriggerSetRootAgentScene(UUID agentID, Scene scene)
{
handlerSetRootAgentScene = OnSetRootAgentScene;

View File

@ -139,15 +139,15 @@ namespace OpenSim.Region.Framework.Scenes
public uint TimeStampTerse;
[XmlIgnore]
public UUID FromItemID;
[XmlIgnore]
public int STATUS_ROTATE_X;
[XmlIgnore]
public int STATUS_ROTATE_Y;
[XmlIgnore]
public UUID FromItemID;
[XmlIgnore]
public int STATUS_ROTATE_X;
[XmlIgnore]
public int STATUS_ROTATE_Y;
[XmlIgnore]
public int STATUS_ROTATE_Z;
[XmlIgnore]
@ -1684,19 +1684,19 @@ namespace OpenSim.Region.Framework.Scenes
return false;
return m_parentGroup.RootPart.DIE_AT_EDGE;
}
public int GetAxisRotation(int axis)
{
//Cannot use ScriptBaseClass constants as no referance to it currently.
if (axis == 2)//STATUS_ROTATE_X
return STATUS_ROTATE_X;
if (axis == 4)//STATUS_ROTATE_Y
return STATUS_ROTATE_Y;
if (axis == 8)//STATUS_ROTATE_Z
return STATUS_ROTATE_Z;
return 0;
}
public int GetAxisRotation(int axis)
{
//Cannot use ScriptBaseClass constants as no referance to it currently.
if (axis == 2)//STATUS_ROTATE_X
return STATUS_ROTATE_X;
if (axis == 4)//STATUS_ROTATE_Y
return STATUS_ROTATE_Y;
if (axis == 8)//STATUS_ROTATE_Z
return STATUS_ROTATE_Z;
return 0;
}
public double GetDistanceTo(Vector3 a, Vector3 b)
@ -1862,16 +1862,12 @@ namespace OpenSim.Region.Framework.Scenes
// and build up list of colliders this time
foreach (uint localid in collissionswith.Keys)
{
if (localid != 0)
thisHitColliders.Add(localid);
if (!m_lastColliders.Contains(localid))
{
thisHitColliders.Add(localid);
if (!m_lastColliders.Contains(localid))
{
startedColliders.Add(localid);
}
//m_log.Debug("[OBJECT]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString());
startedColliders.Add(localid);
}
//m_log.Debug("[OBJECT]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString());
}
// calculate things that ended colliding
@ -1913,6 +1909,8 @@ namespace OpenSim.Region.Framework.Scenes
List<DetectedObject> colliding = new List<DetectedObject>();
foreach (uint localId in startedColliders)
{
if (localId == 0)
return;
// always running this check because if the user deletes the object it would return a null reference.
if (m_parentGroup == null)
return;
@ -1945,24 +1943,24 @@ namespace OpenSim.Region.Framework.Scenes
else
{
}
}
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);
}
//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
@ -1974,7 +1972,7 @@ namespace OpenSim.Region.Framework.Scenes
ScenePresence av = avlist[i];
if (av.LocalId == localId)
{
{
if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name))
{
bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
@ -1996,24 +1994,24 @@ namespace OpenSim.Region.Framework.Scenes
else
{
}
}
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);
}
//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);
}
}
}
@ -2048,7 +2046,7 @@ namespace OpenSim.Region.Framework.Scenes
{
// always running this check because if the user deletes the object it would return a null reference.
if (localId == 0)
continue;
return;
if (m_parentGroup == null)
return;
@ -2110,7 +2108,7 @@ namespace OpenSim.Region.Framework.Scenes
ScenePresence av = avlist[i];
if (av.LocalId == localId)
{
{
if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name))
{
bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
@ -2180,7 +2178,7 @@ namespace OpenSim.Region.Framework.Scenes
foreach (uint localId in endedColliders)
{
if (localId == 0)
continue;
return;
// always running this check because if the user deletes the object it would return a null reference.
if (m_parentGroup == null)
@ -2241,7 +2239,7 @@ namespace OpenSim.Region.Framework.Scenes
ScenePresence av = avlist[i];
if (av.LocalId == localId)
{
{
if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name))
{
bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
@ -2301,7 +2299,121 @@ namespace OpenSim.Region.Framework.Scenes
m_parentGroup.Scene.EventManager.TriggerScriptCollidingEnd(LocalId, EndCollidingMessage);
}
}
}
}
if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision_start) != 0)
{
if (startedColliders.Count > 0)
{
ColliderArgs LandStartCollidingMessage = new ColliderArgs();
List<DetectedObject> colliding = new List<DetectedObject>();
foreach (uint localId in startedColliders)
{
if (localId == 0)
{
//Hope that all is left is ground!
DetectedObject detobj = new DetectedObject();
detobj.keyUUID = UUID.Zero;
detobj.nameStr = "";
detobj.ownerUUID = UUID.Zero;
detobj.posVector = m_parentGroup.RootPart.AbsolutePosition;
detobj.rotQuat = Quaternion.Identity;
detobj.velVector = Vector3.Zero;
detobj.colliderType = 0;
detobj.groupUUID = UUID.Zero;
colliding.Add(detobj);
}
}
if (colliding.Count > 0)
{
LandStartCollidingMessage.Colliders = colliding;
// always running this check because if the user deletes the object it would return a null reference.
if (m_parentGroup == null)
return;
if (m_parentGroup.Scene == null)
return;
m_parentGroup.Scene.EventManager.TriggerScriptLandCollidingStart(LocalId, LandStartCollidingMessage);
}
}
}
if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision) != 0)
{
if (m_lastColliders.Count > 0)
{
ColliderArgs LandCollidingMessage = new ColliderArgs();
List<DetectedObject> colliding = new List<DetectedObject>();
foreach (uint localId in startedColliders)
{
if (localId == 0)
{
//Hope that all is left is ground!
DetectedObject detobj = new DetectedObject();
detobj.keyUUID = UUID.Zero;
detobj.nameStr = "";
detobj.ownerUUID = UUID.Zero;
detobj.posVector = m_parentGroup.RootPart.AbsolutePosition;
detobj.rotQuat = Quaternion.Identity;
detobj.velVector = Vector3.Zero;
detobj.colliderType = 0;
detobj.groupUUID = UUID.Zero;
colliding.Add(detobj);
}
}
if (colliding.Count > 0)
{
LandCollidingMessage.Colliders = colliding;
// always running this check because if the user deletes the object it would return a null reference.
if (m_parentGroup == null)
return;
if (m_parentGroup.Scene == null)
return;
m_parentGroup.Scene.EventManager.TriggerScriptLandColliding(LocalId, LandCollidingMessage);
}
}
}
if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision_end) != 0)
{
if (endedColliders.Count > 0)
{
ColliderArgs LandEndCollidingMessage = new ColliderArgs();
List<DetectedObject> colliding = new List<DetectedObject>();
foreach (uint localId in startedColliders)
{
if (localId == 0)
{
//Hope that all is left is ground!
DetectedObject detobj = new DetectedObject();
detobj.keyUUID = UUID.Zero;
detobj.nameStr = "";
detobj.ownerUUID = UUID.Zero;
detobj.posVector = m_parentGroup.RootPart.AbsolutePosition;
detobj.rotQuat = Quaternion.Identity;
detobj.velVector = Vector3.Zero;
detobj.colliderType = 0;
detobj.groupUUID = UUID.Zero;
colliding.Add(detobj);
}
}
if (colliding.Count > 0)
{
LandEndCollidingMessage.Colliders = colliding;
// always running this check because if the user deletes the object it would return a null reference.
if (m_parentGroup == null)
return;
if (m_parentGroup.Scene == null)
return;
m_parentGroup.Scene.EventManager.TriggerScriptLandCollidingEnd(LocalId, LandEndCollidingMessage);
}
}
}
}
public void PhysicsOutOfBounds(Vector3 pos)
@ -2769,13 +2881,13 @@ namespace OpenSim.Region.Framework.Scenes
if (m_parentGroup != null)
{
m_parentGroup.SetAxisRotation(axis, rotate);
}
//Cannot use ScriptBaseClass constants as no referance to it currently.
if (axis == 2)//STATUS_ROTATE_X
STATUS_ROTATE_X = rotate;
if (axis == 4)//STATUS_ROTATE_Y
STATUS_ROTATE_Y = rotate;
if (axis == 8)//STATUS_ROTATE_Z
}
//Cannot use ScriptBaseClass constants as no referance to it currently.
if (axis == 2)//STATUS_ROTATE_X
STATUS_ROTATE_X = rotate;
if (axis == 4)//STATUS_ROTATE_Y
STATUS_ROTATE_Y = rotate;
if (axis == 8)//STATUS_ROTATE_Z
STATUS_ROTATE_Z = rotate;
}
@ -3709,6 +3821,9 @@ namespace OpenSim.Region.Framework.Scenes
((AggregateScriptEvents & scriptEvents.collision) != 0) ||
((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
((AggregateScriptEvents & scriptEvents.collision_start) != 0) ||
((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) ||
((AggregateScriptEvents & scriptEvents.land_collision) != 0) ||
((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) ||
(CollisionSound != UUID.Zero)
)
{
@ -3913,6 +4028,9 @@ namespace OpenSim.Region.Framework.Scenes
((AggregateScriptEvents & scriptEvents.collision) != 0) ||
((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
((AggregateScriptEvents & scriptEvents.collision_start) != 0) ||
((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) ||
((AggregateScriptEvents & scriptEvents.land_collision) != 0) ||
((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) ||
(CollisionSound != UUID.Zero)
)
{

View File

@ -63,6 +63,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
myScriptEngine.World.EventManager.OnScriptColliderStart += collision_start;
myScriptEngine.World.EventManager.OnScriptColliding += collision;
myScriptEngine.World.EventManager.OnScriptCollidingEnd += collision_end;
myScriptEngine.World.EventManager.OnScriptLandColliderStart += land_collision_start;
myScriptEngine.World.EventManager.OnScriptLandColliding += land_collision;
myScriptEngine.World.EventManager.OnScriptLandColliderEnd += land_collision_end;
IMoneyModule money=myScriptEngine.World.RequestModuleInterface<IMoneyModule>();
if (money != null)
{
@ -285,29 +288,63 @@ namespace OpenSim.Region.ScriptEngine.XEngine
det.ToArray()));
}
public void land_collision_start(uint localID, UUID itemID)
{
myScriptEngine.PostObjectEvent(localID, new EventParams(
"land_collision_start",
new object[0],
new DetectParams[0]));
public void land_collision_start(uint localID, ColliderArgs col)
{
List<DetectParams> det = new List<DetectParams>();
foreach (DetectedObject detobj in col.Colliders)
{
DetectParams d = new DetectParams();
d.Position = new LSL_Types.Vector3(detobj.posVector.X,
detobj.posVector.Y,
detobj.posVector.Z);
d.Populate(myScriptEngine.World);
det.Add(d);
myScriptEngine.PostObjectEvent(localID, new EventParams(
"land_collision_start",
new Object[] { new LSL_Types.Vector3(d.Position) },
det.ToArray()));
}
}
public void land_collision(uint localID, UUID itemID)
public void land_collision(uint localID, ColliderArgs col)
{
myScriptEngine.PostObjectEvent(localID, new EventParams(
"land_collision",
new object[0],
new DetectParams[0]));
List<DetectParams> det = new List<DetectParams>();
foreach (DetectedObject detobj in col.Colliders)
{
DetectParams d = new DetectParams();
d.Position = new LSL_Types.Vector3(detobj.posVector.X,
detobj.posVector.Y,
detobj.posVector.Z);
d.Populate(myScriptEngine.World);
det.Add(d);
myScriptEngine.PostObjectEvent(localID, new EventParams(
"land_collision",
new Object[] { new LSL_Types.Vector3(d.Position) },
det.ToArray()));
}
}
public void land_collision_end(uint localID, UUID itemID)
public void land_collision_end(uint localID, ColliderArgs col)
{
myScriptEngine.PostObjectEvent(localID, new EventParams(
"land_collision_end",
new object[0],
new DetectParams[0]));
}
List<DetectParams> det = new List<DetectParams>();
foreach (DetectedObject detobj in col.Colliders)
{
DetectParams d = new DetectParams();
d.Position = new LSL_Types.Vector3(detobj.posVector.X,
detobj.posVector.Y,
detobj.posVector.Z);
d.Populate(myScriptEngine.World);
det.Add(d);
myScriptEngine.PostObjectEvent(localID, new EventParams(
"land_collision_end",
new Object[] { new LSL_Types.Vector3(d.Position) },
det.ToArray()));
}
}
// timer: not handled here
// listen: not handled here