mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 01:06:30 +08:00
Merge branch 'presence-refactor' of ssh://diva@opensimulator.org/var/git/opensim into presence-refactor
This commit is contained in:
@@ -183,12 +183,24 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
public event ScriptNotAtTargetEvent OnScriptNotAtTargetEvent;
|
||||
|
||||
public delegate void ScriptAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion atrot);
|
||||
|
||||
public event ScriptAtRotTargetEvent OnScriptAtRotTargetEvent;
|
||||
|
||||
public delegate void ScriptNotAtRotTargetEvent(uint localID);
|
||||
|
||||
public event ScriptNotAtRotTargetEvent OnScriptNotAtRotTargetEvent;
|
||||
|
||||
public delegate void ScriptColliding(uint localID, ColliderArgs colliders);
|
||||
|
||||
public event ScriptColliding OnScriptColliderStart;
|
||||
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;
|
||||
|
||||
@@ -380,6 +392,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
private ScriptChangedEvent handlerScriptChangedEvent = null; //OnScriptChangedEvent;
|
||||
private ScriptAtTargetEvent handlerScriptAtTargetEvent = null;
|
||||
private ScriptNotAtTargetEvent handlerScriptNotAtTargetEvent = null;
|
||||
private ScriptAtRotTargetEvent handlerScriptAtRotTargetEvent = null;
|
||||
private ScriptNotAtRotTargetEvent handlerScriptNotAtRotTargetEvent = null;
|
||||
private ClientMovement handlerClientMovement = null; //OnClientMovement;
|
||||
private OnPermissionErrorDelegate handlerPermissionError = null; //OnPermissionError;
|
||||
private OnPluginConsoleDelegate handlerPluginConsole = null; //OnPluginConsole;
|
||||
@@ -439,6 +453,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;
|
||||
@@ -844,6 +861,24 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion currentrot)
|
||||
{
|
||||
handlerScriptAtRotTargetEvent = OnScriptAtRotTargetEvent;
|
||||
if (handlerScriptAtRotTargetEvent != null)
|
||||
{
|
||||
handlerScriptAtRotTargetEvent(localID, handle, targetrot, currentrot);
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerNotAtRotTargetEvent(uint localID)
|
||||
{
|
||||
handlerScriptNotAtRotTargetEvent = OnScriptNotAtRotTargetEvent;
|
||||
if (handlerScriptNotAtRotTargetEvent != null)
|
||||
{
|
||||
handlerScriptNotAtRotTargetEvent(localID);
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerRequestChangeWaterHeight(float height)
|
||||
{
|
||||
handlerRequestChangeWaterHeight = OnRequestChangeWaterHeight;
|
||||
@@ -1034,6 +1069,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;
|
||||
|
||||
@@ -142,7 +142,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
protected AgentCircuitManager m_authenticateHandler;
|
||||
|
||||
protected SceneCommunicationService m_sceneGridService;
|
||||
public bool loginsdisabled = true;
|
||||
public bool LoginsDisabled = true;
|
||||
|
||||
public new float TimeDilation
|
||||
{
|
||||
@@ -1366,15 +1366,19 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS());
|
||||
}
|
||||
|
||||
if (loginsdisabled && m_frame > 20)
|
||||
if (LoginsDisabled && m_frame == 20)
|
||||
{
|
||||
// In 99.9% of cases it is a bad idea to manually force garbage collection. However,
|
||||
// this is a rare case where we know we have just went through a long cycle of heap
|
||||
// allocations, and there is no more work to be done until someone logs in
|
||||
GC.Collect();
|
||||
|
||||
m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName);
|
||||
loginsdisabled = false;
|
||||
IConfig startupConfig = m_config.Configs["Startup"];
|
||||
if (startupConfig == null || !startupConfig.GetBoolean("StartDisabled", false))
|
||||
{
|
||||
m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName);
|
||||
LoginsDisabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (NotImplementedException)
|
||||
@@ -1649,9 +1653,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
//m_sceneGridService.RegisterRegion(m_interregionCommsOut, RegionInfo);
|
||||
|
||||
GridRegion region = new GridRegion(RegionInfo);
|
||||
bool success = GridService.RegisterRegion(RegionInfo.ScopeID, region);
|
||||
if (!success)
|
||||
throw new Exception("Can't register with grid");
|
||||
string error = GridService.RegisterRegion(RegionInfo.ScopeID, region);
|
||||
if (error != String.Empty)
|
||||
throw new Exception(error);
|
||||
|
||||
m_sceneGridService.SetScene(this);
|
||||
m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo);
|
||||
@@ -3404,7 +3408,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// TeleportFlags.ViaLandmark | TeleportFlags.ViaLocation | TeleportFlags.ViaLandmark | TeleportFlags.Default - Regular Teleport
|
||||
|
||||
|
||||
if (loginsdisabled)
|
||||
if (LoginsDisabled)
|
||||
{
|
||||
reason = "Logins Disabled";
|
||||
return false;
|
||||
@@ -3577,8 +3581,35 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
return false;
|
||||
}
|
||||
|
||||
IGroupsModule groupsModule =
|
||||
RequestModuleInterface<IGroupsModule>();
|
||||
|
||||
List<UUID> agentGroups = new List<UUID>();
|
||||
|
||||
if (groupsModule != null)
|
||||
{
|
||||
GroupMembershipData[] GroupMembership =
|
||||
groupsModule.GetMembershipData(agent.AgentID);
|
||||
|
||||
for (int i = 0; i < GroupMembership.Length; i++)
|
||||
agentGroups.Add(GroupMembership[i].GroupID);
|
||||
}
|
||||
|
||||
bool groupAccess = false;
|
||||
UUID[] estateGroups = m_regInfo.EstateSettings.EstateGroups;
|
||||
|
||||
foreach (UUID group in estateGroups)
|
||||
{
|
||||
if (agentGroups.Contains(group))
|
||||
{
|
||||
groupAccess = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_regInfo.EstateSettings.PublicAccess &&
|
||||
!m_regInfo.EstateSettings.HasAccess(agent.AgentID))
|
||||
!m_regInfo.EstateSettings.HasAccess(agent.AgentID) &&
|
||||
!groupAccess)
|
||||
{
|
||||
m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the estate",
|
||||
agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
|
||||
|
||||
@@ -60,12 +60,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
protected RegionCommsListener regionCommsHost;
|
||||
|
||||
public bool RegionLoginsEnabled
|
||||
{
|
||||
get { return m_regionLoginsEnabled; }
|
||||
set { m_regionLoginsEnabled = value; }
|
||||
}
|
||||
private bool m_regionLoginsEnabled = false;
|
||||
protected List<UUID> m_agentsInTransit;
|
||||
|
||||
/// <summary>
|
||||
/// An agent is crossing into this region
|
||||
|
||||
@@ -57,6 +57,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
land_collision_end = 4096,
|
||||
land_collision_start = 8192,
|
||||
at_target = 16384,
|
||||
at_rot_target = 16777216,
|
||||
listen = 32768,
|
||||
money = 65536,
|
||||
moving_end = 131072,
|
||||
@@ -81,6 +82,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public uint handle;
|
||||
}
|
||||
|
||||
struct scriptRotTarget
|
||||
{
|
||||
public Quaternion targetRot;
|
||||
public float tolerance;
|
||||
public uint handle;
|
||||
}
|
||||
|
||||
public delegate void PrimCountTaintedDelegate();
|
||||
|
||||
/// <summary>
|
||||
@@ -166,10 +174,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// private Dictionary<UUID, scriptEvents> m_scriptEvents = new Dictionary<UUID, scriptEvents>();
|
||||
|
||||
private Dictionary<uint, scriptPosTarget> m_targets = new Dictionary<uint, scriptPosTarget>();
|
||||
private Dictionary<uint, scriptRotTarget> m_rotTargets = new Dictionary<uint, scriptRotTarget>();
|
||||
|
||||
private bool m_scriptListens_atTarget = false;
|
||||
private bool m_scriptListens_notAtTarget = false;
|
||||
|
||||
private bool m_scriptListens_atRotTarget = false;
|
||||
private bool m_scriptListens_notAtRotTarget = false;
|
||||
|
||||
internal Dictionary<UUID, string> m_savedScriptState = null;
|
||||
|
||||
#region Properties
|
||||
@@ -1262,6 +1274,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_targets.Clear();
|
||||
m_scene.RemoveGroupTarget(this);
|
||||
}
|
||||
m_scriptListens_atRotTarget = ((aggregateScriptEvents & scriptEvents.at_rot_target) != 0);
|
||||
m_scriptListens_notAtRotTarget = ((aggregateScriptEvents & scriptEvents.not_at_rot_target) != 0);
|
||||
|
||||
if (!m_scriptListens_atRotTarget && !m_scriptListens_notAtRotTarget)
|
||||
{
|
||||
lock (m_rotTargets)
|
||||
m_rotTargets.Clear();
|
||||
m_scene.RemoveGroupTarget(this);
|
||||
}
|
||||
|
||||
ScheduleGroupForFullUpdate();
|
||||
}
|
||||
@@ -3158,6 +3179,30 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
}
|
||||
}
|
||||
public int registerRotTargetWaypoint(Quaternion target, float tolerance)
|
||||
{
|
||||
scriptRotTarget waypoint = new scriptRotTarget();
|
||||
waypoint.targetRot = target;
|
||||
waypoint.tolerance = tolerance;
|
||||
uint handle = m_scene.AllocateLocalId();
|
||||
waypoint.handle = handle;
|
||||
lock (m_rotTargets)
|
||||
{
|
||||
m_rotTargets.Add(handle, waypoint);
|
||||
}
|
||||
m_scene.AddGroupTarget(this);
|
||||
return (int)handle;
|
||||
}
|
||||
|
||||
public void unregisterRotTargetWaypoint(int handle)
|
||||
{
|
||||
lock (m_targets)
|
||||
{
|
||||
m_rotTargets.Remove((uint)handle);
|
||||
if (m_targets.Count == 0)
|
||||
m_scene.RemoveGroupTarget(this);
|
||||
}
|
||||
}
|
||||
|
||||
public int registerTargetWaypoint(Vector3 target, float tolerance)
|
||||
{
|
||||
@@ -3264,6 +3309,85 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m_scriptListens_atRotTarget || m_scriptListens_notAtRotTarget)
|
||||
{
|
||||
if (m_rotTargets.Count > 0)
|
||||
{
|
||||
bool at_Rottarget = false;
|
||||
Dictionary<uint, scriptRotTarget> atRotTargets = new Dictionary<uint, scriptRotTarget>();
|
||||
lock (m_rotTargets)
|
||||
{
|
||||
foreach (uint idx in m_rotTargets.Keys)
|
||||
{
|
||||
scriptRotTarget target = m_rotTargets[idx];
|
||||
double angle = Math.Acos(target.targetRot.X * m_rootPart.RotationOffset.X + target.targetRot.Y * m_rootPart.RotationOffset.Y + target.targetRot.Z * m_rootPart.RotationOffset.Z + target.targetRot.W * m_rootPart.RotationOffset.W) * 2;
|
||||
if (angle < 0) angle = -angle;
|
||||
if (angle > Math.PI) angle = (Math.PI * 2 - angle);
|
||||
if (angle <= target.tolerance)
|
||||
{
|
||||
// trigger at_rot_target
|
||||
if (m_scriptListens_atRotTarget)
|
||||
{
|
||||
at_Rottarget = true;
|
||||
scriptRotTarget att = new scriptRotTarget();
|
||||
att.targetRot = target.targetRot;
|
||||
att.tolerance = target.tolerance;
|
||||
att.handle = target.handle;
|
||||
atRotTargets.Add(idx, att);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (atRotTargets.Count > 0)
|
||||
{
|
||||
uint[] localids = new uint[0];
|
||||
lock (m_parts)
|
||||
{
|
||||
localids = new uint[m_parts.Count];
|
||||
int cntr = 0;
|
||||
foreach (SceneObjectPart part in m_parts.Values)
|
||||
{
|
||||
localids[cntr] = part.LocalId;
|
||||
cntr++;
|
||||
}
|
||||
}
|
||||
|
||||
for (int ctr = 0; ctr < localids.Length; ctr++)
|
||||
{
|
||||
foreach (uint target in atRotTargets.Keys)
|
||||
{
|
||||
scriptRotTarget att = atRotTargets[target];
|
||||
m_scene.EventManager.TriggerAtRotTargetEvent(
|
||||
localids[ctr], att.handle, att.targetRot, m_rootPart.RotationOffset);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_scriptListens_notAtRotTarget && !at_Rottarget)
|
||||
{
|
||||
//trigger not_at_target
|
||||
uint[] localids = new uint[0];
|
||||
lock (m_parts)
|
||||
{
|
||||
localids = new uint[m_parts.Count];
|
||||
int cntr = 0;
|
||||
foreach (SceneObjectPart part in m_parts.Values)
|
||||
{
|
||||
localids[cntr] = part.LocalId;
|
||||
cntr++;
|
||||
}
|
||||
}
|
||||
|
||||
for (int ctr = 0; ctr < localids.Length; ctr++)
|
||||
{
|
||||
m_scene.EventManager.TriggerNotAtRotTargetEvent(localids[ctr]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public float GetMass()
|
||||
|
||||
@@ -140,6 +140,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
[XmlIgnore]
|
||||
public UUID FromItemID;
|
||||
|
||||
[XmlIgnore]
|
||||
public int STATUS_ROTATE_X;
|
||||
|
||||
[XmlIgnore]
|
||||
public int STATUS_ROTATE_Y;
|
||||
|
||||
[XmlIgnore]
|
||||
public int STATUS_ROTATE_Z;
|
||||
|
||||
[XmlIgnore]
|
||||
private Dictionary<int, string> m_CollisionFilter = new Dictionary<int, string>();
|
||||
@@ -1673,6 +1682,19 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
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 double GetDistanceTo(Vector3 a, Vector3 b)
|
||||
{
|
||||
float dx = a.X - b.X;
|
||||
@@ -1831,16 +1853,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
|
||||
@@ -1882,6 +1900,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;
|
||||
@@ -1919,7 +1939,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
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)
|
||||
if (!found)
|
||||
{
|
||||
DetectedObject detobj = new DetectedObject();
|
||||
detobj.keyUUID = obj.UUID;
|
||||
@@ -1944,7 +1964,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
if (av.LocalId == localId)
|
||||
{
|
||||
if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
|
||||
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);
|
||||
//If it is 1, it is to accept ONLY collisions from this avatar
|
||||
@@ -1970,7 +1990,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
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)
|
||||
if (!found)
|
||||
{
|
||||
DetectedObject detobj = new DetectedObject();
|
||||
detobj.keyUUID = av.UUID;
|
||||
@@ -2017,7 +2037,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;
|
||||
@@ -2055,7 +2075,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
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)
|
||||
if (!found)
|
||||
{
|
||||
DetectedObject detobj = new DetectedObject();
|
||||
detobj.keyUUID = obj.UUID;
|
||||
@@ -2080,7 +2100,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
if (av.LocalId == localId)
|
||||
{
|
||||
if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
|
||||
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);
|
||||
//If it is 1, it is to accept ONLY collisions from this avatar
|
||||
@@ -2106,7 +2126,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
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)
|
||||
if (!found)
|
||||
{
|
||||
DetectedObject detobj = new DetectedObject();
|
||||
detobj.keyUUID = av.UUID;
|
||||
@@ -2149,7 +2169,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)
|
||||
@@ -2186,7 +2206,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
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)
|
||||
if (!found)
|
||||
{
|
||||
DetectedObject detobj = new DetectedObject();
|
||||
detobj.keyUUID = obj.UUID;
|
||||
@@ -2211,7 +2231,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
if (av.LocalId == localId)
|
||||
{
|
||||
if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
|
||||
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);
|
||||
//If it is 1, it is to accept ONLY collisions from this avatar
|
||||
@@ -2237,7 +2257,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
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)
|
||||
if (!found)
|
||||
{
|
||||
DetectedObject detobj = new DetectedObject();
|
||||
detobj.keyUUID = av.UUID;
|
||||
@@ -2271,6 +2291,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)
|
||||
@@ -2737,6 +2871,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
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
|
||||
STATUS_ROTATE_Z = rotate;
|
||||
}
|
||||
|
||||
public void SetBuoyancy(float fvalue)
|
||||
@@ -3669,6 +3810,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)
|
||||
)
|
||||
{
|
||||
@@ -3873,6 +4017,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)
|
||||
)
|
||||
{
|
||||
@@ -3933,6 +4080,23 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
public int registerRotTargetWaypoint(Quaternion target, float tolerance)
|
||||
{
|
||||
if (m_parentGroup != null)
|
||||
{
|
||||
return m_parentGroup.registerRotTargetWaypoint(target, tolerance);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void unregisterRotTargetWaypoint(int handle)
|
||||
{
|
||||
if (m_parentGroup != null)
|
||||
{
|
||||
m_parentGroup.unregisterRotTargetWaypoint(handle);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetCameraAtOffset(Vector3 v)
|
||||
{
|
||||
m_cameraAtOffset = v;
|
||||
|
||||
Reference in New Issue
Block a user