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 OnScriptColliding;
public event ScriptColliding OnScriptCollidingEnd; public event ScriptColliding OnScriptCollidingEnd;
public event ScriptColliding OnScriptLandColliderStart;
public event ScriptColliding OnScriptLandColliding;
public event ScriptColliding OnScriptLandColliderEnd;
public delegate void OnMakeChildAgentDelegate(ScenePresence presence); public delegate void OnMakeChildAgentDelegate(ScenePresence presence);
public event OnMakeChildAgentDelegate OnMakeChildAgent; public event OnMakeChildAgentDelegate OnMakeChildAgent;
@ -445,6 +449,9 @@ namespace OpenSim.Region.Framework.Scenes
private ScriptColliding handlerCollidingStart = null; private ScriptColliding handlerCollidingStart = null;
private ScriptColliding handlerColliding = null; private ScriptColliding handlerColliding = null;
private ScriptColliding handlerCollidingEnd = null; private ScriptColliding handlerCollidingEnd = null;
private ScriptColliding handlerLandCollidingStart = null;
private ScriptColliding handlerLandColliding = null;
private ScriptColliding handlerLandCollidingEnd = null;
private GetScriptRunning handlerGetScriptRunning = null; private GetScriptRunning handlerGetScriptRunning = null;
private SunLindenHour handlerCurrentTimeAsLindenSunHour = null; private SunLindenHour handlerCurrentTimeAsLindenSunHour = null;
@ -1058,6 +1065,27 @@ namespace OpenSim.Region.Framework.Scenes
handlerCollidingEnd(localId, colliders); 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) public void TriggerSetRootAgentScene(UUID agentID, Scene scene)
{ {
handlerSetRootAgentScene = OnSetRootAgentScene; handlerSetRootAgentScene = OnSetRootAgentScene;

View File

@ -1862,16 +1862,12 @@ namespace OpenSim.Region.Framework.Scenes
// and build up list of colliders this time // and build up list of colliders this time
foreach (uint localid in collissionswith.Keys) foreach (uint localid in collissionswith.Keys)
{ {
if (localid != 0) thisHitColliders.Add(localid);
if (!m_lastColliders.Contains(localid))
{ {
thisHitColliders.Add(localid); startedColliders.Add(localid);
if (!m_lastColliders.Contains(localid))
{
startedColliders.Add(localid);
}
//m_log.Debug("[OBJECT]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString());
} }
//m_log.Debug("[OBJECT]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString());
} }
// calculate things that ended colliding // calculate things that ended colliding
@ -1913,6 +1909,8 @@ namespace OpenSim.Region.Framework.Scenes
List<DetectedObject> colliding = new List<DetectedObject>(); List<DetectedObject> colliding = new List<DetectedObject>();
foreach (uint localId in startedColliders) 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. // always running this check because if the user deletes the object it would return a null reference.
if (m_parentGroup == null) if (m_parentGroup == null)
return; 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. // always running this check because if the user deletes the object it would return a null reference.
if (localId == 0) if (localId == 0)
continue; return;
if (m_parentGroup == null) if (m_parentGroup == null)
return; return;
@ -2180,7 +2178,7 @@ namespace OpenSim.Region.Framework.Scenes
foreach (uint localId in endedColliders) foreach (uint localId in endedColliders)
{ {
if (localId == 0) if (localId == 0)
continue; return;
// always running this check because if the user deletes the object it would return a null reference. // always running this check because if the user deletes the object it would return a null reference.
if (m_parentGroup == null) 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) public void PhysicsOutOfBounds(Vector3 pos)
@ -3709,6 +3821,9 @@ namespace OpenSim.Region.Framework.Scenes
((AggregateScriptEvents & scriptEvents.collision) != 0) || ((AggregateScriptEvents & scriptEvents.collision) != 0) ||
((AggregateScriptEvents & scriptEvents.collision_end) != 0) || ((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
((AggregateScriptEvents & scriptEvents.collision_start) != 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) (CollisionSound != UUID.Zero)
) )
{ {
@ -3913,6 +4028,9 @@ namespace OpenSim.Region.Framework.Scenes
((AggregateScriptEvents & scriptEvents.collision) != 0) || ((AggregateScriptEvents & scriptEvents.collision) != 0) ||
((AggregateScriptEvents & scriptEvents.collision_end) != 0) || ((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
((AggregateScriptEvents & scriptEvents.collision_start) != 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) (CollisionSound != UUID.Zero)
) )
{ {

View File

@ -63,6 +63,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
myScriptEngine.World.EventManager.OnScriptColliderStart += collision_start; myScriptEngine.World.EventManager.OnScriptColliderStart += collision_start;
myScriptEngine.World.EventManager.OnScriptColliding += collision; myScriptEngine.World.EventManager.OnScriptColliding += collision;
myScriptEngine.World.EventManager.OnScriptCollidingEnd += collision_end; 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>(); IMoneyModule money=myScriptEngine.World.RequestModuleInterface<IMoneyModule>();
if (money != null) if (money != null)
{ {
@ -285,29 +288,63 @@ namespace OpenSim.Region.ScriptEngine.XEngine
det.ToArray())); det.ToArray()));
} }
public void land_collision_start(uint localID, UUID itemID) public void land_collision_start(uint localID, ColliderArgs col)
{ {
myScriptEngine.PostObjectEvent(localID, new EventParams( List<DetectParams> det = new List<DetectParams>();
"land_collision_start",
new object[0], foreach (DetectedObject detobj in col.Colliders)
new DetectParams[0])); {
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( List<DetectParams> det = new List<DetectParams>();
"land_collision",
new object[0], foreach (DetectedObject detobj in col.Colliders)
new DetectParams[0])); {
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( List<DetectParams> det = new List<DetectParams>();
"land_collision_end",
new object[0], foreach (DetectedObject detobj in col.Colliders)
new DetectParams[0])); {
} 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 // timer: not handled here
// listen: not handled here // listen: not handled here