aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorMelanie2010-01-16 00:05:08 +0000
committerMelanie2010-01-16 00:05:08 +0000
commit10f8c2ea9b67158c32b361f9652d503ea48de292 (patch)
treebe0d88bc4b6df3825a0d27f62a08170d7c7ad262 /OpenSim/Region/Framework
parentMerge branch 'presence-refactor' of ssh://diva@opensimulator.org/var/git/open... (diff)
parentAdd "create user" instructions to README.txt (diff)
downloadopensim-SC_OLD-10f8c2ea9b67158c32b361f9652d503ea48de292.zip
opensim-SC_OLD-10f8c2ea9b67158c32b361f9652d503ea48de292.tar.gz
opensim-SC_OLD-10f8c2ea9b67158c32b361f9652d503ea48de292.tar.bz2
opensim-SC_OLD-10f8c2ea9b67158c32b361f9652d503ea48de292.tar.xz
Merge branch 'master' into presence-refactor
This merge was very conflicted. I think I got them all, but I can't be sure. I had to merge to master or risk divergence to the point of unmergeability.
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs20
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs56
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs49
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs124
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs202
6 files changed, 422 insertions, 36 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs b/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs
index 5cdf191..d7fa316 100644
--- a/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs
@@ -32,13 +32,29 @@ namespace OpenSim.Region.Framework.Interfaces
32{ 32{
33 public delegate void ScriptCommand(UUID script, string id, string module, string command, string k); 33 public delegate void ScriptCommand(UUID script, string id, string module, string command, string k);
34 34
35 /// <summary>
36 /// Interface for communication between OpenSim modules and in-world scripts
37 /// </summary>
38 ///
39 /// See OpenSim.Region.ScriptEngine.Shared.Api.MOD_Api.modSendCommand() for information on receiving messages
40 /// from scripts in OpenSim modules.
35 public interface IScriptModuleComms 41 public interface IScriptModuleComms
36 { 42 {
43 /// <summary>
44 /// Modules can subscribe to this event to receive command invocations from in-world scripts
45 /// </summary>
37 event ScriptCommand OnScriptCommand; 46 event ScriptCommand OnScriptCommand;
38 47
39 void DispatchReply(UUID script, int code, string text, string k); 48 /// <summary>
49 /// Send a link_message event to an in-world script
50 /// </summary>
51 /// <param name="scriptId"></param>
52 /// <param name="code"></param>
53 /// <param name="text"></param>
54 /// <param name="key"></param>
55 void DispatchReply(UUID scriptId, int code, string text, string key);
40 56
41 // For use ONLY by the script API 57 // For use ONLY by the script API
42 void RaiseEvent(UUID script, string id, string module, string command, string k); 58 void RaiseEvent(UUID script, string id, string module, string command, string key);
43 } 59 }
44} 60}
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 753344d..399379e 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -183,12 +183,24 @@ namespace OpenSim.Region.Framework.Scenes
183 183
184 public event ScriptNotAtTargetEvent OnScriptNotAtTargetEvent; 184 public event ScriptNotAtTargetEvent OnScriptNotAtTargetEvent;
185 185
186 public delegate void ScriptAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion atrot);
187
188 public event ScriptAtRotTargetEvent OnScriptAtRotTargetEvent;
189
190 public delegate void ScriptNotAtRotTargetEvent(uint localID);
191
192 public event ScriptNotAtRotTargetEvent OnScriptNotAtRotTargetEvent;
193
186 public delegate void ScriptColliding(uint localID, ColliderArgs colliders); 194 public delegate void ScriptColliding(uint localID, ColliderArgs colliders);
187 195
188 public event ScriptColliding OnScriptColliderStart; 196 public event ScriptColliding OnScriptColliderStart;
189 public event ScriptColliding OnScriptColliding; 197 public event ScriptColliding OnScriptColliding;
190 public event ScriptColliding OnScriptCollidingEnd; 198 public event ScriptColliding OnScriptCollidingEnd;
191 199
200 public event ScriptColliding OnScriptLandColliderStart;
201 public event ScriptColliding OnScriptLandColliding;
202 public event ScriptColliding OnScriptLandColliderEnd;
203
192 public delegate void OnMakeChildAgentDelegate(ScenePresence presence); 204 public delegate void OnMakeChildAgentDelegate(ScenePresence presence);
193 public event OnMakeChildAgentDelegate OnMakeChildAgent; 205 public event OnMakeChildAgentDelegate OnMakeChildAgent;
194 206
@@ -380,6 +392,8 @@ namespace OpenSim.Region.Framework.Scenes
380 private ScriptChangedEvent handlerScriptChangedEvent = null; //OnScriptChangedEvent; 392 private ScriptChangedEvent handlerScriptChangedEvent = null; //OnScriptChangedEvent;
381 private ScriptAtTargetEvent handlerScriptAtTargetEvent = null; 393 private ScriptAtTargetEvent handlerScriptAtTargetEvent = null;
382 private ScriptNotAtTargetEvent handlerScriptNotAtTargetEvent = null; 394 private ScriptNotAtTargetEvent handlerScriptNotAtTargetEvent = null;
395 private ScriptAtRotTargetEvent handlerScriptAtRotTargetEvent = null;
396 private ScriptNotAtRotTargetEvent handlerScriptNotAtRotTargetEvent = null;
383 private ClientMovement handlerClientMovement = null; //OnClientMovement; 397 private ClientMovement handlerClientMovement = null; //OnClientMovement;
384 private OnPermissionErrorDelegate handlerPermissionError = null; //OnPermissionError; 398 private OnPermissionErrorDelegate handlerPermissionError = null; //OnPermissionError;
385 private OnPluginConsoleDelegate handlerPluginConsole = null; //OnPluginConsole; 399 private OnPluginConsoleDelegate handlerPluginConsole = null; //OnPluginConsole;
@@ -439,6 +453,9 @@ namespace OpenSim.Region.Framework.Scenes
439 private ScriptColliding handlerCollidingStart = null; 453 private ScriptColliding handlerCollidingStart = null;
440 private ScriptColliding handlerColliding = null; 454 private ScriptColliding handlerColliding = null;
441 private ScriptColliding handlerCollidingEnd = null; 455 private ScriptColliding handlerCollidingEnd = null;
456 private ScriptColliding handlerLandCollidingStart = null;
457 private ScriptColliding handlerLandColliding = null;
458 private ScriptColliding handlerLandCollidingEnd = null;
442 private GetScriptRunning handlerGetScriptRunning = null; 459 private GetScriptRunning handlerGetScriptRunning = null;
443 460
444 private SunLindenHour handlerCurrentTimeAsLindenSunHour = null; 461 private SunLindenHour handlerCurrentTimeAsLindenSunHour = null;
@@ -844,6 +861,24 @@ namespace OpenSim.Region.Framework.Scenes
844 } 861 }
845 } 862 }
846 863
864 public void TriggerAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion currentrot)
865 {
866 handlerScriptAtRotTargetEvent = OnScriptAtRotTargetEvent;
867 if (handlerScriptAtRotTargetEvent != null)
868 {
869 handlerScriptAtRotTargetEvent(localID, handle, targetrot, currentrot);
870 }
871 }
872
873 public void TriggerNotAtRotTargetEvent(uint localID)
874 {
875 handlerScriptNotAtRotTargetEvent = OnScriptNotAtRotTargetEvent;
876 if (handlerScriptNotAtRotTargetEvent != null)
877 {
878 handlerScriptNotAtRotTargetEvent(localID);
879 }
880 }
881
847 public void TriggerRequestChangeWaterHeight(float height) 882 public void TriggerRequestChangeWaterHeight(float height)
848 { 883 {
849 handlerRequestChangeWaterHeight = OnRequestChangeWaterHeight; 884 handlerRequestChangeWaterHeight = OnRequestChangeWaterHeight;
@@ -1034,6 +1069,27 @@ namespace OpenSim.Region.Framework.Scenes
1034 handlerCollidingEnd(localId, colliders); 1069 handlerCollidingEnd(localId, colliders);
1035 } 1070 }
1036 1071
1072 public void TriggerScriptLandCollidingStart(uint localId, ColliderArgs colliders)
1073 {
1074 handlerLandCollidingStart = OnScriptLandColliderStart;
1075 if (handlerLandCollidingStart != null)
1076 handlerLandCollidingStart(localId, colliders);
1077 }
1078
1079 public void TriggerScriptLandColliding(uint localId, ColliderArgs colliders)
1080 {
1081 handlerLandColliding = OnScriptLandColliding;
1082 if (handlerLandColliding != null)
1083 handlerLandColliding(localId, colliders);
1084 }
1085
1086 public void TriggerScriptLandCollidingEnd(uint localId, ColliderArgs colliders)
1087 {
1088 handlerLandCollidingEnd = OnScriptLandColliderEnd;
1089 if (handlerLandCollidingEnd != null)
1090 handlerLandCollidingEnd(localId, colliders);
1091 }
1092
1037 public void TriggerSetRootAgentScene(UUID agentID, Scene scene) 1093 public void TriggerSetRootAgentScene(UUID agentID, Scene scene)
1038 { 1094 {
1039 handlerSetRootAgentScene = OnSetRootAgentScene; 1095 handlerSetRootAgentScene = OnSetRootAgentScene;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index dcbbe08..bf40d82 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -142,7 +142,7 @@ namespace OpenSim.Region.Framework.Scenes
142 protected AgentCircuitManager m_authenticateHandler; 142 protected AgentCircuitManager m_authenticateHandler;
143 143
144 protected SceneCommunicationService m_sceneGridService; 144 protected SceneCommunicationService m_sceneGridService;
145 public bool loginsdisabled = true; 145 public bool LoginsDisabled = true;
146 146
147 public new float TimeDilation 147 public new float TimeDilation
148 { 148 {
@@ -1366,15 +1366,19 @@ namespace OpenSim.Region.Framework.Scenes
1366 StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); 1366 StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS());
1367 } 1367 }
1368 1368
1369 if (loginsdisabled && m_frame > 20) 1369 if (LoginsDisabled && m_frame == 20)
1370 { 1370 {
1371 // In 99.9% of cases it is a bad idea to manually force garbage collection. However, 1371 // In 99.9% of cases it is a bad idea to manually force garbage collection. However,
1372 // this is a rare case where we know we have just went through a long cycle of heap 1372 // this is a rare case where we know we have just went through a long cycle of heap
1373 // allocations, and there is no more work to be done until someone logs in 1373 // allocations, and there is no more work to be done until someone logs in
1374 GC.Collect(); 1374 GC.Collect();
1375 1375
1376 m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName); 1376 IConfig startupConfig = m_config.Configs["Startup"];
1377 loginsdisabled = false; 1377 if (startupConfig == null || !startupConfig.GetBoolean("StartDisabled", false))
1378 {
1379 m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName);
1380 LoginsDisabled = false;
1381 }
1378 } 1382 }
1379 } 1383 }
1380 catch (NotImplementedException) 1384 catch (NotImplementedException)
@@ -1649,9 +1653,9 @@ namespace OpenSim.Region.Framework.Scenes
1649 //m_sceneGridService.RegisterRegion(m_interregionCommsOut, RegionInfo); 1653 //m_sceneGridService.RegisterRegion(m_interregionCommsOut, RegionInfo);
1650 1654
1651 GridRegion region = new GridRegion(RegionInfo); 1655 GridRegion region = new GridRegion(RegionInfo);
1652 bool success = GridService.RegisterRegion(RegionInfo.ScopeID, region); 1656 string error = GridService.RegisterRegion(RegionInfo.ScopeID, region);
1653 if (!success) 1657 if (error != String.Empty)
1654 throw new Exception("Can't register with grid"); 1658 throw new Exception(error);
1655 1659
1656 m_sceneGridService.SetScene(this); 1660 m_sceneGridService.SetScene(this);
1657 m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo); 1661 m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo);
@@ -3404,7 +3408,7 @@ namespace OpenSim.Region.Framework.Scenes
3404 // TeleportFlags.ViaLandmark | TeleportFlags.ViaLocation | TeleportFlags.ViaLandmark | TeleportFlags.Default - Regular Teleport 3408 // TeleportFlags.ViaLandmark | TeleportFlags.ViaLocation | TeleportFlags.ViaLandmark | TeleportFlags.Default - Regular Teleport
3405 3409
3406 3410
3407 if (loginsdisabled) 3411 if (LoginsDisabled)
3408 { 3412 {
3409 reason = "Logins Disabled"; 3413 reason = "Logins Disabled";
3410 return false; 3414 return false;
@@ -3577,8 +3581,35 @@ namespace OpenSim.Region.Framework.Scenes
3577 return false; 3581 return false;
3578 } 3582 }
3579 3583
3584 IGroupsModule groupsModule =
3585 RequestModuleInterface<IGroupsModule>();
3586
3587 List<UUID> agentGroups = new List<UUID>();
3588
3589 if (groupsModule != null)
3590 {
3591 GroupMembershipData[] GroupMembership =
3592 groupsModule.GetMembershipData(agent.AgentID);
3593
3594 for (int i = 0; i < GroupMembership.Length; i++)
3595 agentGroups.Add(GroupMembership[i].GroupID);
3596 }
3597
3598 bool groupAccess = false;
3599 UUID[] estateGroups = m_regInfo.EstateSettings.EstateGroups;
3600
3601 foreach (UUID group in estateGroups)
3602 {
3603 if (agentGroups.Contains(group))
3604 {
3605 groupAccess = true;
3606 break;
3607 }
3608 }
3609
3580 if (!m_regInfo.EstateSettings.PublicAccess && 3610 if (!m_regInfo.EstateSettings.PublicAccess &&
3581 !m_regInfo.EstateSettings.HasAccess(agent.AgentID)) 3611 !m_regInfo.EstateSettings.HasAccess(agent.AgentID) &&
3612 !groupAccess)
3582 { 3613 {
3583 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the estate", 3614 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the estate",
3584 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); 3615 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index a67b42a..f1813a5 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -60,12 +60,7 @@ namespace OpenSim.Region.Framework.Scenes
60 60
61 protected RegionCommsListener regionCommsHost; 61 protected RegionCommsListener regionCommsHost;
62 62
63 public bool RegionLoginsEnabled 63 protected List<UUID> m_agentsInTransit;
64 {
65 get { return m_regionLoginsEnabled; }
66 set { m_regionLoginsEnabled = value; }
67 }
68 private bool m_regionLoginsEnabled = false;
69 64
70 /// <summary> 65 /// <summary>
71 /// An agent is crossing into this region 66 /// An agent is crossing into this region
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 34d8b49..ec41ac7 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -57,6 +57,7 @@ namespace OpenSim.Region.Framework.Scenes
57 land_collision_end = 4096, 57 land_collision_end = 4096,
58 land_collision_start = 8192, 58 land_collision_start = 8192,
59 at_target = 16384, 59 at_target = 16384,
60 at_rot_target = 16777216,
60 listen = 32768, 61 listen = 32768,
61 money = 65536, 62 money = 65536,
62 moving_end = 131072, 63 moving_end = 131072,
@@ -81,6 +82,13 @@ namespace OpenSim.Region.Framework.Scenes
81 public uint handle; 82 public uint handle;
82 } 83 }
83 84
85 struct scriptRotTarget
86 {
87 public Quaternion targetRot;
88 public float tolerance;
89 public uint handle;
90 }
91
84 public delegate void PrimCountTaintedDelegate(); 92 public delegate void PrimCountTaintedDelegate();
85 93
86 /// <summary> 94 /// <summary>
@@ -166,10 +174,14 @@ namespace OpenSim.Region.Framework.Scenes
166 // private Dictionary<UUID, scriptEvents> m_scriptEvents = new Dictionary<UUID, scriptEvents>(); 174 // private Dictionary<UUID, scriptEvents> m_scriptEvents = new Dictionary<UUID, scriptEvents>();
167 175
168 private Dictionary<uint, scriptPosTarget> m_targets = new Dictionary<uint, scriptPosTarget>(); 176 private Dictionary<uint, scriptPosTarget> m_targets = new Dictionary<uint, scriptPosTarget>();
177 private Dictionary<uint, scriptRotTarget> m_rotTargets = new Dictionary<uint, scriptRotTarget>();
169 178
170 private bool m_scriptListens_atTarget = false; 179 private bool m_scriptListens_atTarget = false;
171 private bool m_scriptListens_notAtTarget = false; 180 private bool m_scriptListens_notAtTarget = false;
172 181
182 private bool m_scriptListens_atRotTarget = false;
183 private bool m_scriptListens_notAtRotTarget = false;
184
173 internal Dictionary<UUID, string> m_savedScriptState = null; 185 internal Dictionary<UUID, string> m_savedScriptState = null;
174 186
175 #region Properties 187 #region Properties
@@ -1262,6 +1274,15 @@ namespace OpenSim.Region.Framework.Scenes
1262 m_targets.Clear(); 1274 m_targets.Clear();
1263 m_scene.RemoveGroupTarget(this); 1275 m_scene.RemoveGroupTarget(this);
1264 } 1276 }
1277 m_scriptListens_atRotTarget = ((aggregateScriptEvents & scriptEvents.at_rot_target) != 0);
1278 m_scriptListens_notAtRotTarget = ((aggregateScriptEvents & scriptEvents.not_at_rot_target) != 0);
1279
1280 if (!m_scriptListens_atRotTarget && !m_scriptListens_notAtRotTarget)
1281 {
1282 lock (m_rotTargets)
1283 m_rotTargets.Clear();
1284 m_scene.RemoveGroupTarget(this);
1285 }
1265 1286
1266 ScheduleGroupForFullUpdate(); 1287 ScheduleGroupForFullUpdate();
1267 } 1288 }
@@ -3158,6 +3179,30 @@ namespace OpenSim.Region.Framework.Scenes
3158 3179
3159 } 3180 }
3160 } 3181 }
3182 public int registerRotTargetWaypoint(Quaternion target, float tolerance)
3183 {
3184 scriptRotTarget waypoint = new scriptRotTarget();
3185 waypoint.targetRot = target;
3186 waypoint.tolerance = tolerance;
3187 uint handle = m_scene.AllocateLocalId();
3188 waypoint.handle = handle;
3189 lock (m_rotTargets)
3190 {
3191 m_rotTargets.Add(handle, waypoint);
3192 }
3193 m_scene.AddGroupTarget(this);
3194 return (int)handle;
3195 }
3196
3197 public void unregisterRotTargetWaypoint(int handle)
3198 {
3199 lock (m_targets)
3200 {
3201 m_rotTargets.Remove((uint)handle);
3202 if (m_targets.Count == 0)
3203 m_scene.RemoveGroupTarget(this);
3204 }
3205 }
3161 3206
3162 public int registerTargetWaypoint(Vector3 target, float tolerance) 3207 public int registerTargetWaypoint(Vector3 target, float tolerance)
3163 { 3208 {
@@ -3264,6 +3309,85 @@ namespace OpenSim.Region.Framework.Scenes
3264 } 3309 }
3265 } 3310 }
3266 } 3311 }
3312 if (m_scriptListens_atRotTarget || m_scriptListens_notAtRotTarget)
3313 {
3314 if (m_rotTargets.Count > 0)
3315 {
3316 bool at_Rottarget = false;
3317 Dictionary<uint, scriptRotTarget> atRotTargets = new Dictionary<uint, scriptRotTarget>();
3318 lock (m_rotTargets)
3319 {
3320 foreach (uint idx in m_rotTargets.Keys)
3321 {
3322 scriptRotTarget target = m_rotTargets[idx];
3323 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;
3324 if (angle < 0) angle = -angle;
3325 if (angle > Math.PI) angle = (Math.PI * 2 - angle);
3326 if (angle <= target.tolerance)
3327 {
3328 // trigger at_rot_target
3329 if (m_scriptListens_atRotTarget)
3330 {
3331 at_Rottarget = true;
3332 scriptRotTarget att = new scriptRotTarget();
3333 att.targetRot = target.targetRot;
3334 att.tolerance = target.tolerance;
3335 att.handle = target.handle;
3336 atRotTargets.Add(idx, att);
3337 }
3338 }
3339 }
3340 }
3341
3342 if (atRotTargets.Count > 0)
3343 {
3344 uint[] localids = new uint[0];
3345 lock (m_parts)
3346 {
3347 localids = new uint[m_parts.Count];
3348 int cntr = 0;
3349 foreach (SceneObjectPart part in m_parts.Values)
3350 {
3351 localids[cntr] = part.LocalId;
3352 cntr++;
3353 }
3354 }
3355
3356 for (int ctr = 0; ctr < localids.Length; ctr++)
3357 {
3358 foreach (uint target in atRotTargets.Keys)
3359 {
3360 scriptRotTarget att = atRotTargets[target];
3361 m_scene.EventManager.TriggerAtRotTargetEvent(
3362 localids[ctr], att.handle, att.targetRot, m_rootPart.RotationOffset);
3363 }
3364 }
3365
3366 return;
3367 }
3368
3369 if (m_scriptListens_notAtRotTarget && !at_Rottarget)
3370 {
3371 //trigger not_at_target
3372 uint[] localids = new uint[0];
3373 lock (m_parts)
3374 {
3375 localids = new uint[m_parts.Count];
3376 int cntr = 0;
3377 foreach (SceneObjectPart part in m_parts.Values)
3378 {
3379 localids[cntr] = part.LocalId;
3380 cntr++;
3381 }
3382 }
3383
3384 for (int ctr = 0; ctr < localids.Length; ctr++)
3385 {
3386 m_scene.EventManager.TriggerNotAtRotTargetEvent(localids[ctr]);
3387 }
3388 }
3389 }
3390 }
3267 } 3391 }
3268 3392
3269 public float GetMass() 3393 public float GetMass()
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 22a8ca1..56b2f13 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -140,6 +140,15 @@ namespace OpenSim.Region.Framework.Scenes
140 140
141 [XmlIgnore] 141 [XmlIgnore]
142 public UUID FromItemID; 142 public UUID FromItemID;
143
144 [XmlIgnore]
145 public int STATUS_ROTATE_X;
146
147 [XmlIgnore]
148 public int STATUS_ROTATE_Y;
149
150 [XmlIgnore]
151 public int STATUS_ROTATE_Z;
143 152
144 [XmlIgnore] 153 [XmlIgnore]
145 private Dictionary<int, string> m_CollisionFilter = new Dictionary<int, string>(); 154 private Dictionary<int, string> m_CollisionFilter = new Dictionary<int, string>();
@@ -1673,6 +1682,19 @@ namespace OpenSim.Region.Framework.Scenes
1673 return m_parentGroup.RootPart.DIE_AT_EDGE; 1682 return m_parentGroup.RootPart.DIE_AT_EDGE;
1674 } 1683 }
1675 1684
1685 public int GetAxisRotation(int axis)
1686 {
1687 //Cannot use ScriptBaseClass constants as no referance to it currently.
1688 if (axis == 2)//STATUS_ROTATE_X
1689 return STATUS_ROTATE_X;
1690 if (axis == 4)//STATUS_ROTATE_Y
1691 return STATUS_ROTATE_Y;
1692 if (axis == 8)//STATUS_ROTATE_Z
1693 return STATUS_ROTATE_Z;
1694
1695 return 0;
1696 }
1697
1676 public double GetDistanceTo(Vector3 a, Vector3 b) 1698 public double GetDistanceTo(Vector3 a, Vector3 b)
1677 { 1699 {
1678 float dx = a.X - b.X; 1700 float dx = a.X - b.X;
@@ -1831,16 +1853,12 @@ namespace OpenSim.Region.Framework.Scenes
1831 // and build up list of colliders this time 1853 // and build up list of colliders this time
1832 foreach (uint localid in collissionswith.Keys) 1854 foreach (uint localid in collissionswith.Keys)
1833 { 1855 {
1834 if (localid != 0) 1856 thisHitColliders.Add(localid);
1857 if (!m_lastColliders.Contains(localid))
1835 { 1858 {
1836 thisHitColliders.Add(localid); 1859 startedColliders.Add(localid);
1837 if (!m_lastColliders.Contains(localid))
1838 {
1839 startedColliders.Add(localid);
1840 }
1841
1842 //m_log.Debug("[OBJECT]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString());
1843 } 1860 }
1861 //m_log.Debug("[OBJECT]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString());
1844 } 1862 }
1845 1863
1846 // calculate things that ended colliding 1864 // calculate things that ended colliding
@@ -1882,6 +1900,8 @@ namespace OpenSim.Region.Framework.Scenes
1882 List<DetectedObject> colliding = new List<DetectedObject>(); 1900 List<DetectedObject> colliding = new List<DetectedObject>();
1883 foreach (uint localId in startedColliders) 1901 foreach (uint localId in startedColliders)
1884 { 1902 {
1903 if (localId == 0)
1904 return;
1885 // always running this check because if the user deletes the object it would return a null reference. 1905 // always running this check because if the user deletes the object it would return a null reference.
1886 if (m_parentGroup == null) 1906 if (m_parentGroup == null)
1887 return; 1907 return;
@@ -1919,7 +1939,7 @@ namespace OpenSim.Region.Framework.Scenes
1919 { 1939 {
1920 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); 1940 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
1921 //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work 1941 //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work
1922 if (found) 1942 if (!found)
1923 { 1943 {
1924 DetectedObject detobj = new DetectedObject(); 1944 DetectedObject detobj = new DetectedObject();
1925 detobj.keyUUID = obj.UUID; 1945 detobj.keyUUID = obj.UUID;
@@ -1944,7 +1964,7 @@ namespace OpenSim.Region.Framework.Scenes
1944 1964
1945 if (av.LocalId == localId) 1965 if (av.LocalId == localId)
1946 { 1966 {
1947 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name)) 1967 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name))
1948 { 1968 {
1949 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); 1969 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
1950 //If it is 1, it is to accept ONLY collisions from this avatar 1970 //If it is 1, it is to accept ONLY collisions from this avatar
@@ -1970,7 +1990,7 @@ namespace OpenSim.Region.Framework.Scenes
1970 { 1990 {
1971 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); 1991 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
1972 //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work 1992 //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work
1973 if (found) 1993 if (!found)
1974 { 1994 {
1975 DetectedObject detobj = new DetectedObject(); 1995 DetectedObject detobj = new DetectedObject();
1976 detobj.keyUUID = av.UUID; 1996 detobj.keyUUID = av.UUID;
@@ -2017,7 +2037,7 @@ namespace OpenSim.Region.Framework.Scenes
2017 { 2037 {
2018 // always running this check because if the user deletes the object it would return a null reference. 2038 // always running this check because if the user deletes the object it would return a null reference.
2019 if (localId == 0) 2039 if (localId == 0)
2020 continue; 2040 return;
2021 2041
2022 if (m_parentGroup == null) 2042 if (m_parentGroup == null)
2023 return; 2043 return;
@@ -2055,7 +2075,7 @@ namespace OpenSim.Region.Framework.Scenes
2055 { 2075 {
2056 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); 2076 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
2057 //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work 2077 //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work
2058 if (found) 2078 if (!found)
2059 { 2079 {
2060 DetectedObject detobj = new DetectedObject(); 2080 DetectedObject detobj = new DetectedObject();
2061 detobj.keyUUID = obj.UUID; 2081 detobj.keyUUID = obj.UUID;
@@ -2080,7 +2100,7 @@ namespace OpenSim.Region.Framework.Scenes
2080 2100
2081 if (av.LocalId == localId) 2101 if (av.LocalId == localId)
2082 { 2102 {
2083 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name)) 2103 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name))
2084 { 2104 {
2085 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); 2105 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
2086 //If it is 1, it is to accept ONLY collisions from this avatar 2106 //If it is 1, it is to accept ONLY collisions from this avatar
@@ -2106,7 +2126,7 @@ namespace OpenSim.Region.Framework.Scenes
2106 { 2126 {
2107 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); 2127 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
2108 //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work 2128 //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work
2109 if (found) 2129 if (!found)
2110 { 2130 {
2111 DetectedObject detobj = new DetectedObject(); 2131 DetectedObject detobj = new DetectedObject();
2112 detobj.keyUUID = av.UUID; 2132 detobj.keyUUID = av.UUID;
@@ -2149,7 +2169,7 @@ namespace OpenSim.Region.Framework.Scenes
2149 foreach (uint localId in endedColliders) 2169 foreach (uint localId in endedColliders)
2150 { 2170 {
2151 if (localId == 0) 2171 if (localId == 0)
2152 continue; 2172 return;
2153 2173
2154 // always running this check because if the user deletes the object it would return a null reference. 2174 // always running this check because if the user deletes the object it would return a null reference.
2155 if (m_parentGroup == null) 2175 if (m_parentGroup == null)
@@ -2186,7 +2206,7 @@ namespace OpenSim.Region.Framework.Scenes
2186 { 2206 {
2187 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); 2207 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
2188 //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work 2208 //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work
2189 if (found) 2209 if (!found)
2190 { 2210 {
2191 DetectedObject detobj = new DetectedObject(); 2211 DetectedObject detobj = new DetectedObject();
2192 detobj.keyUUID = obj.UUID; 2212 detobj.keyUUID = obj.UUID;
@@ -2211,7 +2231,7 @@ namespace OpenSim.Region.Framework.Scenes
2211 2231
2212 if (av.LocalId == localId) 2232 if (av.LocalId == localId)
2213 { 2233 {
2214 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name)) 2234 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name))
2215 { 2235 {
2216 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); 2236 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
2217 //If it is 1, it is to accept ONLY collisions from this avatar 2237 //If it is 1, it is to accept ONLY collisions from this avatar
@@ -2237,7 +2257,7 @@ namespace OpenSim.Region.Framework.Scenes
2237 { 2257 {
2238 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); 2258 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
2239 //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work 2259 //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work
2240 if (found) 2260 if (!found)
2241 { 2261 {
2242 DetectedObject detobj = new DetectedObject(); 2262 DetectedObject detobj = new DetectedObject();
2243 detobj.keyUUID = av.UUID; 2263 detobj.keyUUID = av.UUID;
@@ -2271,6 +2291,120 @@ namespace OpenSim.Region.Framework.Scenes
2271 } 2291 }
2272 } 2292 }
2273 } 2293 }
2294 if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision_start) != 0)
2295 {
2296 if (startedColliders.Count > 0)
2297 {
2298 ColliderArgs LandStartCollidingMessage = new ColliderArgs();
2299 List<DetectedObject> colliding = new List<DetectedObject>();
2300 foreach (uint localId in startedColliders)
2301 {
2302 if (localId == 0)
2303 {
2304 //Hope that all is left is ground!
2305 DetectedObject detobj = new DetectedObject();
2306 detobj.keyUUID = UUID.Zero;
2307 detobj.nameStr = "";
2308 detobj.ownerUUID = UUID.Zero;
2309 detobj.posVector = m_parentGroup.RootPart.AbsolutePosition;
2310 detobj.rotQuat = Quaternion.Identity;
2311 detobj.velVector = Vector3.Zero;
2312 detobj.colliderType = 0;
2313 detobj.groupUUID = UUID.Zero;
2314 colliding.Add(detobj);
2315 }
2316 }
2317
2318 if (colliding.Count > 0)
2319 {
2320 LandStartCollidingMessage.Colliders = colliding;
2321 // always running this check because if the user deletes the object it would return a null reference.
2322 if (m_parentGroup == null)
2323 return;
2324
2325 if (m_parentGroup.Scene == null)
2326 return;
2327
2328 m_parentGroup.Scene.EventManager.TriggerScriptLandCollidingStart(LocalId, LandStartCollidingMessage);
2329 }
2330 }
2331 }
2332 if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision) != 0)
2333 {
2334 if (m_lastColliders.Count > 0)
2335 {
2336 ColliderArgs LandCollidingMessage = new ColliderArgs();
2337 List<DetectedObject> colliding = new List<DetectedObject>();
2338 foreach (uint localId in startedColliders)
2339 {
2340 if (localId == 0)
2341 {
2342 //Hope that all is left is ground!
2343 DetectedObject detobj = new DetectedObject();
2344 detobj.keyUUID = UUID.Zero;
2345 detobj.nameStr = "";
2346 detobj.ownerUUID = UUID.Zero;
2347 detobj.posVector = m_parentGroup.RootPart.AbsolutePosition;
2348 detobj.rotQuat = Quaternion.Identity;
2349 detobj.velVector = Vector3.Zero;
2350 detobj.colliderType = 0;
2351 detobj.groupUUID = UUID.Zero;
2352 colliding.Add(detobj);
2353 }
2354 }
2355
2356 if (colliding.Count > 0)
2357 {
2358 LandCollidingMessage.Colliders = colliding;
2359 // always running this check because if the user deletes the object it would return a null reference.
2360 if (m_parentGroup == null)
2361 return;
2362
2363 if (m_parentGroup.Scene == null)
2364 return;
2365
2366 m_parentGroup.Scene.EventManager.TriggerScriptLandColliding(LocalId, LandCollidingMessage);
2367 }
2368 }
2369 }
2370 if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision_end) != 0)
2371 {
2372 if (endedColliders.Count > 0)
2373 {
2374 ColliderArgs LandEndCollidingMessage = new ColliderArgs();
2375 List<DetectedObject> colliding = new List<DetectedObject>();
2376 foreach (uint localId in startedColliders)
2377 {
2378 if (localId == 0)
2379 {
2380 //Hope that all is left is ground!
2381 DetectedObject detobj = new DetectedObject();
2382 detobj.keyUUID = UUID.Zero;
2383 detobj.nameStr = "";
2384 detobj.ownerUUID = UUID.Zero;
2385 detobj.posVector = m_parentGroup.RootPart.AbsolutePosition;
2386 detobj.rotQuat = Quaternion.Identity;
2387 detobj.velVector = Vector3.Zero;
2388 detobj.colliderType = 0;
2389 detobj.groupUUID = UUID.Zero;
2390 colliding.Add(detobj);
2391 }
2392 }
2393
2394 if (colliding.Count > 0)
2395 {
2396 LandEndCollidingMessage.Colliders = colliding;
2397 // always running this check because if the user deletes the object it would return a null reference.
2398 if (m_parentGroup == null)
2399 return;
2400
2401 if (m_parentGroup.Scene == null)
2402 return;
2403
2404 m_parentGroup.Scene.EventManager.TriggerScriptLandCollidingEnd(LocalId, LandEndCollidingMessage);
2405 }
2406 }
2407 }
2274 } 2408 }
2275 2409
2276 public void PhysicsOutOfBounds(Vector3 pos) 2410 public void PhysicsOutOfBounds(Vector3 pos)
@@ -2737,6 +2871,13 @@ namespace OpenSim.Region.Framework.Scenes
2737 { 2871 {
2738 m_parentGroup.SetAxisRotation(axis, rotate); 2872 m_parentGroup.SetAxisRotation(axis, rotate);
2739 } 2873 }
2874 //Cannot use ScriptBaseClass constants as no referance to it currently.
2875 if (axis == 2)//STATUS_ROTATE_X
2876 STATUS_ROTATE_X = rotate;
2877 if (axis == 4)//STATUS_ROTATE_Y
2878 STATUS_ROTATE_Y = rotate;
2879 if (axis == 8)//STATUS_ROTATE_Z
2880 STATUS_ROTATE_Z = rotate;
2740 } 2881 }
2741 2882
2742 public void SetBuoyancy(float fvalue) 2883 public void SetBuoyancy(float fvalue)
@@ -3669,6 +3810,9 @@ namespace OpenSim.Region.Framework.Scenes
3669 ((AggregateScriptEvents & scriptEvents.collision) != 0) || 3810 ((AggregateScriptEvents & scriptEvents.collision) != 0) ||
3670 ((AggregateScriptEvents & scriptEvents.collision_end) != 0) || 3811 ((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
3671 ((AggregateScriptEvents & scriptEvents.collision_start) != 0) || 3812 ((AggregateScriptEvents & scriptEvents.collision_start) != 0) ||
3813 ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) ||
3814 ((AggregateScriptEvents & scriptEvents.land_collision) != 0) ||
3815 ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) ||
3672 (CollisionSound != UUID.Zero) 3816 (CollisionSound != UUID.Zero)
3673 ) 3817 )
3674 { 3818 {
@@ -3873,6 +4017,9 @@ namespace OpenSim.Region.Framework.Scenes
3873 ((AggregateScriptEvents & scriptEvents.collision) != 0) || 4017 ((AggregateScriptEvents & scriptEvents.collision) != 0) ||
3874 ((AggregateScriptEvents & scriptEvents.collision_end) != 0) || 4018 ((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
3875 ((AggregateScriptEvents & scriptEvents.collision_start) != 0) || 4019 ((AggregateScriptEvents & scriptEvents.collision_start) != 0) ||
4020 ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) ||
4021 ((AggregateScriptEvents & scriptEvents.land_collision) != 0) ||
4022 ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) ||
3876 (CollisionSound != UUID.Zero) 4023 (CollisionSound != UUID.Zero)
3877 ) 4024 )
3878 { 4025 {
@@ -3933,6 +4080,23 @@ namespace OpenSim.Region.Framework.Scenes
3933 } 4080 }
3934 } 4081 }
3935 4082
4083 public int registerRotTargetWaypoint(Quaternion target, float tolerance)
4084 {
4085 if (m_parentGroup != null)
4086 {
4087 return m_parentGroup.registerRotTargetWaypoint(target, tolerance);
4088 }
4089 return 0;
4090 }
4091
4092 public void unregisterRotTargetWaypoint(int handle)
4093 {
4094 if (m_parentGroup != null)
4095 {
4096 m_parentGroup.unregisterRotTargetWaypoint(handle);
4097 }
4098 }
4099
3936 public void SetCameraAtOffset(Vector3 v) 4100 public void SetCameraAtOffset(Vector3 v)
3937 { 4101 {
3938 m_cameraAtOffset = v; 4102 m_cameraAtOffset = v;