aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorDiva Canto2009-09-14 10:29:28 -0700
committerDiva Canto2009-09-14 10:29:28 -0700
commit69b19a3b85cc18c417500da4acbf07ef21e0a8b4 (patch)
treed98fbb2dfe5f63e7f2dfff4efa4dacc7532036a9 /OpenSim
parentRemoved dependencies that OptionalModules had on IronPython and Puma. They ar... (diff)
parentlabel load and save iar commands as experimental. (diff)
downloadopensim-SC-69b19a3b85cc18c417500da4acbf07ef21e0a8b4.zip
opensim-SC-69b19a3b85cc18c417500da4acbf07ef21e0a8b4.tar.gz
opensim-SC-69b19a3b85cc18c417500da4acbf07ef21e0a8b4.tar.bz2
opensim-SC-69b19a3b85cc18c417500da4acbf07ef21e0a8b4.tar.xz
Merge branch 'master' of ssh://diva@opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs16
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Land/RegionCombinerClientEventForwarder.cs94
-rw-r--r--OpenSim/Region/CoreModules/World/Land/RegionCombinerIndividualEventForwarder.cs125
-rw-r--r--OpenSim/Region/CoreModules/World/Land/RegionCombinerLargeLandChannel.cs163
-rw-r--r--OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs617
-rw-r--r--OpenSim/Region/CoreModules/World/Land/RegionCombinerPermissionModule.cs275
-rw-r--r--OpenSim/Region/CoreModules/World/Land/RegionConnections.cs65
-rw-r--r--OpenSim/Region/CoreModules/World/Land/RegionCourseLocation.cs43
-rw-r--r--OpenSim/Region/CoreModules/World/Land/RegionData.cs39
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs146
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs26
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs8
15 files changed, 1057 insertions, 578 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
index 4d96b28..00faabb 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
@@ -92,12 +92,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
92 scene.AddCommand( 92 scene.AddCommand(
93 this, "load iar", 93 this, "load iar",
94 "load iar <first> <last> <inventory path> [<archive path>]", 94 "load iar <first> <last> <inventory path> [<archive path>]",
95 "Load user inventory archive. EXPERIMENTAL, CURRENTLY DISABLED", HandleLoadInvConsoleCommand); 95 "Load user inventory archive. EXPERIMENTAL", HandleLoadInvConsoleCommand);
96 96
97 scene.AddCommand( 97 scene.AddCommand(
98 this, "save iar", 98 this, "save iar",
99 "save iar <first> <last> <inventory path> [<archive path>]", 99 "save iar <first> <last> <inventory path> [<archive path>]",
100 "Save user inventory archive. EXPERIMENTAL, CURRENTLY DISABLED", HandleSaveInvConsoleCommand); 100 "Save user inventory archive. EXPERIMENTAL", HandleSaveInvConsoleCommand);
101 101
102 m_aScene = scene; 102 m_aScene = scene;
103 } 103 }
@@ -233,9 +233,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
233 /// <param name="cmdparams"></param> 233 /// <param name="cmdparams"></param>
234 protected void HandleLoadInvConsoleCommand(string module, string[] cmdparams) 234 protected void HandleLoadInvConsoleCommand(string module, string[] cmdparams)
235 { 235 {
236 return;
237
238 /*
239 if (cmdparams.Length < 5) 236 if (cmdparams.Length < 5)
240 { 237 {
241 m_log.Error( 238 m_log.Error(
@@ -243,6 +240,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
243 return; 240 return;
244 } 241 }
245 242
243 m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME.");
244
246 string firstName = cmdparams[2]; 245 string firstName = cmdparams[2];
247 string lastName = cmdparams[3]; 246 string lastName = cmdparams[3];
248 string invPath = cmdparams[4]; 247 string invPath = cmdparams[4];
@@ -256,7 +255,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
256 m_log.InfoFormat( 255 m_log.InfoFormat(
257 "[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}", 256 "[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}",
258 loadPath, firstName, lastName); 257 loadPath, firstName, lastName);
259 */
260 } 258 }
261 259
262 /// <summary> 260 /// <summary>
@@ -265,9 +263,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
265 /// <param name="cmdparams"></param> 263 /// <param name="cmdparams"></param>
266 protected void HandleSaveInvConsoleCommand(string module, string[] cmdparams) 264 protected void HandleSaveInvConsoleCommand(string module, string[] cmdparams)
267 { 265 {
268 return;
269
270 /*
271 if (cmdparams.Length < 5) 266 if (cmdparams.Length < 5)
272 { 267 {
273 m_log.Error( 268 m_log.Error(
@@ -275,6 +270,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
275 return; 270 return;
276 } 271 }
277 272
273 m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME.");
274
278 string firstName = cmdparams[2]; 275 string firstName = cmdparams[2];
279 string lastName = cmdparams[3]; 276 string lastName = cmdparams[3];
280 string invPath = cmdparams[4]; 277 string invPath = cmdparams[4];
@@ -289,7 +286,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
289 286
290 lock (m_pendingConsoleSaves) 287 lock (m_pendingConsoleSaves)
291 m_pendingConsoleSaves.Add(id); 288 m_pendingConsoleSaves.Add(id);
292 */
293 } 289 }
294 290
295 private void SaveInvConsoleCommandCompleted( 291 private void SaveInvConsoleCommandCompleted(
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs
index ac8b566..9241851 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs
@@ -136,7 +136,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
136 } 136 }
137 } 137 }
138 138
139 if(scene != null) 139 if (scene != null)
140 { 140 {
141 UserProfileData profile = scene.CommsManager.UserService.GetUserProfile(new UUID(userID)); 141 UserProfileData profile = scene.CommsManager.UserService.GetUserProfile(new UUID(userID));
142 isAuthorized = IsAuthorizedForRegion(userID, profile.FirstName, profile.SurName, 142 isAuthorized = IsAuthorizedForRegion(userID, profile.FirstName, profile.SurName,
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerClientEventForwarder.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerClientEventForwarder.cs
new file mode 100644
index 0000000..70d6de3
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Land/RegionCombinerClientEventForwarder.cs
@@ -0,0 +1,94 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using OpenMetaverse;
31using OpenSim.Region.Framework.Scenes;
32
33namespace OpenSim.Region.CoreModules.World.Land
34{
35public class RegionCombinerClientEventForwarder
36 {
37 private Scene m_rootScene;
38 private Dictionary<UUID, Scene> m_virtScene = new Dictionary<UUID, Scene>();
39 private Dictionary<UUID,RegionCombinerIndividualEventForwarder> m_forwarders = new Dictionary<UUID,
40 RegionCombinerIndividualEventForwarder>();
41
42 public RegionCombinerClientEventForwarder(RegionConnections rootScene)
43 {
44 m_rootScene = rootScene.RegionScene;
45 }
46
47 public void AddSceneToEventForwarding(Scene virtualScene)
48 {
49 lock (m_virtScene)
50 {
51 if (m_virtScene.ContainsKey(virtualScene.RegionInfo.originRegionID))
52 {
53 m_virtScene[virtualScene.RegionInfo.originRegionID] = virtualScene;
54 }
55 else
56 {
57 m_virtScene.Add(virtualScene.RegionInfo.originRegionID, virtualScene);
58 }
59 }
60
61 lock (m_forwarders)
62 {
63 // TODO: Fix this to unregister if this happens
64 if (m_forwarders.ContainsKey(virtualScene.RegionInfo.originRegionID))
65 m_forwarders.Remove(virtualScene.RegionInfo.originRegionID);
66
67 RegionCombinerIndividualEventForwarder forwarder =
68 new RegionCombinerIndividualEventForwarder(m_rootScene, virtualScene);
69 m_forwarders.Add(virtualScene.RegionInfo.originRegionID, forwarder);
70
71 virtualScene.EventManager.OnNewClient += forwarder.ClientConnect;
72 virtualScene.EventManager.OnClientClosed += forwarder.ClientClosed;
73 }
74 }
75
76 public void RemoveSceneFromEventForwarding (Scene virtualScene)
77 {
78 lock (m_forwarders)
79 {
80 RegionCombinerIndividualEventForwarder forwarder = m_forwarders[virtualScene.RegionInfo.originRegionID];
81 virtualScene.EventManager.OnNewClient -= forwarder.ClientConnect;
82 virtualScene.EventManager.OnClientClosed -= forwarder.ClientClosed;
83 m_forwarders.Remove(virtualScene.RegionInfo.originRegionID);
84 }
85 lock (m_virtScene)
86 {
87 if (m_virtScene.ContainsKey(virtualScene.RegionInfo.originRegionID))
88 {
89 m_virtScene.Remove(virtualScene.RegionInfo.originRegionID);
90 }
91 }
92 }
93 }
94} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerIndividualEventForwarder.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerIndividualEventForwarder.cs
new file mode 100644
index 0000000..65f22b1
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Land/RegionCombinerIndividualEventForwarder.cs
@@ -0,0 +1,125 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using OpenMetaverse;
30using OpenSim.Framework;
31using OpenSim.Region.Framework.Scenes;
32
33namespace OpenSim.Region.CoreModules.World.Land
34{
35 public class RegionCombinerIndividualEventForwarder
36 {
37 private Scene m_rootScene;
38 private Scene m_virtScene;
39
40 public RegionCombinerIndividualEventForwarder(Scene rootScene, Scene virtScene)
41 {
42 m_rootScene = rootScene;
43 m_virtScene = virtScene;
44 }
45
46 public void ClientConnect(IClientAPI client)
47 {
48 m_virtScene.UnSubscribeToClientPrimEvents(client);
49 m_virtScene.UnSubscribeToClientPrimRezEvents(client);
50 m_virtScene.UnSubscribeToClientInventoryEvents(client);
51 m_virtScene.UnSubscribeToClientAttachmentEvents(client);
52 //m_virtScene.UnSubscribeToClientTeleportEvents(client);
53 m_virtScene.UnSubscribeToClientScriptEvents(client);
54 m_virtScene.UnSubscribeToClientGodEvents(client);
55 m_virtScene.UnSubscribeToClientNetworkEvents(client);
56
57 m_rootScene.SubscribeToClientPrimEvents(client);
58 client.OnAddPrim += LocalAddNewPrim;
59 client.OnRezObject += LocalRezObject;
60 m_rootScene.SubscribeToClientInventoryEvents(client);
61 m_rootScene.SubscribeToClientAttachmentEvents(client);
62 //m_rootScene.SubscribeToClientTeleportEvents(client);
63 m_rootScene.SubscribeToClientScriptEvents(client);
64 m_rootScene.SubscribeToClientGodEvents(client);
65 m_rootScene.SubscribeToClientNetworkEvents(client);
66 }
67
68 public void ClientClosed(UUID clientid, Scene scene)
69 {
70 }
71
72 /// <summary>
73 /// Fixes position based on the region the Rez event came in on
74 /// </summary>
75 /// <param name="remoteclient"></param>
76 /// <param name="itemid"></param>
77 /// <param name="rayend"></param>
78 /// <param name="raystart"></param>
79 /// <param name="raytargetid"></param>
80 /// <param name="bypassraycast"></param>
81 /// <param name="rayendisintersection"></param>
82 /// <param name="rezselected"></param>
83 /// <param name="removeitem"></param>
84 /// <param name="fromtaskid"></param>
85 private void LocalRezObject(IClientAPI remoteclient, UUID itemid, Vector3 rayend, Vector3 raystart,
86 UUID raytargetid, byte bypassraycast, bool rayendisintersection, bool rezselected, bool removeitem,
87 UUID fromtaskid)
88 {
89 int differenceX = (int)m_virtScene.RegionInfo.RegionLocX - (int)m_rootScene.RegionInfo.RegionLocX;
90 int differenceY = (int)m_virtScene.RegionInfo.RegionLocY - (int)m_rootScene.RegionInfo.RegionLocY;
91 rayend.X += differenceX * (int)Constants.RegionSize;
92 rayend.Y += differenceY * (int)Constants.RegionSize;
93 raystart.X += differenceX * (int)Constants.RegionSize;
94 raystart.Y += differenceY * (int)Constants.RegionSize;
95
96 m_rootScene.RezObject(remoteclient, itemid, rayend, raystart, raytargetid, bypassraycast,
97 rayendisintersection, rezselected, removeitem, fromtaskid);
98 }
99 /// <summary>
100 /// Fixes position based on the region the AddPrimShape event came in on
101 /// </summary>
102 /// <param name="ownerid"></param>
103 /// <param name="groupid"></param>
104 /// <param name="rayend"></param>
105 /// <param name="rot"></param>
106 /// <param name="shape"></param>
107 /// <param name="bypassraycast"></param>
108 /// <param name="raystart"></param>
109 /// <param name="raytargetid"></param>
110 /// <param name="rayendisintersection"></param>
111 private void LocalAddNewPrim(UUID ownerid, UUID groupid, Vector3 rayend, Quaternion rot,
112 PrimitiveBaseShape shape, byte bypassraycast, Vector3 raystart, UUID raytargetid,
113 byte rayendisintersection)
114 {
115 int differenceX = (int)m_virtScene.RegionInfo.RegionLocX - (int)m_rootScene.RegionInfo.RegionLocX;
116 int differenceY = (int)m_virtScene.RegionInfo.RegionLocY - (int)m_rootScene.RegionInfo.RegionLocY;
117 rayend.X += differenceX * (int)Constants.RegionSize;
118 rayend.Y += differenceY * (int)Constants.RegionSize;
119 raystart.X += differenceX * (int)Constants.RegionSize;
120 raystart.Y += differenceY * (int)Constants.RegionSize;
121 m_rootScene.AddNewPrim(ownerid, groupid, rayend, rot, shape, bypassraycast, raystart, raytargetid,
122 rayendisintersection);
123 }
124 }
125} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerLargeLandChannel.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerLargeLandChannel.cs
new file mode 100644
index 0000000..9e46b94
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Land/RegionCombinerLargeLandChannel.cs
@@ -0,0 +1,163 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using OpenMetaverse;
31using OpenSim.Framework;
32using OpenSim.Region.Framework.Interfaces;
33
34namespace OpenSim.Region.CoreModules.World.Land
35{
36public class RegionCombinerLargeLandChannel : ILandChannel
37 {
38 // private static readonly ILog m_log =
39 // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
40 private RegionData RegData;
41 private ILandChannel RootRegionLandChannel;
42 private readonly List<RegionData> RegionConnections;
43
44 #region ILandChannel Members
45
46 public RegionCombinerLargeLandChannel(RegionData regData, ILandChannel rootRegionLandChannel,
47 List<RegionData> regionConnections)
48 {
49 RegData = regData;
50 RootRegionLandChannel = rootRegionLandChannel;
51 RegionConnections = regionConnections;
52 }
53
54 public List<ILandObject> ParcelsNearPoint(Vector3 position)
55 {
56 //m_log.DebugFormat("[LANDPARCELNEARPOINT]: {0}>", position);
57 return RootRegionLandChannel.ParcelsNearPoint(position - RegData.Offset);
58 }
59
60 public List<ILandObject> AllParcels()
61 {
62 return RootRegionLandChannel.AllParcels();
63 }
64
65 public ILandObject GetLandObject(int x, int y)
66 {
67 //m_log.DebugFormat("[BIGLANDTESTINT]: <{0},{1}>", x, y);
68
69 if (x > 0 && x <= (int)Constants.RegionSize && y > 0 && y <= (int)Constants.RegionSize)
70 {
71 return RootRegionLandChannel.GetLandObject(x, y);
72 }
73 else
74 {
75 int offsetX = (x / (int)Constants.RegionSize);
76 int offsetY = (y / (int)Constants.RegionSize);
77 offsetX *= (int)Constants.RegionSize;
78 offsetY *= (int)Constants.RegionSize;
79
80 foreach (RegionData regionData in RegionConnections)
81 {
82 if (regionData.Offset.X == offsetX && regionData.Offset.Y == offsetY)
83 {
84 return regionData.RegionScene.LandChannel.GetLandObject(x - offsetX, y - offsetY);
85 }
86 }
87 ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene);
88 obj.landData.Name = "NO LAND";
89 return obj;
90 }
91 }
92
93 public ILandObject GetLandObject(int localID)
94 {
95 return RootRegionLandChannel.GetLandObject(localID);
96 }
97
98 public ILandObject GetLandObject(float x, float y)
99 {
100 //m_log.DebugFormat("[BIGLANDTESTFLOAT]: <{0},{1}>", x, y);
101
102 if (x > 0 && x <= (int)Constants.RegionSize && y > 0 && y <= (int)Constants.RegionSize)
103 {
104 return RootRegionLandChannel.GetLandObject(x, y);
105 }
106 else
107 {
108 int offsetX = (int)(x/(int) Constants.RegionSize);
109 int offsetY = (int)(y/(int) Constants.RegionSize);
110 offsetX *= (int) Constants.RegionSize;
111 offsetY *= (int) Constants.RegionSize;
112
113 foreach (RegionData regionData in RegionConnections)
114 {
115 if (regionData.Offset.X == offsetX && regionData.Offset.Y == offsetY)
116 {
117 return regionData.RegionScene.LandChannel.GetLandObject(x - offsetX, y - offsetY);
118 }
119 }
120 ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene);
121 obj.landData.Name = "NO LAND";
122 return obj;
123 }
124 }
125
126 public bool IsLandPrimCountTainted()
127 {
128 return RootRegionLandChannel.IsLandPrimCountTainted();
129 }
130
131 public bool IsForcefulBansAllowed()
132 {
133 return RootRegionLandChannel.IsForcefulBansAllowed();
134 }
135
136 public void UpdateLandObject(int localID, LandData data)
137 {
138 RootRegionLandChannel.UpdateLandObject(localID, data);
139 }
140
141 public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient)
142 {
143 RootRegionLandChannel.ReturnObjectsInParcel(localID, returnType, agentIDs, taskIDs, remoteClient);
144 }
145
146 public void setParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel)
147 {
148 RootRegionLandChannel.setParcelObjectMaxOverride(overrideDel);
149 }
150
151 public void setSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel)
152 {
153 RootRegionLandChannel.setSimulatorObjectMaxOverride(overrideDel);
154 }
155
156 public void SetParcelOtherCleanTime(IClientAPI remoteClient, int localID, int otherCleanTime)
157 {
158 RootRegionLandChannel.SetParcelOtherCleanTime(remoteClient, localID, otherCleanTime);
159 }
160
161 #endregion
162 }
163} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
index 45e09a3..1436912 100644
--- a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
@@ -80,9 +80,15 @@ namespace OpenSim.Region.CoreModules.World.Land
80 if (!enabledYN) 80 if (!enabledYN)
81 return; 81 return;
82 82
83 // For testing on a single instance
84 if (scene.RegionInfo.RegionLocX == 1004 && scene.RegionInfo.RegionLocY == 1000)
85 return;
86 //
87
83 lock (m_startingScenes) 88 lock (m_startingScenes)
84 m_startingScenes.Add(scene.RegionInfo.originRegionID, scene); 89 m_startingScenes.Add(scene.RegionInfo.originRegionID, scene);
85 90
91 // Give each region a standard set of non-infinite borders
86 Border northBorder = new Border(); 92 Border northBorder = new Border();
87 northBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, (int)Constants.RegionSize); //<--- 93 northBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, (int)Constants.RegionSize); //<---
88 northBorder.CrossDirection = Cardinals.N; 94 northBorder.CrossDirection = Cardinals.N;
@@ -103,6 +109,8 @@ namespace OpenSim.Region.CoreModules.World.Land
103 westBorder.CrossDirection = Cardinals.W; 109 westBorder.CrossDirection = Cardinals.W;
104 scene.WestBorders[0] = westBorder; 110 scene.WestBorders[0] = westBorder;
105 111
112
113
106 RegionConnections regionConnections = new RegionConnections(); 114 RegionConnections regionConnections = new RegionConnections();
107 regionConnections.ConnectedRegions = new List<RegionData>(); 115 regionConnections.ConnectedRegions = new List<RegionData>();
108 regionConnections.RegionScene = scene; 116 regionConnections.RegionScene = scene;
@@ -112,6 +120,8 @@ namespace OpenSim.Region.CoreModules.World.Land
112 regionConnections.Y = scene.RegionInfo.RegionLocY; 120 regionConnections.Y = scene.RegionInfo.RegionLocY;
113 regionConnections.XEnd = (int)Constants.RegionSize; 121 regionConnections.XEnd = (int)Constants.RegionSize;
114 regionConnections.YEnd = (int)Constants.RegionSize; 122 regionConnections.YEnd = (int)Constants.RegionSize;
123
124
115 lock (m_regions) 125 lock (m_regions)
116 { 126 {
117 bool connectedYN = false; 127 bool connectedYN = false;
@@ -280,6 +290,7 @@ namespace OpenSim.Region.CoreModules.World.Land
280 //xxx 290 //xxx
281 //xxy 291 //xxy
282 //xxx 292 //xxx
293
283 if ((((int)conn.X * (int)Constants.RegionSize) + conn.XEnd 294 if ((((int)conn.X * (int)Constants.RegionSize) + conn.XEnd
284 >= (regionConnections.X * (int)Constants.RegionSize)) 295 >= (regionConnections.X * (int)Constants.RegionSize))
285 && (((int)conn.Y * (int)Constants.RegionSize) 296 && (((int)conn.Y * (int)Constants.RegionSize)
@@ -310,9 +321,13 @@ namespace OpenSim.Region.CoreModules.World.Land
310 ConnectedRegion.RegionScene = scene; 321 ConnectedRegion.RegionScene = scene;
311 conn.ConnectedRegions.Add(ConnectedRegion); 322 conn.ConnectedRegions.Add(ConnectedRegion);
312 323
324 // Inform root region Physics about the extents of this region
313 conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); 325 conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
326
327 // Inform Child region that it needs to forward it's terrain to the root region
314 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero); 328 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero);
315 329
330 // Extend the borders as appropriate
316 lock (conn.RegionScene.EastBorders) 331 lock (conn.RegionScene.EastBorders)
317 conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize; 332 conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize;
318 333
@@ -323,15 +338,24 @@ namespace OpenSim.Region.CoreModules.World.Land
323 conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize; 338 conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
324 339
325 lock (scene.WestBorders) 340 lock (scene.WestBorders)
326 scene.WestBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport West 341 {
342 scene.WestBorders[0].BorderLine.Z += (int) Constants.RegionSize; //auto teleport West
327 343
328 // Reset Terrain.. since terrain normally loads first. 344 // Trigger auto teleport to root region
329 // 345 scene.WestBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
330 scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); 346 scene.WestBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
331 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); 347 }
332 348
349 // Reset Terrain.. since terrain loads before we get here, we need to load
350 // it again so it loads in the root region
351
352 scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
353
354 // Unlock borders
333 conn.RegionScene.BordersLocked = false; 355 conn.RegionScene.BordersLocked = false;
334 scene.BordersLocked = false; 356 scene.BordersLocked = false;
357
358 // Create a client event forwarder and add this region's events to the root region.
335 if (conn.ClientEventForwarder != null) 359 if (conn.ClientEventForwarder != null)
336 conn.ClientEventForwarder.AddSceneToEventForwarding(scene); 360 conn.ClientEventForwarder.AddSceneToEventForwarding(scene);
337 connectedYN = true; 361 connectedYN = true;
@@ -381,7 +405,11 @@ namespace OpenSim.Region.CoreModules.World.Land
381 lock (conn.RegionScene.WestBorders) 405 lock (conn.RegionScene.WestBorders)
382 conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize; 406 conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
383 lock (scene.SouthBorders) 407 lock (scene.SouthBorders)
384 scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south 408 {
409 scene.SouthBorders[0].BorderLine.Z += (int) Constants.RegionSize; //auto teleport south
410 scene.SouthBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
411 scene.SouthBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
412 }
385 413
386 // Reset Terrain.. since terrain normally loads first. 414 // Reset Terrain.. since terrain normally loads first.
387 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); 415 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
@@ -446,8 +474,13 @@ namespace OpenSim.Region.CoreModules.World.Land
446 conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize; 474 conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
447 } 475 }
448 } 476 }
477
449 lock (scene.SouthBorders) 478 lock (scene.SouthBorders)
450 scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south 479 {
480 scene.SouthBorders[0].BorderLine.Z += (int) Constants.RegionSize; //auto teleport south
481 scene.SouthBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
482 scene.SouthBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
483 }
451 484
452 lock (conn.RegionScene.EastBorders) 485 lock (conn.RegionScene.EastBorders)
453 { 486 {
@@ -463,9 +496,14 @@ namespace OpenSim.Region.CoreModules.World.Land
463 496
464 } 497 }
465 } 498 }
466 499
467 lock (scene.WestBorders) 500 lock (scene.WestBorders)
468 scene.WestBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport West 501 {
502 scene.WestBorders[0].BorderLine.Z += (int) Constants.RegionSize; //auto teleport West
503 scene.WestBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
504 scene.WestBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
505 }
506
469 /* 507 /*
470 else 508 else
471 { 509 {
@@ -495,17 +533,21 @@ namespace OpenSim.Region.CoreModules.World.Land
495 } 533 }
496 } 534 }
497 535
536 // If !connectYN means that this region is a root region
498 if (!connectedYN) 537 if (!connectedYN)
499 { 538 {
500 RegionData rdata = new RegionData(); 539 RegionData rdata = new RegionData();
501 rdata.Offset = Vector3.Zero; 540 rdata.Offset = Vector3.Zero;
502 rdata.RegionId = scene.RegionInfo.originRegionID; 541 rdata.RegionId = scene.RegionInfo.originRegionID;
503 rdata.RegionScene = scene; 542 rdata.RegionScene = scene;
543 // save it's land channel
504 regionConnections.RegionLandChannel = scene.LandChannel; 544 regionConnections.RegionLandChannel = scene.LandChannel;
505 545
546 // Substitue our landchannel
506 RegionCombinerLargeLandChannel lnd = new RegionCombinerLargeLandChannel(rdata, scene.LandChannel, 547 RegionCombinerLargeLandChannel lnd = new RegionCombinerLargeLandChannel(rdata, scene.LandChannel,
507 regionConnections.ConnectedRegions); 548 regionConnections.ConnectedRegions);
508 scene.LandChannel = lnd; 549 scene.LandChannel = lnd;
550 // Forward the permissions modules of each of the connected regions to the root region
509 lock (m_regions) 551 lock (m_regions)
510 { 552 {
511 foreach (RegionData r in regionConnections.ConnectedRegions) 553 foreach (RegionData r in regionConnections.ConnectedRegions)
@@ -513,12 +555,17 @@ namespace OpenSim.Region.CoreModules.World.Land
513 ForwardPermissionRequests(regionConnections, r.RegionScene); 555 ForwardPermissionRequests(regionConnections, r.RegionScene);
514 } 556 }
515 } 557 }
516 558 // Create the root region's Client Event Forwarder
517 regionConnections.ClientEventForwarder = new RegionCombinerClientEventForwarder(regionConnections); 559 regionConnections.ClientEventForwarder = new RegionCombinerClientEventForwarder(regionConnections);
560
561 // Sets up the CoarseLocationUpdate forwarder for this root region
518 scene.EventManager.OnNewPresence += SetCourseLocationDelegate; 562 scene.EventManager.OnNewPresence += SetCourseLocationDelegate;
563
564 // Adds this root region to a dictionary of regions that are connectable
519 m_regions.Add(scene.RegionInfo.originRegionID, regionConnections); 565 m_regions.Add(scene.RegionInfo.originRegionID, regionConnections);
520 } 566 }
521 } 567 }
568 // Set up infinite borders around the entire AABB of the combined ConnectedRegions
522 AdjustLargeRegionBounds(); 569 AdjustLargeRegionBounds();
523 } 570 }
524 571
@@ -646,6 +693,13 @@ namespace OpenSim.Region.CoreModules.World.Land
646 } 693 }
647 } 694 }
648 695
696 /// <summary>
697 /// Locates a the Client of a particular region in an Array of RegionData based on offset
698 /// </summary>
699 /// <param name="offset"></param>
700 /// <param name="uUID"></param>
701 /// <param name="rdata"></param>
702 /// <returns>IClientAPI or null</returns>
649 private IClientAPI LocateUsersChildAgentIClientAPI(Vector2 offset, UUID uUID, RegionData[] rdata) 703 private IClientAPI LocateUsersChildAgentIClientAPI(Vector2 offset, UUID uUID, RegionData[] rdata)
650 { 704 {
651 IClientAPI returnclient = null; 705 IClientAPI returnclient = null;
@@ -664,6 +718,10 @@ namespace OpenSim.Region.CoreModules.World.Land
664 { 718 {
665 } 719 }
666 720
721 /// <summary>
722 /// TODO:
723 /// </summary>
724 /// <param name="rdata"></param>
667 public void UnCombineRegion(RegionData rdata) 725 public void UnCombineRegion(RegionData rdata)
668 { 726 {
669 lock (m_regions) 727 lock (m_regions)
@@ -706,7 +764,7 @@ namespace OpenSim.Region.CoreModules.World.Land
706 lock (rconn.RegionScene.NorthBorders) 764 lock (rconn.RegionScene.NorthBorders)
707 { 765 {
708 Border northBorder = null; 766 Border northBorder = null;
709 767 // If we don't already have an infinite border, create one.
710 if (!TryGetInfiniteBorder(rconn.RegionScene.NorthBorders, out northBorder)) 768 if (!TryGetInfiniteBorder(rconn.RegionScene.NorthBorders, out northBorder))
711 { 769 {
712 northBorder = new Border(); 770 northBorder = new Border();
@@ -721,6 +779,7 @@ namespace OpenSim.Region.CoreModules.World.Land
721 lock (rconn.RegionScene.SouthBorders) 779 lock (rconn.RegionScene.SouthBorders)
722 { 780 {
723 Border southBorder = null; 781 Border southBorder = null;
782 // If we don't already have an infinite border, create one.
724 if (!TryGetInfiniteBorder(rconn.RegionScene.SouthBorders, out southBorder)) 783 if (!TryGetInfiniteBorder(rconn.RegionScene.SouthBorders, out southBorder))
725 { 784 {
726 southBorder = new Border(); 785 southBorder = new Border();
@@ -733,6 +792,7 @@ namespace OpenSim.Region.CoreModules.World.Land
733 lock (rconn.RegionScene.EastBorders) 792 lock (rconn.RegionScene.EastBorders)
734 { 793 {
735 Border eastBorder = null; 794 Border eastBorder = null;
795 // If we don't already have an infinite border, create one.
736 if (!TryGetInfiniteBorder(rconn.RegionScene.EastBorders, out eastBorder)) 796 if (!TryGetInfiniteBorder(rconn.RegionScene.EastBorders, out eastBorder))
737 { 797 {
738 eastBorder = new Border(); 798 eastBorder = new Border();
@@ -746,6 +806,7 @@ namespace OpenSim.Region.CoreModules.World.Land
746 lock (rconn.RegionScene.WestBorders) 806 lock (rconn.RegionScene.WestBorders)
747 { 807 {
748 Border westBorder = null; 808 Border westBorder = null;
809 // If we don't already have an infinite border, create one.
749 if (!TryGetInfiniteBorder(rconn.RegionScene.WestBorders, out westBorder)) 810 if (!TryGetInfiniteBorder(rconn.RegionScene.WestBorders, out westBorder))
750 { 811 {
751 westBorder = new Border(); 812 westBorder = new Border();
@@ -761,6 +822,12 @@ namespace OpenSim.Region.CoreModules.World.Land
761 } 822 }
762 } 823 }
763 824
825 /// <summary>
826 /// Try and get an Infinite border out of a listT of borders
827 /// </summary>
828 /// <param name="borders"></param>
829 /// <param name="oborder"></param>
830 /// <returns></returns>
764 public static bool TryGetInfiniteBorder(List<Border> borders, out Border oborder) 831 public static bool TryGetInfiniteBorder(List<Border> borders, out Border oborder)
765 { 832 {
766 // Warning! Should be locked before getting here! 833 // Warning! Should be locked before getting here!
@@ -844,532 +911,4 @@ namespace OpenSim.Region.CoreModules.World.Land
844 VirtualRegion.Permissions.OnUseObjectReturn += BigRegion.PermissionModule.CanUseObjectReturn; //NOT YET IMPLEMENTED 911 VirtualRegion.Permissions.OnUseObjectReturn += BigRegion.PermissionModule.CanUseObjectReturn; //NOT YET IMPLEMENTED
845 } 912 }
846 } 913 }
847
848 public class RegionConnections
849 {
850 public UUID RegionId;
851 public Scene RegionScene;
852 public ILandChannel RegionLandChannel;
853 public uint X;
854 public uint Y;
855 public int XEnd;
856 public int YEnd;
857 public List<RegionData> ConnectedRegions;
858 public RegionCombinerPermissionModule PermissionModule;
859 public RegionCombinerClientEventForwarder ClientEventForwarder;
860 public void UpdateExtents(Vector3 extents)
861 {
862 XEnd = (int)extents.X;
863 YEnd = (int)extents.Y;
864 }
865 }
866
867 public class RegionData
868 {
869 public UUID RegionId;
870 public Scene RegionScene;
871 public Vector3 Offset;
872 }
873
874 struct RegionCourseLocationStruct
875 {
876 public List<Vector3> Locations;
877 public List<UUID> Uuids;
878 public IClientAPI UserAPI;
879 public Vector2 Offset;
880 }
881
882 public class RegionCombinerLargeLandChannel : ILandChannel
883 {
884 // private static readonly ILog m_log =
885 // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
886 private RegionData RegData;
887 private ILandChannel RootRegionLandChannel;
888 private readonly List<RegionData> RegionConnections;
889
890 #region ILandChannel Members
891
892 public RegionCombinerLargeLandChannel(RegionData regData, ILandChannel rootRegionLandChannel,
893 List<RegionData> regionConnections)
894 {
895 RegData = regData;
896 RootRegionLandChannel = rootRegionLandChannel;
897 RegionConnections = regionConnections;
898 }
899
900 public List<ILandObject> ParcelsNearPoint(Vector3 position)
901 {
902 //m_log.DebugFormat("[LANDPARCELNEARPOINT]: {0}>", position);
903 return RootRegionLandChannel.ParcelsNearPoint(position - RegData.Offset);
904 }
905
906 public List<ILandObject> AllParcels()
907 {
908 return RootRegionLandChannel.AllParcels();
909 }
910
911 public ILandObject GetLandObject(int x, int y)
912 {
913 //m_log.DebugFormat("[BIGLANDTESTINT]: <{0},{1}>", x, y);
914
915 if (x > 0 && x <= (int)Constants.RegionSize && y > 0 && y <= (int)Constants.RegionSize)
916 {
917 return RootRegionLandChannel.GetLandObject(x, y);
918 }
919 else
920 {
921 int offsetX = (x / (int)Constants.RegionSize);
922 int offsetY = (y / (int)Constants.RegionSize);
923 offsetX *= (int)Constants.RegionSize;
924 offsetY *= (int)Constants.RegionSize;
925
926 foreach (RegionData regionData in RegionConnections)
927 {
928 if (regionData.Offset.X == offsetX && regionData.Offset.Y == offsetY)
929 {
930 return regionData.RegionScene.LandChannel.GetLandObject(x - offsetX, y - offsetY);
931 }
932 }
933 ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene);
934 obj.landData.Name = "NO LAND";
935 return obj;
936 }
937 }
938
939 public ILandObject GetLandObject(int localID)
940 {
941 return RootRegionLandChannel.GetLandObject(localID);
942 }
943
944 public ILandObject GetLandObject(float x, float y)
945 {
946 //m_log.DebugFormat("[BIGLANDTESTFLOAT]: <{0},{1}>", x, y);
947
948 if (x > 0 && x <= (int)Constants.RegionSize && y > 0 && y <= (int)Constants.RegionSize)
949 {
950 return RootRegionLandChannel.GetLandObject(x, y);
951 }
952 else
953 {
954 int offsetX = (int)(x/(int) Constants.RegionSize);
955 int offsetY = (int)(y/(int) Constants.RegionSize);
956 offsetX *= (int) Constants.RegionSize;
957 offsetY *= (int) Constants.RegionSize;
958
959 foreach (RegionData regionData in RegionConnections)
960 {
961 if (regionData.Offset.X == offsetX && regionData.Offset.Y == offsetY)
962 {
963 return regionData.RegionScene.LandChannel.GetLandObject(x - offsetX, y - offsetY);
964 }
965 }
966 ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene);
967 obj.landData.Name = "NO LAND";
968 return obj;
969 }
970 }
971
972 public bool IsLandPrimCountTainted()
973 {
974 return RootRegionLandChannel.IsLandPrimCountTainted();
975 }
976
977 public bool IsForcefulBansAllowed()
978 {
979 return RootRegionLandChannel.IsForcefulBansAllowed();
980 }
981
982 public void UpdateLandObject(int localID, LandData data)
983 {
984 RootRegionLandChannel.UpdateLandObject(localID, data);
985 }
986
987 public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient)
988 {
989 RootRegionLandChannel.ReturnObjectsInParcel(localID, returnType, agentIDs, taskIDs, remoteClient);
990 }
991
992 public void setParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel)
993 {
994 RootRegionLandChannel.setParcelObjectMaxOverride(overrideDel);
995 }
996
997 public void setSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel)
998 {
999 RootRegionLandChannel.setSimulatorObjectMaxOverride(overrideDel);
1000 }
1001
1002 public void SetParcelOtherCleanTime(IClientAPI remoteClient, int localID, int otherCleanTime)
1003 {
1004 RootRegionLandChannel.SetParcelOtherCleanTime(remoteClient, localID, otherCleanTime);
1005 }
1006
1007 #endregion
1008 }
1009
1010 public class RegionCombinerPermissionModule
1011 {
1012 private Scene m_rootScene;
1013
1014 public RegionCombinerPermissionModule(Scene RootScene)
1015 {
1016 m_rootScene = RootScene;
1017 }
1018
1019 #region Permission Override
1020
1021 public bool BypassPermissions()
1022 {
1023 return m_rootScene.Permissions.BypassPermissions();
1024 }
1025
1026 public void SetBypassPermissions(bool value)
1027 {
1028 m_rootScene.Permissions.SetBypassPermissions(value);
1029 }
1030
1031 public bool PropagatePermissions()
1032 {
1033 return m_rootScene.Permissions.PropagatePermissions();
1034 }
1035
1036 public uint GenerateClientFlags(UUID userid, UUID objectidid)
1037 {
1038 return m_rootScene.Permissions.GenerateClientFlags(userid,objectidid);
1039 }
1040
1041 public bool CanAbandonParcel(UUID user, ILandObject parcel, Scene scene)
1042 {
1043 return m_rootScene.Permissions.CanAbandonParcel(user,parcel);
1044 }
1045
1046 public bool CanReclaimParcel(UUID user, ILandObject parcel, Scene scene)
1047 {
1048 return m_rootScene.Permissions.CanReclaimParcel(user, parcel);
1049 }
1050
1051 public bool CanDeedParcel(UUID user, ILandObject parcel, Scene scene)
1052 {
1053 return m_rootScene.Permissions.CanDeedParcel(user, parcel);
1054 }
1055
1056 public bool CanDeedObject(UUID user, UUID @group, Scene scene)
1057 {
1058 return m_rootScene.Permissions.CanDeedObject(user,@group);
1059 }
1060
1061 public bool IsGod(UUID user, Scene requestfromscene)
1062 {
1063 return m_rootScene.Permissions.IsGod(user);
1064 }
1065
1066 public bool CanDuplicateObject(int objectcount, UUID objectid, UUID owner, Scene scene, Vector3 objectposition)
1067 {
1068 return m_rootScene.Permissions.CanDuplicateObject(objectcount, objectid, owner, objectposition);
1069 }
1070
1071 public bool CanDeleteObject(UUID objectid, UUID deleter, Scene scene)
1072 {
1073 return m_rootScene.Permissions.CanDeleteObject(objectid, deleter);
1074 }
1075
1076 public bool CanEditObject(UUID objectid, UUID editorid, Scene scene)
1077 {
1078 return m_rootScene.Permissions.CanEditObject(objectid, editorid);
1079 }
1080
1081 public bool CanEditParcel(UUID user, ILandObject parcel, Scene scene)
1082 {
1083 return m_rootScene.Permissions.CanEditParcel(user, parcel);
1084 }
1085
1086 public bool CanInstantMessage(UUID user, UUID target, Scene startscene)
1087 {
1088 return m_rootScene.Permissions.CanInstantMessage(user, target);
1089 }
1090
1091 public bool CanInventoryTransfer(UUID user, UUID target, Scene startscene)
1092 {
1093 return m_rootScene.Permissions.CanInventoryTransfer(user, target);
1094 }
1095
1096 public bool CanIssueEstateCommand(UUID user, Scene requestfromscene, bool ownercommand)
1097 {
1098 return m_rootScene.Permissions.CanIssueEstateCommand(user, ownercommand);
1099 }
1100
1101 public bool CanMoveObject(UUID objectid, UUID moverid, Scene scene)
1102 {
1103 return m_rootScene.Permissions.CanMoveObject(objectid, moverid);
1104 }
1105
1106 public bool CanObjectEntry(UUID objectid, bool enteringregion, Vector3 newpoint, Scene scene)
1107 {
1108 return m_rootScene.Permissions.CanObjectEntry(objectid, enteringregion, newpoint);
1109 }
1110
1111 public bool CanReturnObject(UUID objectid, UUID returnerid, Scene scene)
1112 {
1113 return m_rootScene.Permissions.CanReturnObject(objectid, returnerid);
1114 }
1115
1116 public bool CanRezObject(int objectcount, UUID owner, Vector3 objectposition, Scene scene)
1117 {
1118 return m_rootScene.Permissions.CanRezObject(objectcount, owner, objectposition);
1119 }
1120
1121 public bool CanRunConsoleCommand(UUID user, Scene requestfromscene)
1122 {
1123 return m_rootScene.Permissions.CanRunConsoleCommand(user);
1124 }
1125
1126 public bool CanRunScript(UUID script, UUID objectid, UUID user, Scene scene)
1127 {
1128 return m_rootScene.Permissions.CanRunScript(script, objectid, user);
1129 }
1130
1131 public bool CanCompileScript(UUID owneruuid, int scripttype, Scene scene)
1132 {
1133 return m_rootScene.Permissions.CanCompileScript(owneruuid, scripttype);
1134 }
1135
1136 public bool CanSellParcel(UUID user, ILandObject parcel, Scene scene)
1137 {
1138 return m_rootScene.Permissions.CanSellParcel(user, parcel);
1139 }
1140
1141 public bool CanTakeObject(UUID objectid, UUID stealer, Scene scene)
1142 {
1143 return m_rootScene.Permissions.CanTakeObject(objectid, stealer);
1144 }
1145
1146 public bool CanTakeCopyObject(UUID objectid, UUID userid, Scene inscene)
1147 {
1148 return m_rootScene.Permissions.CanTakeObject(objectid, userid);
1149 }
1150
1151 public bool CanTerraformLand(UUID user, Vector3 position, Scene requestfromscene)
1152 {
1153 return m_rootScene.Permissions.CanTerraformLand(user, position);
1154 }
1155
1156 public bool CanLinkObject(UUID user, UUID objectid)
1157 {
1158 return m_rootScene.Permissions.CanLinkObject(user, objectid);
1159 }
1160
1161 public bool CanDelinkObject(UUID user, UUID objectid)
1162 {
1163 return m_rootScene.Permissions.CanDelinkObject(user, objectid);
1164 }
1165
1166 public bool CanBuyLand(UUID user, ILandObject parcel, Scene scene)
1167 {
1168 return m_rootScene.Permissions.CanBuyLand(user, parcel);
1169 }
1170
1171 public bool CanViewNotecard(UUID script, UUID objectid, UUID user, Scene scene)
1172 {
1173 return m_rootScene.Permissions.CanViewNotecard(script, objectid, user);
1174 }
1175
1176 public bool CanViewScript(UUID script, UUID objectid, UUID user, Scene scene)
1177 {
1178 return m_rootScene.Permissions.CanViewScript(script, objectid, user);
1179 }
1180
1181 public bool CanEditNotecard(UUID notecard, UUID objectid, UUID user, Scene scene)
1182 {
1183 return m_rootScene.Permissions.CanEditNotecard(notecard, objectid, user);
1184 }
1185
1186 public bool CanEditScript(UUID script, UUID objectid, UUID user, Scene scene)
1187 {
1188 return m_rootScene.Permissions.CanEditScript(script, objectid, user);
1189 }
1190
1191 public bool CanCreateObjectInventory(int invtype, UUID objectid, UUID userid)
1192 {
1193 return m_rootScene.Permissions.CanCreateObjectInventory(invtype, objectid, userid);
1194 }
1195
1196 public bool CanEditObjectInventory(UUID objectid, UUID editorid, Scene scene)
1197 {
1198 return m_rootScene.Permissions.CanEditObjectInventory(objectid, editorid);
1199 }
1200
1201 public bool CanCopyObjectInventory(UUID itemid, UUID objectid, UUID userid)
1202 {
1203 return m_rootScene.Permissions.CanCopyObjectInventory(itemid, objectid, userid);
1204 }
1205
1206 public bool CanDeleteObjectInventory(UUID itemid, UUID objectid, UUID userid)
1207 {
1208 return m_rootScene.Permissions.CanDeleteObjectInventory(itemid, objectid, userid);
1209 }
1210
1211 public bool CanResetScript(UUID prim, UUID script, UUID user, Scene scene)
1212 {
1213 return m_rootScene.Permissions.CanResetScript(prim, script, user);
1214 }
1215
1216 public bool CanCreateUserInventory(int invtype, UUID userid)
1217 {
1218 return m_rootScene.Permissions.CanCreateUserInventory(invtype, userid);
1219 }
1220
1221 public bool CanCopyUserInventory(UUID itemid, UUID userid)
1222 {
1223 return m_rootScene.Permissions.CanCopyUserInventory(itemid, userid);
1224 }
1225
1226 public bool CanEditUserInventory(UUID itemid, UUID userid)
1227 {
1228 return m_rootScene.Permissions.CanEditUserInventory(itemid, userid);
1229 }
1230
1231 public bool CanDeleteUserInventory(UUID itemid, UUID userid)
1232 {
1233 return m_rootScene.Permissions.CanDeleteUserInventory(itemid, userid);
1234 }
1235
1236 public bool CanTeleport(UUID userid, Scene scene)
1237 {
1238 return m_rootScene.Permissions.CanTeleport(userid);
1239 }
1240
1241 public bool CanUseObjectReturn(ILandObject landdata, uint type, IClientAPI client, List<SceneObjectGroup> retlist, Scene scene)
1242 {
1243 return m_rootScene.Permissions.CanUseObjectReturn(landdata, type, client, retlist);
1244 }
1245
1246 #endregion
1247 }
1248
1249 public class RegionCombinerClientEventForwarder
1250 {
1251 private Scene m_rootScene;
1252 private Dictionary<UUID, Scene> m_virtScene = new Dictionary<UUID, Scene>();
1253 private Dictionary<UUID,RegionCombinerModuleIndividualForwarder> m_forwarders = new Dictionary<UUID,
1254 RegionCombinerModuleIndividualForwarder>();
1255
1256 public RegionCombinerClientEventForwarder(RegionConnections rootScene)
1257 {
1258 m_rootScene = rootScene.RegionScene;
1259 }
1260
1261 public void AddSceneToEventForwarding(Scene virtualScene)
1262 {
1263 lock (m_virtScene)
1264 {
1265 if (m_virtScene.ContainsKey(virtualScene.RegionInfo.originRegionID))
1266 {
1267 m_virtScene[virtualScene.RegionInfo.originRegionID] = virtualScene;
1268 }
1269 else
1270 {
1271 m_virtScene.Add(virtualScene.RegionInfo.originRegionID, virtualScene);
1272 }
1273 }
1274
1275 lock (m_forwarders)
1276 {
1277 // TODO: Fix this to unregister if this happens
1278 if (m_forwarders.ContainsKey(virtualScene.RegionInfo.originRegionID))
1279 m_forwarders.Remove(virtualScene.RegionInfo.originRegionID);
1280
1281 RegionCombinerModuleIndividualForwarder forwarder =
1282 new RegionCombinerModuleIndividualForwarder(m_rootScene, virtualScene);
1283 m_forwarders.Add(virtualScene.RegionInfo.originRegionID, forwarder);
1284
1285 virtualScene.EventManager.OnNewClient += forwarder.ClientConnect;
1286 virtualScene.EventManager.OnClientClosed += forwarder.ClientClosed;
1287 }
1288 }
1289
1290 public void RemoveSceneFromEventForwarding (Scene virtualScene)
1291 {
1292 lock (m_forwarders)
1293 {
1294 RegionCombinerModuleIndividualForwarder forwarder = m_forwarders[virtualScene.RegionInfo.originRegionID];
1295 virtualScene.EventManager.OnNewClient -= forwarder.ClientConnect;
1296 virtualScene.EventManager.OnClientClosed -= forwarder.ClientClosed;
1297 m_forwarders.Remove(virtualScene.RegionInfo.originRegionID);
1298 }
1299 lock (m_virtScene)
1300 {
1301 if (m_virtScene.ContainsKey(virtualScene.RegionInfo.originRegionID))
1302 {
1303 m_virtScene.Remove(virtualScene.RegionInfo.originRegionID);
1304 }
1305 }
1306 }
1307 }
1308
1309 public class RegionCombinerModuleIndividualForwarder
1310 {
1311 private Scene m_rootScene;
1312 private Scene m_virtScene;
1313
1314 public RegionCombinerModuleIndividualForwarder(Scene rootScene, Scene virtScene)
1315 {
1316 m_rootScene = rootScene;
1317 m_virtScene = virtScene;
1318 }
1319
1320 public void ClientConnect(IClientAPI client)
1321 {
1322 m_virtScene.UnSubscribeToClientPrimEvents(client);
1323 m_virtScene.UnSubscribeToClientPrimRezEvents(client);
1324 m_virtScene.UnSubscribeToClientInventoryEvents(client);
1325 m_virtScene.UnSubscribeToClientAttachmentEvents(client);
1326 m_virtScene.UnSubscribeToClientTeleportEvents(client);
1327 m_virtScene.UnSubscribeToClientScriptEvents(client);
1328 m_virtScene.UnSubscribeToClientGodEvents(client);
1329 m_virtScene.UnSubscribeToClientNetworkEvents(client);
1330
1331 m_rootScene.SubscribeToClientPrimEvents(client);
1332 client.OnAddPrim += LocalAddNewPrim;
1333 client.OnRezObject += LocalRezObject;
1334 m_rootScene.SubscribeToClientInventoryEvents(client);
1335 m_rootScene.SubscribeToClientAttachmentEvents(client);
1336 m_rootScene.SubscribeToClientTeleportEvents(client);
1337 m_rootScene.SubscribeToClientScriptEvents(client);
1338 m_rootScene.SubscribeToClientGodEvents(client);
1339 m_rootScene.SubscribeToClientNetworkEvents(client);
1340 }
1341
1342 public void ClientClosed(UUID clientid, Scene scene)
1343 {
1344 }
1345
1346 private void LocalRezObject(IClientAPI remoteclient, UUID itemid, Vector3 rayend, Vector3 raystart,
1347 UUID raytargetid, byte bypassraycast, bool rayendisintersection, bool rezselected, bool removeitem,
1348 UUID fromtaskid)
1349 {
1350 int differenceX = (int)m_virtScene.RegionInfo.RegionLocX - (int)m_rootScene.RegionInfo.RegionLocX;
1351 int differenceY = (int)m_virtScene.RegionInfo.RegionLocY - (int)m_rootScene.RegionInfo.RegionLocY;
1352 rayend.X += differenceX * (int)Constants.RegionSize;
1353 rayend.Y += differenceY * (int)Constants.RegionSize;
1354 raystart.X += differenceX * (int)Constants.RegionSize;
1355 raystart.Y += differenceY * (int)Constants.RegionSize;
1356
1357 m_rootScene.RezObject(remoteclient, itemid, rayend, raystart, raytargetid, bypassraycast,
1358 rayendisintersection, rezselected, removeitem, fromtaskid);
1359 }
1360
1361 private void LocalAddNewPrim(UUID ownerid, UUID groupid, Vector3 rayend, Quaternion rot,
1362 PrimitiveBaseShape shape, byte bypassraycast, Vector3 raystart, UUID raytargetid,
1363 byte rayendisintersection)
1364 {
1365 int differenceX = (int)m_virtScene.RegionInfo.RegionLocX - (int)m_rootScene.RegionInfo.RegionLocX;
1366 int differenceY = (int)m_virtScene.RegionInfo.RegionLocY - (int)m_rootScene.RegionInfo.RegionLocY;
1367 rayend.X += differenceX * (int)Constants.RegionSize;
1368 rayend.Y += differenceY * (int)Constants.RegionSize;
1369 raystart.X += differenceX * (int)Constants.RegionSize;
1370 raystart.Y += differenceY * (int)Constants.RegionSize;
1371 m_rootScene.AddNewPrim(ownerid, groupid, rayend, rot, shape, bypassraycast, raystart, raytargetid,
1372 rayendisintersection);
1373 }
1374 }
1375} 914}
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerPermissionModule.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerPermissionModule.cs
new file mode 100644
index 0000000..76ca5e3
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Land/RegionCombinerPermissionModule.cs
@@ -0,0 +1,275 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using OpenMetaverse;
31using OpenSim.Framework;
32using OpenSim.Region.Framework.Interfaces;
33using OpenSim.Region.Framework.Scenes;
34
35namespace OpenSim.Region.CoreModules.World.Land
36{
37 public class RegionCombinerPermissionModule
38 {
39 private Scene m_rootScene;
40
41 public RegionCombinerPermissionModule(Scene RootScene)
42 {
43 m_rootScene = RootScene;
44 }
45
46 #region Permission Override
47
48 public bool BypassPermissions()
49 {
50 return m_rootScene.Permissions.BypassPermissions();
51 }
52
53 public void SetBypassPermissions(bool value)
54 {
55 m_rootScene.Permissions.SetBypassPermissions(value);
56 }
57
58 public bool PropagatePermissions()
59 {
60 return m_rootScene.Permissions.PropagatePermissions();
61 }
62
63 public uint GenerateClientFlags(UUID userid, UUID objectidid)
64 {
65 return m_rootScene.Permissions.GenerateClientFlags(userid,objectidid);
66 }
67
68 public bool CanAbandonParcel(UUID user, ILandObject parcel, Scene scene)
69 {
70 return m_rootScene.Permissions.CanAbandonParcel(user,parcel);
71 }
72
73 public bool CanReclaimParcel(UUID user, ILandObject parcel, Scene scene)
74 {
75 return m_rootScene.Permissions.CanReclaimParcel(user, parcel);
76 }
77
78 public bool CanDeedParcel(UUID user, ILandObject parcel, Scene scene)
79 {
80 return m_rootScene.Permissions.CanDeedParcel(user, parcel);
81 }
82
83 public bool CanDeedObject(UUID user, UUID @group, Scene scene)
84 {
85 return m_rootScene.Permissions.CanDeedObject(user,@group);
86 }
87
88 public bool IsGod(UUID user, Scene requestfromscene)
89 {
90 return m_rootScene.Permissions.IsGod(user);
91 }
92
93 public bool CanDuplicateObject(int objectcount, UUID objectid, UUID owner, Scene scene, Vector3 objectposition)
94 {
95 return m_rootScene.Permissions.CanDuplicateObject(objectcount, objectid, owner, objectposition);
96 }
97
98 public bool CanDeleteObject(UUID objectid, UUID deleter, Scene scene)
99 {
100 return m_rootScene.Permissions.CanDeleteObject(objectid, deleter);
101 }
102
103 public bool CanEditObject(UUID objectid, UUID editorid, Scene scene)
104 {
105 return m_rootScene.Permissions.CanEditObject(objectid, editorid);
106 }
107
108 public bool CanEditParcel(UUID user, ILandObject parcel, Scene scene)
109 {
110 return m_rootScene.Permissions.CanEditParcel(user, parcel);
111 }
112
113 public bool CanInstantMessage(UUID user, UUID target, Scene startscene)
114 {
115 return m_rootScene.Permissions.CanInstantMessage(user, target);
116 }
117
118 public bool CanInventoryTransfer(UUID user, UUID target, Scene startscene)
119 {
120 return m_rootScene.Permissions.CanInventoryTransfer(user, target);
121 }
122
123 public bool CanIssueEstateCommand(UUID user, Scene requestfromscene, bool ownercommand)
124 {
125 return m_rootScene.Permissions.CanIssueEstateCommand(user, ownercommand);
126 }
127
128 public bool CanMoveObject(UUID objectid, UUID moverid, Scene scene)
129 {
130 return m_rootScene.Permissions.CanMoveObject(objectid, moverid);
131 }
132
133 public bool CanObjectEntry(UUID objectid, bool enteringregion, Vector3 newpoint, Scene scene)
134 {
135 return m_rootScene.Permissions.CanObjectEntry(objectid, enteringregion, newpoint);
136 }
137
138 public bool CanReturnObject(UUID objectid, UUID returnerid, Scene scene)
139 {
140 return m_rootScene.Permissions.CanReturnObject(objectid, returnerid);
141 }
142
143 public bool CanRezObject(int objectcount, UUID owner, Vector3 objectposition, Scene scene)
144 {
145 return m_rootScene.Permissions.CanRezObject(objectcount, owner, objectposition);
146 }
147
148 public bool CanRunConsoleCommand(UUID user, Scene requestfromscene)
149 {
150 return m_rootScene.Permissions.CanRunConsoleCommand(user);
151 }
152
153 public bool CanRunScript(UUID script, UUID objectid, UUID user, Scene scene)
154 {
155 return m_rootScene.Permissions.CanRunScript(script, objectid, user);
156 }
157
158 public bool CanCompileScript(UUID owneruuid, int scripttype, Scene scene)
159 {
160 return m_rootScene.Permissions.CanCompileScript(owneruuid, scripttype);
161 }
162
163 public bool CanSellParcel(UUID user, ILandObject parcel, Scene scene)
164 {
165 return m_rootScene.Permissions.CanSellParcel(user, parcel);
166 }
167
168 public bool CanTakeObject(UUID objectid, UUID stealer, Scene scene)
169 {
170 return m_rootScene.Permissions.CanTakeObject(objectid, stealer);
171 }
172
173 public bool CanTakeCopyObject(UUID objectid, UUID userid, Scene inscene)
174 {
175 return m_rootScene.Permissions.CanTakeObject(objectid, userid);
176 }
177
178 public bool CanTerraformLand(UUID user, Vector3 position, Scene requestfromscene)
179 {
180 return m_rootScene.Permissions.CanTerraformLand(user, position);
181 }
182
183 public bool CanLinkObject(UUID user, UUID objectid)
184 {
185 return m_rootScene.Permissions.CanLinkObject(user, objectid);
186 }
187
188 public bool CanDelinkObject(UUID user, UUID objectid)
189 {
190 return m_rootScene.Permissions.CanDelinkObject(user, objectid);
191 }
192
193 public bool CanBuyLand(UUID user, ILandObject parcel, Scene scene)
194 {
195 return m_rootScene.Permissions.CanBuyLand(user, parcel);
196 }
197
198 public bool CanViewNotecard(UUID script, UUID objectid, UUID user, Scene scene)
199 {
200 return m_rootScene.Permissions.CanViewNotecard(script, objectid, user);
201 }
202
203 public bool CanViewScript(UUID script, UUID objectid, UUID user, Scene scene)
204 {
205 return m_rootScene.Permissions.CanViewScript(script, objectid, user);
206 }
207
208 public bool CanEditNotecard(UUID notecard, UUID objectid, UUID user, Scene scene)
209 {
210 return m_rootScene.Permissions.CanEditNotecard(notecard, objectid, user);
211 }
212
213 public bool CanEditScript(UUID script, UUID objectid, UUID user, Scene scene)
214 {
215 return m_rootScene.Permissions.CanEditScript(script, objectid, user);
216 }
217
218 public bool CanCreateObjectInventory(int invtype, UUID objectid, UUID userid)
219 {
220 return m_rootScene.Permissions.CanCreateObjectInventory(invtype, objectid, userid);
221 }
222
223 public bool CanEditObjectInventory(UUID objectid, UUID editorid, Scene scene)
224 {
225 return m_rootScene.Permissions.CanEditObjectInventory(objectid, editorid);
226 }
227
228 public bool CanCopyObjectInventory(UUID itemid, UUID objectid, UUID userid)
229 {
230 return m_rootScene.Permissions.CanCopyObjectInventory(itemid, objectid, userid);
231 }
232
233 public bool CanDeleteObjectInventory(UUID itemid, UUID objectid, UUID userid)
234 {
235 return m_rootScene.Permissions.CanDeleteObjectInventory(itemid, objectid, userid);
236 }
237
238 public bool CanResetScript(UUID prim, UUID script, UUID user, Scene scene)
239 {
240 return m_rootScene.Permissions.CanResetScript(prim, script, user);
241 }
242
243 public bool CanCreateUserInventory(int invtype, UUID userid)
244 {
245 return m_rootScene.Permissions.CanCreateUserInventory(invtype, userid);
246 }
247
248 public bool CanCopyUserInventory(UUID itemid, UUID userid)
249 {
250 return m_rootScene.Permissions.CanCopyUserInventory(itemid, userid);
251 }
252
253 public bool CanEditUserInventory(UUID itemid, UUID userid)
254 {
255 return m_rootScene.Permissions.CanEditUserInventory(itemid, userid);
256 }
257
258 public bool CanDeleteUserInventory(UUID itemid, UUID userid)
259 {
260 return m_rootScene.Permissions.CanDeleteUserInventory(itemid, userid);
261 }
262
263 public bool CanTeleport(UUID userid, Scene scene)
264 {
265 return m_rootScene.Permissions.CanTeleport(userid);
266 }
267
268 public bool CanUseObjectReturn(ILandObject landdata, uint type, IClientAPI client, List<SceneObjectGroup> retlist, Scene scene)
269 {
270 return m_rootScene.Permissions.CanUseObjectReturn(landdata, type, client, retlist);
271 }
272
273 #endregion
274 }
275} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionConnections.cs b/OpenSim/Region/CoreModules/World/Land/RegionConnections.cs
new file mode 100644
index 0000000..419ed74
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Land/RegionConnections.cs
@@ -0,0 +1,65 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using OpenMetaverse;
31using OpenSim.Region.Framework.Interfaces;
32using OpenSim.Region.Framework.Scenes;
33
34namespace OpenSim.Region.CoreModules.World.Land
35{
36 public class RegionConnections
37 {
38 /// <summary>
39 /// Root Region ID
40 /// </summary>
41 public UUID RegionId;
42
43 /// <summary>
44 /// Root Region Scene
45 /// </summary>
46 public Scene RegionScene;
47
48 /// <summary>
49 /// LargeLandChannel for combined region
50 /// </summary>
51 public ILandChannel RegionLandChannel;
52 public uint X;
53 public uint Y;
54 public int XEnd;
55 public int YEnd;
56 public List<RegionData> ConnectedRegions;
57 public RegionCombinerPermissionModule PermissionModule;
58 public RegionCombinerClientEventForwarder ClientEventForwarder;
59 public void UpdateExtents(Vector3 extents)
60 {
61 XEnd = (int)extents.X;
62 YEnd = (int)extents.Y;
63 }
64 }
65} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCourseLocation.cs b/OpenSim/Region/CoreModules/World/Land/RegionCourseLocation.cs
new file mode 100644
index 0000000..175ca89
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Land/RegionCourseLocation.cs
@@ -0,0 +1,43 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using OpenMetaverse;
31using OpenSim.Framework;
32
33namespace OpenSim.Region.CoreModules.World.Land
34{
35
36 struct RegionCourseLocationStruct
37 {
38 public List<Vector3> Locations;
39 public List<UUID> Uuids;
40 public IClientAPI UserAPI;
41 public Vector2 Offset;
42 }
43} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionData.cs b/OpenSim/Region/CoreModules/World/Land/RegionData.cs
new file mode 100644
index 0000000..3383527
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Land/RegionData.cs
@@ -0,0 +1,39 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using OpenMetaverse;
29using OpenSim.Region.Framework.Scenes;
30
31namespace OpenSim.Region.CoreModules.World.Land
32{
33 public class RegionData
34 {
35 public UUID RegionId;
36 public Scene RegionScene;
37 public Vector3 Offset;
38 }
39} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 4ea283f..eb397f6 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1136,7 +1136,7 @@ namespace OpenSim.Region.Framework.Scenes
1136 1136
1137 UUID newFolderID = UUID.Random(); 1137 UUID newFolderID = UUID.Random();
1138 1138
1139 InventoryFolderBase newFolder = new InventoryFolderBase(newFolderID, category, destID, 0xff, rootFolder.ID, rootFolder.Version); 1139 InventoryFolderBase newFolder = new InventoryFolderBase(newFolderID, category, destID, -1, rootFolder.ID, rootFolder.Version);
1140 InventoryService.AddFolder(newFolder); 1140 InventoryService.AddFolder(newFolder);
1141 1141
1142 foreach (UUID itemID in items) 1142 foreach (UUID itemID in items)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index d95d9d3..0c2f991 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3253,18 +3253,18 @@ namespace OpenSim.Region.Framework.Scenes
3253 3253
3254 if (AuthorizationService != null) 3254 if (AuthorizationService != null)
3255 { 3255 {
3256 if(!AuthorizationService.IsAuthorizedForRegion(agent.AgentID.ToString(), RegionInfo.RegionID.ToString())) 3256 if (!AuthorizationService.IsAuthorizedForRegion(agent.AgentID.ToString(), RegionInfo.RegionID.ToString()))
3257 { 3257 {
3258 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the region", 3258 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the region",
3259 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); 3259 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
3260 return false; 3260 return false;
3261 } 3261 }
3262 } 3262 }
3263 3263
3264 if (m_regInfo.EstateSettings.IsBanned(agent.AgentID)) 3264 if (m_regInfo.EstateSettings.IsBanned(agent.AgentID))
3265 { 3265 {
3266 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", 3266 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist",
3267 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); 3267 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
3268 reason = String.Format("Denied access to region {0}: You have been banned from that region.", 3268 reason = String.Format("Denied access to region {0}: You have been banned from that region.",
3269 RegionInfo.RegionName); 3269 RegionInfo.RegionName);
3270 return false; 3270 return false;
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index 1c71a99..204c319 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -1074,7 +1074,7 @@ namespace OpenSim.Region.Framework.Scenes
1074 if (eq != null) 1074 if (eq != null)
1075 { 1075 {
1076 eq.TeleportFinishEvent(reg.RegionHandle, 13, endPoint, 1076 eq.TeleportFinishEvent(reg.RegionHandle, 13, endPoint,
1077 4, teleportFlags, capsPath, avatar.UUID); 1077 0, teleportFlags, capsPath, avatar.UUID);
1078 } 1078 }
1079 else 1079 else
1080 { 1080 {
@@ -1269,16 +1269,53 @@ namespace OpenSim.Region.Framework.Scenes
1269 if (scene.TestBorderCross(pos + northCross, Cardinals.N)) 1269 if (scene.TestBorderCross(pos + northCross, Cardinals.N))
1270 { 1270 {
1271 Border b = scene.GetCrossedBorder(pos + northCross, Cardinals.N); 1271 Border b = scene.GetCrossedBorder(pos + northCross, Cardinals.N);
1272 neighboury += (uint)(int)(b.BorderLine.Z/(int)Constants.RegionSize); 1272 neighboury += (uint)(int)(b.BorderLine.Z / (int)Constants.RegionSize);
1273 } 1273 }
1274 else if (scene.TestBorderCross(pos + southCross, Cardinals.S)) 1274 else if (scene.TestBorderCross(pos + southCross, Cardinals.S))
1275 { 1275 {
1276 neighboury--; 1276 Border b = scene.GetCrossedBorder(pos + southCross, Cardinals.S);
1277 newpos.Y = Constants.RegionSize - enterDistance; 1277 if (b.TriggerRegionX == 0 && b.TriggerRegionY == 0)
1278 {
1279 neighboury--;
1280 newpos.Y = Constants.RegionSize - enterDistance;
1281 }
1282 else
1283 {
1284 neighboury = b.TriggerRegionY;
1285 neighbourx = b.TriggerRegionX;
1286
1287 Vector3 newposition = pos;
1288 newposition.X += (scene.RegionInfo.RegionLocX - neighbourx) * Constants.RegionSize;
1289 newposition.Y += (scene.RegionInfo.RegionLocY - neighboury) * Constants.RegionSize;
1290 agent.ControllingClient.SendAgentAlertMessage(
1291 String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false);
1292 InformClientToInitateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene);
1293 return;
1294 }
1278 } 1295 }
1279 1296
1280 neighbourx--; 1297 Border ba = scene.GetCrossedBorder(pos + westCross, Cardinals.W);
1281 newpos.X = Constants.RegionSize - enterDistance; 1298 if (ba.TriggerRegionX == 0 && ba.TriggerRegionY == 0)
1299 {
1300 neighbourx--;
1301 newpos.X = Constants.RegionSize - enterDistance;
1302 }
1303 else
1304 {
1305 neighboury = ba.TriggerRegionY;
1306 neighbourx = ba.TriggerRegionX;
1307
1308
1309 Vector3 newposition = pos;
1310 newposition.X += (scene.RegionInfo.RegionLocX - neighbourx) * Constants.RegionSize;
1311 newposition.Y += (scene.RegionInfo.RegionLocY - neighboury) * Constants.RegionSize;
1312 agent.ControllingClient.SendAgentAlertMessage(
1313 String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false);
1314 InformClientToInitateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene);
1315
1316
1317 return;
1318 }
1282 1319
1283 } 1320 }
1284 else if (scene.TestBorderCross(pos + eastCross, Cardinals.E)) 1321 else if (scene.TestBorderCross(pos + eastCross, Cardinals.E))
@@ -1289,8 +1326,24 @@ namespace OpenSim.Region.Framework.Scenes
1289 1326
1290 if (scene.TestBorderCross(pos + southCross, Cardinals.S)) 1327 if (scene.TestBorderCross(pos + southCross, Cardinals.S))
1291 { 1328 {
1292 neighboury--; 1329 Border ba = scene.GetCrossedBorder(pos + southCross, Cardinals.S);
1293 newpos.Y = Constants.RegionSize - enterDistance; 1330 if (ba.TriggerRegionX == 0 && ba.TriggerRegionY == 0)
1331 {
1332 neighboury--;
1333 newpos.Y = Constants.RegionSize - enterDistance;
1334 }
1335 else
1336 {
1337 neighboury = ba.TriggerRegionY;
1338 neighbourx = ba.TriggerRegionX;
1339 Vector3 newposition = pos;
1340 newposition.X += (scene.RegionInfo.RegionLocX - neighbourx) * Constants.RegionSize;
1341 newposition.Y += (scene.RegionInfo.RegionLocY - neighboury) * Constants.RegionSize;
1342 agent.ControllingClient.SendAgentAlertMessage(
1343 String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false);
1344 InformClientToInitateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene);
1345 return;
1346 }
1294 } 1347 }
1295 else if (scene.TestBorderCross(pos + northCross, Cardinals.N)) 1348 else if (scene.TestBorderCross(pos + northCross, Cardinals.N))
1296 { 1349 {
@@ -1298,16 +1351,33 @@ namespace OpenSim.Region.Framework.Scenes
1298 neighboury += (uint)(int)(c.BorderLine.Z / (int)Constants.RegionSize); 1351 neighboury += (uint)(int)(c.BorderLine.Z / (int)Constants.RegionSize);
1299 newpos.Y = enterDistance; 1352 newpos.Y = enterDistance;
1300 } 1353 }
1301 1354
1302 1355
1303 } 1356 }
1304 else if (scene.TestBorderCross(pos + southCross, Cardinals.S)) 1357 else if (scene.TestBorderCross(pos + southCross, Cardinals.S))
1305 { 1358 {
1306 neighboury--; 1359 Border b = scene.GetCrossedBorder(pos + southCross, Cardinals.S);
1307 newpos.Y = Constants.RegionSize - enterDistance; 1360 if (b.TriggerRegionX == 0 && b.TriggerRegionY == 0)
1361 {
1362 neighboury--;
1363 newpos.Y = Constants.RegionSize - enterDistance;
1364 }
1365 else
1366 {
1367 neighboury = b.TriggerRegionY;
1368 neighbourx = b.TriggerRegionX;
1369 Vector3 newposition = pos;
1370 newposition.X += (scene.RegionInfo.RegionLocX - neighbourx) * Constants.RegionSize;
1371 newposition.Y += (scene.RegionInfo.RegionLocY - neighboury) * Constants.RegionSize;
1372 agent.ControllingClient.SendAgentAlertMessage(
1373 String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false);
1374 InformClientToInitateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene);
1375 return;
1376 }
1308 } 1377 }
1309 else if (scene.TestBorderCross(pos + northCross, Cardinals.N)) 1378 else if (scene.TestBorderCross(pos + northCross, Cardinals.N))
1310 { 1379 {
1380
1311 Border b = scene.GetCrossedBorder(pos + northCross, Cardinals.N); 1381 Border b = scene.GetCrossedBorder(pos + northCross, Cardinals.N);
1312 neighboury += (uint)(int)(b.BorderLine.Z / (int)Constants.RegionSize); 1382 neighboury += (uint)(int)(b.BorderLine.Z / (int)Constants.RegionSize);
1313 newpos.Y = enterDistance; 1383 newpos.Y = enterDistance;
@@ -1342,9 +1412,61 @@ namespace OpenSim.Region.Framework.Scenes
1342 d.BeginInvoke(agent, newpos, neighbourx, neighboury, isFlying, CrossAgentToNewRegionCompleted, d); 1412 d.BeginInvoke(agent, newpos, neighbourx, neighboury, isFlying, CrossAgentToNewRegionCompleted, d);
1343 } 1413 }
1344 1414
1415 public delegate void InformClientToInitateTeleportToLocationDelegate(ScenePresence agent, uint regionX, uint regionY,
1416 Vector3 position,
1417 Scene initiatingScene);
1418
1419 public void InformClientToInitateTeleportToLocation(ScenePresence agent, uint regionX, uint regionY, Vector3 position,
1420 Scene initiatingScene)
1421 {
1422
1423 // This assumes that we know what our neighbors are.
1424
1425 InformClientToInitateTeleportToLocationDelegate d = InformClientToInitiateTeleportToLocationAsync;
1426 d.BeginInvoke(agent,regionX,regionY,position,initiatingScene,
1427 InformClientToInitiateTeleportToLocationCompleted,
1428 d);
1429 }
1430
1431 public void InformClientToInitiateTeleportToLocationAsync(ScenePresence agent, uint regionX, uint regionY, Vector3 position,
1432 Scene initiatingScene)
1433 {
1434 Thread.Sleep(10000);
1435 IMessageTransferModule im = initiatingScene.RequestModuleInterface<IMessageTransferModule>();
1436 if (im != null)
1437 {
1438 UUID gotoLocation = Util.BuildFakeParcelID(
1439 Util.UIntsToLong(
1440 (regionX *
1441 (uint)Constants.RegionSize),
1442 (regionY *
1443 (uint)Constants.RegionSize)),
1444 (uint)(int)position.X,
1445 (uint)(int)position.Y,
1446 (uint)(int)position.Z);
1447 GridInstantMessage m = new GridInstantMessage(initiatingScene, UUID.Zero,
1448 "Region", agent.UUID,
1449 (byte)InstantMessageDialog.GodLikeRequestTeleport, false,
1450 "", gotoLocation, false, new Vector3(127, 0, 0),
1451 new Byte[0]);
1452 im.SendInstantMessage(m, delegate(bool success)
1453 {
1454 m_log.DebugFormat("[CLIENT]: Client Initiating Teleport sending IM success = {0}", success);
1455 });
1456
1457 }
1458 }
1459
1460 private void InformClientToInitiateTeleportToLocationCompleted(IAsyncResult iar)
1461 {
1462 InformClientToInitateTeleportToLocationDelegate icon =
1463 (InformClientToInitateTeleportToLocationDelegate) iar.AsyncState;
1464 icon.EndInvoke(iar);
1465 }
1466
1345 public delegate ScenePresence CrossAgentToNewRegionDelegate(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, bool isFlying); 1467 public delegate ScenePresence CrossAgentToNewRegionDelegate(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, bool isFlying);
1346 1468
1347 /// <summary> 1469 /// <summary>
1348 /// This Closes child agents on neighboring regions 1470 /// This Closes child agents on neighboring regions
1349 /// Calls an asynchronous method to do so.. so it doesn't lag the sim. 1471 /// Calls an asynchronous method to do so.. so it doesn't lag the sim.
1350 /// </summary> 1472 /// </summary>
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 1024857..23fe2d3 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -776,8 +776,20 @@ namespace OpenSim.Region.Framework.Scenes
776 // before the inventory is processed in MakeRootAgent. This fixes a race condition 776 // before the inventory is processed in MakeRootAgent. This fixes a race condition
777 // related to the handling of attachments 777 // related to the handling of attachments
778 //m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); 778 //m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance);
779 if (m_scene.TestBorderCross(pos, Cardinals.E))
780 {
781 Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.E);
782 pos.X = crossedBorder.BorderLine.Z - 1;
783 }
784
785 if (m_scene.TestBorderCross(pos, Cardinals.N))
786 {
787 Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.N);
788 pos.Y = crossedBorder.BorderLine.Z - 1;
789 }
790
779 791
780 if (pos.X < 0 || pos.X >= (int)Constants.RegionSize || pos.Y < 0 || pos.Y >= (int)Constants.RegionSize || pos.Z < 0) 792 if (pos.X < 0 || pos.Y < 0 || pos.Z < 0)
781 { 793 {
782 Vector3 emergencyPos = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 128); 794 Vector3 emergencyPos = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 128);
783 795
@@ -795,7 +807,11 @@ namespace OpenSim.Region.Framework.Scenes
795 localAVHeight = m_avHeight; 807 localAVHeight = m_avHeight;
796 } 808 }
797 809
798 float posZLimit = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y]; 810 float posZLimit = 0;
811
812 if (pos.X <Constants.RegionSize && pos.Y < Constants.RegionSize)
813 posZLimit = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y];
814
799 float newPosZ = posZLimit + localAVHeight / 2; 815 float newPosZ = posZLimit + localAVHeight / 2;
800 if (posZLimit >= (pos.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ))) 816 if (posZLimit >= (pos.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ)))
801 { 817 {
@@ -877,6 +893,7 @@ namespace OpenSim.Region.Framework.Scenes
877 m_isChildAgent = true; 893 m_isChildAgent = true;
878 m_scene.SwapRootAgentCount(true); 894 m_scene.SwapRootAgentCount(true);
879 RemoveFromPhysicalScene(); 895 RemoveFromPhysicalScene();
896
880 m_scene.EventManager.TriggerOnMakeChildAgent(this); 897 m_scene.EventManager.TriggerOnMakeChildAgent(this);
881 } 898 }
882 899
@@ -904,7 +921,7 @@ namespace OpenSim.Region.Framework.Scenes
904 bool isFlying = false; 921 bool isFlying = false;
905 if (m_physicsActor != null) 922 if (m_physicsActor != null)
906 isFlying = m_physicsActor.Flying; 923 isFlying = m_physicsActor.Flying;
907 924
908 RemoveFromPhysicalScene(); 925 RemoveFromPhysicalScene();
909 Velocity = new Vector3(0, 0, 0); 926 Velocity = new Vector3(0, 0, 0);
910 AbsolutePosition = pos; 927 AbsolutePosition = pos;
@@ -2412,7 +2429,8 @@ namespace OpenSim.Region.Framework.Scenes
2412 } 2429 }
2413 2430
2414 // followed suggestion from mic bowman. reversed the two lines below. 2431 // followed suggestion from mic bowman. reversed the two lines below.
2415 CheckForBorderCrossing(); 2432 if (m_parentID == 0 && m_physicsActor != null || m_parentID != 0) // Check that we have a physics actor or we're sitting on something
2433 CheckForBorderCrossing();
2416 CheckForSignificantMovement(); // sends update to the modules. 2434 CheckForSignificantMovement(); // sends update to the modules.
2417 } 2435 }
2418 } 2436 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 04f7862..650d9fa 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -298,14 +298,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
298 try 298 try
299 { 299 {
300 FileInfo fi = new FileInfo(savedState); 300 FileInfo fi = new FileInfo(savedState);
301 int size=(int)fi.Length; 301 int size = (int)fi.Length;
302 if (size < 512000) 302 if (size < 512000)
303 { 303 {
304 using (FileStream fs = File.Open(savedState, 304 using (FileStream fs = File.Open(savedState,
305 FileMode.Open, FileAccess.Read, FileShare.None)) 305 FileMode.Open, FileAccess.Read, FileShare.None))
306 { 306 {
307 System.Text.ASCIIEncoding enc = 307 System.Text.UTF8Encoding enc =
308 new System.Text.ASCIIEncoding(); 308 new System.Text.UTF8Encoding();
309 309
310 Byte[] data = new Byte[size]; 310 Byte[] data = new Byte[size];
311 fs.Read(data, 0, size); 311 fs.Read(data, 0, size);
@@ -899,7 +899,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
899 try 899 try
900 { 900 {
901 FileStream fs = File.Create(Path.Combine(Path.GetDirectoryName(assembly), m_ItemID.ToString() + ".state")); 901 FileStream fs = File.Create(Path.Combine(Path.GetDirectoryName(assembly), m_ItemID.ToString() + ".state"));
902 System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); 902 System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
903 Byte[] buf = enc.GetBytes(xml); 903 Byte[] buf = enc.GetBytes(xml);
904 fs.Write(buf, 0, buf.Length); 904 fs.Write(buf, 0, buf.Length);
905 fs.Close(); 905 fs.Close();