aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/RegionCombinerModule
diff options
context:
space:
mode:
authorTeravus Ovares (Dan Olivares)2009-11-10 22:15:34 -0500
committerTeravus Ovares (Dan Olivares)2009-11-10 22:40:08 -0500
commit2e514bfb1bcc55def804772e00200b44c20d3d7a (patch)
tree8f63295deed687e08dba1c6d944aae00e554b25b /OpenSim/Region/RegionCombinerModule
parentMerge branch 'master' of ssh://justincc@opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-2e514bfb1bcc55def804772e00200b44c20d3d7a.zip
opensim-SC_OLD-2e514bfb1bcc55def804772e00200b44c20d3d7a.tar.gz
opensim-SC_OLD-2e514bfb1bcc55def804772e00200b44c20d3d7a.tar.bz2
opensim-SC_OLD-2e514bfb1bcc55def804772e00200b44c20d3d7a.tar.xz
* Move RegionCombinerModule to it's own project
* Moves the mono_metadata_token_from_dor message to a different module on loading.
Diffstat (limited to 'OpenSim/Region/RegionCombinerModule')
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCombinerClientEventForwarder.cs94
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs125
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs163
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs964
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs275
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionConnections.cs65
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCourseLocation.cs43
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionData.cs39
-rw-r--r--OpenSim/Region/RegionCombinerModule/Resources/RegionCombinerModule.addin.xml13
9 files changed, 1781 insertions, 0 deletions
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerClientEventForwarder.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerClientEventForwarder.cs
new file mode 100644
index 0000000..70d6de3
--- /dev/null
+++ b/OpenSim/Region/RegionCombinerModule/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/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs
new file mode 100644
index 0000000..2cbaf96
--- /dev/null
+++ b/OpenSim/Region/RegionCombinerModule/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/RegionCombinerModule/RegionCombinerLargeLandChannel.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs
new file mode 100644
index 0000000..7df836c
--- /dev/null
+++ b/OpenSim/Region/RegionCombinerModule/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/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
new file mode 100644
index 0000000..6859d6d
--- /dev/null
+++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
@@ -0,0 +1,964 @@
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 System.Reflection;
31using log4net;
32using Nini.Config;
33using OpenMetaverse;
34using OpenSim.Framework;
35using OpenSim.Framework.Client;
36using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes;
38using OpenSim.Framework.Console;
39using OpenSim.Region.Physics.Manager;
40
41namespace OpenSim.Region.CoreModules.World.Land
42{
43 public class RegionCombinerModule : ISharedRegionModule
44 {
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46
47 public string Name
48 {
49 get { return "RegionCombinerModule"; }
50 }
51
52 public Type ReplaceableInterface
53 {
54 get { return null; }
55 }
56
57 private Dictionary<UUID, RegionConnections> m_regions = new Dictionary<UUID, RegionConnections>();
58 private bool enabledYN = false;
59 private Dictionary<UUID, Scene> m_startingScenes = new Dictionary<UUID, Scene>();
60
61 public void Initialise(IConfigSource source)
62 {
63 IConfig myConfig = source.Configs["Startup"];
64 enabledYN = myConfig.GetBoolean("CombineContiguousRegions", false);
65 //enabledYN = true;
66 if (enabledYN)
67 MainConsole.Instance.Commands.AddCommand("RegionCombinerModule", false, "fix-phantoms",
68 "Fix phantom objects", "Fixes phantom objects after an import to megaregions", FixPhantoms);
69 }
70
71 public void Close()
72 {
73 }
74
75 public void AddRegion(Scene scene)
76 {
77 }
78
79 public void RemoveRegion(Scene scene)
80 {
81 }
82
83 public void RegionLoaded(Scene scene)
84 {
85 if (enabledYN)
86 RegionLoadedDoWork(scene);
87 }
88
89 private void RegionLoadedDoWork(Scene scene)
90 {
91/*
92 // For testing on a single instance
93 if (scene.RegionInfo.RegionLocX == 1004 && scene.RegionInfo.RegionLocY == 1000)
94 return;
95 //
96*/
97 lock (m_startingScenes)
98 m_startingScenes.Add(scene.RegionInfo.originRegionID, scene);
99
100 // Give each region a standard set of non-infinite borders
101 Border northBorder = new Border();
102 northBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, (int)Constants.RegionSize); //<---
103 northBorder.CrossDirection = Cardinals.N;
104 scene.NorthBorders[0] = northBorder;
105
106 Border southBorder = new Border();
107 southBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, 0); //--->
108 southBorder.CrossDirection = Cardinals.S;
109 scene.SouthBorders[0] = southBorder;
110
111 Border eastBorder = new Border();
112 eastBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, (int)Constants.RegionSize); //<---
113 eastBorder.CrossDirection = Cardinals.E;
114 scene.EastBorders[0] = eastBorder;
115
116 Border westBorder = new Border();
117 westBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, 0); //--->
118 westBorder.CrossDirection = Cardinals.W;
119 scene.WestBorders[0] = westBorder;
120
121
122
123 RegionConnections regionConnections = new RegionConnections();
124 regionConnections.ConnectedRegions = new List<RegionData>();
125 regionConnections.RegionScene = scene;
126 regionConnections.RegionLandChannel = scene.LandChannel;
127 regionConnections.RegionId = scene.RegionInfo.originRegionID;
128 regionConnections.X = scene.RegionInfo.RegionLocX;
129 regionConnections.Y = scene.RegionInfo.RegionLocY;
130 regionConnections.XEnd = (int)Constants.RegionSize;
131 regionConnections.YEnd = (int)Constants.RegionSize;
132
133
134 lock (m_regions)
135 {
136 bool connectedYN = false;
137
138 foreach (RegionConnections conn in m_regions.Values)
139 {
140 #region commented
141 /*
142 // If we're one region over +x +y
143 //xxy
144 //xxx
145 //xxx
146 if ((((int)conn.X * (int)Constants.RegionSize) + conn.XEnd
147 == (regionConnections.X * (int)Constants.RegionSize))
148 && (((int)conn.Y * (int)Constants.RegionSize) - conn.YEnd
149 == (regionConnections.Y * (int)Constants.RegionSize)))
150 {
151 Vector3 offset = Vector3.Zero;
152 offset.X = (((regionConnections.X * (int) Constants.RegionSize)) -
153 ((conn.X * (int) Constants.RegionSize)));
154 offset.Y = (((regionConnections.Y * (int) Constants.RegionSize)) -
155 ((conn.Y * (int) Constants.RegionSize)));
156
157 Vector3 extents = Vector3.Zero;
158 extents.Y = regionConnections.YEnd + conn.YEnd;
159 extents.X = conn.XEnd + conn.XEnd;
160
161 m_log.DebugFormat("Scene: {0} to the northwest of Scene{1}. Offset: {2}. Extents:{3}",
162 conn.RegionScene.RegionInfo.RegionName,
163 regionConnections.RegionScene.RegionInfo.RegionName,
164 offset, extents);
165
166 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
167
168 connectedYN = true;
169 break;
170 }
171 */
172
173 /*
174 //If we're one region over x +y
175 //xxx
176 //xxx
177 //xyx
178 if ((((int)conn.X * (int)Constants.RegionSize)
179 == (regionConnections.X * (int)Constants.RegionSize))
180 && (((int)conn.Y * (int)Constants.RegionSize) - conn.YEnd
181 == (regionConnections.Y * (int)Constants.RegionSize)))
182 {
183 Vector3 offset = Vector3.Zero;
184 offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
185 ((conn.X * (int)Constants.RegionSize)));
186 offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
187 ((conn.Y * (int)Constants.RegionSize)));
188
189 Vector3 extents = Vector3.Zero;
190 extents.Y = regionConnections.YEnd + conn.YEnd;
191 extents.X = conn.XEnd;
192
193 m_log.DebugFormat("Scene: {0} to the north of Scene{1}. Offset: {2}. Extents:{3}",
194 conn.RegionScene.RegionInfo.RegionName,
195 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
196
197 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
198 connectedYN = true;
199 break;
200 }
201 */
202
203 /*
204 // If we're one region over -x +y
205 //xxx
206 //xxx
207 //yxx
208 if ((((int)conn.X * (int)Constants.RegionSize) - conn.XEnd
209 == (regionConnections.X * (int)Constants.RegionSize))
210 && (((int)conn.Y * (int)Constants.RegionSize) - conn.YEnd
211 == (regionConnections.Y * (int)Constants.RegionSize)))
212 {
213 Vector3 offset = Vector3.Zero;
214 offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
215 ((conn.X * (int)Constants.RegionSize)));
216 offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
217 ((conn.Y * (int)Constants.RegionSize)));
218
219 Vector3 extents = Vector3.Zero;
220 extents.Y = regionConnections.YEnd + conn.YEnd;
221 extents.X = conn.XEnd + conn.XEnd;
222
223 m_log.DebugFormat("Scene: {0} to the northeast of Scene. Offset: {2}. Extents:{3}",
224 conn.RegionScene.RegionInfo.RegionName,
225 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
226
227 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
228
229
230 connectedYN = true;
231 break;
232 }
233 */
234
235 /*
236 // If we're one region over -x y
237 //xxx
238 //yxx
239 //xxx
240 if ((((int)conn.X * (int)Constants.RegionSize) - conn.XEnd
241 == (regionConnections.X * (int)Constants.RegionSize))
242 && (((int)conn.Y * (int)Constants.RegionSize)
243 == (regionConnections.Y * (int)Constants.RegionSize)))
244 {
245 Vector3 offset = Vector3.Zero;
246 offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
247 ((conn.X * (int)Constants.RegionSize)));
248 offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
249 ((conn.Y * (int)Constants.RegionSize)));
250
251 Vector3 extents = Vector3.Zero;
252 extents.Y = regionConnections.YEnd;
253 extents.X = conn.XEnd + conn.XEnd;
254
255 m_log.DebugFormat("Scene: {0} to the east of Scene{1} Offset: {2}. Extents:{3}",
256 conn.RegionScene.RegionInfo.RegionName,
257 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
258
259 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
260
261 connectedYN = true;
262 break;
263 }
264 */
265
266 /*
267 // If we're one region over -x -y
268 //yxx
269 //xxx
270 //xxx
271 if ((((int)conn.X * (int)Constants.RegionSize) - conn.XEnd
272 == (regionConnections.X * (int)Constants.RegionSize))
273 && (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd
274 == (regionConnections.Y * (int)Constants.RegionSize)))
275 {
276 Vector3 offset = Vector3.Zero;
277 offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
278 ((conn.X * (int)Constants.RegionSize)));
279 offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
280 ((conn.Y * (int)Constants.RegionSize)));
281
282 Vector3 extents = Vector3.Zero;
283 extents.Y = regionConnections.YEnd + conn.YEnd;
284 extents.X = conn.XEnd + conn.XEnd;
285
286 m_log.DebugFormat("Scene: {0} to the northeast of Scene{1} Offset: {2}. Extents:{3}",
287 conn.RegionScene.RegionInfo.RegionName,
288 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
289
290 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
291
292 connectedYN = true;
293 break;
294 }
295 */
296 #endregion
297
298 // If we're one region over +x y
299 //xxx
300 //xxy
301 //xxx
302
303
304 if ((((int)conn.X * (int)Constants.RegionSize) + conn.XEnd
305 >= (regionConnections.X * (int)Constants.RegionSize))
306 && (((int)conn.Y * (int)Constants.RegionSize)
307 >= (regionConnections.Y * (int)Constants.RegionSize)))
308 {
309 connectedYN = DoWorkForOneRegionOverPlusXY(conn, regionConnections, scene);
310 break;
311 }
312
313 // If we're one region over x +y
314 //xyx
315 //xxx
316 //xxx
317 if ((((int)conn.X * (int)Constants.RegionSize)
318 >= (regionConnections.X * (int)Constants.RegionSize))
319 && (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd
320 >= (regionConnections.Y * (int)Constants.RegionSize)))
321 {
322 connectedYN = DoWorkForOneRegionOverXPlusY(conn, regionConnections, scene);
323 break;
324 }
325
326 // If we're one region over +x +y
327 //xxy
328 //xxx
329 //xxx
330 if ((((int)conn.X * (int)Constants.RegionSize) + conn.YEnd
331 >= (regionConnections.X * (int)Constants.RegionSize))
332 && (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd
333 >= (regionConnections.Y * (int)Constants.RegionSize)))
334 {
335 connectedYN = DoWorkForOneRegionOverPlusXPlusY(conn, regionConnections, scene);
336 break;
337
338 }
339 }
340
341 // If !connectYN means that this region is a root region
342 if (!connectedYN)
343 {
344 DoWorkForRootRegion(regionConnections, scene);
345
346 }
347 }
348 // Set up infinite borders around the entire AABB of the combined ConnectedRegions
349 AdjustLargeRegionBounds();
350 }
351
352 private bool DoWorkForOneRegionOverPlusXY(RegionConnections conn, RegionConnections regionConnections, Scene scene)
353 {
354 Vector3 offset = Vector3.Zero;
355 offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
356 ((conn.X * (int)Constants.RegionSize)));
357 offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
358 ((conn.Y * (int)Constants.RegionSize)));
359
360 Vector3 extents = Vector3.Zero;
361 extents.Y = conn.YEnd;
362 extents.X = conn.XEnd + regionConnections.XEnd;
363
364 conn.UpdateExtents(extents);
365
366 m_log.DebugFormat("Scene: {0} to the west of Scene{1} Offset: {2}. Extents:{3}",
367 conn.RegionScene.RegionInfo.RegionName,
368 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
369
370 scene.BordersLocked = true;
371 conn.RegionScene.BordersLocked = true;
372
373 RegionData ConnectedRegion = new RegionData();
374 ConnectedRegion.Offset = offset;
375 ConnectedRegion.RegionId = scene.RegionInfo.originRegionID;
376 ConnectedRegion.RegionScene = scene;
377 conn.ConnectedRegions.Add(ConnectedRegion);
378
379 // Inform root region Physics about the extents of this region
380 conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
381
382 // Inform Child region that it needs to forward it's terrain to the root region
383 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero);
384
385 // Extend the borders as appropriate
386 lock (conn.RegionScene.EastBorders)
387 conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize;
388
389 lock (conn.RegionScene.NorthBorders)
390 conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
391
392 lock (conn.RegionScene.SouthBorders)
393 conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
394
395 lock (scene.WestBorders)
396 {
397
398
399 scene.WestBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocX - conn.RegionScene.RegionInfo.RegionLocX) * (int)Constants.RegionSize); //auto teleport West
400
401 // Trigger auto teleport to root region
402 scene.WestBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
403 scene.WestBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
404 }
405
406 // Reset Terrain.. since terrain loads before we get here, we need to load
407 // it again so it loads in the root region
408
409 scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
410
411 // Unlock borders
412 conn.RegionScene.BordersLocked = false;
413 scene.BordersLocked = false;
414
415 // Create a client event forwarder and add this region's events to the root region.
416 if (conn.ClientEventForwarder != null)
417 conn.ClientEventForwarder.AddSceneToEventForwarding(scene);
418
419 return true;
420 }
421
422 private bool DoWorkForOneRegionOverXPlusY(RegionConnections conn, RegionConnections regionConnections, Scene scene)
423 {
424 Vector3 offset = Vector3.Zero;
425 offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
426 ((conn.X * (int)Constants.RegionSize)));
427 offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
428 ((conn.Y * (int)Constants.RegionSize)));
429
430 Vector3 extents = Vector3.Zero;
431 extents.Y = regionConnections.YEnd + conn.YEnd;
432 extents.X = conn.XEnd;
433 conn.UpdateExtents(extents);
434
435 scene.BordersLocked = true;
436 conn.RegionScene.BordersLocked = true;
437
438 RegionData ConnectedRegion = new RegionData();
439 ConnectedRegion.Offset = offset;
440 ConnectedRegion.RegionId = scene.RegionInfo.originRegionID;
441 ConnectedRegion.RegionScene = scene;
442 conn.ConnectedRegions.Add(ConnectedRegion);
443
444 m_log.DebugFormat("Scene: {0} to the northeast of Scene{1} Offset: {2}. Extents:{3}",
445 conn.RegionScene.RegionInfo.RegionName,
446 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
447
448 conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
449 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero);
450
451 lock (conn.RegionScene.NorthBorders)
452 conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
453 lock (conn.RegionScene.EastBorders)
454 conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
455 lock (conn.RegionScene.WestBorders)
456 conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
457 lock (scene.SouthBorders)
458 {
459 scene.SouthBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocY - conn.RegionScene.RegionInfo.RegionLocY) * (int)Constants.RegionSize); //auto teleport south
460 scene.SouthBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
461 scene.SouthBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
462 }
463
464 // Reset Terrain.. since terrain normally loads first.
465 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
466 scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
467 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
468
469 scene.BordersLocked = false;
470 conn.RegionScene.BordersLocked = false;
471 if (conn.ClientEventForwarder != null)
472 conn.ClientEventForwarder.AddSceneToEventForwarding(scene);
473 return true;
474 }
475
476 private bool DoWorkForOneRegionOverPlusXPlusY(RegionConnections conn, RegionConnections regionConnections, Scene scene)
477 {
478 Vector3 offset = Vector3.Zero;
479 offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
480 ((conn.X * (int)Constants.RegionSize)));
481 offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
482 ((conn.Y * (int)Constants.RegionSize)));
483
484 Vector3 extents = Vector3.Zero;
485 extents.Y = regionConnections.YEnd + conn.YEnd;
486 extents.X = regionConnections.XEnd + conn.XEnd;
487 conn.UpdateExtents(extents);
488
489 scene.BordersLocked = true;
490 conn.RegionScene.BordersLocked = true;
491
492 RegionData ConnectedRegion = new RegionData();
493 ConnectedRegion.Offset = offset;
494 ConnectedRegion.RegionId = scene.RegionInfo.originRegionID;
495 ConnectedRegion.RegionScene = scene;
496
497 conn.ConnectedRegions.Add(ConnectedRegion);
498
499 m_log.DebugFormat("Scene: {0} to the NorthEast of Scene{1} Offset: {2}. Extents:{3}",
500 conn.RegionScene.RegionInfo.RegionName,
501 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
502
503 conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
504 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero);
505 lock (conn.RegionScene.NorthBorders)
506 {
507 if (conn.RegionScene.NorthBorders.Count == 1)// && 2)
508 {
509 //compound border
510 // already locked above
511 conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
512
513 lock (conn.RegionScene.EastBorders)
514 conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
515 lock (conn.RegionScene.WestBorders)
516 conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
517 }
518 }
519
520 lock (scene.SouthBorders)
521 {
522 scene.SouthBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocY - conn.RegionScene.RegionInfo.RegionLocY) * (int)Constants.RegionSize); //auto teleport south
523 scene.SouthBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
524 scene.SouthBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
525 }
526
527 lock (conn.RegionScene.EastBorders)
528 {
529 if (conn.RegionScene.EastBorders.Count == 1)// && conn.RegionScene.EastBorders.Count == 2)
530 {
531
532 conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize;
533 lock (conn.RegionScene.NorthBorders)
534 conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
535 lock (conn.RegionScene.SouthBorders)
536 conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
537
538
539 }
540 }
541
542 lock (scene.WestBorders)
543 {
544 scene.WestBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocX - conn.RegionScene.RegionInfo.RegionLocX) * (int)Constants.RegionSize); //auto teleport West
545 scene.WestBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
546 scene.WestBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
547 }
548
549 /*
550 else
551 {
552 conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
553 conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
554 conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
555 scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south
556 }
557 */
558
559
560 // Reset Terrain.. since terrain normally loads first.
561 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
562 scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
563 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
564 scene.BordersLocked = false;
565 conn.RegionScene.BordersLocked = false;
566
567 if (conn.ClientEventForwarder != null)
568 conn.ClientEventForwarder.AddSceneToEventForwarding(scene);
569
570 return true;
571
572 //scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset,extents);
573
574 }
575
576 private void DoWorkForRootRegion(RegionConnections regionConnections, Scene scene)
577 {
578 RegionData rdata = new RegionData();
579 rdata.Offset = Vector3.Zero;
580 rdata.RegionId = scene.RegionInfo.originRegionID;
581 rdata.RegionScene = scene;
582 // save it's land channel
583 regionConnections.RegionLandChannel = scene.LandChannel;
584
585 // Substitue our landchannel
586 RegionCombinerLargeLandChannel lnd = new RegionCombinerLargeLandChannel(rdata, scene.LandChannel,
587 regionConnections.ConnectedRegions);
588 scene.LandChannel = lnd;
589 // Forward the permissions modules of each of the connected regions to the root region
590 lock (m_regions)
591 {
592 foreach (RegionData r in regionConnections.ConnectedRegions)
593 {
594 ForwardPermissionRequests(regionConnections, r.RegionScene);
595 }
596 }
597 // Create the root region's Client Event Forwarder
598 regionConnections.ClientEventForwarder = new RegionCombinerClientEventForwarder(regionConnections);
599
600 // Sets up the CoarseLocationUpdate forwarder for this root region
601 scene.EventManager.OnNewPresence += SetCourseLocationDelegate;
602
603 // Adds this root region to a dictionary of regions that are connectable
604 m_regions.Add(scene.RegionInfo.originRegionID, regionConnections);
605 }
606
607 private void SetCourseLocationDelegate(ScenePresence presence)
608 {
609 presence.SetSendCourseLocationMethod(SendCourseLocationUpdates);
610 }
611
612 private void SendCourseLocationUpdates(UUID sceneId, ScenePresence presence)
613 {
614 RegionConnections connectiondata = null;
615 lock (m_regions)
616 {
617 if (m_regions.ContainsKey(sceneId))
618 connectiondata = m_regions[sceneId];
619 else
620 return;
621 }
622
623 List<ScenePresence> avatars = connectiondata.RegionScene.GetAvatars();
624 List<Vector3> CoarseLocations = new List<Vector3>();
625 List<UUID> AvatarUUIDs = new List<UUID>();
626 for (int i = 0; i < avatars.Count; i++)
627 {
628 if (avatars[i].UUID != presence.UUID)
629 {
630 if (avatars[i].ParentID != 0)
631 {
632 // sitting avatar
633 SceneObjectPart sop = connectiondata.RegionScene.GetSceneObjectPart(avatars[i].ParentID);
634 if (sop != null)
635 {
636 CoarseLocations.Add(sop.AbsolutePosition + avatars[i].AbsolutePosition);
637 AvatarUUIDs.Add(avatars[i].UUID);
638 }
639 else
640 {
641 // we can't find the parent.. ! arg!
642 CoarseLocations.Add(avatars[i].AbsolutePosition);
643 AvatarUUIDs.Add(avatars[i].UUID);
644 }
645 }
646 else
647 {
648 CoarseLocations.Add(avatars[i].AbsolutePosition);
649 AvatarUUIDs.Add(avatars[i].UUID);
650 }
651 }
652 }
653 DistributeCourseLocationUpdates(CoarseLocations, AvatarUUIDs, connectiondata, presence);
654 }
655
656 private void DistributeCourseLocationUpdates(List<Vector3> locations, List<UUID> uuids,
657 RegionConnections connectiondata, ScenePresence rootPresence)
658 {
659 RegionData[] rdata = connectiondata.ConnectedRegions.ToArray();
660 //List<IClientAPI> clients = new List<IClientAPI>();
661 Dictionary<Vector2, RegionCourseLocationStruct> updates = new Dictionary<Vector2, RegionCourseLocationStruct>();
662
663 // Root Region entry
664 RegionCourseLocationStruct rootupdatedata = new RegionCourseLocationStruct();
665 rootupdatedata.Locations = new List<Vector3>();
666 rootupdatedata.Uuids = new List<UUID>();
667 rootupdatedata.Offset = Vector2.Zero;
668
669 rootupdatedata.UserAPI = rootPresence.ControllingClient;
670
671 if (rootupdatedata.UserAPI != null)
672 updates.Add(Vector2.Zero, rootupdatedata);
673
674 //Each Region needs an entry or we will end up with dead minimap dots
675 foreach (RegionData regiondata in rdata)
676 {
677 Vector2 offset = new Vector2(regiondata.Offset.X, regiondata.Offset.Y);
678 RegionCourseLocationStruct updatedata = new RegionCourseLocationStruct();
679 updatedata.Locations = new List<Vector3>();
680 updatedata.Uuids = new List<UUID>();
681 updatedata.Offset = offset;
682
683 if (offset == Vector2.Zero)
684 updatedata.UserAPI = rootPresence.ControllingClient;
685 else
686 updatedata.UserAPI = LocateUsersChildAgentIClientAPI(offset, rootPresence.UUID, rdata);
687
688 if (updatedata.UserAPI != null)
689 updates.Add(offset, updatedata);
690 }
691
692 // go over the locations and assign them to an IClientAPI
693 for (int i = 0; i < locations.Count; i++)
694 //{locations[i]/(int) Constants.RegionSize;
695 {
696 Vector3 pPosition = new Vector3((int)locations[i].X / (int)Constants.RegionSize,
697 (int)locations[i].Y / (int)Constants.RegionSize, locations[i].Z);
698 Vector2 offset = new Vector2(pPosition.X*(int) Constants.RegionSize,
699 pPosition.Y*(int) Constants.RegionSize);
700
701 if (!updates.ContainsKey(offset))
702 {
703 // This shouldn't happen
704 RegionCourseLocationStruct updatedata = new RegionCourseLocationStruct();
705 updatedata.Locations = new List<Vector3>();
706 updatedata.Uuids = new List<UUID>();
707 updatedata.Offset = offset;
708
709 if (offset == Vector2.Zero)
710 updatedata.UserAPI = rootPresence.ControllingClient;
711 else
712 updatedata.UserAPI = LocateUsersChildAgentIClientAPI(offset, rootPresence.UUID, rdata);
713
714 updates.Add(offset,updatedata);
715 }
716
717 updates[offset].Locations.Add(locations[i]);
718 updates[offset].Uuids.Add(uuids[i]);
719 }
720
721 // Send out the CoarseLocationupdates from their respective client connection based on where the avatar is
722 foreach (Vector2 offset in updates.Keys)
723 {
724 if (updates[offset].UserAPI != null)
725 {
726 updates[offset].UserAPI.SendCoarseLocationUpdate(updates[offset].Uuids,updates[offset].Locations);
727 }
728 }
729 }
730
731 /// <summary>
732 /// Locates a the Client of a particular region in an Array of RegionData based on offset
733 /// </summary>
734 /// <param name="offset"></param>
735 /// <param name="uUID"></param>
736 /// <param name="rdata"></param>
737 /// <returns>IClientAPI or null</returns>
738 private IClientAPI LocateUsersChildAgentIClientAPI(Vector2 offset, UUID uUID, RegionData[] rdata)
739 {
740 IClientAPI returnclient = null;
741 foreach (RegionData r in rdata)
742 {
743 if (r.Offset.X == offset.X && r.Offset.Y == offset.Y)
744 {
745 return r.RegionScene.SceneGraph.GetControllingClient(uUID);
746 }
747 }
748
749 return returnclient;
750 }
751
752 public void PostInitialise()
753 {
754 }
755
756 /// <summary>
757 /// TODO:
758 /// </summary>
759 /// <param name="rdata"></param>
760 public void UnCombineRegion(RegionData rdata)
761 {
762 lock (m_regions)
763 {
764 if (m_regions.ContainsKey(rdata.RegionId))
765 {
766 // uncombine root region and virtual regions
767 }
768 else
769 {
770 foreach (RegionConnections r in m_regions.Values)
771 {
772 foreach (RegionData rd in r.ConnectedRegions)
773 {
774 if (rd.RegionId == rdata.RegionId)
775 {
776 // uncombine virtual region
777 }
778 }
779 }
780 }
781 }
782 }
783
784 // Create a set of infinite borders around the whole aabb of the combined island.
785 private void AdjustLargeRegionBounds()
786 {
787 lock (m_regions)
788 {
789 foreach (RegionConnections rconn in m_regions.Values)
790 {
791 Vector3 offset = Vector3.Zero;
792 rconn.RegionScene.BordersLocked = true;
793 foreach (RegionData rdata in rconn.ConnectedRegions)
794 {
795 if (rdata.Offset.X > offset.X) offset.X = rdata.Offset.X;
796 if (rdata.Offset.Y > offset.Y) offset.Y = rdata.Offset.Y;
797 }
798
799 lock (rconn.RegionScene.NorthBorders)
800 {
801 Border northBorder = null;
802 // If we don't already have an infinite border, create one.
803 if (!TryGetInfiniteBorder(rconn.RegionScene.NorthBorders, out northBorder))
804 {
805 northBorder = new Border();
806 rconn.RegionScene.NorthBorders.Add(northBorder);
807 }
808
809 northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue,
810 offset.Y + (int) Constants.RegionSize); //<---
811 northBorder.CrossDirection = Cardinals.N;
812 }
813
814 lock (rconn.RegionScene.SouthBorders)
815 {
816 Border southBorder = null;
817 // If we don't already have an infinite border, create one.
818 if (!TryGetInfiniteBorder(rconn.RegionScene.SouthBorders, out southBorder))
819 {
820 southBorder = new Border();
821 rconn.RegionScene.SouthBorders.Add(southBorder);
822 }
823 southBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, 0); //--->
824 southBorder.CrossDirection = Cardinals.S;
825 }
826
827 lock (rconn.RegionScene.EastBorders)
828 {
829 Border eastBorder = null;
830 // If we don't already have an infinite border, create one.
831 if (!TryGetInfiniteBorder(rconn.RegionScene.EastBorders, out eastBorder))
832 {
833 eastBorder = new Border();
834 rconn.RegionScene.EastBorders.Add(eastBorder);
835 }
836 eastBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, offset.X + (int)Constants.RegionSize);
837 //<---
838 eastBorder.CrossDirection = Cardinals.E;
839 }
840
841 lock (rconn.RegionScene.WestBorders)
842 {
843 Border westBorder = null;
844 // If we don't already have an infinite border, create one.
845 if (!TryGetInfiniteBorder(rconn.RegionScene.WestBorders, out westBorder))
846 {
847 westBorder = new Border();
848 rconn.RegionScene.WestBorders.Add(westBorder);
849
850 }
851 westBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, 0); //--->
852 westBorder.CrossDirection = Cardinals.W;
853 }
854
855 rconn.RegionScene.BordersLocked = false;
856 }
857 }
858 }
859
860 /// <summary>
861 /// Try and get an Infinite border out of a listT of borders
862 /// </summary>
863 /// <param name="borders"></param>
864 /// <param name="oborder"></param>
865 /// <returns></returns>
866 public static bool TryGetInfiniteBorder(List<Border> borders, out Border oborder)
867 {
868 // Warning! Should be locked before getting here!
869 foreach (Border b in borders)
870 {
871 if (b.BorderLine.X == float.MinValue && b.BorderLine.Y == float.MaxValue)
872 {
873 oborder = b;
874 return true;
875 }
876 }
877 oborder = null;
878 return false;
879 }
880
881 public RegionData GetRegionFromPosition(Vector3 pPosition)
882 {
883 pPosition = pPosition/(int) Constants.RegionSize;
884 int OffsetX = (int) pPosition.X;
885 int OffsetY = (int) pPosition.Y;
886 foreach (RegionConnections regConn in m_regions.Values)
887 {
888 foreach (RegionData reg in regConn.ConnectedRegions)
889 {
890 if (reg.Offset.X == OffsetX && reg.Offset.Y == OffsetY)
891 return reg;
892 }
893 }
894 return new RegionData();
895 }
896
897 public void ForwardPermissionRequests(RegionConnections BigRegion, Scene VirtualRegion)
898 {
899 if (BigRegion.PermissionModule == null)
900 BigRegion.PermissionModule = new RegionCombinerPermissionModule(BigRegion.RegionScene);
901
902 VirtualRegion.Permissions.OnBypassPermissions += BigRegion.PermissionModule.BypassPermissions;
903 VirtualRegion.Permissions.OnSetBypassPermissions += BigRegion.PermissionModule.SetBypassPermissions;
904 VirtualRegion.Permissions.OnPropagatePermissions += BigRegion.PermissionModule.PropagatePermissions;
905 VirtualRegion.Permissions.OnGenerateClientFlags += BigRegion.PermissionModule.GenerateClientFlags;
906 VirtualRegion.Permissions.OnAbandonParcel += BigRegion.PermissionModule.CanAbandonParcel;
907 VirtualRegion.Permissions.OnReclaimParcel += BigRegion.PermissionModule.CanReclaimParcel;
908 VirtualRegion.Permissions.OnDeedParcel += BigRegion.PermissionModule.CanDeedParcel;
909 VirtualRegion.Permissions.OnDeedObject += BigRegion.PermissionModule.CanDeedObject;
910 VirtualRegion.Permissions.OnIsGod += BigRegion.PermissionModule.IsGod;
911 VirtualRegion.Permissions.OnDuplicateObject += BigRegion.PermissionModule.CanDuplicateObject;
912 VirtualRegion.Permissions.OnDeleteObject += BigRegion.PermissionModule.CanDeleteObject; //MAYBE FULLY IMPLEMENTED
913 VirtualRegion.Permissions.OnEditObject += BigRegion.PermissionModule.CanEditObject; //MAYBE FULLY IMPLEMENTED
914 VirtualRegion.Permissions.OnEditParcel += BigRegion.PermissionModule.CanEditParcel; //MAYBE FULLY IMPLEMENTED
915 VirtualRegion.Permissions.OnInstantMessage += BigRegion.PermissionModule.CanInstantMessage;
916 VirtualRegion.Permissions.OnInventoryTransfer += BigRegion.PermissionModule.CanInventoryTransfer; //NOT YET IMPLEMENTED
917 VirtualRegion.Permissions.OnIssueEstateCommand += BigRegion.PermissionModule.CanIssueEstateCommand; //FULLY IMPLEMENTED
918 VirtualRegion.Permissions.OnMoveObject += BigRegion.PermissionModule.CanMoveObject; //MAYBE FULLY IMPLEMENTED
919 VirtualRegion.Permissions.OnObjectEntry += BigRegion.PermissionModule.CanObjectEntry;
920 VirtualRegion.Permissions.OnReturnObject += BigRegion.PermissionModule.CanReturnObject; //NOT YET IMPLEMENTED
921 VirtualRegion.Permissions.OnRezObject += BigRegion.PermissionModule.CanRezObject; //MAYBE FULLY IMPLEMENTED
922 VirtualRegion.Permissions.OnRunConsoleCommand += BigRegion.PermissionModule.CanRunConsoleCommand;
923 VirtualRegion.Permissions.OnRunScript += BigRegion.PermissionModule.CanRunScript; //NOT YET IMPLEMENTED
924 VirtualRegion.Permissions.OnCompileScript += BigRegion.PermissionModule.CanCompileScript;
925 VirtualRegion.Permissions.OnSellParcel += BigRegion.PermissionModule.CanSellParcel;
926 VirtualRegion.Permissions.OnTakeObject += BigRegion.PermissionModule.CanTakeObject;
927 VirtualRegion.Permissions.OnTakeCopyObject += BigRegion.PermissionModule.CanTakeCopyObject;
928 VirtualRegion.Permissions.OnTerraformLand += BigRegion.PermissionModule.CanTerraformLand;
929 VirtualRegion.Permissions.OnLinkObject += BigRegion.PermissionModule.CanLinkObject; //NOT YET IMPLEMENTED
930 VirtualRegion.Permissions.OnDelinkObject += BigRegion.PermissionModule.CanDelinkObject; //NOT YET IMPLEMENTED
931 VirtualRegion.Permissions.OnBuyLand += BigRegion.PermissionModule.CanBuyLand; //NOT YET IMPLEMENTED
932 VirtualRegion.Permissions.OnViewNotecard += BigRegion.PermissionModule.CanViewNotecard; //NOT YET IMPLEMENTED
933 VirtualRegion.Permissions.OnViewScript += BigRegion.PermissionModule.CanViewScript; //NOT YET IMPLEMENTED
934 VirtualRegion.Permissions.OnEditNotecard += BigRegion.PermissionModule.CanEditNotecard; //NOT YET IMPLEMENTED
935 VirtualRegion.Permissions.OnEditScript += BigRegion.PermissionModule.CanEditScript; //NOT YET IMPLEMENTED
936 VirtualRegion.Permissions.OnCreateObjectInventory += BigRegion.PermissionModule.CanCreateObjectInventory; //NOT IMPLEMENTED HERE
937 VirtualRegion.Permissions.OnEditObjectInventory += BigRegion.PermissionModule.CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED
938 VirtualRegion.Permissions.OnCopyObjectInventory += BigRegion.PermissionModule.CanCopyObjectInventory; //NOT YET IMPLEMENTED
939 VirtualRegion.Permissions.OnDeleteObjectInventory += BigRegion.PermissionModule.CanDeleteObjectInventory; //NOT YET IMPLEMENTED
940 VirtualRegion.Permissions.OnResetScript += BigRegion.PermissionModule.CanResetScript;
941 VirtualRegion.Permissions.OnCreateUserInventory += BigRegion.PermissionModule.CanCreateUserInventory; //NOT YET IMPLEMENTED
942 VirtualRegion.Permissions.OnCopyUserInventory += BigRegion.PermissionModule.CanCopyUserInventory; //NOT YET IMPLEMENTED
943 VirtualRegion.Permissions.OnEditUserInventory += BigRegion.PermissionModule.CanEditUserInventory; //NOT YET IMPLEMENTED
944 VirtualRegion.Permissions.OnDeleteUserInventory += BigRegion.PermissionModule.CanDeleteUserInventory; //NOT YET IMPLEMENTED
945 VirtualRegion.Permissions.OnTeleport += BigRegion.PermissionModule.CanTeleport; //NOT YET IMPLEMENTED
946 VirtualRegion.Permissions.OnUseObjectReturn += BigRegion.PermissionModule.CanUseObjectReturn; //NOT YET IMPLEMENTED
947 }
948
949 #region console commands
950 public void FixPhantoms(string module, string[] cmdparams)
951 {
952 List<Scene> scenes = new List<Scene>(m_startingScenes.Values);
953 foreach (Scene s in scenes)
954 {
955 s.ForEachSOG(delegate(SceneObjectGroup e)
956 {
957 e.AbsolutePosition = e.AbsolutePosition;
958 }
959 );
960 }
961 }
962 #endregion
963 }
964}
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs
new file mode 100644
index 0000000..76ca5e3
--- /dev/null
+++ b/OpenSim/Region/RegionCombinerModule/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/RegionCombinerModule/RegionConnections.cs b/OpenSim/Region/RegionCombinerModule/RegionConnections.cs
new file mode 100644
index 0000000..419ed74
--- /dev/null
+++ b/OpenSim/Region/RegionCombinerModule/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/RegionCombinerModule/RegionCourseLocation.cs b/OpenSim/Region/RegionCombinerModule/RegionCourseLocation.cs
new file mode 100644
index 0000000..175ca89
--- /dev/null
+++ b/OpenSim/Region/RegionCombinerModule/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/RegionCombinerModule/RegionData.cs b/OpenSim/Region/RegionCombinerModule/RegionData.cs
new file mode 100644
index 0000000..3383527
--- /dev/null
+++ b/OpenSim/Region/RegionCombinerModule/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/RegionCombinerModule/Resources/RegionCombinerModule.addin.xml b/OpenSim/Region/RegionCombinerModule/Resources/RegionCombinerModule.addin.xml
new file mode 100644
index 0000000..8e447d4
--- /dev/null
+++ b/OpenSim/Region/RegionCombinerModule/Resources/RegionCombinerModule.addin.xml
@@ -0,0 +1,13 @@
1<Addin id="OpenSim.Region.CoreModules" version="0.3">
2 <Runtime>
3 <Import assembly="OpenSim.Region.RegionCombinerModule.dll"/>
4 </Runtime>
5
6 <Dependencies>
7 <Addin id="OpenSim" version="0.5" />
8 </Dependencies>
9
10 <Extension path = "/OpenSim/RegionModules">
11 <RegionModule id="RegionCombinerModule" type="OpenSim.Region.CoreModules.World.Land.RegionCombinerModule" />
12 </Extension>
13</Addin>