aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules
diff options
context:
space:
mode:
authorDiva Canto2015-09-04 15:12:36 -0700
committerDiva Canto2015-09-04 15:12:36 -0700
commitf9a7099abcc8bb2da81dc514adbe7803b14fcd6f (patch)
treead29c37adba37526a768696673e67126ab02ded8 /OpenSim/Region/OptionalModules
parentDeleted OpenSim.Framework.Communications. Moved its two remaining files to Op... (diff)
downloadopensim-SC_OLD-f9a7099abcc8bb2da81dc514adbe7803b14fcd6f.zip
opensim-SC_OLD-f9a7099abcc8bb2da81dc514adbe7803b14fcd6f.tar.gz
opensim-SC_OLD-f9a7099abcc8bb2da81dc514adbe7803b14fcd6f.tar.bz2
opensim-SC_OLD-f9a7099abcc8bb2da81dc514adbe7803b14fcd6f.tar.xz
Moved RegionCombinerModule to OptionalModules. Removed it as its own top-level project/dll.
Diffstat (limited to 'OpenSim/Region/OptionalModules')
-rw-r--r--OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerClientEventForwarder.cs94
-rw-r--r--OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs139
-rw-r--r--OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerLargeLandChannel.cs201
-rw-r--r--OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerModule.cs878
-rw-r--r--OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerPermissionModule.cs270
-rw-r--r--OpenSim/Region/OptionalModules/RegionCombinerModule/RegionConnections.cs94
-rw-r--r--OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCourseLocation.cs43
-rw-r--r--OpenSim/Region/OptionalModules/RegionCombinerModule/RegionData.cs40
8 files changed, 1759 insertions, 0 deletions
diff --git a/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerClientEventForwarder.cs b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerClientEventForwarder.cs
new file mode 100644
index 0000000..721d396
--- /dev/null
+++ b/OpenSim/Region/OptionalModules/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.RegionCombinerModule
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/OptionalModules/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs
new file mode 100644
index 0000000..83732e2
--- /dev/null
+++ b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs
@@ -0,0 +1,139 @@
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.CoreModules.Avatar.Attachments;
32using OpenSim.Region.CoreModules.Avatar.Gods;
33using OpenSim.Region.Framework.Interfaces;
34using OpenSim.Region.Framework.Scenes;
35
36namespace OpenSim.Region.RegionCombinerModule
37{
38 public class RegionCombinerIndividualEventForwarder
39 {
40 private Scene m_rootScene;
41 private Scene m_virtScene;
42
43 public RegionCombinerIndividualEventForwarder(Scene rootScene, Scene virtScene)
44 {
45 m_rootScene = rootScene;
46 m_virtScene = virtScene;
47 }
48
49 public void ClientConnect(IClientAPI client)
50 {
51 m_virtScene.UnSubscribeToClientPrimEvents(client);
52 m_virtScene.UnSubscribeToClientPrimRezEvents(client);
53 m_virtScene.UnSubscribeToClientInventoryEvents(client);
54 if(m_virtScene.AttachmentsModule != null)
55 ((AttachmentsModule)m_virtScene.AttachmentsModule).UnsubscribeFromClientEvents(client);
56 //m_virtScene.UnSubscribeToClientTeleportEvents(client);
57 m_virtScene.UnSubscribeToClientScriptEvents(client);
58
59 IGodsModule virtGodsModule = m_virtScene.RequestModuleInterface<IGodsModule>();
60 if (virtGodsModule != null)
61 ((GodsModule)virtGodsModule).UnsubscribeFromClientEvents(client);
62
63 m_virtScene.UnSubscribeToClientNetworkEvents(client);
64
65 m_rootScene.SubscribeToClientPrimEvents(client);
66 client.OnAddPrim += LocalAddNewPrim;
67 client.OnRezObject += LocalRezObject;
68
69 m_rootScene.SubscribeToClientInventoryEvents(client);
70 if (m_rootScene.AttachmentsModule != null)
71 ((AttachmentsModule)m_rootScene.AttachmentsModule).SubscribeToClientEvents(client);
72 //m_rootScene.SubscribeToClientTeleportEvents(client);
73 m_rootScene.SubscribeToClientScriptEvents(client);
74
75 IGodsModule rootGodsModule = m_virtScene.RequestModuleInterface<IGodsModule>();
76 if (rootGodsModule != null)
77 ((GodsModule)rootGodsModule).UnsubscribeFromClientEvents(client);
78
79 m_rootScene.SubscribeToClientNetworkEvents(client);
80 }
81
82 public void ClientClosed(UUID clientid, Scene scene)
83 {
84 }
85
86 /// <summary>
87 /// Fixes position based on the region the Rez event came in on
88 /// </summary>
89 /// <param name="remoteclient"></param>
90 /// <param name="itemid"></param>
91 /// <param name="rayend"></param>
92 /// <param name="raystart"></param>
93 /// <param name="raytargetid"></param>
94 /// <param name="bypassraycast"></param>
95 /// <param name="rayendisintersection"></param>
96 /// <param name="rezselected"></param>
97 /// <param name="removeitem"></param>
98 /// <param name="fromtaskid"></param>
99 private void LocalRezObject(IClientAPI remoteclient, UUID itemid, Vector3 rayend, Vector3 raystart,
100 UUID raytargetid, byte bypassraycast, bool rayendisintersection, bool rezselected, bool removeitem,
101 UUID fromtaskid)
102 {
103 int differenceX = (int)m_virtScene.RegionInfo.RegionLocX - (int)m_rootScene.RegionInfo.RegionLocX;
104 int differenceY = (int)m_virtScene.RegionInfo.RegionLocY - (int)m_rootScene.RegionInfo.RegionLocY;
105 rayend.X += differenceX * (int)Constants.RegionSize;
106 rayend.Y += differenceY * (int)Constants.RegionSize;
107 raystart.X += differenceX * (int)Constants.RegionSize;
108 raystart.Y += differenceY * (int)Constants.RegionSize;
109
110 m_rootScene.RezObject(remoteclient, itemid, rayend, raystart, raytargetid, bypassraycast,
111 rayendisintersection, rezselected, removeitem, fromtaskid);
112 }
113 /// <summary>
114 /// Fixes position based on the region the AddPrimShape event came in on
115 /// </summary>
116 /// <param name="ownerid"></param>
117 /// <param name="groupid"></param>
118 /// <param name="rayend"></param>
119 /// <param name="rot"></param>
120 /// <param name="shape"></param>
121 /// <param name="bypassraycast"></param>
122 /// <param name="raystart"></param>
123 /// <param name="raytargetid"></param>
124 /// <param name="rayendisintersection"></param>
125 private void LocalAddNewPrim(UUID ownerid, UUID groupid, Vector3 rayend, Quaternion rot,
126 PrimitiveBaseShape shape, byte bypassraycast, Vector3 raystart, UUID raytargetid,
127 byte rayendisintersection)
128 {
129 int differenceX = (int)m_virtScene.RegionInfo.RegionLocX - (int)m_rootScene.RegionInfo.RegionLocX;
130 int differenceY = (int)m_virtScene.RegionInfo.RegionLocY - (int)m_rootScene.RegionInfo.RegionLocY;
131 rayend.X += differenceX * (int)Constants.RegionSize;
132 rayend.Y += differenceY * (int)Constants.RegionSize;
133 raystart.X += differenceX * (int)Constants.RegionSize;
134 raystart.Y += differenceY * (int)Constants.RegionSize;
135 m_rootScene.AddNewPrim(ownerid, groupid, rayend, rot, shape, bypassraycast, raystart, raytargetid,
136 rayendisintersection);
137 }
138 }
139} \ No newline at end of file
diff --git a/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerLargeLandChannel.cs b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerLargeLandChannel.cs
new file mode 100644
index 0000000..4bf2a82
--- /dev/null
+++ b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerLargeLandChannel.cs
@@ -0,0 +1,201 @@
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 OpenMetaverse;
33using OpenSim.Framework;
34using OpenSim.Region.Framework.Interfaces;
35using OpenSim.Region.CoreModules.World.Land;
36
37namespace OpenSim.Region.RegionCombinerModule
38{
39 public class RegionCombinerLargeLandChannel : ILandChannel
40 {
41// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42
43 private RegionData RegData;
44 private ILandChannel RootRegionLandChannel;
45 private readonly List<RegionData> RegionConnections;
46
47 #region ILandChannel Members
48
49 public RegionCombinerLargeLandChannel(RegionData regData, ILandChannel rootRegionLandChannel,
50 List<RegionData> regionConnections)
51 {
52 RegData = regData;
53 RootRegionLandChannel = rootRegionLandChannel;
54 RegionConnections = regionConnections;
55 }
56
57 public List<ILandObject> ParcelsNearPoint(Vector3 position)
58 {
59 //m_log.DebugFormat("[LANDPARCELNEARPOINT]: {0}>", position);
60 return RootRegionLandChannel.ParcelsNearPoint(position - RegData.Offset);
61 }
62
63 public List<ILandObject> AllParcels()
64 {
65 return RootRegionLandChannel.AllParcels();
66 }
67
68 public void Clear(bool setupDefaultParcel)
69 {
70 RootRegionLandChannel.Clear(setupDefaultParcel);
71 }
72
73 public ILandObject GetLandObject(Vector3 position)
74 {
75 return GetLandObject(position.X, position.Y);
76 }
77
78 public ILandObject GetLandObject(int x, int y)
79 {
80 return GetLandObject((float)x, (float)y);
81
82// m_log.DebugFormat("[BIGLANDTESTINT]: <{0},{1}>", x, y);
83//
84// if (x > 0 && x <= (int)Constants.RegionSize && y > 0 && y <= (int)Constants.RegionSize)
85// {
86// return RootRegionLandChannel.GetLandObject(x, y);
87// }
88// else
89// {
90// int offsetX = (x / (int)Constants.RegionSize);
91// int offsetY = (y / (int)Constants.RegionSize);
92// offsetX *= (int)Constants.RegionSize;
93// offsetY *= (int)Constants.RegionSize;
94//
95// foreach (RegionData regionData in RegionConnections)
96// {
97// if (regionData.Offset.X == offsetX && regionData.Offset.Y == offsetY)
98// {
99// m_log.DebugFormat(
100// "[REGION COMBINER LARGE LAND CHANNEL]: Found region {0} at offset {1},{2}",
101// regionData.RegionScene.Name, offsetX, offsetY);
102//
103// return regionData.RegionScene.LandChannel.GetLandObject(x - offsetX, y - offsetY);
104// }
105// }
106// //ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene);
107// //obj.LandData.Name = "NO LAND";
108// //return obj;
109// }
110//
111// m_log.DebugFormat("[REGION COMBINER LARGE LAND CHANNEL]: No region found at {0},{1}, returning null", x, y);
112//
113// return null;
114 }
115
116 public ILandObject GetLandObject(int localID)
117 {
118 // XXX: Possibly should be looking in every land channel, not just the root.
119 return RootRegionLandChannel.GetLandObject(localID);
120 }
121
122 public ILandObject GetLandObject(float x, float y)
123 {
124// m_log.DebugFormat("[BIGLANDTESTFLOAT]: <{0},{1}>", x, y);
125
126 if (x > 0 && x <= (int)Constants.RegionSize && y > 0 && y <= (int)Constants.RegionSize)
127 {
128 return RootRegionLandChannel.GetLandObject(x, y);
129 }
130 else
131 {
132 int offsetX = (int)(x/(int) Constants.RegionSize);
133 int offsetY = (int)(y/(int) Constants.RegionSize);
134 offsetX *= (int) Constants.RegionSize;
135 offsetY *= (int) Constants.RegionSize;
136
137 foreach (RegionData regionData in RegionConnections)
138 {
139 if (regionData.Offset.X == offsetX && regionData.Offset.Y == offsetY)
140 {
141// m_log.DebugFormat(
142// "[REGION COMBINER LARGE LAND CHANNEL]: Found region {0} at offset {1},{2}",
143// regionData.RegionScene.Name, offsetX, offsetY);
144
145 return regionData.RegionScene.LandChannel.GetLandObject(x - offsetX, y - offsetY);
146 }
147 }
148
149// ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene);
150// obj.LandData.Name = "NO LAND";
151// return obj;
152 }
153
154// m_log.DebugFormat("[REGION COMBINER LARGE LAND CHANNEL]: No region found at {0},{1}, returning null", x, y);
155
156 return null;
157 }
158
159 public bool IsForcefulBansAllowed()
160 {
161 return RootRegionLandChannel.IsForcefulBansAllowed();
162 }
163
164 public void UpdateLandObject(int localID, LandData data)
165 {
166 RootRegionLandChannel.UpdateLandObject(localID, data);
167 }
168
169 public void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id)
170 {
171 RootRegionLandChannel.Join(start_x, start_y, end_x, end_y, attempting_user_id);
172 }
173
174 public void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id)
175 {
176 RootRegionLandChannel.Subdivide(start_x, start_y, end_x, end_y, attempting_user_id);
177 }
178
179 public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient)
180 {
181 RootRegionLandChannel.ReturnObjectsInParcel(localID, returnType, agentIDs, taskIDs, remoteClient);
182 }
183
184 public void setParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel)
185 {
186 RootRegionLandChannel.setParcelObjectMaxOverride(overrideDel);
187 }
188
189 public void setSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel)
190 {
191 RootRegionLandChannel.setSimulatorObjectMaxOverride(overrideDel);
192 }
193
194 public void SetParcelOtherCleanTime(IClientAPI remoteClient, int localID, int otherCleanTime)
195 {
196 RootRegionLandChannel.SetParcelOtherCleanTime(remoteClient, localID, otherCleanTime);
197 }
198
199 #endregion
200 }
201} \ No newline at end of file
diff --git a/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerModule.cs
new file mode 100644
index 0000000..98b0ae1
--- /dev/null
+++ b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerModule.cs
@@ -0,0 +1,878 @@
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.PhysicsModules.SharedBase;
40using Mono.Addins;
41
42namespace OpenSim.Region.RegionCombinerModule
43{
44 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RegionCombinerModule")]
45 public class RegionCombinerModule : ISharedRegionModule, IRegionCombinerModule
46 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48// private static string LogHeader = "[REGION COMBINER MODULE]";
49
50 public string Name
51 {
52 get { return "RegionCombinerModule"; }
53 }
54
55 public Type ReplaceableInterface
56 {
57 get { return null; }
58 }
59
60 /// <summary>
61 /// Is this module enabled?
62 /// </summary>
63 private bool m_combineContiguousRegions = false;
64
65 /// <summary>
66 /// This holds the root regions for the megaregions.
67 /// </summary>
68 /// <remarks>
69 /// Usually there is only ever one megaregion (and hence only one entry here).
70 /// </remarks>
71 private Dictionary<UUID, RegionConnections> m_regions = new Dictionary<UUID, RegionConnections>();
72
73 /// <summary>
74 /// The scenes that comprise the megaregion.
75 /// </summary>
76 private Dictionary<UUID, Scene> m_startingScenes = new Dictionary<UUID, Scene>();
77
78 public void Initialise(IConfigSource source)
79 {
80 IConfig myConfig = source.Configs["Startup"];
81 m_combineContiguousRegions = myConfig.GetBoolean("CombineContiguousRegions", false);
82
83 MainConsole.Instance.Commands.AddCommand(
84 "RegionCombinerModule", false, "fix-phantoms", "fix-phantoms",
85 "Fixes phantom objects after an import to a megaregion or a change from a megaregion back to normal regions",
86 FixPhantoms);
87 }
88
89 public void Close()
90 {
91 }
92
93 public void AddRegion(Scene scene)
94 {
95 if (m_combineContiguousRegions)
96 scene.RegisterModuleInterface<IRegionCombinerModule>(this);
97 }
98
99 public void RemoveRegion(Scene scene)
100 {
101 lock (m_startingScenes)
102 m_startingScenes.Remove(scene.RegionInfo.originRegionID);
103 }
104
105 public void RegionLoaded(Scene scene)
106 {
107 lock (m_startingScenes)
108 m_startingScenes.Add(scene.RegionInfo.originRegionID, scene);
109
110 if (m_combineContiguousRegions)
111 {
112 RegionLoadedDoWork(scene);
113
114 scene.EventManager.OnNewPresence += NewPresence;
115 }
116 }
117
118 public bool IsRootForMegaregion(UUID regionId)
119 {
120 lock (m_regions)
121 return m_regions.ContainsKey(regionId);
122 }
123
124 public Vector2 GetSizeOfMegaregion(UUID regionId)
125 {
126 lock (m_regions)
127 {
128 if (m_regions.ContainsKey(regionId))
129 {
130 RegionConnections rootConn = m_regions[regionId];
131
132 return new Vector2((float)rootConn.XEnd, (float)rootConn.YEnd);
133 }
134 }
135
136 throw new Exception(string.Format("Region with id {0} not found", regionId));
137 }
138
139 // Test to see if this postiion (relative to the region) is within the area covered
140 // by this megaregion.
141 public bool PositionIsInMegaregion(UUID currentRegion, int xx, int yy)
142 {
143 bool ret = false;
144 if (xx < 0 || yy < 0)
145 return ret;
146
147 foreach (RegionConnections rootRegion in m_regions.Values)
148 {
149 if (currentRegion == rootRegion.RegionId)
150 {
151 // The caller is in the root region so this is an easy test
152 if (xx < rootRegion.XEnd && yy < rootRegion.YEnd)
153 {
154 ret = true;
155 }
156 break;
157 }
158 else
159 {
160 // Maybe the caller is in one of the sub-regions
161 foreach (RegionData childRegion in rootRegion.ConnectedRegions)
162 {
163 if (currentRegion == childRegion.RegionId)
164 {
165 // This is a child. Diddle the offsets and check if in
166 Vector3 positionInMegaregion = childRegion.Offset;
167 positionInMegaregion.X += xx;
168 positionInMegaregion.Y += yy;
169 if (positionInMegaregion.X < rootRegion.XEnd && positionInMegaregion.Y < rootRegion.YEnd)
170 {
171 ret = true;
172 }
173 break;
174 }
175 }
176 }
177 }
178
179 return ret;
180 }
181
182 private void NewPresence(ScenePresence presence)
183 {
184 if (presence.IsChildAgent)
185 {
186 byte[] throttleData;
187
188 try
189 {
190 throttleData = presence.ControllingClient.GetThrottlesPacked(1);
191 }
192 catch (NotImplementedException)
193 {
194 return;
195 }
196
197 if (throttleData == null)
198 return;
199
200 if (throttleData.Length == 0)
201 return;
202
203 if (throttleData.Length != 28)
204 return;
205
206 byte[] adjData;
207 int pos = 0;
208
209 if (!BitConverter.IsLittleEndian)
210 {
211 byte[] newData = new byte[7 * 4];
212 Buffer.BlockCopy(throttleData, 0, newData, 0, 7 * 4);
213
214 for (int i = 0; i < 7; i++)
215 Array.Reverse(newData, i * 4, 4);
216
217 adjData = newData;
218 }
219 else
220 {
221 adjData = throttleData;
222 }
223
224 // 0.125f converts from bits to bytes
225 int resend = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
226 int land = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
227 int wind = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
228 int cloud = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
229 int task = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
230 int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
231 int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f);
232 // State is a subcategory of task that we allocate a percentage to
233
234
235 //int total = resend + land + wind + cloud + task + texture + asset;
236
237 byte[] data = new byte[7 * 4];
238 int ii = 0;
239
240 Buffer.BlockCopy(Utils.FloatToBytes(resend), 0, data, ii, 4); ii += 4;
241 Buffer.BlockCopy(Utils.FloatToBytes(land * 50), 0, data, ii, 4); ii += 4;
242 Buffer.BlockCopy(Utils.FloatToBytes(wind), 0, data, ii, 4); ii += 4;
243 Buffer.BlockCopy(Utils.FloatToBytes(cloud), 0, data, ii, 4); ii += 4;
244 Buffer.BlockCopy(Utils.FloatToBytes(task), 0, data, ii, 4); ii += 4;
245 Buffer.BlockCopy(Utils.FloatToBytes(texture), 0, data, ii, 4); ii += 4;
246 Buffer.BlockCopy(Utils.FloatToBytes(asset), 0, data, ii, 4);
247
248 try
249 {
250 presence.ControllingClient.SetChildAgentThrottle(data);
251 }
252 catch (NotImplementedException)
253 {
254 return;
255 }
256 }
257 }
258
259 private void RegionLoadedDoWork(Scene scene)
260 {
261/*
262 // For testing on a single instance
263 if (scene.RegionInfo.RegionLocX == 1004 && scene.RegionInfo.RegionLocY == 1000)
264 return;
265 //
266*/
267
268 RegionConnections newConn = new RegionConnections();
269 newConn.ConnectedRegions = new List<RegionData>();
270 newConn.RegionScene = scene;
271 newConn.RegionLandChannel = scene.LandChannel;
272 newConn.RegionId = scene.RegionInfo.originRegionID;
273 newConn.X = scene.RegionInfo.RegionLocX;
274 newConn.Y = scene.RegionInfo.RegionLocY;
275 newConn.XEnd = scene.RegionInfo.RegionSizeX;
276 newConn.YEnd = scene.RegionInfo.RegionSizeX;
277
278 lock (m_regions)
279 {
280 bool connectedYN = false;
281
282 foreach (RegionConnections rootConn in m_regions.Values)
283 {
284 #region commented
285 /*
286 // If we're one region over +x +y
287 //xxy
288 //xxx
289 //xxx
290 if ((((int)conn.X * (int)Constants.RegionSize) + conn.XEnd
291 == (regionConnections.X * (int)Constants.RegionSize))
292 && (((int)conn.Y * (int)Constants.RegionSize) - conn.YEnd
293 == (regionConnections.Y * (int)Constants.RegionSize)))
294 {
295 Vector3 offset = Vector3.Zero;
296 offset.X = (((regionConnections.X * (int) Constants.RegionSize)) -
297 ((conn.X * (int) Constants.RegionSize)));
298 offset.Y = (((regionConnections.Y * (int) Constants.RegionSize)) -
299 ((conn.Y * (int) Constants.RegionSize)));
300
301 Vector3 extents = Vector3.Zero;
302 extents.Y = regionConnections.YEnd + conn.YEnd;
303 extents.X = conn.XEnd + conn.XEnd;
304
305 m_log.DebugFormat("Scene: {0} to the northwest of Scene{1}. Offset: {2}. Extents:{3}",
306 conn.RegionScene.RegionInfo.RegionName,
307 regionConnections.RegionScene.RegionInfo.RegionName,
308 offset, extents);
309
310 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
311
312 connectedYN = true;
313 break;
314 }
315 */
316
317 /*
318 //If we're one region over x +y
319 //xxx
320 //xxx
321 //xyx
322 if ((((int)conn.X * (int)Constants.RegionSize)
323 == (regionConnections.X * (int)Constants.RegionSize))
324 && (((int)conn.Y * (int)Constants.RegionSize) - conn.YEnd
325 == (regionConnections.Y * (int)Constants.RegionSize)))
326 {
327 Vector3 offset = Vector3.Zero;
328 offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
329 ((conn.X * (int)Constants.RegionSize)));
330 offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
331 ((conn.Y * (int)Constants.RegionSize)));
332
333 Vector3 extents = Vector3.Zero;
334 extents.Y = regionConnections.YEnd + conn.YEnd;
335 extents.X = conn.XEnd;
336
337 m_log.DebugFormat("Scene: {0} to the north of Scene{1}. Offset: {2}. Extents:{3}",
338 conn.RegionScene.RegionInfo.RegionName,
339 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
340
341 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
342 connectedYN = true;
343 break;
344 }
345 */
346
347 /*
348 // If we're one region over -x +y
349 //xxx
350 //xxx
351 //yxx
352 if ((((int)conn.X * (int)Constants.RegionSize) - conn.XEnd
353 == (regionConnections.X * (int)Constants.RegionSize))
354 && (((int)conn.Y * (int)Constants.RegionSize) - conn.YEnd
355 == (regionConnections.Y * (int)Constants.RegionSize)))
356 {
357 Vector3 offset = Vector3.Zero;
358 offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
359 ((conn.X * (int)Constants.RegionSize)));
360 offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
361 ((conn.Y * (int)Constants.RegionSize)));
362
363 Vector3 extents = Vector3.Zero;
364 extents.Y = regionConnections.YEnd + conn.YEnd;
365 extents.X = conn.XEnd + conn.XEnd;
366
367 m_log.DebugFormat("Scene: {0} to the northeast of Scene. Offset: {2}. Extents:{3}",
368 conn.RegionScene.RegionInfo.RegionName,
369 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
370
371 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
372
373
374 connectedYN = true;
375 break;
376 }
377 */
378
379 /*
380 // If we're one region over -x y
381 //xxx
382 //yxx
383 //xxx
384 if ((((int)conn.X * (int)Constants.RegionSize) - conn.XEnd
385 == (regionConnections.X * (int)Constants.RegionSize))
386 && (((int)conn.Y * (int)Constants.RegionSize)
387 == (regionConnections.Y * (int)Constants.RegionSize)))
388 {
389 Vector3 offset = Vector3.Zero;
390 offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
391 ((conn.X * (int)Constants.RegionSize)));
392 offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
393 ((conn.Y * (int)Constants.RegionSize)));
394
395 Vector3 extents = Vector3.Zero;
396 extents.Y = regionConnections.YEnd;
397 extents.X = conn.XEnd + conn.XEnd;
398
399 m_log.DebugFormat("Scene: {0} to the east of Scene{1} Offset: {2}. Extents:{3}",
400 conn.RegionScene.RegionInfo.RegionName,
401 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
402
403 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
404
405 connectedYN = true;
406 break;
407 }
408 */
409
410 /*
411 // If we're one region over -x -y
412 //yxx
413 //xxx
414 //xxx
415 if ((((int)conn.X * (int)Constants.RegionSize) - conn.XEnd
416 == (regionConnections.X * (int)Constants.RegionSize))
417 && (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd
418 == (regionConnections.Y * (int)Constants.RegionSize)))
419 {
420 Vector3 offset = Vector3.Zero;
421 offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
422 ((conn.X * (int)Constants.RegionSize)));
423 offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
424 ((conn.Y * (int)Constants.RegionSize)));
425
426 Vector3 extents = Vector3.Zero;
427 extents.Y = regionConnections.YEnd + conn.YEnd;
428 extents.X = conn.XEnd + conn.XEnd;
429
430 m_log.DebugFormat("Scene: {0} to the northeast of Scene{1} Offset: {2}. Extents:{3}",
431 conn.RegionScene.RegionInfo.RegionName,
432 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
433
434 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
435
436 connectedYN = true;
437 break;
438 }
439 */
440 #endregion
441
442
443 // Check to see if this new region is adjacent to the root region.
444 // Note that we expect the regions to be combined from the root region outward
445 // thus the requirement for the ordering in the configuration files.
446
447 // If we're one region over +x y (i.e. root region is to the west)
448 //xxx
449 //xxy
450 //xxx
451 if (rootConn.PosX + rootConn.XEnd >= newConn.PosX && rootConn.PosY >= newConn.PosY)
452 {
453 connectedYN = DoWorkForOneRegionOverPlusXY(rootConn, newConn, scene);
454 break;
455 }
456
457 // If we're one region over x +y (i.e. root region is to the south)
458 //xyx
459 //xxx
460 //xxx
461 if (rootConn.PosX >= newConn.PosX && rootConn.PosY + rootConn.YEnd >= newConn.PosY)
462 {
463 connectedYN = DoWorkForOneRegionOverPlusXY(rootConn, newConn, scene);
464 break;
465 }
466
467 // If we're one region over +x +y (i.e. root region is to the south-west)
468 //xxy
469 //xxx
470 //xxx
471 if (rootConn.PosX + rootConn.XEnd >= newConn.PosX && rootConn.PosY + rootConn.YEnd >= newConn.PosY)
472 {
473 connectedYN = DoWorkForOneRegionOverPlusXY(rootConn, newConn, scene);
474 break;
475 }
476 }
477
478 // If !connectYN means that this region is a root region
479 if (!connectedYN)
480 {
481 DoWorkForRootRegion(newConn, scene);
482 }
483 }
484 }
485
486 private bool DoWorkForOneRegionOverPlusXY(RegionConnections rootConn, RegionConnections newConn, Scene scene)
487 {
488 // Offset (in meters) from the base of this region to the base of the root region.
489 Vector3 offset = Vector3.Zero;
490 offset.X = newConn.PosX - rootConn.PosX;
491 offset.Y = newConn.PosY - rootConn.PosY;
492
493 // The new total size of the region (in meters)
494 // We just extend the X and Y dimensions so the extent might temporarily include areas without regions.
495 Vector3 extents = Vector3.Zero;
496 extents.X = Math.Max(rootConn.XEnd, offset.X + newConn.RegionScene.RegionInfo.RegionSizeX);
497 extents.Y = Math.Max(rootConn.YEnd, offset.Y + newConn.RegionScene.RegionInfo.RegionSizeY);
498
499 rootConn.UpdateExtents(extents);
500
501 m_log.DebugFormat(
502 "[REGION COMBINER MODULE]: Root region {0} is to the west of region {1}, Offset: {2}, Extents: {3}",
503 rootConn.RegionScene.RegionInfo.RegionName,
504 newConn.RegionScene.RegionInfo.RegionName, offset, extents);
505
506 RegionData ConnectedRegion = new RegionData();
507 ConnectedRegion.Offset = offset;
508 ConnectedRegion.RegionId = scene.RegionInfo.originRegionID;
509 ConnectedRegion.RegionScene = scene;
510 rootConn.ConnectedRegions.Add(ConnectedRegion);
511
512 // Inform root region Physics about the extents of this region
513 rootConn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
514
515 // Inform Child region that it needs to forward it's terrain to the root region
516 scene.PhysicsScene.Combine(rootConn.RegionScene.PhysicsScene, offset, Vector3.Zero);
517
518 // Reset Terrain.. since terrain loads before we get here, we need to load
519 // it again so it loads in the root region
520 scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
521
522 // Create a client event forwarder and add this region's events to the root region.
523 if (rootConn.ClientEventForwarder != null)
524 rootConn.ClientEventForwarder.AddSceneToEventForwarding(scene);
525
526 return true;
527 }
528
529 /*
530 * 20140215 radams1: The border stuff was removed and the addition of regions to the mega-regions
531 * was generalized. These functions are not needed for the generalized solution but left for reference.
532 private bool DoWorkForOneRegionOverXPlusY(RegionConnections rootConn, RegionConnections newConn, Scene scene)
533 {
534 Vector3 offset = Vector3.Zero;
535 offset.X = newConn.PosX - rootConn.PosX;
536 offset.Y = newConn.PosY - rootConn.PosY;
537
538 Vector3 extents = Vector3.Zero;
539 extents.Y = newConn.YEnd + rootConn.YEnd;
540 extents.X = rootConn.XEnd;
541 rootConn.UpdateExtents(extents);
542
543 RegionData ConnectedRegion = new RegionData();
544 ConnectedRegion.Offset = offset;
545 ConnectedRegion.RegionId = scene.RegionInfo.originRegionID;
546 ConnectedRegion.RegionScene = scene;
547 rootConn.ConnectedRegions.Add(ConnectedRegion);
548
549 m_log.DebugFormat(
550 "[REGION COMBINER MODULE]: Root region {0} is to the south of region {1}, Offset: {2}, Extents: {3}",
551 rootConn.RegionScene.RegionInfo.RegionName,
552 newConn.RegionScene.RegionInfo.RegionName, offset, extents);
553
554 rootConn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
555 scene.PhysicsScene.Combine(rootConn.RegionScene.PhysicsScene, offset, Vector3.Zero);
556
557 // Reset Terrain.. since terrain normally loads first.
558 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
559 scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
560 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
561
562 if (rootConn.ClientEventForwarder != null)
563 rootConn.ClientEventForwarder.AddSceneToEventForwarding(scene);
564
565 return true;
566 }
567
568 private bool DoWorkForOneRegionOverPlusXPlusY(RegionConnections rootConn, RegionConnections newConn, Scene scene)
569 {
570 Vector3 offset = Vector3.Zero;
571 offset.X = newConn.PosX - rootConn.PosX;
572 offset.Y = newConn.PosY - rootConn.PosY;
573
574 Vector3 extents = Vector3.Zero;
575
576 // We do not want to inflate the extents for regions strictly to the NE of the root region, since this
577 // would double count regions strictly to the north and east that have already been added.
578// extents.Y = regionConnections.YEnd + conn.YEnd;
579// extents.X = regionConnections.XEnd + conn.XEnd;
580// conn.UpdateExtents(extents);
581
582 extents.Y = rootConn.YEnd;
583 extents.X = rootConn.XEnd;
584
585 RegionData ConnectedRegion = new RegionData();
586 ConnectedRegion.Offset = offset;
587 ConnectedRegion.RegionId = scene.RegionInfo.originRegionID;
588 ConnectedRegion.RegionScene = scene;
589
590 rootConn.ConnectedRegions.Add(ConnectedRegion);
591
592 m_log.DebugFormat(
593 "[REGION COMBINER MODULE]: Region {0} is to the southwest of Scene {1}, Offset: {2}, Extents: {3}",
594 rootConn.RegionScene.RegionInfo.RegionName,
595 newConn.RegionScene.RegionInfo.RegionName, offset, extents);
596
597 rootConn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
598 scene.PhysicsScene.Combine(rootConn.RegionScene.PhysicsScene, offset, Vector3.Zero);
599
600 // Reset Terrain.. since terrain normally loads first.
601 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
602 scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
603 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
604
605 if (rootConn.ClientEventForwarder != null)
606 rootConn.ClientEventForwarder.AddSceneToEventForwarding(scene);
607
608 return true;
609
610 //scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset,extents);
611 }
612 */
613
614 private void DoWorkForRootRegion(RegionConnections rootConn, Scene scene)
615 {
616 m_log.DebugFormat("[REGION COMBINER MODULE]: Adding root region {0}", scene.RegionInfo.RegionName);
617
618 RegionData rdata = new RegionData();
619 rdata.Offset = Vector3.Zero;
620 rdata.RegionId = scene.RegionInfo.originRegionID;
621 rdata.RegionScene = scene;
622 // save it's land channel
623 rootConn.RegionLandChannel = scene.LandChannel;
624
625 // Substitue our landchannel
626 RegionCombinerLargeLandChannel lnd = new RegionCombinerLargeLandChannel(rdata, scene.LandChannel,
627 rootConn.ConnectedRegions);
628
629 scene.LandChannel = lnd;
630
631 // Forward the permissions modules of each of the connected regions to the root region
632 lock (m_regions)
633 {
634 foreach (RegionData r in rootConn.ConnectedRegions)
635 {
636 ForwardPermissionRequests(rootConn, r.RegionScene);
637 }
638
639 // Create the root region's Client Event Forwarder
640 rootConn.ClientEventForwarder = new RegionCombinerClientEventForwarder(rootConn);
641
642 // Sets up the CoarseLocationUpdate forwarder for this root region
643 scene.EventManager.OnNewPresence += SetCoarseLocationDelegate;
644
645 // Adds this root region to a dictionary of regions that are connectable
646 m_regions.Add(scene.RegionInfo.originRegionID, rootConn);
647 }
648 }
649
650 private void SetCoarseLocationDelegate(ScenePresence presence)
651 {
652 presence.SetSendCoarseLocationMethod(SendCoarseLocationUpdates);
653 }
654
655 // This delegate was refactored for non-combined regions.
656 // This combined region version will not use the pre-compiled lists of locations and ids
657 private void SendCoarseLocationUpdates(UUID sceneId, ScenePresence presence, List<Vector3> coarseLocations, List<UUID> avatarUUIDs)
658 {
659 RegionConnections connectiondata = null;
660 lock (m_regions)
661 {
662 if (m_regions.ContainsKey(sceneId))
663 connectiondata = m_regions[sceneId];
664 else
665 return;
666 }
667
668 List<Vector3> CoarseLocations = new List<Vector3>();
669 List<UUID> AvatarUUIDs = new List<UUID>();
670
671 connectiondata.RegionScene.ForEachRootScenePresence(delegate(ScenePresence sp)
672 {
673 if (sp.UUID != presence.UUID)
674 {
675 CoarseLocations.Add(sp.AbsolutePosition);
676 AvatarUUIDs.Add(sp.UUID);
677 }
678 });
679
680 DistributeCoarseLocationUpdates(CoarseLocations, AvatarUUIDs, connectiondata, presence);
681 }
682
683 private void DistributeCoarseLocationUpdates(List<Vector3> locations, List<UUID> uuids,
684 RegionConnections connectiondata, ScenePresence rootPresence)
685 {
686 RegionData[] rdata = connectiondata.ConnectedRegions.ToArray();
687 //List<IClientAPI> clients = new List<IClientAPI>();
688 Dictionary<Vector2, RegionCoarseLocationStruct> updates = new Dictionary<Vector2, RegionCoarseLocationStruct>();
689
690 // Root Region entry
691 RegionCoarseLocationStruct rootupdatedata = new RegionCoarseLocationStruct();
692 rootupdatedata.Locations = new List<Vector3>();
693 rootupdatedata.Uuids = new List<UUID>();
694 rootupdatedata.Offset = Vector2.Zero;
695
696 rootupdatedata.UserAPI = rootPresence.ControllingClient;
697
698 if (rootupdatedata.UserAPI != null)
699 updates.Add(Vector2.Zero, rootupdatedata);
700
701 //Each Region needs an entry or we will end up with dead minimap dots
702 foreach (RegionData regiondata in rdata)
703 {
704 Vector2 offset = new Vector2(regiondata.Offset.X, regiondata.Offset.Y);
705 RegionCoarseLocationStruct updatedata = new RegionCoarseLocationStruct();
706 updatedata.Locations = new List<Vector3>();
707 updatedata.Uuids = new List<UUID>();
708 updatedata.Offset = offset;
709
710 if (offset == Vector2.Zero)
711 updatedata.UserAPI = rootPresence.ControllingClient;
712 else
713 updatedata.UserAPI = LocateUsersChildAgentIClientAPI(offset, rootPresence.UUID, rdata);
714
715 if (updatedata.UserAPI != null)
716 updates.Add(offset, updatedata);
717 }
718
719 // go over the locations and assign them to an IClientAPI
720 for (int i = 0; i < locations.Count; i++)
721 //{locations[i]/(int) Constants.RegionSize;
722 {
723 Vector3 pPosition = new Vector3((int)locations[i].X / (int)Constants.RegionSize,
724 (int)locations[i].Y / (int)Constants.RegionSize, locations[i].Z);
725 Vector2 offset = new Vector2(pPosition.X*(int) Constants.RegionSize,
726 pPosition.Y*(int) Constants.RegionSize);
727
728 if (!updates.ContainsKey(offset))
729 {
730 // This shouldn't happen
731 RegionCoarseLocationStruct updatedata = new RegionCoarseLocationStruct();
732 updatedata.Locations = new List<Vector3>();
733 updatedata.Uuids = new List<UUID>();
734 updatedata.Offset = offset;
735
736 if (offset == Vector2.Zero)
737 updatedata.UserAPI = rootPresence.ControllingClient;
738 else
739 updatedata.UserAPI = LocateUsersChildAgentIClientAPI(offset, rootPresence.UUID, rdata);
740
741 updates.Add(offset,updatedata);
742 }
743
744 updates[offset].Locations.Add(locations[i]);
745 updates[offset].Uuids.Add(uuids[i]);
746 }
747
748 // Send out the CoarseLocationupdates from their respective client connection based on where the avatar is
749 foreach (Vector2 offset in updates.Keys)
750 {
751 if (updates[offset].UserAPI != null)
752 {
753 updates[offset].UserAPI.SendCoarseLocationUpdate(updates[offset].Uuids,updates[offset].Locations);
754 }
755 }
756 }
757
758 /// <summary>
759 /// Locates a the Client of a particular region in an Array of RegionData based on offset
760 /// </summary>
761 /// <param name="offset"></param>
762 /// <param name="uUID"></param>
763 /// <param name="rdata"></param>
764 /// <returns>IClientAPI or null</returns>
765 private IClientAPI LocateUsersChildAgentIClientAPI(Vector2 offset, UUID uUID, RegionData[] rdata)
766 {
767 IClientAPI returnclient = null;
768 foreach (RegionData r in rdata)
769 {
770 if (r.Offset.X == offset.X && r.Offset.Y == offset.Y)
771 {
772 return r.RegionScene.SceneGraph.GetControllingClient(uUID);
773 }
774 }
775
776 return returnclient;
777 }
778
779 public void PostInitialise()
780 {
781 }
782
783// /// <summary>
784// /// TODO:
785// /// </summary>
786// /// <param name="rdata"></param>
787// public void UnCombineRegion(RegionData rdata)
788// {
789// lock (m_regions)
790// {
791// if (m_regions.ContainsKey(rdata.RegionId))
792// {
793// // uncombine root region and virtual regions
794// }
795// else
796// {
797// foreach (RegionConnections r in m_regions.Values)
798// {
799// foreach (RegionData rd in r.ConnectedRegions)
800// {
801// if (rd.RegionId == rdata.RegionId)
802// {
803// // uncombine virtual region
804// }
805// }
806// }
807// }
808// }
809// }
810
811 public void ForwardPermissionRequests(RegionConnections BigRegion, Scene VirtualRegion)
812 {
813 if (BigRegion.PermissionModule == null)
814 BigRegion.PermissionModule = new RegionCombinerPermissionModule(BigRegion.RegionScene);
815
816 VirtualRegion.Permissions.OnBypassPermissions += BigRegion.PermissionModule.BypassPermissions;
817 VirtualRegion.Permissions.OnSetBypassPermissions += BigRegion.PermissionModule.SetBypassPermissions;
818 VirtualRegion.Permissions.OnPropagatePermissions += BigRegion.PermissionModule.PropagatePermissions;
819 VirtualRegion.Permissions.OnGenerateClientFlags += BigRegion.PermissionModule.GenerateClientFlags;
820 VirtualRegion.Permissions.OnAbandonParcel += BigRegion.PermissionModule.CanAbandonParcel;
821 VirtualRegion.Permissions.OnReclaimParcel += BigRegion.PermissionModule.CanReclaimParcel;
822 VirtualRegion.Permissions.OnDeedParcel += BigRegion.PermissionModule.CanDeedParcel;
823 VirtualRegion.Permissions.OnDeedObject += BigRegion.PermissionModule.CanDeedObject;
824 VirtualRegion.Permissions.OnIsGod += BigRegion.PermissionModule.IsGod;
825 VirtualRegion.Permissions.OnDuplicateObject += BigRegion.PermissionModule.CanDuplicateObject;
826 VirtualRegion.Permissions.OnDeleteObject += BigRegion.PermissionModule.CanDeleteObject; //MAYBE FULLY IMPLEMENTED
827 VirtualRegion.Permissions.OnEditObject += BigRegion.PermissionModule.CanEditObject; //MAYBE FULLY IMPLEMENTED
828 VirtualRegion.Permissions.OnEditParcelProperties += BigRegion.PermissionModule.CanEditParcelProperties; //MAYBE FULLY IMPLEMENTED
829 VirtualRegion.Permissions.OnInstantMessage += BigRegion.PermissionModule.CanInstantMessage;
830 VirtualRegion.Permissions.OnInventoryTransfer += BigRegion.PermissionModule.CanInventoryTransfer; //NOT YET IMPLEMENTED
831 VirtualRegion.Permissions.OnIssueEstateCommand += BigRegion.PermissionModule.CanIssueEstateCommand; //FULLY IMPLEMENTED
832 VirtualRegion.Permissions.OnMoveObject += BigRegion.PermissionModule.CanMoveObject; //MAYBE FULLY IMPLEMENTED
833 VirtualRegion.Permissions.OnObjectEntry += BigRegion.PermissionModule.CanObjectEntry;
834 VirtualRegion.Permissions.OnReturnObjects += BigRegion.PermissionModule.CanReturnObjects; //NOT YET IMPLEMENTED
835 VirtualRegion.Permissions.OnRezObject += BigRegion.PermissionModule.CanRezObject; //MAYBE FULLY IMPLEMENTED
836 VirtualRegion.Permissions.OnRunConsoleCommand += BigRegion.PermissionModule.CanRunConsoleCommand;
837 VirtualRegion.Permissions.OnRunScript += BigRegion.PermissionModule.CanRunScript; //NOT YET IMPLEMENTED
838 VirtualRegion.Permissions.OnCompileScript += BigRegion.PermissionModule.CanCompileScript;
839 VirtualRegion.Permissions.OnSellParcel += BigRegion.PermissionModule.CanSellParcel;
840 VirtualRegion.Permissions.OnTakeObject += BigRegion.PermissionModule.CanTakeObject;
841 VirtualRegion.Permissions.OnTakeCopyObject += BigRegion.PermissionModule.CanTakeCopyObject;
842 VirtualRegion.Permissions.OnTerraformLand += BigRegion.PermissionModule.CanTerraformLand;
843 VirtualRegion.Permissions.OnLinkObject += BigRegion.PermissionModule.CanLinkObject; //NOT YET IMPLEMENTED
844 VirtualRegion.Permissions.OnDelinkObject += BigRegion.PermissionModule.CanDelinkObject; //NOT YET IMPLEMENTED
845 VirtualRegion.Permissions.OnBuyLand += BigRegion.PermissionModule.CanBuyLand; //NOT YET IMPLEMENTED
846 VirtualRegion.Permissions.OnViewNotecard += BigRegion.PermissionModule.CanViewNotecard; //NOT YET IMPLEMENTED
847 VirtualRegion.Permissions.OnViewScript += BigRegion.PermissionModule.CanViewScript; //NOT YET IMPLEMENTED
848 VirtualRegion.Permissions.OnEditNotecard += BigRegion.PermissionModule.CanEditNotecard; //NOT YET IMPLEMENTED
849 VirtualRegion.Permissions.OnEditScript += BigRegion.PermissionModule.CanEditScript; //NOT YET IMPLEMENTED
850 VirtualRegion.Permissions.OnCreateObjectInventory += BigRegion.PermissionModule.CanCreateObjectInventory; //NOT IMPLEMENTED HERE
851 VirtualRegion.Permissions.OnEditObjectInventory += BigRegion.PermissionModule.CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED
852 VirtualRegion.Permissions.OnCopyObjectInventory += BigRegion.PermissionModule.CanCopyObjectInventory; //NOT YET IMPLEMENTED
853 VirtualRegion.Permissions.OnDeleteObjectInventory += BigRegion.PermissionModule.CanDeleteObjectInventory; //NOT YET IMPLEMENTED
854 VirtualRegion.Permissions.OnResetScript += BigRegion.PermissionModule.CanResetScript;
855 VirtualRegion.Permissions.OnCreateUserInventory += BigRegion.PermissionModule.CanCreateUserInventory; //NOT YET IMPLEMENTED
856 VirtualRegion.Permissions.OnCopyUserInventory += BigRegion.PermissionModule.CanCopyUserInventory; //NOT YET IMPLEMENTED
857 VirtualRegion.Permissions.OnEditUserInventory += BigRegion.PermissionModule.CanEditUserInventory; //NOT YET IMPLEMENTED
858 VirtualRegion.Permissions.OnDeleteUserInventory += BigRegion.PermissionModule.CanDeleteUserInventory; //NOT YET IMPLEMENTED
859 VirtualRegion.Permissions.OnTeleport += BigRegion.PermissionModule.CanTeleport; //NOT YET IMPLEMENTED
860 }
861
862 #region console commands
863
864 public void FixPhantoms(string module, string[] cmdparams)
865 {
866 List<Scene> scenes = new List<Scene>(m_startingScenes.Values);
867
868 foreach (Scene s in scenes)
869 {
870 MainConsole.Instance.OutputFormat("Fixing phantoms for {0}", s.RegionInfo.RegionName);
871
872 s.ForEachSOG(so => so.AbsolutePosition = so.AbsolutePosition);
873 }
874 }
875
876 #endregion
877 }
878}
diff --git a/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerPermissionModule.cs b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerPermissionModule.cs
new file mode 100644
index 0000000..07dd68b
--- /dev/null
+++ b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerPermissionModule.cs
@@ -0,0 +1,270 @@
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.RegionCombinerModule
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 CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers g, Scene scene)
109 {
110 return m_rootScene.Permissions.CanEditParcelProperties(user, parcel, g);
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 CanReturnObjects(ILandObject land, UUID user, List<SceneObjectGroup> objects, Scene scene)
139 {
140 return m_rootScene.Permissions.CanReturnObjects(land, user, objects);
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 #endregion
269 }
270}
diff --git a/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionConnections.cs b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionConnections.cs
new file mode 100644
index 0000000..62a3a91
--- /dev/null
+++ b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionConnections.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.Framework;
32using OpenSim.Region.Framework.Interfaces;
33using OpenSim.Region.Framework.Scenes;
34
35namespace OpenSim.Region.RegionCombinerModule
36{
37 public class RegionConnections
38 {
39 /// <summary>
40 /// Root Region ID
41 /// </summary>
42 public UUID RegionId;
43
44 /// <summary>
45 /// Root Region Scene
46 /// </summary>
47 public Scene RegionScene;
48
49 /// <summary>
50 /// LargeLandChannel for combined region
51 /// </summary>
52 public ILandChannel RegionLandChannel;
53
54 /// <summary>
55 /// The x map co-ordinate for this region (where each co-ordinate is a Constants.RegionSize block).
56 /// </summary>
57 public uint X;
58
59 /// <summary>
60 /// The y co-ordinate for this region (where each cor-odinate is a Constants.RegionSize block).
61 /// </summary>
62 public uint Y;
63
64 /// <summary>
65 /// The X meters position of this connection.
66 /// </summary>
67 public uint PosX { get { return Util.RegionToWorldLoc(X); } }
68
69 /// <summary>
70 /// The Y meters co-ordinate of this connection.
71 /// </summary>
72 public uint PosY { get { return Util.RegionToWorldLoc(Y); } }
73
74 /// <summary>
75 /// The size of the megaregion in meters.
76 /// </summary>
77 public uint XEnd;
78
79 /// <summary>
80 /// The size of the megaregion in meters.
81 /// </summary>
82 public uint YEnd;
83
84 public List<RegionData> ConnectedRegions;
85 public RegionCombinerPermissionModule PermissionModule;
86 public RegionCombinerClientEventForwarder ClientEventForwarder;
87
88 public void UpdateExtents(Vector3 extents)
89 {
90 XEnd = (uint)extents.X;
91 YEnd = (uint)extents.Y;
92 }
93 }
94} \ No newline at end of file
diff --git a/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCourseLocation.cs b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCourseLocation.cs
new file mode 100644
index 0000000..224ac99
--- /dev/null
+++ b/OpenSim/Region/OptionalModules/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.RegionCombinerModule
34{
35
36 struct RegionCoarseLocationStruct
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/OptionalModules/RegionCombinerModule/RegionData.cs b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionData.cs
new file mode 100644
index 0000000..42fca9f
--- /dev/null
+++ b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionData.cs
@@ -0,0 +1,40 @@
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.RegionCombinerModule
32{
33 public class RegionData
34 {
35 public UUID RegionId;
36 public Scene RegionScene;
37 // Offset of this region from the base of the root region.
38 public Vector3 Offset;
39 }
40} \ No newline at end of file