From 7dd43bef8cc75cd0364abdd763a972ef9ed6f990 Mon Sep 17 00:00:00 2001 From: Revolution Date: Wed, 6 Jan 2010 21:19:00 -0600 Subject: Fixes the Collision errors and adds more to llGetStatus Signed-off-by: Melanie --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 119 +++++++++++++-------- 1 file changed, 74 insertions(+), 45 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 22a8ca1..d1bc351 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -139,7 +139,16 @@ namespace OpenSim.Region.Framework.Scenes public uint TimeStampTerse; [XmlIgnore] - public UUID FromItemID; + public UUID FromItemID; + + [XmlIgnore] + public int STATUS_ROTATE_X; + + [XmlIgnore] + public int STATUS_ROTATE_Y; + + [XmlIgnore] + public int STATUS_ROTATE_Z; [XmlIgnore] private Dictionary m_CollisionFilter = new Dictionary(); @@ -1671,6 +1680,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 double GetDistanceTo(Vector3 a, Vector3 b) @@ -1914,24 +1936,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 @@ -1943,8 +1965,8 @@ 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)) + { + 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 @@ -1965,24 +1987,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); + } } } @@ -2079,8 +2101,8 @@ 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)) + { + 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 +2128,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; @@ -2210,8 +2232,8 @@ 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)) + { + 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 +2259,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; @@ -2270,7 +2292,7 @@ namespace OpenSim.Region.Framework.Scenes m_parentGroup.Scene.EventManager.TriggerScriptCollidingEnd(LocalId, EndCollidingMessage); } } - } + } } public void PhysicsOutOfBounds(Vector3 pos) @@ -2736,7 +2758,14 @@ 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 + STATUS_ROTATE_Z = rotate; } public void SetBuoyancy(float fvalue) -- cgit v1.1 From 673a52fa7a0cef508396cfc2185825e72cf96507 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 9 Jan 2010 15:58:18 +0000 Subject: Implement the groups module query to make the estate allowed groups work --- OpenSim/Region/Framework/Scenes/Scene.cs | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 764ac60..183d811 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3525,8 +3525,35 @@ namespace OpenSim.Region.Framework.Scenes return false; } + IGroupsModule groupsModule = + RequestModuleInterface(); + + List agentGroups = new List(); + + 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); -- cgit v1.1 From 49c09ef24c37637c023d1ae22865d546efc4d0d0 Mon Sep 17 00:00:00 2001 From: Revolution Date: Fri, 8 Jan 2010 12:37:10 -0600 Subject: Fixes prim to prim collision. Signed-off-by: Melanie --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index d1bc351..cadb19f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1941,7 +1941,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; @@ -2077,7 +2077,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; @@ -2208,7 +2208,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; -- cgit v1.1 From 81d5a4b6d8d8548dde98cbf827d171bb1ebf96ba Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 10 Jan 2010 03:03:18 +0000 Subject: Remove "login disable", "login enable" and "login status" commands. --- OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | 7 ------- 1 file changed, 7 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index f49d072..6164368 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs @@ -65,13 +65,6 @@ namespace OpenSim.Region.Framework.Scenes protected List m_agentsInTransit; - public bool RegionLoginsEnabled - { - get { return m_regionLoginsEnabled; } - set { m_regionLoginsEnabled = value; } - } - private bool m_regionLoginsEnabled = false; - /// /// An agent is crossing into this region /// -- cgit v1.1 From b0a7bcb2c814554dff4fc6dcdcd45ccf700601e9 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 10 Jan 2010 03:17:40 +0000 Subject: Add "StartDisabled" to [Startup] to make all regions start up with logins disabled until enabled from the console. Add the AccessModule (WIP) --- OpenSim/Region/Framework/Scenes/Scene.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 183d811..da0b8e4 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -144,7 +144,7 @@ namespace OpenSim.Region.Framework.Scenes public CommunicationsManager CommsManager; protected SceneCommunicationService m_sceneGridService; - public bool loginsdisabled = true; + public bool LoginsDisabled = true; public new float TimeDilation { @@ -1275,15 +1275,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) @@ -3348,7 +3352,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; -- cgit v1.1 From 45b19e5e2da33813de07c2be2e46c1f28cbf9b38 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 10 Jan 2010 04:05:19 +0000 Subject: Fix a small bug in login disable code --- OpenSim/Region/Framework/Scenes/Scene.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index da0b8e4..bc9301b 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1275,7 +1275,7 @@ 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 -- cgit v1.1 From 038ec133e648ab99643f5738e4ab85e450e5aa45 Mon Sep 17 00:00:00 2001 From: Revolution Date: Sun, 10 Jan 2010 14:28:53 -0600 Subject: Adds land collision events. CRs cleaned from patch Signed-off-by: Melanie --- OpenSim/Region/Framework/Scenes/EventManager.cs | 28 +++++ OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 138 +++++++++++++++++++-- 2 files changed, 156 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 753344d..4dd6f32 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -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; @@ -439,6 +443,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; @@ -1034,6 +1041,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; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index cadb19f..a427f12 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1853,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 @@ -1904,6 +1900,8 @@ namespace OpenSim.Region.Framework.Scenes List colliding = new List(); 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; @@ -2039,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; @@ -2171,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) @@ -2293,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 colliding = new List(); + 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 colliding = new List(); + 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 colliding = new List(); + 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) @@ -3698,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) ) { @@ -3902,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) ) { -- cgit v1.1 From 2bf49cc1bb2d87877476f68daec2d515f475406d Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 10 Jan 2010 19:58:44 +0000 Subject: Clean CRs from previous patch --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 134 ++++++++++----------- 1 file changed, 67 insertions(+), 67 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a427f12..73f79b3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -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] @@ -1680,19 +1680,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) @@ -1934,24 +1934,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 @@ -1963,7 +1963,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); @@ -1985,24 +1985,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); + } } } @@ -2099,7 +2099,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); @@ -2230,7 +2230,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); @@ -2290,7 +2290,7 @@ 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) @@ -2870,13 +2870,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; } -- cgit v1.1 From a0859754c03324be9a4a2b9c9f26928e64cb5a6f Mon Sep 17 00:00:00 2001 From: Revolution Date: Sun, 10 Jan 2010 20:20:00 -0600 Subject: Adds llRotTarget and the events at_rot_target and not_at_rot_target. Signed-off-by: Melanie --- OpenSim/Region/Framework/Scenes/EventManager.cs | 32 ++++- .../Region/Framework/Scenes/SceneObjectGroup.cs | 130 ++++++++++++++++++++- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 17 +++ 3 files changed, 174 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 4dd6f32..76d5cb6 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -181,7 +181,15 @@ namespace OpenSim.Region.Framework.Scenes public delegate void ScriptNotAtTargetEvent(uint localID); - public event ScriptNotAtTargetEvent OnScriptNotAtTargetEvent; + 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); @@ -383,7 +391,9 @@ namespace OpenSim.Region.Framework.Scenes private ScriptChangedEvent handlerScriptChangedEvent = null; //OnScriptChangedEvent; private ScriptAtTargetEvent handlerScriptAtTargetEvent = null; - private ScriptNotAtTargetEvent handlerScriptNotAtTargetEvent = 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; @@ -849,6 +859,24 @@ namespace OpenSim.Region.Framework.Scenes { handlerScriptNotAtTargetEvent(localID); } + } + + 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) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 34d8b49..8050bf6 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -56,7 +56,8 @@ namespace OpenSim.Region.Framework.Scenes land_collision = 2048, land_collision_end = 4096, land_collision_start = 8192, - at_target = 16384, + at_target = 16384, + at_rot_target = 16777216, listen = 32768, money = 65536, moving_end = 131072, @@ -79,6 +80,13 @@ namespace OpenSim.Region.Framework.Scenes public Vector3 targetPos; public float tolerance; public uint handle; + } + + struct scriptRotTarget + { + public Quaternion targetRot; + public float tolerance; + public uint handle; } public delegate void PrimCountTaintedDelegate(); @@ -165,10 +173,14 @@ namespace OpenSim.Region.Framework.Scenes protected SceneObjectPart m_rootPart; // private Dictionary m_scriptEvents = new Dictionary(); - private Dictionary m_targets = new Dictionary(); + private Dictionary m_targets = new Dictionary(); + private Dictionary m_rotTargets = new Dictionary(); private bool m_scriptListens_atTarget = false; - private bool m_scriptListens_notAtTarget = false; + private bool m_scriptListens_notAtTarget = false; + + private bool m_scriptListens_atRotTarget = false; + private bool m_scriptListens_notAtRotTarget = false; internal Dictionary m_savedScriptState = null; @@ -1261,6 +1273,15 @@ namespace OpenSim.Region.Framework.Scenes lock (m_targets) 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(); @@ -3157,6 +3178,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) @@ -3263,6 +3308,85 @@ namespace OpenSim.Region.Framework.Scenes } } } + } + if (m_scriptListens_atRotTarget || m_scriptListens_notAtRotTarget) + { + if (m_rotTargets.Count > 0) + { + bool at_Rottarget = false; + Dictionary atRotTargets = new Dictionary(); + 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]); + } + } + } } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 73f79b3..177de47 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4078,6 +4078,23 @@ namespace OpenSim.Region.Framework.Scenes { m_parentGroup.unregisterTargetWaypoint(handle); } + } + + 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) -- cgit v1.1 From 2320b17ca92d0c922d78ad72933fe3903f2108d0 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 11 Jan 2010 02:04:05 +0000 Subject: Whitespace cleanup --- OpenSim/Region/Framework/Scenes/EventManager.cs | 56 ++--- .../Region/Framework/Scenes/SceneObjectGroup.cs | 248 ++++++++++----------- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 34 +-- 3 files changed, 169 insertions(+), 169 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 76d5cb6..399379e 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -181,14 +181,14 @@ namespace OpenSim.Region.Framework.Scenes public delegate void ScriptNotAtTargetEvent(uint localID); - 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 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); @@ -391,8 +391,8 @@ namespace OpenSim.Region.Framework.Scenes private ScriptChangedEvent handlerScriptChangedEvent = null; //OnScriptChangedEvent; private ScriptAtTargetEvent handlerScriptAtTargetEvent = null; - private ScriptNotAtTargetEvent handlerScriptNotAtTargetEvent = null; - private ScriptAtRotTargetEvent handlerScriptAtRotTargetEvent = null; + private ScriptNotAtTargetEvent handlerScriptNotAtTargetEvent = null; + private ScriptAtRotTargetEvent handlerScriptAtRotTargetEvent = null; private ScriptNotAtRotTargetEvent handlerScriptNotAtRotTargetEvent = null; private ClientMovement handlerClientMovement = null; //OnClientMovement; private OnPermissionErrorDelegate handlerPermissionError = null; //OnPermissionError; @@ -859,24 +859,24 @@ namespace OpenSim.Region.Framework.Scenes { handlerScriptNotAtTargetEvent(localID); } - } - - 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 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) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 8050bf6..ec41ac7 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -56,7 +56,7 @@ namespace OpenSim.Region.Framework.Scenes land_collision = 2048, land_collision_end = 4096, land_collision_start = 8192, - at_target = 16384, + at_target = 16384, at_rot_target = 16777216, listen = 32768, money = 65536, @@ -80,13 +80,13 @@ namespace OpenSim.Region.Framework.Scenes public Vector3 targetPos; public float tolerance; public uint handle; - } - - struct scriptRotTarget - { - public Quaternion targetRot; - public float tolerance; - public uint handle; + } + + struct scriptRotTarget + { + public Quaternion targetRot; + public float tolerance; + public uint handle; } public delegate void PrimCountTaintedDelegate(); @@ -173,13 +173,13 @@ namespace OpenSim.Region.Framework.Scenes protected SceneObjectPart m_rootPart; // private Dictionary m_scriptEvents = new Dictionary(); - private Dictionary m_targets = new Dictionary(); + private Dictionary m_targets = new Dictionary(); private Dictionary m_rotTargets = new Dictionary(); private bool m_scriptListens_atTarget = false; - private bool m_scriptListens_notAtTarget = false; - - private bool m_scriptListens_atRotTarget = false; + private bool m_scriptListens_notAtTarget = false; + + private bool m_scriptListens_atRotTarget = false; private bool m_scriptListens_notAtRotTarget = false; internal Dictionary m_savedScriptState = null; @@ -1273,15 +1273,15 @@ namespace OpenSim.Region.Framework.Scenes lock (m_targets) 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); + } + 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(); @@ -3178,30 +3178,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 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) @@ -3308,85 +3308,85 @@ namespace OpenSim.Region.Framework.Scenes } } } - } - if (m_scriptListens_atRotTarget || m_scriptListens_notAtRotTarget) - { - if (m_rotTargets.Count > 0) - { - bool at_Rottarget = false; - Dictionary atRotTargets = new Dictionary(); - 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]); - } - } - } + } + if (m_scriptListens_atRotTarget || m_scriptListens_notAtRotTarget) + { + if (m_rotTargets.Count > 0) + { + bool at_Rottarget = false; + Dictionary atRotTargets = new Dictionary(); + 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]); + } + } + } } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 177de47..56b2f13 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4078,23 +4078,23 @@ namespace OpenSim.Region.Framework.Scenes { m_parentGroup.unregisterTargetWaypoint(handle); } - } - - 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 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) -- cgit v1.1 From e3a04fcb7b6510b46bc4e24b9a1bc6e321774ac3 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 13 Jan 2010 03:08:34 +0000 Subject: Change the error messages on region region registration. This changes URM and region. The non-error case should be compatible, so no version bump. Untested. --- OpenSim/Region/Framework/Scenes/Scene.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index bc9301b..234554e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1562,9 +1562,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(), RegionInfo); -- cgit v1.1