aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorDiva Canto2010-01-16 07:46:07 -0800
committerDiva Canto2010-01-16 07:46:07 -0800
commitbd6d1a24448dafea5be7ddbcd591b352040e4412 (patch)
treee0416f8cc144cde7220412abec211f010e5c5344 /OpenSim
parentMerge branch 'master' into presence-refactor (diff)
downloadopensim-SC_OLD-bd6d1a24448dafea5be7ddbcd591b352040e4412.zip
opensim-SC_OLD-bd6d1a24448dafea5be7ddbcd591b352040e4412.tar.gz
opensim-SC_OLD-bd6d1a24448dafea5be7ddbcd591b352040e4412.tar.bz2
opensim-SC_OLD-bd6d1a24448dafea5be7ddbcd591b352040e4412.tar.xz
Moved prim crossing to EntityTransferModule. Not complete yet.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs421
-rw-r--r--OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml2
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs353
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs4
-rw-r--r--OpenSim/Services/Interfaces/IGridService.cs4
6 files changed, 560 insertions, 226 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index af004b0..44d3858 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -46,15 +46,16 @@ using Nini.Config;
46 46
47namespace OpenSim.Region.CoreModules.Framework.EntityTransfer 47namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
48{ 48{
49 public class AgentTransferModule : ISharedRegionModule, IEntityTransferModule 49 public class EntityTransferModule : ISharedRegionModule, IEntityTransferModule
50 { 50 {
51 #region ISharedRegionModule 51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
53 52
54 private bool m_Enabled = false; 53 private bool m_Enabled = false;
55 protected Scene m_aScene; 54 protected Scene m_aScene;
56 protected List<UUID> m_agentsInTransit; 55 protected List<UUID> m_agentsInTransit;
57 56
57 #region ISharedRegionModule
58
58 public Type ReplaceableInterface 59 public Type ReplaceableInterface
59 { 60 {
60 get { return null; } 61 get { return null; }
@@ -62,7 +63,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
62 63
63 public string Name 64 public string Name
64 { 65 {
65 get { return "AgentTransferModule"; } 66 get { return "BasicEntityTransferModule"; }
66 } 67 }
67 68
68 public virtual void Initialise(IConfigSource source) 69 public virtual void Initialise(IConfigSource source)
@@ -70,12 +71,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
70 IConfig moduleConfig = source.Configs["Modules"]; 71 IConfig moduleConfig = source.Configs["Modules"];
71 if (moduleConfig != null) 72 if (moduleConfig != null)
72 { 73 {
73 string name = moduleConfig.GetString("AgentTransferModule", ""); 74 string name = moduleConfig.GetString("EntityTransferModule", "");
74 if (name == Name) 75 if (name == Name)
75 { 76 {
76 m_agentsInTransit = new List<UUID>(); 77 m_agentsInTransit = new List<UUID>();
77 m_Enabled = true; 78 m_Enabled = true;
78 m_log.Info("[AGENT TRANSFER MODULE]: Enabled."); 79 m_log.InfoFormat("[ENTITY TRANSFER MODULE]: {0} nabled.", Name);
79 } 80 }
80 } 81 }
81 } 82 }
@@ -120,7 +121,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
120 121
121 #endregion 122 #endregion
122 123
123 #region Teleports 124 #region Agent Teleports
124 125
125 public void Teleport(ScenePresence sp, ulong regionHandle, Vector3 position, Vector3 lookAt, uint teleportFlags) 126 public void Teleport(ScenePresence sp, ulong regionHandle, Vector3 position, Vector3 lookAt, uint teleportFlags)
126 { 127 {
@@ -137,7 +138,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
137 if (regionHandle == sp.Scene.RegionInfo.RegionHandle) 138 if (regionHandle == sp.Scene.RegionInfo.RegionHandle)
138 { 139 {
139 m_log.DebugFormat( 140 m_log.DebugFormat(
140 "[AGENT TRANSFER MODULE]: RequestTeleportToLocation {0} within {1}", 141 "[ENTITY TRANSFER MODULE]: RequestTeleportToLocation {0} within {1}",
141 position, sp.Scene.RegionInfo.RegionName); 142 position, sp.Scene.RegionInfo.RegionName);
142 143
143 // Teleport within the same region 144 // Teleport within the same region
@@ -146,7 +147,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
146 Vector3 emergencyPos = new Vector3(128, 128, 128); 147 Vector3 emergencyPos = new Vector3(128, 128, 128);
147 148
148 m_log.WarnFormat( 149 m_log.WarnFormat(
149 "[AGENT TRANSFER MODULE]: RequestTeleportToLocation() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}", 150 "[ENTITY TRANSFER MODULE]: RequestTeleportToLocation() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}",
150 position, sp.Name, sp.UUID, emergencyPos); 151 position, sp.Name, sp.UUID, emergencyPos);
151 position = emergencyPos; 152 position = emergencyPos;
152 } 153 }
@@ -183,7 +184,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
183 if (reg != null) 184 if (reg != null)
184 { 185 {
185 m_log.DebugFormat( 186 m_log.DebugFormat(
186 "[AGENT TRANSFER MODULE]: RequestTeleportToLocation to {0} in {1}", 187 "[ENTITY TRANSFER MODULE]: RequestTeleportToLocation to {0} in {1}",
187 position, reg.RegionName); 188 position, reg.RegionName);
188 189
189 uint newRegionX = (uint)(reg.RegionHandle >> 40); 190 uint newRegionX = (uint)(reg.RegionHandle >> 40);
@@ -338,7 +339,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
338 m_aScene.SimulationService.UpdateAgent(reg, agent); 339 m_aScene.SimulationService.UpdateAgent(reg, agent);
339 340
340 m_log.DebugFormat( 341 m_log.DebugFormat(
341 "[AGENT TRANSFER MODULE]: Sending new AGENT TRANSFER MODULE seed url {0} to client {1}", capsPath, sp.UUID); 342 "[ENTITY TRANSFER MODULE]: Sending new ENTITY TRANSFER MODULE seed url {0} to client {1}", capsPath, sp.UUID);
342 343
343 344
344 if (eq != null) 345 if (eq != null)
@@ -377,7 +378,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
377 sp.MakeChildAgent(); 378 sp.MakeChildAgent();
378 379
379 // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it 380 // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it
380 sp.CrossAttachmentsIntoNewRegion(reg, true); 381 CrossAttachmentsIntoNewRegion(reg, sp, true);
381 382
382 // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone 383 // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone
383 384
@@ -396,7 +397,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
396 if (sp.Scene.NeedSceneCacheClear(sp.UUID)) 397 if (sp.Scene.NeedSceneCacheClear(sp.UUID))
397 { 398 {
398 m_log.DebugFormat( 399 m_log.DebugFormat(
399 "[AGENT TRANSFER MODULE]: User {0} is going to another region, profile cache removed", 400 "[ENTITY TRANSFER MODULE]: User {0} is going to another region, profile cache removed",
400 sp.UUID); 401 sp.UUID);
401 } 402 }
402 } 403 }
@@ -470,28 +471,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
470 471
471 #endregion 472 #endregion
472 473
473 #region Enable Child Agent 474 #region Agent Crossings
474 /// <summary>
475 /// This informs a single neighboring region about agent "avatar".
476 /// Calls an asynchronous method to do so.. so it doesn't lag the sim.
477 /// </summary>
478 public void EnableChildAgent(ScenePresence sp, GridRegion region)
479 {
480 AgentCircuitData agent = sp.ControllingClient.RequestClientInfo();
481 agent.BaseFolder = UUID.Zero;
482 agent.InventoryFolder = UUID.Zero;
483 agent.startpos = new Vector3(128, 128, 70);
484 agent.child = true;
485 agent.Appearance = sp.Appearance;
486
487 InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync;
488 d.BeginInvoke(sp, agent, region, region.ExternalEndPoint, true,
489 InformClientOfNeighbourCompleted,
490 d);
491 }
492 #endregion
493
494 #region Crossings
495 475
496 public void Cross(ScenePresence agent, bool isFlying) 476 public void Cross(ScenePresence agent, bool isFlying)
497 { 477 {
@@ -700,7 +680,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
700 new Byte[0]); 680 new Byte[0]);
701 im.SendInstantMessage(m, delegate(bool success) 681 im.SendInstantMessage(m, delegate(bool success)
702 { 682 {
703 m_log.DebugFormat("[AGENT TRANSFER MODULE]: Client Initiating Teleport sending IM success = {0}", success); 683 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Client Initiating Teleport sending IM success = {0}", success);
704 }); 684 });
705 685
706 } 686 }
@@ -721,7 +701,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
721 /// </summary> 701 /// </summary>
722 protected ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, bool isFlying) 702 protected ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, bool isFlying)
723 { 703 {
724 m_log.DebugFormat("[AGENT TRANSFER MODULE]: Crossing agent {0} {1} to {2}-{3}", agent.Firstname, agent.Lastname, neighbourx, neighboury); 704 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} to {2}-{3}", agent.Firstname, agent.Lastname, neighbourx, neighboury);
725 705
726 Scene m_scene = agent.Scene; 706 Scene m_scene = agent.Scene;
727 ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); 707 ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize));
@@ -756,7 +736,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
756 string agentcaps; 736 string agentcaps;
757 if (!agent.KnownRegions.TryGetValue(neighbourRegion.RegionHandle, out agentcaps)) 737 if (!agent.KnownRegions.TryGetValue(neighbourRegion.RegionHandle, out agentcaps))
758 { 738 {
759 m_log.ErrorFormat("[AGENT TRANSFER MODULE]: No AGENT TRANSFER MODULE information for region handle {0}, exiting CrossToNewRegion.", 739 m_log.ErrorFormat("[ENTITY TRANSFER MODULE]: No ENTITY TRANSFER MODULE information for region handle {0}, exiting CrossToNewRegion.",
760 neighbourRegion.RegionHandle); 740 neighbourRegion.RegionHandle);
761 return agent; 741 return agent;
762 } 742 }
@@ -765,7 +745,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
765 "http://" + neighbourRegion.ExternalHostName + ":" + neighbourRegion.HttpPort 745 "http://" + neighbourRegion.ExternalHostName + ":" + neighbourRegion.HttpPort
766 + "/CAPS/" + agentcaps /*circuitdata.CapsPath*/ + "0000/"; 746 + "/CAPS/" + agentcaps /*circuitdata.CapsPath*/ + "0000/";
767 747
768 m_log.DebugFormat("[AGENT TRANSFER MODULE]: Sending new AGENT TRANSFER MODULE seed url {0} to client {1}", capsPath, agent.UUID); 748 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new ENTITY TRANSFER MODULE seed url {0} to client {1}", capsPath, agent.UUID);
769 749
770 IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>(); 750 IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>();
771 if (eq != null) 751 if (eq != null)
@@ -781,7 +761,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
781 761
782 if (!WaitForCallback(agent.UUID)) 762 if (!WaitForCallback(agent.UUID))
783 { 763 {
784 m_log.Debug("[AGENT TRANSFER MODULE]: Callback never came in crossing agent"); 764 m_log.Debug("[ENTITY TRANSFER MODULE]: Callback never came in crossing agent");
785 ResetFromTransit(agent.UUID); 765 ResetFromTransit(agent.UUID);
786 766
787 // Yikes! We should just have a ref to scene here. 767 // Yikes! We should just have a ref to scene here.
@@ -795,7 +775,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
795 // now we have a child agent in this region. Request all interesting data about other (root) agents 775 // now we have a child agent in this region. Request all interesting data about other (root) agents
796 agent.SendInitialFullUpdateToAllClients(); 776 agent.SendInitialFullUpdateToAllClients();
797 777
798 agent.CrossAttachmentsIntoNewRegion(neighbourRegion, true); 778 CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true);
799 779
800 // m_scene.SendKillObject(m_localId); 780 // m_scene.SendKillObject(m_localId);
801 781
@@ -806,7 +786,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
806 if (agent.Scene.NeedSceneCacheClear(agent.UUID)) 786 if (agent.Scene.NeedSceneCacheClear(agent.UUID))
807 { 787 {
808 m_log.DebugFormat( 788 m_log.DebugFormat(
809 "[AGENT TRANSFER MODULE]: User {0} is going to another region", agent.UUID); 789 "[ENTITY TRANSFER MODULE]: User {0} is going to another region", agent.UUID);
810 } 790 }
811 } 791 }
812 792
@@ -830,11 +810,31 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
830 // In any case 810 // In any case
831 agent.NotInTransit(); 811 agent.NotInTransit();
832 812
833 //m_log.DebugFormat("[AGENT TRANSFER MODULE]: Crossing agent {0} {1} completed.", agent.Firstname, agent.Lastname); 813 //m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} completed.", agent.Firstname, agent.Lastname);
834 } 814 }
835 815
836 #endregion 816 #endregion
837 817
818 #region Enable Child Agent
819 /// <summary>
820 /// This informs a single neighboring region about agent "avatar".
821 /// Calls an asynchronous method to do so.. so it doesn't lag the sim.
822 /// </summary>
823 public void EnableChildAgent(ScenePresence sp, GridRegion region)
824 {
825 AgentCircuitData agent = sp.ControllingClient.RequestClientInfo();
826 agent.BaseFolder = UUID.Zero;
827 agent.InventoryFolder = UUID.Zero;
828 agent.startpos = new Vector3(128, 128, 70);
829 agent.child = true;
830 agent.Appearance = sp.Appearance;
831
832 InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync;
833 d.BeginInvoke(sp, agent, region, region.ExternalEndPoint, true,
834 InformClientOfNeighbourCompleted,
835 d);
836 }
837 #endregion
838 838
839 #region Enable Child Agents 839 #region Enable Child Agents
840 840
@@ -856,7 +856,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
856 } 856 }
857 else 857 else
858 { 858 {
859 m_log.Debug("[AGENT TRANSFER MODULE]: m_regionInfo was null in EnableChildAgents, is this a NPC?"); 859 m_log.Debug("[ENTITY TRANSFER MODULE]: m_regionInfo was null in EnableChildAgents, is this a NPC?");
860 } 860 }
861 861
862 /// We need to find the difference between the new regions where there are no child agents 862 /// We need to find the difference between the new regions where there are no child agents
@@ -963,7 +963,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
963 catch (ArgumentOutOfRangeException) 963 catch (ArgumentOutOfRangeException)
964 { 964 {
965 m_log.ErrorFormat( 965 m_log.ErrorFormat(
966 "[AGENT TRANSFER MODULE]: Neighbour Regions response included the current region in the neighbor list. The following region will not display to the client: {0} for region {1} ({2}, {3}).", 966 "[ENTITY TRANSFER MODULE]: Neighbour Regions response included the current region in the neighbor list. The following region will not display to the client: {0} for region {1} ({2}, {3}).",
967 neighbour.ExternalHostName, 967 neighbour.ExternalHostName,
968 neighbour.RegionHandle, 968 neighbour.RegionHandle,
969 neighbour.RegionLocX, 969 neighbour.RegionLocX,
@@ -972,7 +972,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
972 catch (Exception e) 972 catch (Exception e)
973 { 973 {
974 m_log.ErrorFormat( 974 m_log.ErrorFormat(
975 "[AGENT TRANSFER MODULE]: Could not resolve external hostname {0} for region {1} ({2}, {3}). {4}", 975 "[ENTITY TRANSFER MODULE]: Could not resolve external hostname {0} for region {1} ({2}, {3}). {4}",
976 neighbour.ExternalHostName, 976 neighbour.ExternalHostName,
977 neighbour.RegionHandle, 977 neighbour.RegionHandle,
978 neighbour.RegionLocX, 978 neighbour.RegionLocX,
@@ -1021,7 +1021,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1021 Utils.LongToUInts(reg.RegionHandle, out x, out y); 1021 Utils.LongToUInts(reg.RegionHandle, out x, out y);
1022 x = x / Constants.RegionSize; 1022 x = x / Constants.RegionSize;
1023 y = y / Constants.RegionSize; 1023 y = y / Constants.RegionSize;
1024 m_log.Info("[AGENT TRANSFER MODULE]: Starting to inform client about neighbour " + x + ", " + y + "(" + endPoint.ToString() + ")"); 1024 m_log.Info("[ENTITY TRANSFER MODULE]: Starting to inform client about neighbour " + x + ", " + y + "(" + endPoint.ToString() + ")");
1025 1025
1026 string capsPath = "http://" + reg.ExternalHostName + ":" + reg.HttpPort 1026 string capsPath = "http://" + reg.ExternalHostName + ":" + reg.HttpPort
1027 + "/CAPS/" + a.CapsPath + "0000/"; 1027 + "/CAPS/" + a.CapsPath + "0000/";
@@ -1046,7 +1046,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1046 1046
1047 eq.EnableSimulator(reg.RegionHandle, endPoint, sp.UUID); 1047 eq.EnableSimulator(reg.RegionHandle, endPoint, sp.UUID);
1048 eq.EstablishAgentCommunication(sp.UUID, endPoint, capsPath); 1048 eq.EstablishAgentCommunication(sp.UUID, endPoint, capsPath);
1049 m_log.DebugFormat("[AGENT TRANSFER MODULE]: Sending new AGENT TRANSFER MODULE seed url {0} to client {1} in region {2}", 1049 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new ENTITY TRANSFER MODULE seed url {0} to client {1} in region {2}",
1050 capsPath, sp.UUID, sp.Scene.RegionInfo.RegionName); 1050 capsPath, sp.UUID, sp.Scene.RegionInfo.RegionName);
1051 } 1051 }
1052 else 1052 else
@@ -1055,7 +1055,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1055 // TODO: make Event Queue disablable! 1055 // TODO: make Event Queue disablable!
1056 } 1056 }
1057 1057
1058 m_log.Info("[AGENT TRANSFER MODULE]: Completed inform client about neighbour " + endPoint.ToString()); 1058 m_log.Info("[ENTITY TRANSFER MODULE]: Completed inform client about neighbour " + endPoint.ToString());
1059 1059
1060 } 1060 }
1061 1061
@@ -1154,6 +1154,329 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1154 1154
1155 #endregion 1155 #endregion
1156 1156
1157 #region Object Crossings
1158 /// <summary>
1159 /// Move the given scene object into a new region depending on which region its absolute position has moved
1160 /// into.
1161 ///
1162 /// This method locates the new region handle and offsets the prim position for the new region
1163 /// </summary>
1164 /// <param name="attemptedPosition">the attempted out of region position of the scene object</param>
1165 /// <param name="grp">the scene object that we're crossing</param>
1166 public void Cross(SceneObjectGroup grp, Vector3 attemptedPosition, bool silent)
1167 {
1168 if (grp == null)
1169 return;
1170 if (grp.IsDeleted)
1171 return;
1172
1173 Scene scene = grp.Scene;
1174 if (scene == null)
1175 return;
1176
1177 if (grp.RootPart.DIE_AT_EDGE)
1178 {
1179 // We remove the object here
1180 try
1181 {
1182 scene.DeleteSceneObject(grp, false);
1183 }
1184 catch (Exception)
1185 {
1186 m_log.Warn("[DATABASE]: exception when trying to remove the prim that crossed the border.");
1187 }
1188 return;
1189 }
1190
1191 int thisx = (int)scene.RegionInfo.RegionLocX;
1192 int thisy = (int)scene.RegionInfo.RegionLocY;
1193 Vector3 EastCross = new Vector3(0.1f, 0, 0);
1194 Vector3 WestCross = new Vector3(-0.1f, 0, 0);
1195 Vector3 NorthCross = new Vector3(0, 0.1f, 0);
1196 Vector3 SouthCross = new Vector3(0, -0.1f, 0);
1197
1198
1199 // use this if no borders were crossed!
1200 ulong newRegionHandle
1201 = Util.UIntsToLong((uint)((thisx) * Constants.RegionSize),
1202 (uint)((thisy) * Constants.RegionSize));
1203
1204 Vector3 pos = attemptedPosition;
1205
1206 int changeX = 1;
1207 int changeY = 1;
1208
1209 if (scene.TestBorderCross(attemptedPosition + WestCross, Cardinals.W))
1210 {
1211 if (scene.TestBorderCross(attemptedPosition + SouthCross, Cardinals.S))
1212 {
1213
1214 Border crossedBorderx = scene.GetCrossedBorder(attemptedPosition + WestCross, Cardinals.W);
1215
1216 if (crossedBorderx.BorderLine.Z > 0)
1217 {
1218 pos.X = ((pos.X + crossedBorderx.BorderLine.Z));
1219 changeX = (int)(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize);
1220 }
1221 else
1222 pos.X = ((pos.X + Constants.RegionSize));
1223
1224 Border crossedBordery = scene.GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S);
1225 //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize)
1226
1227 if (crossedBordery.BorderLine.Z > 0)
1228 {
1229 pos.Y = ((pos.Y + crossedBordery.BorderLine.Z));
1230 changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize);
1231 }
1232 else
1233 pos.Y = ((pos.Y + Constants.RegionSize));
1234
1235
1236
1237 newRegionHandle
1238 = Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize),
1239 (uint)((thisy - changeY) * Constants.RegionSize));
1240 // x - 1
1241 // y - 1
1242 }
1243 else if (scene.TestBorderCross(attemptedPosition + NorthCross, Cardinals.N))
1244 {
1245 Border crossedBorderx = scene.GetCrossedBorder(attemptedPosition + WestCross, Cardinals.W);
1246
1247 if (crossedBorderx.BorderLine.Z > 0)
1248 {
1249 pos.X = ((pos.X + crossedBorderx.BorderLine.Z));
1250 changeX = (int)(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize);
1251 }
1252 else
1253 pos.X = ((pos.X + Constants.RegionSize));
1254
1255
1256 Border crossedBordery = scene.GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S);
1257 //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize)
1258
1259 if (crossedBordery.BorderLine.Z > 0)
1260 {
1261 pos.Y = ((pos.Y + crossedBordery.BorderLine.Z));
1262 changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize);
1263 }
1264 else
1265 pos.Y = ((pos.Y + Constants.RegionSize));
1266
1267 newRegionHandle
1268 = Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize),
1269 (uint)((thisy + changeY) * Constants.RegionSize));
1270 // x - 1
1271 // y + 1
1272 }
1273 else
1274 {
1275 Border crossedBorderx = scene.GetCrossedBorder(attemptedPosition + WestCross, Cardinals.W);
1276
1277 if (crossedBorderx.BorderLine.Z > 0)
1278 {
1279 pos.X = ((pos.X + crossedBorderx.BorderLine.Z));
1280 changeX = (int)(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize);
1281 }
1282 else
1283 pos.X = ((pos.X + Constants.RegionSize));
1284
1285 newRegionHandle
1286 = Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize),
1287 (uint)(thisy * Constants.RegionSize));
1288 // x - 1
1289 }
1290 }
1291 else if (scene.TestBorderCross(attemptedPosition + EastCross, Cardinals.E))
1292 {
1293 if (scene.TestBorderCross(attemptedPosition + SouthCross, Cardinals.S))
1294 {
1295
1296 pos.X = ((pos.X - Constants.RegionSize));
1297 Border crossedBordery = scene.GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S);
1298 //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize)
1299
1300 if (crossedBordery.BorderLine.Z > 0)
1301 {
1302 pos.Y = ((pos.Y + crossedBordery.BorderLine.Z));
1303 changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize);
1304 }
1305 else
1306 pos.Y = ((pos.Y + Constants.RegionSize));
1307
1308
1309 newRegionHandle
1310 = Util.UIntsToLong((uint)((thisx + changeX) * Constants.RegionSize),
1311 (uint)((thisy - changeY) * Constants.RegionSize));
1312 // x + 1
1313 // y - 1
1314 }
1315 else if (scene.TestBorderCross(attemptedPosition + NorthCross, Cardinals.N))
1316 {
1317 pos.X = ((pos.X - Constants.RegionSize));
1318 pos.Y = ((pos.Y - Constants.RegionSize));
1319 newRegionHandle
1320 = Util.UIntsToLong((uint)((thisx + changeX) * Constants.RegionSize),
1321 (uint)((thisy + changeY) * Constants.RegionSize));
1322 // x + 1
1323 // y + 1
1324 }
1325 else
1326 {
1327 pos.X = ((pos.X - Constants.RegionSize));
1328 newRegionHandle
1329 = Util.UIntsToLong((uint)((thisx + changeX) * Constants.RegionSize),
1330 (uint)(thisy * Constants.RegionSize));
1331 // x + 1
1332 }
1333 }
1334 else if (scene.TestBorderCross(attemptedPosition + SouthCross, Cardinals.S))
1335 {
1336 Border crossedBordery = scene.GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S);
1337 //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize)
1338
1339 if (crossedBordery.BorderLine.Z > 0)
1340 {
1341 pos.Y = ((pos.Y + crossedBordery.BorderLine.Z));
1342 changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize);
1343 }
1344 else
1345 pos.Y = ((pos.Y + Constants.RegionSize));
1346
1347 newRegionHandle
1348 = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy - changeY) * Constants.RegionSize));
1349 // y - 1
1350 }
1351 else if (scene.TestBorderCross(attemptedPosition + NorthCross, Cardinals.N))
1352 {
1353
1354 pos.Y = ((pos.Y - Constants.RegionSize));
1355 newRegionHandle
1356 = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy + changeY) * Constants.RegionSize));
1357 // y + 1
1358 }
1359
1360 // Offset the positions for the new region across the border
1361 Vector3 oldGroupPosition = grp.RootPart.GroupPosition;
1362 grp.OffsetForNewRegion(pos);
1363
1364 // If we fail to cross the border, then reset the position of the scene object on that border.
1365 uint x = 0, y = 0;
1366 Utils.LongToUInts(newRegionHandle, out x, out y);
1367 GridRegion destination = scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
1368 if (destination != null && !CrossPrimGroupIntoNewRegion(destination, grp, silent))
1369 {
1370 grp.OffsetForNewRegion(oldGroupPosition);
1371 grp.ScheduleGroupForFullUpdate();
1372 }
1373 }
1374
1375
1376 /// <summary>
1377 /// Move the given scene object into a new region
1378 /// </summary>
1379 /// <param name="newRegionHandle"></param>
1380 /// <param name="grp">Scene Object Group that we're crossing</param>
1381 /// <returns>
1382 /// true if the crossing itself was successful, false on failure
1383 /// FIMXE: we still return true if the crossing object was not successfully deleted from the originating region
1384 /// </returns>
1385 protected bool CrossPrimGroupIntoNewRegion(GridRegion destination, SceneObjectGroup grp, bool silent)
1386 {
1387 //m_log.Debug(" >>> CrossPrimGroupIntoNewRegion <<<");
1388
1389 bool successYN = false;
1390 grp.RootPart.UpdateFlag = 0;
1391 //int primcrossingXMLmethod = 0;
1392
1393 if (destination != null)
1394 {
1395 //string objectState = grp.GetStateSnapshot();
1396
1397 //successYN
1398 // = m_sceneGridService.PrimCrossToNeighboringRegion(
1399 // newRegionHandle, grp.UUID, m_serialiser.SaveGroupToXml2(grp), primcrossingXMLmethod);
1400 //if (successYN && (objectState != "") && m_allowScriptCrossings)
1401 //{
1402 // successYN = m_sceneGridService.PrimCrossToNeighboringRegion(
1403 // newRegionHandle, grp.UUID, objectState, 100);
1404 //}
1405
1406 //// And the new channel...
1407 //if (m_interregionCommsOut != null)
1408 // successYN = m_interregionCommsOut.SendCreateObject(newRegionHandle, grp, true);
1409 if (m_aScene.SimulationService != null)
1410 successYN = m_aScene.SimulationService.CreateObject(destination, grp, true);
1411
1412 if (successYN)
1413 {
1414 // We remove the object here
1415 try
1416 {
1417 grp.Scene.DeleteSceneObject(grp, silent);
1418 }
1419 catch (Exception e)
1420 {
1421 m_log.ErrorFormat(
1422 "[ENTITY TRANSFER MODULE]: Exception deleting the old object left behind on a border crossing for {0}, {1}",
1423 grp, e);
1424 }
1425 }
1426 else
1427 {
1428 if (!grp.IsDeleted)
1429 {
1430 if (grp.RootPart.PhysActor != null)
1431 {
1432 grp.RootPart.PhysActor.CrossingFailure();
1433 }
1434 }
1435
1436 m_log.ErrorFormat("[ENTITY TRANSFER MODULE]: Prim crossing failed for {0}", grp);
1437 }
1438 }
1439 else
1440 {
1441 m_log.Error("[ENTITY TRANSFER MODULE]: destination was unexpectedly null in Scene.CrossPrimGroupIntoNewRegion()");
1442 }
1443
1444 return successYN;
1445 }
1446
1447 protected bool CrossAttachmentsIntoNewRegion(GridRegion destination, ScenePresence sp, bool silent)
1448 {
1449 List<SceneObjectGroup> m_attachments = sp.Attachments;
1450 lock (m_attachments)
1451 {
1452 // Validate
1453 foreach (SceneObjectGroup gobj in m_attachments)
1454 {
1455 if (gobj == null || gobj.IsDeleted)
1456 return false;
1457 }
1458
1459 foreach (SceneObjectGroup gobj in m_attachments)
1460 {
1461 // If the prim group is null then something must have happened to it!
1462 if (gobj != null && gobj.RootPart != null)
1463 {
1464 // Set the parent localID to 0 so it transfers over properly.
1465 gobj.RootPart.SetParentLocalId(0);
1466 gobj.AbsolutePosition = gobj.RootPart.AttachedPos;
1467 gobj.RootPart.IsAttachment = false;
1468 //gobj.RootPart.LastOwnerID = gobj.GetFromAssetID();
1469 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending attachment {0} to region {1}", gobj.UUID, destination.RegionName);
1470 CrossPrimGroupIntoNewRegion(destination, gobj, silent);
1471 }
1472 }
1473 m_attachments.Clear();
1474
1475 return true;
1476 }
1477 }
1478
1479 #endregion
1157 1480
1158 #region Misc 1481 #region Misc
1159 1482
diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
index 106e87c..68cf060 100644
--- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
+++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
@@ -8,7 +8,7 @@
8 </Dependencies> 8 </Dependencies>
9 9
10 <Extension path = "/OpenSim/RegionModules"> 10 <Extension path = "/OpenSim/RegionModules">
11 <RegionModule id="AgentTransferModule" type="OpenSim.Region.CoreModules.Agent.AgentTransfer.AgentTransferModule" /> 11 <RegionModule id="EntityTransferModule" type="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule" />
12 <RegionModule id="LandManagementModule" type="OpenSim.Region.CoreModules.World.Land.LandManagementModule" /> 12 <RegionModule id="LandManagementModule" type="OpenSim.Region.CoreModules.World.Land.LandManagementModule" />
13 <RegionModule id="ExportSerialisationModule" type="OpenSim.Region.CoreModules.World.Serialiser.SerialiserModule" /> 13 <RegionModule id="ExportSerialisationModule" type="OpenSim.Region.CoreModules.World.Serialiser.SerialiserModule" />
14 <RegionModule id="ArchiverModule" type="OpenSim.Region.CoreModules.World.Archiver.ArchiverModule" /> 14 <RegionModule id="ArchiverModule" type="OpenSim.Region.CoreModules.World.Archiver.ArchiverModule" />
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs
index 96884b3..a0505df 100644
--- a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs
@@ -46,5 +46,7 @@ namespace OpenSim.Region.Framework.Interfaces
46 void EnableChildAgents(ScenePresence agent); 46 void EnableChildAgents(ScenePresence agent);
47 47
48 void EnableChildAgent(ScenePresence agent, GridRegion region); 48 void EnableChildAgent(ScenePresence agent, GridRegion region);
49
50 void Cross(SceneObjectGroup sog, Vector3 position, bool silent);
49 } 51 }
50} 52}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 7b582a9..bd753cc 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1655,7 +1655,9 @@ namespace OpenSim.Region.Framework.Scenes
1655 GridRegion region = new GridRegion(RegionInfo); 1655 GridRegion region = new GridRegion(RegionInfo);
1656 string error = GridService.RegisterRegion(RegionInfo.ScopeID, region); 1656 string error = GridService.RegisterRegion(RegionInfo.ScopeID, region);
1657 if (error != String.Empty) 1657 if (error != String.Empty)
1658 {
1658 throw new Exception(error); 1659 throw new Exception(error);
1660 }
1659 1661
1660 m_sceneGridService.SetScene(this); 1662 m_sceneGridService.SetScene(this);
1661 m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo); 1663 m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo);
@@ -2049,202 +2051,205 @@ namespace OpenSim.Region.Framework.Scenes
2049 if (grp.IsDeleted) 2051 if (grp.IsDeleted)
2050 return; 2052 return;
2051 2053
2052 if (grp.RootPart.DIE_AT_EDGE) 2054 if (m_teleportModule != null)
2053 { 2055 m_teleportModule.Cross(grp, attemptedPosition, silent);
2054 // We remove the object here 2056
2055 try 2057 //if (grp.RootPart.DIE_AT_EDGE)
2056 { 2058 //{
2057 DeleteSceneObject(grp, false); 2059 // // We remove the object here
2058 } 2060 // try
2059 catch (Exception) 2061 // {
2060 { 2062 // DeleteSceneObject(grp, false);
2061 m_log.Warn("[DATABASE]: exception when trying to remove the prim that crossed the border."); 2063 // }
2062 } 2064 // catch (Exception)
2063 return; 2065 // {
2064 } 2066 // m_log.Warn("[DATABASE]: exception when trying to remove the prim that crossed the border.");
2067 // }
2068 // return;
2069 //}
2065 2070
2066 int thisx = (int)RegionInfo.RegionLocX; 2071 //int thisx = (int)RegionInfo.RegionLocX;
2067 int thisy = (int)RegionInfo.RegionLocY; 2072 //int thisy = (int)RegionInfo.RegionLocY;
2068 Vector3 EastCross = new Vector3(0.1f,0,0); 2073 //Vector3 EastCross = new Vector3(0.1f,0,0);
2069 Vector3 WestCross = new Vector3(-0.1f, 0, 0); 2074 //Vector3 WestCross = new Vector3(-0.1f, 0, 0);
2070 Vector3 NorthCross = new Vector3(0, 0.1f, 0); 2075 //Vector3 NorthCross = new Vector3(0, 0.1f, 0);
2071 Vector3 SouthCross = new Vector3(0, -0.1f, 0); 2076 //Vector3 SouthCross = new Vector3(0, -0.1f, 0);
2072 2077
2073 2078
2074 // use this if no borders were crossed! 2079 //// use this if no borders were crossed!
2075 ulong newRegionHandle 2080 //ulong newRegionHandle
2076 = Util.UIntsToLong((uint)((thisx) * Constants.RegionSize), 2081 // = Util.UIntsToLong((uint)((thisx) * Constants.RegionSize),
2077 (uint)((thisy) * Constants.RegionSize)); 2082 // (uint)((thisy) * Constants.RegionSize));
2078 2083
2079 Vector3 pos = attemptedPosition; 2084 //Vector3 pos = attemptedPosition;
2080 2085
2081 int changeX = 1; 2086 //int changeX = 1;
2082 int changeY = 1; 2087 //int changeY = 1;
2083 2088
2084 if (TestBorderCross(attemptedPosition + WestCross, Cardinals.W)) 2089 //if (TestBorderCross(attemptedPosition + WestCross, Cardinals.W))
2085 { 2090 //{
2086 if (TestBorderCross(attemptedPosition + SouthCross, Cardinals.S)) 2091 // if (TestBorderCross(attemptedPosition + SouthCross, Cardinals.S))
2087 { 2092 // {
2088 2093
2089 Border crossedBorderx = GetCrossedBorder(attemptedPosition + WestCross, Cardinals.W); 2094 // Border crossedBorderx = GetCrossedBorder(attemptedPosition + WestCross, Cardinals.W);
2090 2095
2091 if (crossedBorderx.BorderLine.Z > 0) 2096 // if (crossedBorderx.BorderLine.Z > 0)
2092 { 2097 // {
2093 pos.X = ((pos.X + crossedBorderx.BorderLine.Z)); 2098 // pos.X = ((pos.X + crossedBorderx.BorderLine.Z));
2094 changeX = (int)(crossedBorderx.BorderLine.Z /(int) Constants.RegionSize); 2099 // changeX = (int)(crossedBorderx.BorderLine.Z /(int) Constants.RegionSize);
2095 } 2100 // }
2096 else 2101 // else
2097 pos.X = ((pos.X + Constants.RegionSize)); 2102 // pos.X = ((pos.X + Constants.RegionSize));
2098 2103
2099 Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S); 2104 // Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S);
2100 //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize) 2105 // //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize)
2101 2106
2102 if (crossedBordery.BorderLine.Z > 0) 2107 // if (crossedBordery.BorderLine.Z > 0)
2103 { 2108 // {
2104 pos.Y = ((pos.Y + crossedBordery.BorderLine.Z)); 2109 // pos.Y = ((pos.Y + crossedBordery.BorderLine.Z));
2105 changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize); 2110 // changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize);
2106 } 2111 // }
2107 else 2112 // else
2108 pos.Y = ((pos.Y + Constants.RegionSize)); 2113 // pos.Y = ((pos.Y + Constants.RegionSize));
2109 2114
2110 2115
2111 2116
2112 newRegionHandle 2117 // newRegionHandle
2113 = Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize), 2118 // = Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize),
2114 (uint)((thisy - changeY) * Constants.RegionSize)); 2119 // (uint)((thisy - changeY) * Constants.RegionSize));
2115 // x - 1 2120 // // x - 1
2116 // y - 1 2121 // // y - 1
2117 } 2122 // }
2118 else if (TestBorderCross(attemptedPosition + NorthCross, Cardinals.N)) 2123 // else if (TestBorderCross(attemptedPosition + NorthCross, Cardinals.N))
2119 { 2124 // {
2120 Border crossedBorderx = GetCrossedBorder(attemptedPosition + WestCross, Cardinals.W); 2125 // Border crossedBorderx = GetCrossedBorder(attemptedPosition + WestCross, Cardinals.W);
2121 2126
2122 if (crossedBorderx.BorderLine.Z > 0) 2127 // if (crossedBorderx.BorderLine.Z > 0)
2123 { 2128 // {
2124 pos.X = ((pos.X + crossedBorderx.BorderLine.Z)); 2129 // pos.X = ((pos.X + crossedBorderx.BorderLine.Z));
2125 changeX = (int)(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize); 2130 // changeX = (int)(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize);
2126 } 2131 // }
2127 else 2132 // else
2128 pos.X = ((pos.X + Constants.RegionSize)); 2133 // pos.X = ((pos.X + Constants.RegionSize));
2129 2134
2130 2135
2131 Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S); 2136 // Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S);
2132 //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize) 2137 // //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize)
2133 2138
2134 if (crossedBordery.BorderLine.Z > 0) 2139 // if (crossedBordery.BorderLine.Z > 0)
2135 { 2140 // {
2136 pos.Y = ((pos.Y + crossedBordery.BorderLine.Z)); 2141 // pos.Y = ((pos.Y + crossedBordery.BorderLine.Z));
2137 changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize); 2142 // changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize);
2138 } 2143 // }
2139 else 2144 // else
2140 pos.Y = ((pos.Y + Constants.RegionSize)); 2145 // pos.Y = ((pos.Y + Constants.RegionSize));
2141 2146
2142 newRegionHandle 2147 // newRegionHandle
2143 = Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize), 2148 // = Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize),
2144 (uint)((thisy + changeY) * Constants.RegionSize)); 2149 // (uint)((thisy + changeY) * Constants.RegionSize));
2145 // x - 1 2150 // // x - 1
2146 // y + 1 2151 // // y + 1
2147 } 2152 // }
2148 else 2153 // else
2149 { 2154 // {
2150 Border crossedBorderx = GetCrossedBorder(attemptedPosition + WestCross, Cardinals.W); 2155 // Border crossedBorderx = GetCrossedBorder(attemptedPosition + WestCross, Cardinals.W);
2151 2156
2152 if (crossedBorderx.BorderLine.Z > 0) 2157 // if (crossedBorderx.BorderLine.Z > 0)
2153 { 2158 // {
2154 pos.X = ((pos.X + crossedBorderx.BorderLine.Z)); 2159 // pos.X = ((pos.X + crossedBorderx.BorderLine.Z));
2155 changeX = (int)(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize); 2160 // changeX = (int)(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize);
2156 } 2161 // }
2157 else 2162 // else
2158 pos.X = ((pos.X + Constants.RegionSize)); 2163 // pos.X = ((pos.X + Constants.RegionSize));
2159 2164
2160 newRegionHandle 2165 // newRegionHandle
2161 = Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize), 2166 // = Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize),
2162 (uint) (thisy*Constants.RegionSize)); 2167 // (uint) (thisy*Constants.RegionSize));
2163 // x - 1 2168 // // x - 1
2164 } 2169 // }
2165 } 2170 //}
2166 else if (TestBorderCross(attemptedPosition + EastCross, Cardinals.E)) 2171 //else if (TestBorderCross(attemptedPosition + EastCross, Cardinals.E))
2167 { 2172 //{
2168 if (TestBorderCross(attemptedPosition + SouthCross, Cardinals.S)) 2173 // if (TestBorderCross(attemptedPosition + SouthCross, Cardinals.S))
2169 { 2174 // {
2170 2175
2171 pos.X = ((pos.X - Constants.RegionSize)); 2176 // pos.X = ((pos.X - Constants.RegionSize));
2172 Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S); 2177 // Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S);
2173 //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize) 2178 // //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize)
2174 2179
2175 if (crossedBordery.BorderLine.Z > 0) 2180 // if (crossedBordery.BorderLine.Z > 0)
2176 { 2181 // {
2177 pos.Y = ((pos.Y + crossedBordery.BorderLine.Z)); 2182 // pos.Y = ((pos.Y + crossedBordery.BorderLine.Z));
2178 changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize); 2183 // changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize);
2179 } 2184 // }
2180 else 2185 // else
2181 pos.Y = ((pos.Y + Constants.RegionSize)); 2186 // pos.Y = ((pos.Y + Constants.RegionSize));
2182 2187
2183 2188
2184 newRegionHandle 2189 // newRegionHandle
2185 = Util.UIntsToLong((uint)((thisx + changeX) * Constants.RegionSize), 2190 // = Util.UIntsToLong((uint)((thisx + changeX) * Constants.RegionSize),
2186 (uint)((thisy - changeY) * Constants.RegionSize)); 2191 // (uint)((thisy - changeY) * Constants.RegionSize));
2187 // x + 1 2192 // // x + 1
2188 // y - 1 2193 // // y - 1
2189 } 2194 // }
2190 else if (TestBorderCross(attemptedPosition + NorthCross, Cardinals.N)) 2195 // else if (TestBorderCross(attemptedPosition + NorthCross, Cardinals.N))
2191 { 2196 // {
2192 pos.X = ((pos.X - Constants.RegionSize)); 2197 // pos.X = ((pos.X - Constants.RegionSize));
2193 pos.Y = ((pos.Y - Constants.RegionSize)); 2198 // pos.Y = ((pos.Y - Constants.RegionSize));
2194 newRegionHandle 2199 // newRegionHandle
2195 = Util.UIntsToLong((uint)((thisx + changeX) * Constants.RegionSize), 2200 // = Util.UIntsToLong((uint)((thisx + changeX) * Constants.RegionSize),
2196 (uint)((thisy + changeY) * Constants.RegionSize)); 2201 // (uint)((thisy + changeY) * Constants.RegionSize));
2197 // x + 1 2202 // // x + 1
2198 // y + 1 2203 // // y + 1
2199 } 2204 // }
2200 else 2205 // else
2201 { 2206 // {
2202 pos.X = ((pos.X - Constants.RegionSize)); 2207 // pos.X = ((pos.X - Constants.RegionSize));
2203 newRegionHandle 2208 // newRegionHandle
2204 = Util.UIntsToLong((uint)((thisx + changeX) * Constants.RegionSize), 2209 // = Util.UIntsToLong((uint)((thisx + changeX) * Constants.RegionSize),
2205 (uint) (thisy*Constants.RegionSize)); 2210 // (uint) (thisy*Constants.RegionSize));
2206 // x + 1 2211 // // x + 1
2207 } 2212 // }
2208 } 2213 //}
2209 else if (TestBorderCross(attemptedPosition + SouthCross, Cardinals.S)) 2214 //else if (TestBorderCross(attemptedPosition + SouthCross, Cardinals.S))
2210 { 2215 //{
2211 Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S); 2216 // Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S);
2212 //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize) 2217 // //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize)
2213 2218
2214 if (crossedBordery.BorderLine.Z > 0) 2219 // if (crossedBordery.BorderLine.Z > 0)
2215 { 2220 // {
2216 pos.Y = ((pos.Y + crossedBordery.BorderLine.Z)); 2221 // pos.Y = ((pos.Y + crossedBordery.BorderLine.Z));
2217 changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize); 2222 // changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize);
2218 } 2223 // }
2219 else 2224 // else
2220 pos.Y = ((pos.Y + Constants.RegionSize)); 2225 // pos.Y = ((pos.Y + Constants.RegionSize));
2221 2226
2222 newRegionHandle 2227 // newRegionHandle
2223 = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy - changeY) * Constants.RegionSize)); 2228 // = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy - changeY) * Constants.RegionSize));
2224 // y - 1 2229 // // y - 1
2225 } 2230 //}
2226 else if (TestBorderCross(attemptedPosition + NorthCross, Cardinals.N)) 2231 //else if (TestBorderCross(attemptedPosition + NorthCross, Cardinals.N))
2227 { 2232 //{
2228 2233
2229 pos.Y = ((pos.Y - Constants.RegionSize)); 2234 // pos.Y = ((pos.Y - Constants.RegionSize));
2230 newRegionHandle 2235 // newRegionHandle
2231 = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy + changeY) * Constants.RegionSize)); 2236 // = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy + changeY) * Constants.RegionSize));
2232 // y + 1 2237 // // y + 1
2233 } 2238 //}
2234 2239
2235 // Offset the positions for the new region across the border 2240 //// Offset the positions for the new region across the border
2236 Vector3 oldGroupPosition = grp.RootPart.GroupPosition; 2241 //Vector3 oldGroupPosition = grp.RootPart.GroupPosition;
2237 grp.OffsetForNewRegion(pos); 2242 //grp.OffsetForNewRegion(pos);
2238 2243
2239 // If we fail to cross the border, then reset the position of the scene object on that border. 2244 //// If we fail to cross the border, then reset the position of the scene object on that border.
2240 uint x = 0, y = 0; 2245 //uint x = 0, y = 0;
2241 Utils.LongToUInts(newRegionHandle, out x, out y); 2246 //Utils.LongToUInts(newRegionHandle, out x, out y);
2242 GridRegion destination = GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); 2247 //GridRegion destination = GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
2243 if (destination != null && !CrossPrimGroupIntoNewRegion(destination, grp, silent)) 2248 //if (destination != null && !CrossPrimGroupIntoNewRegion(destination, grp, silent))
2244 { 2249 //{
2245 grp.OffsetForNewRegion(oldGroupPosition); 2250 // grp.OffsetForNewRegion(oldGroupPosition);
2246 grp.ScheduleGroupForFullUpdate(); 2251 // grp.ScheduleGroupForFullUpdate();
2247 } 2252 //}
2248 } 2253 }
2249 2254
2250 public Border GetCrossedBorder(Vector3 position, Cardinals gridline) 2255 public Border GetCrossedBorder(Vector3 position, Cardinals gridline)
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 2c8c675..d185fba 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -218,6 +218,10 @@ namespace OpenSim.Region.Framework.Scenes
218 protected AvatarAppearance m_appearance; 218 protected AvatarAppearance m_appearance;
219 219
220 protected List<SceneObjectGroup> m_attachments = new List<SceneObjectGroup>(); 220 protected List<SceneObjectGroup> m_attachments = new List<SceneObjectGroup>();
221 public List<SceneObjectGroup> Attachments
222 {
223 get { return m_attachments; }
224 }
221 225
222 // neighbouring regions we have enabled a child agent in 226 // neighbouring regions we have enabled a child agent in
223 // holds the seed cap for the child agent in that region 227 // holds the seed cap for the child agent in that region
diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs
index 6186d80..6a83f65 100644
--- a/OpenSim/Services/Interfaces/IGridService.cs
+++ b/OpenSim/Services/Interfaces/IGridService.cs
@@ -158,8 +158,8 @@ namespace OpenSim.Services.Interfaces
158 public UUID TerrainImage = UUID.Zero; 158 public UUID TerrainImage = UUID.Zero;
159 public byte Access; 159 public byte Access;
160 public int Maturity; 160 public int Maturity;
161 public string RegionSecret; 161 public string RegionSecret = string.Empty;
162 public string Token; 162 public string Token = string.Empty;
163 163
164 public GridRegion() 164 public GridRegion()
165 { 165 {