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

@ -1861,18 +1861,14 @@ namespace OpenSim.Region.Framework.Scenes
// calculate things that started colliding this time
// 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))
{
startedColliders.Add(localid);
}
//m_log.Debug("[OBJECT]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString());
}
}
// calculate things that ended colliding
foreach (uint localID in m_lastColliders)
@ -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;
@ -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;
@ -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)
@ -2302,6 +2300,120 @@ namespace OpenSim.Region.Framework.Scenes
}
}
}
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)
@ -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,28 +288,62 @@ namespace OpenSim.Region.ScriptEngine.XEngine
det.ToArray()));
}
public void land_collision_start(uint localID, UUID itemID)
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[0],
new DetectParams[0]));
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)
{
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[0],
new DetectParams[0]));
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)
{
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[0],
new DetectParams[0]));
new Object[] { new LSL_Types.Vector3(d.Position) },
det.ToArray()));
}
}
// timer: not handled here