diff options
author | Diva Canto | 2010-01-15 17:14:48 -0800 |
---|---|---|
committer | Diva Canto | 2010-01-15 17:14:48 -0800 |
commit | 4ac3c0e81b8760ef31f741cd55e703eee86b93b7 (patch) | |
tree | 18565d8b20669ccdc45e3ef02d59cfd1eabaa297 /OpenSim/Region/CoreModules/Framework/EntityTransfer | |
parent | Merge branch 'presence-refactor' of ssh://diva@opensimulator.org/var/git/open... (diff) | |
download | opensim-SC_OLD-4ac3c0e81b8760ef31f741cd55e703eee86b93b7.zip opensim-SC_OLD-4ac3c0e81b8760ef31f741cd55e703eee86b93b7.tar.gz opensim-SC_OLD-4ac3c0e81b8760ef31f741cd55e703eee86b93b7.tar.bz2 opensim-SC_OLD-4ac3c0e81b8760ef31f741cd55e703eee86b93b7.tar.xz |
Renamed IAgentTransferModule to IEntityTransferModule -- accounts for objects too.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs (renamed from OpenSim/Region/CoreModules/Agent/AgentTransfer/AgentTransferModule.cs) | 81 |
1 files changed, 47 insertions, 34 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/AgentTransfer/AgentTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 8e3d041..af004b0 100644 --- a/OpenSim/Region/CoreModules/Agent/AgentTransfer/AgentTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -44,9 +44,9 @@ using OpenMetaverse; | |||
44 | using log4net; | 44 | using log4net; |
45 | using Nini.Config; | 45 | using Nini.Config; |
46 | 46 | ||
47 | namespace OpenSim.Region.CoreModules.Agent.AgentTransfer | 47 | namespace OpenSim.Region.CoreModules.Framework.EntityTransfer |
48 | { | 48 | { |
49 | public class AgentTransferModule : ISharedRegionModule, IAgentTransferModule | 49 | public class AgentTransferModule : ISharedRegionModule, IEntityTransferModule |
50 | { | 50 | { |
51 | #region ISharedRegionModule | 51 | #region ISharedRegionModule |
52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -92,7 +92,7 @@ namespace OpenSim.Region.CoreModules.Agent.AgentTransfer | |||
92 | if (m_aScene == null) | 92 | if (m_aScene == null) |
93 | m_aScene = scene; | 93 | m_aScene = scene; |
94 | 94 | ||
95 | scene.RegisterModuleInterface<IAgentTransferModule>(this); | 95 | scene.RegisterModuleInterface<IEntityTransferModule>(this); |
96 | } | 96 | } |
97 | 97 | ||
98 | public virtual void Close() | 98 | public virtual void Close() |
@@ -192,6 +192,7 @@ namespace OpenSim.Region.CoreModules.Agent.AgentTransfer | |||
192 | uint oldRegionY = (((uint)(sp.Scene.RegionInfo.RegionHandle)) >> 8); | 192 | uint oldRegionY = (((uint)(sp.Scene.RegionInfo.RegionHandle)) >> 8); |
193 | 193 | ||
194 | ulong destinationHandle = GetRegionHandle(reg); | 194 | ulong destinationHandle = GetRegionHandle(reg); |
195 | GridRegion finalDestination = GetFinalDestination(reg); | ||
195 | 196 | ||
196 | if (eq == null) | 197 | if (eq == null) |
197 | sp.ControllingClient.SendTeleportLocationStart(); | 198 | sp.ControllingClient.SendTeleportLocationStart(); |
@@ -235,7 +236,7 @@ namespace OpenSim.Region.CoreModules.Agent.AgentTransfer | |||
235 | agentCircuit.child = true; | 236 | agentCircuit.child = true; |
236 | agentCircuit.Appearance = sp.Appearance; | 237 | agentCircuit.Appearance = sp.Appearance; |
237 | 238 | ||
238 | if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY)) | 239 | if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) |
239 | { | 240 | { |
240 | // brand new agent, let's create a new caps seed | 241 | // brand new agent, let's create a new caps seed |
241 | agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); | 242 | agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); |
@@ -244,7 +245,6 @@ namespace OpenSim.Region.CoreModules.Agent.AgentTransfer | |||
244 | string reason = String.Empty; | 245 | string reason = String.Empty; |
245 | 246 | ||
246 | // Let's create an agent there if one doesn't exist yet. | 247 | // Let's create an agent there if one doesn't exist yet. |
247 | //if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agentCircuit)) | ||
248 | if (!m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason)) | 248 | if (!m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason)) |
249 | { | 249 | { |
250 | sp.ControllingClient.SendTeleportFailed(String.Format("Destination is not accepting teleports: {0}", | 250 | sp.ControllingClient.SendTeleportFailed(String.Format("Destination is not accepting teleports: {0}", |
@@ -255,7 +255,7 @@ namespace OpenSim.Region.CoreModules.Agent.AgentTransfer | |||
255 | // OK, it got this agent. Let's close some child agents | 255 | // OK, it got this agent. Let's close some child agents |
256 | sp.CloseChildAgents(newRegionX, newRegionY); | 256 | sp.CloseChildAgents(newRegionX, newRegionY); |
257 | 257 | ||
258 | if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY)) | 258 | if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) |
259 | { | 259 | { |
260 | #region IP Translation for NAT | 260 | #region IP Translation for NAT |
261 | IClientIPEndpoint ipepClient; | 261 | IClientIPEndpoint ipepClient; |
@@ -427,6 +427,47 @@ namespace OpenSim.Region.CoreModules.Agent.AgentTransfer | |||
427 | } | 427 | } |
428 | } | 428 | } |
429 | 429 | ||
430 | protected void KillEntity(Scene scene, uint localID) | ||
431 | { | ||
432 | scene.SendKillObject(localID); | ||
433 | } | ||
434 | |||
435 | protected virtual ulong GetRegionHandle(GridRegion region) | ||
436 | { | ||
437 | return region.RegionHandle; | ||
438 | } | ||
439 | |||
440 | protected virtual GridRegion GetFinalDestination(GridRegion region) | ||
441 | { | ||
442 | return region; | ||
443 | } | ||
444 | |||
445 | protected virtual bool NeedsNewAgent(uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY) | ||
446 | { | ||
447 | return Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY); | ||
448 | } | ||
449 | |||
450 | protected virtual bool NeedsClosing(uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg) | ||
451 | { | ||
452 | return Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY); | ||
453 | } | ||
454 | |||
455 | protected virtual bool IsOutsideRegion(Scene s, Vector3 pos) | ||
456 | { | ||
457 | |||
458 | if (s.TestBorderCross(pos, Cardinals.N)) | ||
459 | return true; | ||
460 | if (s.TestBorderCross(pos, Cardinals.S)) | ||
461 | return true; | ||
462 | if (s.TestBorderCross(pos, Cardinals.E)) | ||
463 | return true; | ||
464 | if (s.TestBorderCross(pos, Cardinals.W)) | ||
465 | return true; | ||
466 | |||
467 | return false; | ||
468 | } | ||
469 | |||
470 | |||
430 | #endregion | 471 | #endregion |
431 | 472 | ||
432 | #region Enable Child Agent | 473 | #region Enable Child Agent |
@@ -1115,20 +1156,6 @@ namespace OpenSim.Region.CoreModules.Agent.AgentTransfer | |||
1115 | 1156 | ||
1116 | 1157 | ||
1117 | #region Misc | 1158 | #region Misc |
1118 | protected bool IsOutsideRegion(Scene s, Vector3 pos) | ||
1119 | { | ||
1120 | |||
1121 | if (s.TestBorderCross(pos, Cardinals.N)) | ||
1122 | return true; | ||
1123 | if (s.TestBorderCross(pos, Cardinals.S)) | ||
1124 | return true; | ||
1125 | if (s.TestBorderCross(pos, Cardinals.E)) | ||
1126 | return true; | ||
1127 | if (s.TestBorderCross(pos, Cardinals.W)) | ||
1128 | return true; | ||
1129 | |||
1130 | return false; | ||
1131 | } | ||
1132 | 1159 | ||
1133 | protected bool WaitForCallback(UUID id) | 1160 | protected bool WaitForCallback(UUID id) |
1134 | { | 1161 | { |
@@ -1167,20 +1194,6 @@ namespace OpenSim.Region.CoreModules.Agent.AgentTransfer | |||
1167 | return false; | 1194 | return false; |
1168 | } | 1195 | } |
1169 | 1196 | ||
1170 | protected void KillEntity(Scene scene, uint localID) | ||
1171 | { | ||
1172 | scene.SendKillObject(localID); | ||
1173 | } | ||
1174 | |||
1175 | protected virtual ulong GetRegionHandle(GridRegion region) | ||
1176 | { | ||
1177 | return region.RegionHandle; | ||
1178 | } | ||
1179 | |||
1180 | protected virtual bool NeedsClosing(uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg) | ||
1181 | { | ||
1182 | return Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY); | ||
1183 | } | ||
1184 | 1197 | ||
1185 | #endregion | 1198 | #endregion |
1186 | 1199 | ||