aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/RegionCombinerModule
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/RegionCombinerModule')
-rw-r--r--OpenSim/Region/RegionCombinerModule/Properties/AssemblyInfo.cs33
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCombinerClientEventForwarder.cs94
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs137
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs175
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs1076
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs270
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionConnections.cs94
-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.xml14
10 files changed, 0 insertions, 1975 deletions
diff --git a/OpenSim/Region/RegionCombinerModule/Properties/AssemblyInfo.cs b/OpenSim/Region/RegionCombinerModule/Properties/AssemblyInfo.cs
deleted file mode 100644
index 085eb59..0000000
--- a/OpenSim/Region/RegionCombinerModule/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,33 +0,0 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Region.RegionCombinerModule")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("http://opensimulator.org")]
12[assembly: AssemblyProduct("OpenSim")]
13[assembly: AssemblyCopyright("OpenSimulator developers")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("73c166d2-c9d8-4ab8-af4e-89c41b4b58a9")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("0.7.5.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerClientEventForwarder.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerClientEventForwarder.cs
deleted file mode 100644
index 721d396..0000000
--- a/OpenSim/Region/RegionCombinerModule/RegionCombinerClientEventForwarder.cs
+++ /dev/null
@@ -1,94 +0,0 @@
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/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs
deleted file mode 100644
index f424e7f..0000000
--- a/OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs
+++ /dev/null
@@ -1,137 +0,0 @@
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 ((AttachmentsModule)m_virtScene.AttachmentsModule).UnsubscribeFromClientEvents(client);
55 //m_virtScene.UnSubscribeToClientTeleportEvents(client);
56 m_virtScene.UnSubscribeToClientScriptEvents(client);
57
58 IGodsModule virtGodsModule = m_virtScene.RequestModuleInterface<IGodsModule>();
59 if (virtGodsModule != null)
60 ((GodsModule)virtGodsModule).UnsubscribeFromClientEvents(client);
61
62 m_virtScene.UnSubscribeToClientNetworkEvents(client);
63
64 m_rootScene.SubscribeToClientPrimEvents(client);
65 client.OnAddPrim += LocalAddNewPrim;
66 client.OnRezObject += LocalRezObject;
67
68 m_rootScene.SubscribeToClientInventoryEvents(client);
69 ((AttachmentsModule)m_rootScene.AttachmentsModule).SubscribeToClientEvents(client);
70 //m_rootScene.SubscribeToClientTeleportEvents(client);
71 m_rootScene.SubscribeToClientScriptEvents(client);
72
73 IGodsModule rootGodsModule = m_virtScene.RequestModuleInterface<IGodsModule>();
74 if (rootGodsModule != null)
75 ((GodsModule)rootGodsModule).UnsubscribeFromClientEvents(client);
76
77 m_rootScene.SubscribeToClientNetworkEvents(client);
78 }
79
80 public void ClientClosed(UUID clientid, Scene scene)
81 {
82 }
83
84 /// <summary>
85 /// Fixes position based on the region the Rez event came in on
86 /// </summary>
87 /// <param name="remoteclient"></param>
88 /// <param name="itemid"></param>
89 /// <param name="rayend"></param>
90 /// <param name="raystart"></param>
91 /// <param name="raytargetid"></param>
92 /// <param name="bypassraycast"></param>
93 /// <param name="rayendisintersection"></param>
94 /// <param name="rezselected"></param>
95 /// <param name="removeitem"></param>
96 /// <param name="fromtaskid"></param>
97 private void LocalRezObject(IClientAPI remoteclient, UUID itemid, Vector3 rayend, Vector3 raystart,
98 UUID raytargetid, byte bypassraycast, bool rayendisintersection, bool rezselected, bool removeitem,
99 UUID fromtaskid)
100 {
101 int differenceX = (int)m_virtScene.RegionInfo.RegionLocX - (int)m_rootScene.RegionInfo.RegionLocX;
102 int differenceY = (int)m_virtScene.RegionInfo.RegionLocY - (int)m_rootScene.RegionInfo.RegionLocY;
103 rayend.X += differenceX * (int)Constants.RegionSize;
104 rayend.Y += differenceY * (int)Constants.RegionSize;
105 raystart.X += differenceX * (int)Constants.RegionSize;
106 raystart.Y += differenceY * (int)Constants.RegionSize;
107
108 m_rootScene.RezObject(remoteclient, itemid, rayend, raystart, raytargetid, bypassraycast,
109 rayendisintersection, rezselected, removeitem, fromtaskid);
110 }
111 /// <summary>
112 /// Fixes position based on the region the AddPrimShape event came in on
113 /// </summary>
114 /// <param name="ownerid"></param>
115 /// <param name="groupid"></param>
116 /// <param name="rayend"></param>
117 /// <param name="rot"></param>
118 /// <param name="shape"></param>
119 /// <param name="bypassraycast"></param>
120 /// <param name="raystart"></param>
121 /// <param name="raytargetid"></param>
122 /// <param name="rayendisintersection"></param>
123 private void LocalAddNewPrim(UUID ownerid, UUID groupid, Vector3 rayend, Quaternion rot,
124 PrimitiveBaseShape shape, byte bypassraycast, Vector3 raystart, UUID raytargetid,
125 byte rayendisintersection)
126 {
127 int differenceX = (int)m_virtScene.RegionInfo.RegionLocX - (int)m_rootScene.RegionInfo.RegionLocX;
128 int differenceY = (int)m_virtScene.RegionInfo.RegionLocY - (int)m_rootScene.RegionInfo.RegionLocY;
129 rayend.X += differenceX * (int)Constants.RegionSize;
130 rayend.Y += differenceY * (int)Constants.RegionSize;
131 raystart.X += differenceX * (int)Constants.RegionSize;
132 raystart.Y += differenceY * (int)Constants.RegionSize;
133 m_rootScene.AddNewPrim(ownerid, groupid, rayend, rot, shape, bypassraycast, raystart, raytargetid,
134 rayendisintersection);
135 }
136 }
137} \ No newline at end of file
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs
deleted file mode 100644
index a133e51..0000000
--- a/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs
+++ /dev/null
@@ -1,175 +0,0 @@
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.CoreModules.World.Land;
34
35namespace OpenSim.Region.RegionCombinerModule
36{
37public class RegionCombinerLargeLandChannel : ILandChannel
38 {
39 // private static readonly ILog m_log =
40 // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
41 private RegionData RegData;
42 private ILandChannel RootRegionLandChannel;
43 private readonly List<RegionData> RegionConnections;
44
45 #region ILandChannel Members
46
47 public RegionCombinerLargeLandChannel(RegionData regData, ILandChannel rootRegionLandChannel,
48 List<RegionData> regionConnections)
49 {
50 RegData = regData;
51 RootRegionLandChannel = rootRegionLandChannel;
52 RegionConnections = regionConnections;
53 }
54
55 public List<ILandObject> ParcelsNearPoint(Vector3 position)
56 {
57 //m_log.DebugFormat("[LANDPARCELNEARPOINT]: {0}>", position);
58 return RootRegionLandChannel.ParcelsNearPoint(position - RegData.Offset);
59 }
60
61 public List<ILandObject> AllParcels()
62 {
63 return RootRegionLandChannel.AllParcels();
64 }
65
66 public void Clear(bool setupDefaultParcel)
67 {
68 RootRegionLandChannel.Clear(setupDefaultParcel);
69 }
70
71 public ILandObject GetLandObject(int x, int y)
72 {
73 //m_log.DebugFormat("[BIGLANDTESTINT]: <{0},{1}>", x, y);
74
75 if (x > 0 && x <= (int)Constants.RegionSize && y > 0 && y <= (int)Constants.RegionSize)
76 {
77 return RootRegionLandChannel.GetLandObject(x, y);
78 }
79 else
80 {
81 int offsetX = (x / (int)Constants.RegionSize);
82 int offsetY = (y / (int)Constants.RegionSize);
83 offsetX *= (int)Constants.RegionSize;
84 offsetY *= (int)Constants.RegionSize;
85
86 foreach (RegionData regionData in RegionConnections)
87 {
88 if (regionData.Offset.X == offsetX && regionData.Offset.Y == offsetY)
89 {
90 return regionData.RegionScene.LandChannel.GetLandObject(x - offsetX, y - offsetY);
91 }
92 }
93 ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene);
94 obj.LandData.Name = "NO LAND";
95 return obj;
96 }
97 }
98
99 public ILandObject GetLandObject(int localID)
100 {
101 return RootRegionLandChannel.GetLandObject(localID);
102 }
103
104 public ILandObject GetLandObject(float x, float y)
105 {
106 //m_log.DebugFormat("[BIGLANDTESTFLOAT]: <{0},{1}>", x, y);
107
108 if (x > 0 && x <= (int)Constants.RegionSize && y > 0 && y <= (int)Constants.RegionSize)
109 {
110 return RootRegionLandChannel.GetLandObject(x, y);
111 }
112 else
113 {
114 int offsetX = (int)(x/(int) Constants.RegionSize);
115 int offsetY = (int)(y/(int) Constants.RegionSize);
116 offsetX *= (int) Constants.RegionSize;
117 offsetY *= (int) Constants.RegionSize;
118
119 foreach (RegionData regionData in RegionConnections)
120 {
121 if (regionData.Offset.X == offsetX && regionData.Offset.Y == offsetY)
122 {
123 return regionData.RegionScene.LandChannel.GetLandObject(x - offsetX, y - offsetY);
124 }
125 }
126
127 ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene);
128 obj.LandData.Name = "NO LAND";
129 return obj;
130 }
131 }
132
133 public bool IsForcefulBansAllowed()
134 {
135 return RootRegionLandChannel.IsForcefulBansAllowed();
136 }
137
138 public void UpdateLandObject(int localID, LandData data)
139 {
140 RootRegionLandChannel.UpdateLandObject(localID, data);
141 }
142
143 public void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id)
144 {
145 RootRegionLandChannel.Join(start_x, start_y, end_x, end_y, attempting_user_id);
146 }
147
148 public void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id)
149 {
150 RootRegionLandChannel.Subdivide(start_x, start_y, end_x, end_y, attempting_user_id);
151 }
152
153 public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient)
154 {
155 RootRegionLandChannel.ReturnObjectsInParcel(localID, returnType, agentIDs, taskIDs, remoteClient);
156 }
157
158 public void setParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel)
159 {
160 RootRegionLandChannel.setParcelObjectMaxOverride(overrideDel);
161 }
162
163 public void setSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel)
164 {
165 RootRegionLandChannel.setSimulatorObjectMaxOverride(overrideDel);
166 }
167
168 public void SetParcelOtherCleanTime(IClientAPI remoteClient, int localID, int otherCleanTime)
169 {
170 RootRegionLandChannel.SetParcelOtherCleanTime(remoteClient, localID, otherCleanTime);
171 }
172
173 #endregion
174 }
175} \ No newline at end of file
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
deleted file mode 100644
index 905540d..0000000
--- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
+++ /dev/null
@@ -1,1076 +0,0 @@
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;
40using Mono.Addins;
41
42namespace OpenSim.Region.RegionCombinerModule
43{
44 public class RegionCombinerModule : ISharedRegionModule, IRegionCombinerModule
45 {
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47
48 public string Name
49 {
50 get { return "RegionCombinerModule"; }
51 }
52
53 public Type ReplaceableInterface
54 {
55 get { return null; }
56 }
57
58 /// <summary>
59 /// Is this module enabled?
60 /// </summary>
61 private bool m_combineContiguousRegions = false;
62
63 /// <summary>
64 /// This holds the root regions for the megaregions.
65 /// </summary>
66 /// <remarks>
67 /// Usually there is only ever one megaregion (and hence only one entry here).
68 /// </remarks>
69 private Dictionary<UUID, RegionConnections> m_regions = new Dictionary<UUID, RegionConnections>();
70
71 /// <summary>
72 /// The scenes that comprise the megaregion.
73 /// </summary>
74 private Dictionary<UUID, Scene> m_startingScenes = new Dictionary<UUID, Scene>();
75
76 public void Initialise(IConfigSource source)
77 {
78 IConfig myConfig = source.Configs["Startup"];
79 m_combineContiguousRegions = myConfig.GetBoolean("CombineContiguousRegions", false);
80
81 MainConsole.Instance.Commands.AddCommand(
82 "RegionCombinerModule", false, "fix-phantoms", "fix-phantoms",
83 "Fixes phantom objects after an import to a megaregion or a change from a megaregion back to normal regions",
84 FixPhantoms);
85 }
86
87 public void Close()
88 {
89 }
90
91 public void AddRegion(Scene scene)
92 {
93 if (m_combineContiguousRegions)
94 scene.RegisterModuleInterface<IRegionCombinerModule>(this);
95 }
96
97 public void RemoveRegion(Scene scene)
98 {
99 lock (m_startingScenes)
100 m_startingScenes.Remove(scene.RegionInfo.originRegionID);
101 }
102
103 public void RegionLoaded(Scene scene)
104 {
105 lock (m_startingScenes)
106 m_startingScenes.Add(scene.RegionInfo.originRegionID, scene);
107
108 if (m_combineContiguousRegions)
109 {
110 RegionLoadedDoWork(scene);
111
112 scene.EventManager.OnNewPresence += NewPresence;
113 }
114 }
115
116 public bool IsRootForMegaregion(UUID regionId)
117 {
118 lock (m_regions)
119 return m_regions.ContainsKey(regionId);
120 }
121
122 public Vector2 GetSizeOfMegaregion(UUID regionId)
123 {
124 lock (m_regions)
125 {
126 if (m_regions.ContainsKey(regionId))
127 {
128 RegionConnections rootConn = m_regions[regionId];
129
130 return new Vector2((float)rootConn.XEnd, (float)rootConn.YEnd);
131 }
132 }
133
134 throw new Exception(string.Format("Region with id {0} not found", regionId));
135 }
136
137 private void NewPresence(ScenePresence presence)
138 {
139 if (presence.IsChildAgent)
140 {
141 byte[] throttleData;
142
143 try
144 {
145 throttleData = presence.ControllingClient.GetThrottlesPacked(1);
146 }
147 catch (NotImplementedException)
148 {
149 return;
150 }
151
152 if (throttleData == null)
153 return;
154
155 if (throttleData.Length == 0)
156 return;
157
158 if (throttleData.Length != 28)
159 return;
160
161 byte[] adjData;
162 int pos = 0;
163
164 if (!BitConverter.IsLittleEndian)
165 {
166 byte[] newData = new byte[7 * 4];
167 Buffer.BlockCopy(throttleData, 0, newData, 0, 7 * 4);
168
169 for (int i = 0; i < 7; i++)
170 Array.Reverse(newData, i * 4, 4);
171
172 adjData = newData;
173 }
174 else
175 {
176 adjData = throttleData;
177 }
178
179 // 0.125f converts from bits to bytes
180 int resend = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
181 int land = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
182 int wind = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
183 int cloud = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
184 int task = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
185 int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
186 int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f);
187 // State is a subcategory of task that we allocate a percentage to
188
189
190 //int total = resend + land + wind + cloud + task + texture + asset;
191
192 byte[] data = new byte[7 * 4];
193 int ii = 0;
194
195 Buffer.BlockCopy(Utils.FloatToBytes(resend), 0, data, ii, 4); ii += 4;
196 Buffer.BlockCopy(Utils.FloatToBytes(land * 50), 0, data, ii, 4); ii += 4;
197 Buffer.BlockCopy(Utils.FloatToBytes(wind), 0, data, ii, 4); ii += 4;
198 Buffer.BlockCopy(Utils.FloatToBytes(cloud), 0, data, ii, 4); ii += 4;
199 Buffer.BlockCopy(Utils.FloatToBytes(task), 0, data, ii, 4); ii += 4;
200 Buffer.BlockCopy(Utils.FloatToBytes(texture), 0, data, ii, 4); ii += 4;
201 Buffer.BlockCopy(Utils.FloatToBytes(asset), 0, data, ii, 4);
202
203 try
204 {
205 presence.ControllingClient.SetChildAgentThrottle(data);
206 }
207 catch (NotImplementedException)
208 {
209 return;
210 }
211 }
212 }
213
214 private void RegionLoadedDoWork(Scene scene)
215 {
216/*
217 // For testing on a single instance
218 if (scene.RegionInfo.RegionLocX == 1004 && scene.RegionInfo.RegionLocY == 1000)
219 return;
220 //
221*/
222
223 // Give each region a standard set of non-infinite borders
224 Border northBorder = new Border();
225 northBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, (int)Constants.RegionSize); //<---
226 northBorder.CrossDirection = Cardinals.N;
227 scene.NorthBorders[0] = northBorder;
228
229 Border southBorder = new Border();
230 southBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, 0); //--->
231 southBorder.CrossDirection = Cardinals.S;
232 scene.SouthBorders[0] = southBorder;
233
234 Border eastBorder = new Border();
235 eastBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, (int)Constants.RegionSize); //<---
236 eastBorder.CrossDirection = Cardinals.E;
237 scene.EastBorders[0] = eastBorder;
238
239 Border westBorder = new Border();
240 westBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, 0); //--->
241 westBorder.CrossDirection = Cardinals.W;
242 scene.WestBorders[0] = westBorder;
243
244 RegionConnections newConn = new RegionConnections();
245 newConn.ConnectedRegions = new List<RegionData>();
246 newConn.RegionScene = scene;
247 newConn.RegionLandChannel = scene.LandChannel;
248 newConn.RegionId = scene.RegionInfo.originRegionID;
249 newConn.X = scene.RegionInfo.RegionLocX;
250 newConn.Y = scene.RegionInfo.RegionLocY;
251 newConn.XEnd = (int)Constants.RegionSize;
252 newConn.YEnd = (int)Constants.RegionSize;
253
254 lock (m_regions)
255 {
256 bool connectedYN = false;
257
258 foreach (RegionConnections rootConn in m_regions.Values)
259 {
260 #region commented
261 /*
262 // If we're one region over +x +y
263 //xxy
264 //xxx
265 //xxx
266 if ((((int)conn.X * (int)Constants.RegionSize) + conn.XEnd
267 == (regionConnections.X * (int)Constants.RegionSize))
268 && (((int)conn.Y * (int)Constants.RegionSize) - conn.YEnd
269 == (regionConnections.Y * (int)Constants.RegionSize)))
270 {
271 Vector3 offset = Vector3.Zero;
272 offset.X = (((regionConnections.X * (int) Constants.RegionSize)) -
273 ((conn.X * (int) Constants.RegionSize)));
274 offset.Y = (((regionConnections.Y * (int) Constants.RegionSize)) -
275 ((conn.Y * (int) Constants.RegionSize)));
276
277 Vector3 extents = Vector3.Zero;
278 extents.Y = regionConnections.YEnd + conn.YEnd;
279 extents.X = conn.XEnd + conn.XEnd;
280
281 m_log.DebugFormat("Scene: {0} to the northwest of Scene{1}. Offset: {2}. Extents:{3}",
282 conn.RegionScene.RegionInfo.RegionName,
283 regionConnections.RegionScene.RegionInfo.RegionName,
284 offset, extents);
285
286 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
287
288 connectedYN = true;
289 break;
290 }
291 */
292
293 /*
294 //If we're one region over x +y
295 //xxx
296 //xxx
297 //xyx
298 if ((((int)conn.X * (int)Constants.RegionSize)
299 == (regionConnections.X * (int)Constants.RegionSize))
300 && (((int)conn.Y * (int)Constants.RegionSize) - conn.YEnd
301 == (regionConnections.Y * (int)Constants.RegionSize)))
302 {
303 Vector3 offset = Vector3.Zero;
304 offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
305 ((conn.X * (int)Constants.RegionSize)));
306 offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
307 ((conn.Y * (int)Constants.RegionSize)));
308
309 Vector3 extents = Vector3.Zero;
310 extents.Y = regionConnections.YEnd + conn.YEnd;
311 extents.X = conn.XEnd;
312
313 m_log.DebugFormat("Scene: {0} to the north of Scene{1}. Offset: {2}. Extents:{3}",
314 conn.RegionScene.RegionInfo.RegionName,
315 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
316
317 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
318 connectedYN = true;
319 break;
320 }
321 */
322
323 /*
324 // If we're one region over -x +y
325 //xxx
326 //xxx
327 //yxx
328 if ((((int)conn.X * (int)Constants.RegionSize) - conn.XEnd
329 == (regionConnections.X * (int)Constants.RegionSize))
330 && (((int)conn.Y * (int)Constants.RegionSize) - conn.YEnd
331 == (regionConnections.Y * (int)Constants.RegionSize)))
332 {
333 Vector3 offset = Vector3.Zero;
334 offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
335 ((conn.X * (int)Constants.RegionSize)));
336 offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
337 ((conn.Y * (int)Constants.RegionSize)));
338
339 Vector3 extents = Vector3.Zero;
340 extents.Y = regionConnections.YEnd + conn.YEnd;
341 extents.X = conn.XEnd + conn.XEnd;
342
343 m_log.DebugFormat("Scene: {0} to the northeast of Scene. Offset: {2}. Extents:{3}",
344 conn.RegionScene.RegionInfo.RegionName,
345 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
346
347 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
348
349
350 connectedYN = true;
351 break;
352 }
353 */
354
355 /*
356 // If we're one region over -x y
357 //xxx
358 //yxx
359 //xxx
360 if ((((int)conn.X * (int)Constants.RegionSize) - conn.XEnd
361 == (regionConnections.X * (int)Constants.RegionSize))
362 && (((int)conn.Y * (int)Constants.RegionSize)
363 == (regionConnections.Y * (int)Constants.RegionSize)))
364 {
365 Vector3 offset = Vector3.Zero;
366 offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
367 ((conn.X * (int)Constants.RegionSize)));
368 offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
369 ((conn.Y * (int)Constants.RegionSize)));
370
371 Vector3 extents = Vector3.Zero;
372 extents.Y = regionConnections.YEnd;
373 extents.X = conn.XEnd + conn.XEnd;
374
375 m_log.DebugFormat("Scene: {0} to the east of Scene{1} Offset: {2}. Extents:{3}",
376 conn.RegionScene.RegionInfo.RegionName,
377 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
378
379 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
380
381 connectedYN = true;
382 break;
383 }
384 */
385
386 /*
387 // If we're one region over -x -y
388 //yxx
389 //xxx
390 //xxx
391 if ((((int)conn.X * (int)Constants.RegionSize) - conn.XEnd
392 == (regionConnections.X * (int)Constants.RegionSize))
393 && (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd
394 == (regionConnections.Y * (int)Constants.RegionSize)))
395 {
396 Vector3 offset = Vector3.Zero;
397 offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
398 ((conn.X * (int)Constants.RegionSize)));
399 offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
400 ((conn.Y * (int)Constants.RegionSize)));
401
402 Vector3 extents = Vector3.Zero;
403 extents.Y = regionConnections.YEnd + conn.YEnd;
404 extents.X = conn.XEnd + conn.XEnd;
405
406 m_log.DebugFormat("Scene: {0} to the northeast of Scene{1} Offset: {2}. Extents:{3}",
407 conn.RegionScene.RegionInfo.RegionName,
408 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
409
410 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
411
412 connectedYN = true;
413 break;
414 }
415 */
416 #endregion
417
418 // If we're one region over +x y
419 //xxx
420 //xxy
421 //xxx
422
423 if (rootConn.PosX + rootConn.XEnd >= newConn.PosX && rootConn.PosY >= newConn.PosY)
424 {
425 connectedYN = DoWorkForOneRegionOverPlusXY(rootConn, newConn, scene);
426 break;
427 }
428
429 // If we're one region over x +y
430 //xyx
431 //xxx
432 //xxx
433 if (rootConn.PosX >= newConn.PosX && rootConn.PosY + rootConn.YEnd >= newConn.PosY)
434 {
435 connectedYN = DoWorkForOneRegionOverXPlusY(rootConn, newConn, scene);
436 break;
437 }
438
439 // If we're one region over +x +y
440 //xxy
441 //xxx
442 //xxx
443 if (rootConn.PosX + rootConn.XEnd >= newConn.PosX && rootConn.PosY + rootConn.YEnd >= newConn.PosY)
444 {
445 connectedYN = DoWorkForOneRegionOverPlusXPlusY(rootConn, newConn, scene);
446 break;
447
448 }
449 }
450
451 // If !connectYN means that this region is a root region
452 if (!connectedYN)
453 {
454 DoWorkForRootRegion(newConn, scene);
455 }
456 }
457
458 // Set up infinite borders around the entire AABB of the combined ConnectedRegions
459 AdjustLargeRegionBounds();
460 }
461
462 private bool DoWorkForOneRegionOverPlusXY(RegionConnections rootConn, RegionConnections newConn, Scene scene)
463 {
464 Vector3 offset = Vector3.Zero;
465 offset.X = newConn.PosX - rootConn.PosX;
466 offset.Y = newConn.PosY - rootConn.PosY;
467
468 Vector3 extents = Vector3.Zero;
469 extents.Y = rootConn.YEnd;
470 extents.X = rootConn.XEnd + newConn.XEnd;
471
472 rootConn.UpdateExtents(extents);
473
474 m_log.DebugFormat(
475 "[REGION COMBINER MODULE]: Root region {0} is to the west of region {1}, Offset: {2}, Extents: {3}",
476 rootConn.RegionScene.RegionInfo.RegionName,
477 newConn.RegionScene.RegionInfo.RegionName, offset, extents);
478
479 scene.BordersLocked = true;
480 rootConn.RegionScene.BordersLocked = true;
481
482 RegionData ConnectedRegion = new RegionData();
483 ConnectedRegion.Offset = offset;
484 ConnectedRegion.RegionId = scene.RegionInfo.originRegionID;
485 ConnectedRegion.RegionScene = scene;
486 rootConn.ConnectedRegions.Add(ConnectedRegion);
487
488 // Inform root region Physics about the extents of this region
489 rootConn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
490
491 // Inform Child region that it needs to forward it's terrain to the root region
492 scene.PhysicsScene.Combine(rootConn.RegionScene.PhysicsScene, offset, Vector3.Zero);
493
494 // Extend the borders as appropriate
495 lock (rootConn.RegionScene.EastBorders)
496 rootConn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize;
497
498 lock (rootConn.RegionScene.NorthBorders)
499 rootConn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
500
501 lock (rootConn.RegionScene.SouthBorders)
502 rootConn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
503
504 lock (scene.WestBorders)
505 {
506 scene.WestBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocX - rootConn.RegionScene.RegionInfo.RegionLocX) * (int)Constants.RegionSize); //auto teleport West
507
508 // Trigger auto teleport to root region
509 scene.WestBorders[0].TriggerRegionX = rootConn.RegionScene.RegionInfo.RegionLocX;
510 scene.WestBorders[0].TriggerRegionY = rootConn.RegionScene.RegionInfo.RegionLocY;
511 }
512
513 // Reset Terrain.. since terrain loads before we get here, we need to load
514 // it again so it loads in the root region
515
516 scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
517
518 // Unlock borders
519 rootConn.RegionScene.BordersLocked = false;
520 scene.BordersLocked = false;
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 private bool DoWorkForOneRegionOverXPlusY(RegionConnections rootConn, RegionConnections newConn, Scene scene)
530 {
531 Vector3 offset = Vector3.Zero;
532 offset.X = newConn.PosX - rootConn.PosX;
533 offset.Y = newConn.PosY - rootConn.PosY;
534
535 Vector3 extents = Vector3.Zero;
536 extents.Y = newConn.YEnd + rootConn.YEnd;
537 extents.X = rootConn.XEnd;
538 rootConn.UpdateExtents(extents);
539
540 scene.BordersLocked = true;
541 rootConn.RegionScene.BordersLocked = true;
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 lock (rootConn.RegionScene.NorthBorders)
558 rootConn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
559
560 lock (rootConn.RegionScene.EastBorders)
561 rootConn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
562
563 lock (rootConn.RegionScene.WestBorders)
564 rootConn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
565
566 lock (scene.SouthBorders)
567 {
568 scene.SouthBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocY - rootConn.RegionScene.RegionInfo.RegionLocY) * (int)Constants.RegionSize); //auto teleport south
569 scene.SouthBorders[0].TriggerRegionX = rootConn.RegionScene.RegionInfo.RegionLocX;
570 scene.SouthBorders[0].TriggerRegionY = rootConn.RegionScene.RegionInfo.RegionLocY;
571 }
572
573 // Reset Terrain.. since terrain normally loads first.
574 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
575 scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
576 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
577
578 scene.BordersLocked = false;
579 rootConn.RegionScene.BordersLocked = false;
580
581 if (rootConn.ClientEventForwarder != null)
582 rootConn.ClientEventForwarder.AddSceneToEventForwarding(scene);
583
584 return true;
585 }
586
587 private bool DoWorkForOneRegionOverPlusXPlusY(RegionConnections rootConn, RegionConnections newConn, Scene scene)
588 {
589 Vector3 offset = Vector3.Zero;
590 offset.X = newConn.PosX - rootConn.PosX;
591 offset.Y = newConn.PosY - rootConn.PosY;
592
593 Vector3 extents = Vector3.Zero;
594
595 // We do not want to inflate the extents for regions strictly to the NE of the root region, since this
596 // would double count regions strictly to the north and east that have already been added.
597// extents.Y = regionConnections.YEnd + conn.YEnd;
598// extents.X = regionConnections.XEnd + conn.XEnd;
599// conn.UpdateExtents(extents);
600
601 extents.Y = rootConn.YEnd;
602 extents.X = rootConn.XEnd;
603
604 scene.BordersLocked = true;
605 rootConn.RegionScene.BordersLocked = true;
606
607 RegionData ConnectedRegion = new RegionData();
608 ConnectedRegion.Offset = offset;
609 ConnectedRegion.RegionId = scene.RegionInfo.originRegionID;
610 ConnectedRegion.RegionScene = scene;
611
612 rootConn.ConnectedRegions.Add(ConnectedRegion);
613
614 m_log.DebugFormat(
615 "[REGION COMBINER MODULE]: Region {0} is to the southwest of Scene {1}, Offset: {2}, Extents: {3}",
616 rootConn.RegionScene.RegionInfo.RegionName,
617 newConn.RegionScene.RegionInfo.RegionName, offset, extents);
618
619 rootConn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
620 scene.PhysicsScene.Combine(rootConn.RegionScene.PhysicsScene, offset, Vector3.Zero);
621
622 lock (rootConn.RegionScene.NorthBorders)
623 {
624 if (rootConn.RegionScene.NorthBorders.Count == 1)// && 2)
625 {
626 //compound border
627 // already locked above
628 rootConn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
629
630 lock (rootConn.RegionScene.EastBorders)
631 rootConn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
632
633 lock (rootConn.RegionScene.WestBorders)
634 rootConn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
635 }
636 }
637
638 lock (scene.SouthBorders)
639 {
640 scene.SouthBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocY - rootConn.RegionScene.RegionInfo.RegionLocY) * (int)Constants.RegionSize); //auto teleport south
641 scene.SouthBorders[0].TriggerRegionX = rootConn.RegionScene.RegionInfo.RegionLocX;
642 scene.SouthBorders[0].TriggerRegionY = rootConn.RegionScene.RegionInfo.RegionLocY;
643 }
644
645 lock (rootConn.RegionScene.EastBorders)
646 {
647 if (rootConn.RegionScene.EastBorders.Count == 1)// && conn.RegionScene.EastBorders.Count == 2)
648 {
649
650 rootConn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize;
651
652 lock (rootConn.RegionScene.NorthBorders)
653 rootConn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
654
655 lock (rootConn.RegionScene.SouthBorders)
656 rootConn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
657 }
658 }
659
660 lock (scene.WestBorders)
661 {
662 scene.WestBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocX - rootConn.RegionScene.RegionInfo.RegionLocX) * (int)Constants.RegionSize); //auto teleport West
663 scene.WestBorders[0].TriggerRegionX = rootConn.RegionScene.RegionInfo.RegionLocX;
664 scene.WestBorders[0].TriggerRegionY = rootConn.RegionScene.RegionInfo.RegionLocY;
665 }
666
667 /*
668 else
669 {
670 conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
671 conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
672 conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
673 scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south
674 }
675 */
676
677
678 // Reset Terrain.. since terrain normally loads first.
679 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
680 scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
681 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
682 scene.BordersLocked = false;
683 rootConn.RegionScene.BordersLocked = false;
684
685 if (rootConn.ClientEventForwarder != null)
686 rootConn.ClientEventForwarder.AddSceneToEventForwarding(scene);
687
688 return true;
689
690 //scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset,extents);
691 }
692
693 private void DoWorkForRootRegion(RegionConnections rootConn, Scene scene)
694 {
695 m_log.DebugFormat("[REGION COMBINER MODULE]: Adding root region {0}", scene.RegionInfo.RegionName);
696
697 RegionData rdata = new RegionData();
698 rdata.Offset = Vector3.Zero;
699 rdata.RegionId = scene.RegionInfo.originRegionID;
700 rdata.RegionScene = scene;
701 // save it's land channel
702 rootConn.RegionLandChannel = scene.LandChannel;
703
704 // Substitue our landchannel
705 RegionCombinerLargeLandChannel lnd = new RegionCombinerLargeLandChannel(rdata, scene.LandChannel,
706 rootConn.ConnectedRegions);
707
708 scene.LandChannel = lnd;
709
710 // Forward the permissions modules of each of the connected regions to the root region
711 lock (m_regions)
712 {
713 foreach (RegionData r in rootConn.ConnectedRegions)
714 {
715 ForwardPermissionRequests(rootConn, r.RegionScene);
716 }
717
718 // Create the root region's Client Event Forwarder
719 rootConn.ClientEventForwarder = new RegionCombinerClientEventForwarder(rootConn);
720
721 // Sets up the CoarseLocationUpdate forwarder for this root region
722 scene.EventManager.OnNewPresence += SetCoarseLocationDelegate;
723
724 // Adds this root region to a dictionary of regions that are connectable
725 m_regions.Add(scene.RegionInfo.originRegionID, rootConn);
726 }
727 }
728
729 private void SetCoarseLocationDelegate(ScenePresence presence)
730 {
731 presence.SetSendCoarseLocationMethod(SendCoarseLocationUpdates);
732 }
733
734 // This delegate was refactored for non-combined regions.
735 // This combined region version will not use the pre-compiled lists of locations and ids
736 private void SendCoarseLocationUpdates(UUID sceneId, ScenePresence presence, List<Vector3> coarseLocations, List<UUID> avatarUUIDs)
737 {
738 RegionConnections connectiondata = null;
739 lock (m_regions)
740 {
741 if (m_regions.ContainsKey(sceneId))
742 connectiondata = m_regions[sceneId];
743 else
744 return;
745 }
746
747 List<Vector3> CoarseLocations = new List<Vector3>();
748 List<UUID> AvatarUUIDs = new List<UUID>();
749
750 connectiondata.RegionScene.ForEachRootScenePresence(delegate(ScenePresence sp)
751 {
752 if (sp.UUID != presence.UUID)
753 {
754 CoarseLocations.Add(sp.AbsolutePosition);
755 AvatarUUIDs.Add(sp.UUID);
756 }
757 });
758
759 DistributeCoarseLocationUpdates(CoarseLocations, AvatarUUIDs, connectiondata, presence);
760 }
761
762 private void DistributeCoarseLocationUpdates(List<Vector3> locations, List<UUID> uuids,
763 RegionConnections connectiondata, ScenePresence rootPresence)
764 {
765 RegionData[] rdata = connectiondata.ConnectedRegions.ToArray();
766 //List<IClientAPI> clients = new List<IClientAPI>();
767 Dictionary<Vector2, RegionCoarseLocationStruct> updates = new Dictionary<Vector2, RegionCoarseLocationStruct>();
768
769 // Root Region entry
770 RegionCoarseLocationStruct rootupdatedata = new RegionCoarseLocationStruct();
771 rootupdatedata.Locations = new List<Vector3>();
772 rootupdatedata.Uuids = new List<UUID>();
773 rootupdatedata.Offset = Vector2.Zero;
774
775 rootupdatedata.UserAPI = rootPresence.ControllingClient;
776
777 if (rootupdatedata.UserAPI != null)
778 updates.Add(Vector2.Zero, rootupdatedata);
779
780 //Each Region needs an entry or we will end up with dead minimap dots
781 foreach (RegionData regiondata in rdata)
782 {
783 Vector2 offset = new Vector2(regiondata.Offset.X, regiondata.Offset.Y);
784 RegionCoarseLocationStruct updatedata = new RegionCoarseLocationStruct();
785 updatedata.Locations = new List<Vector3>();
786 updatedata.Uuids = new List<UUID>();
787 updatedata.Offset = offset;
788
789 if (offset == Vector2.Zero)
790 updatedata.UserAPI = rootPresence.ControllingClient;
791 else
792 updatedata.UserAPI = LocateUsersChildAgentIClientAPI(offset, rootPresence.UUID, rdata);
793
794 if (updatedata.UserAPI != null)
795 updates.Add(offset, updatedata);
796 }
797
798 // go over the locations and assign them to an IClientAPI
799 for (int i = 0; i < locations.Count; i++)
800 //{locations[i]/(int) Constants.RegionSize;
801 {
802 Vector3 pPosition = new Vector3((int)locations[i].X / (int)Constants.RegionSize,
803 (int)locations[i].Y / (int)Constants.RegionSize, locations[i].Z);
804 Vector2 offset = new Vector2(pPosition.X*(int) Constants.RegionSize,
805 pPosition.Y*(int) Constants.RegionSize);
806
807 if (!updates.ContainsKey(offset))
808 {
809 // This shouldn't happen
810 RegionCoarseLocationStruct updatedata = new RegionCoarseLocationStruct();
811 updatedata.Locations = new List<Vector3>();
812 updatedata.Uuids = new List<UUID>();
813 updatedata.Offset = offset;
814
815 if (offset == Vector2.Zero)
816 updatedata.UserAPI = rootPresence.ControllingClient;
817 else
818 updatedata.UserAPI = LocateUsersChildAgentIClientAPI(offset, rootPresence.UUID, rdata);
819
820 updates.Add(offset,updatedata);
821 }
822
823 updates[offset].Locations.Add(locations[i]);
824 updates[offset].Uuids.Add(uuids[i]);
825 }
826
827 // Send out the CoarseLocationupdates from their respective client connection based on where the avatar is
828 foreach (Vector2 offset in updates.Keys)
829 {
830 if (updates[offset].UserAPI != null)
831 {
832 updates[offset].UserAPI.SendCoarseLocationUpdate(updates[offset].Uuids,updates[offset].Locations);
833 }
834 }
835 }
836
837 /// <summary>
838 /// Locates a the Client of a particular region in an Array of RegionData based on offset
839 /// </summary>
840 /// <param name="offset"></param>
841 /// <param name="uUID"></param>
842 /// <param name="rdata"></param>
843 /// <returns>IClientAPI or null</returns>
844 private IClientAPI LocateUsersChildAgentIClientAPI(Vector2 offset, UUID uUID, RegionData[] rdata)
845 {
846 IClientAPI returnclient = null;
847 foreach (RegionData r in rdata)
848 {
849 if (r.Offset.X == offset.X && r.Offset.Y == offset.Y)
850 {
851 return r.RegionScene.SceneGraph.GetControllingClient(uUID);
852 }
853 }
854
855 return returnclient;
856 }
857
858 public void PostInitialise()
859 {
860 }
861
862// /// <summary>
863// /// TODO:
864// /// </summary>
865// /// <param name="rdata"></param>
866// public void UnCombineRegion(RegionData rdata)
867// {
868// lock (m_regions)
869// {
870// if (m_regions.ContainsKey(rdata.RegionId))
871// {
872// // uncombine root region and virtual regions
873// }
874// else
875// {
876// foreach (RegionConnections r in m_regions.Values)
877// {
878// foreach (RegionData rd in r.ConnectedRegions)
879// {
880// if (rd.RegionId == rdata.RegionId)
881// {
882// // uncombine virtual region
883// }
884// }
885// }
886// }
887// }
888// }
889
890 // Create a set of infinite borders around the whole aabb of the combined island.
891 private void AdjustLargeRegionBounds()
892 {
893 lock (m_regions)
894 {
895 foreach (RegionConnections rconn in m_regions.Values)
896 {
897 Vector3 offset = Vector3.Zero;
898 rconn.RegionScene.BordersLocked = true;
899 foreach (RegionData rdata in rconn.ConnectedRegions)
900 {
901 if (rdata.Offset.X > offset.X) offset.X = rdata.Offset.X;
902 if (rdata.Offset.Y > offset.Y) offset.Y = rdata.Offset.Y;
903 }
904
905 lock (rconn.RegionScene.NorthBorders)
906 {
907 Border northBorder = null;
908 // If we don't already have an infinite border, create one.
909 if (!TryGetInfiniteBorder(rconn.RegionScene.NorthBorders, out northBorder))
910 {
911 northBorder = new Border();
912 rconn.RegionScene.NorthBorders.Add(northBorder);
913 }
914
915 northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue,
916 offset.Y + (int) Constants.RegionSize); //<---
917 northBorder.CrossDirection = Cardinals.N;
918 }
919
920 lock (rconn.RegionScene.SouthBorders)
921 {
922 Border southBorder = null;
923 // If we don't already have an infinite border, create one.
924 if (!TryGetInfiniteBorder(rconn.RegionScene.SouthBorders, out southBorder))
925 {
926 southBorder = new Border();
927 rconn.RegionScene.SouthBorders.Add(southBorder);
928 }
929 southBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, 0); //--->
930 southBorder.CrossDirection = Cardinals.S;
931 }
932
933 lock (rconn.RegionScene.EastBorders)
934 {
935 Border eastBorder = null;
936 // If we don't already have an infinite border, create one.
937 if (!TryGetInfiniteBorder(rconn.RegionScene.EastBorders, out eastBorder))
938 {
939 eastBorder = new Border();
940 rconn.RegionScene.EastBorders.Add(eastBorder);
941 }
942 eastBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, offset.X + (int)Constants.RegionSize);
943 //<---
944 eastBorder.CrossDirection = Cardinals.E;
945 }
946
947 lock (rconn.RegionScene.WestBorders)
948 {
949 Border westBorder = null;
950 // If we don't already have an infinite border, create one.
951 if (!TryGetInfiniteBorder(rconn.RegionScene.WestBorders, out westBorder))
952 {
953 westBorder = new Border();
954 rconn.RegionScene.WestBorders.Add(westBorder);
955
956 }
957 westBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, 0); //--->
958 westBorder.CrossDirection = Cardinals.W;
959 }
960
961 rconn.RegionScene.BordersLocked = false;
962 }
963 }
964 }
965
966 /// <summary>
967 /// Try and get an Infinite border out of a listT of borders
968 /// </summary>
969 /// <param name="borders"></param>
970 /// <param name="oborder"></param>
971 /// <returns></returns>
972 public static bool TryGetInfiniteBorder(List<Border> borders, out Border oborder)
973 {
974 // Warning! Should be locked before getting here!
975 foreach (Border b in borders)
976 {
977 if (b.BorderLine.X == float.MinValue && b.BorderLine.Y == float.MaxValue)
978 {
979 oborder = b;
980 return true;
981 }
982 }
983
984 oborder = null;
985 return false;
986 }
987
988 public RegionData GetRegionFromPosition(Vector3 pPosition)
989 {
990 pPosition = pPosition/(int) Constants.RegionSize;
991 int OffsetX = (int) pPosition.X;
992 int OffsetY = (int) pPosition.Y;
993
994 lock (m_regions)
995 {
996 foreach (RegionConnections regConn in m_regions.Values)
997 {
998 foreach (RegionData reg in regConn.ConnectedRegions)
999 {
1000 if (reg.Offset.X == OffsetX && reg.Offset.Y == OffsetY)
1001 return reg;
1002 }
1003 }
1004 }
1005
1006 return new RegionData();
1007 }
1008
1009 public void ForwardPermissionRequests(RegionConnections BigRegion, Scene VirtualRegion)
1010 {
1011 if (BigRegion.PermissionModule == null)
1012 BigRegion.PermissionModule = new RegionCombinerPermissionModule(BigRegion.RegionScene);
1013
1014 VirtualRegion.Permissions.OnBypassPermissions += BigRegion.PermissionModule.BypassPermissions;
1015 VirtualRegion.Permissions.OnSetBypassPermissions += BigRegion.PermissionModule.SetBypassPermissions;
1016 VirtualRegion.Permissions.OnPropagatePermissions += BigRegion.PermissionModule.PropagatePermissions;
1017 VirtualRegion.Permissions.OnGenerateClientFlags += BigRegion.PermissionModule.GenerateClientFlags;
1018 VirtualRegion.Permissions.OnAbandonParcel += BigRegion.PermissionModule.CanAbandonParcel;
1019 VirtualRegion.Permissions.OnReclaimParcel += BigRegion.PermissionModule.CanReclaimParcel;
1020 VirtualRegion.Permissions.OnDeedParcel += BigRegion.PermissionModule.CanDeedParcel;
1021 VirtualRegion.Permissions.OnDeedObject += BigRegion.PermissionModule.CanDeedObject;
1022 VirtualRegion.Permissions.OnIsGod += BigRegion.PermissionModule.IsGod;
1023 VirtualRegion.Permissions.OnDuplicateObject += BigRegion.PermissionModule.CanDuplicateObject;
1024 VirtualRegion.Permissions.OnDeleteObject += BigRegion.PermissionModule.CanDeleteObject; //MAYBE FULLY IMPLEMENTED
1025 VirtualRegion.Permissions.OnEditObject += BigRegion.PermissionModule.CanEditObject; //MAYBE FULLY IMPLEMENTED
1026 VirtualRegion.Permissions.OnEditParcelProperties += BigRegion.PermissionModule.CanEditParcelProperties; //MAYBE FULLY IMPLEMENTED
1027 VirtualRegion.Permissions.OnInstantMessage += BigRegion.PermissionModule.CanInstantMessage;
1028 VirtualRegion.Permissions.OnInventoryTransfer += BigRegion.PermissionModule.CanInventoryTransfer; //NOT YET IMPLEMENTED
1029 VirtualRegion.Permissions.OnIssueEstateCommand += BigRegion.PermissionModule.CanIssueEstateCommand; //FULLY IMPLEMENTED
1030 VirtualRegion.Permissions.OnMoveObject += BigRegion.PermissionModule.CanMoveObject; //MAYBE FULLY IMPLEMENTED
1031 VirtualRegion.Permissions.OnObjectEntry += BigRegion.PermissionModule.CanObjectEntry;
1032 VirtualRegion.Permissions.OnReturnObjects += BigRegion.PermissionModule.CanReturnObjects; //NOT YET IMPLEMENTED
1033 VirtualRegion.Permissions.OnRezObject += BigRegion.PermissionModule.CanRezObject; //MAYBE FULLY IMPLEMENTED
1034 VirtualRegion.Permissions.OnRunConsoleCommand += BigRegion.PermissionModule.CanRunConsoleCommand;
1035 VirtualRegion.Permissions.OnRunScript += BigRegion.PermissionModule.CanRunScript; //NOT YET IMPLEMENTED
1036 VirtualRegion.Permissions.OnCompileScript += BigRegion.PermissionModule.CanCompileScript;
1037 VirtualRegion.Permissions.OnSellParcel += BigRegion.PermissionModule.CanSellParcel;
1038 VirtualRegion.Permissions.OnTakeObject += BigRegion.PermissionModule.CanTakeObject;
1039 VirtualRegion.Permissions.OnTakeCopyObject += BigRegion.PermissionModule.CanTakeCopyObject;
1040 VirtualRegion.Permissions.OnTerraformLand += BigRegion.PermissionModule.CanTerraformLand;
1041 VirtualRegion.Permissions.OnLinkObject += BigRegion.PermissionModule.CanLinkObject; //NOT YET IMPLEMENTED
1042 VirtualRegion.Permissions.OnDelinkObject += BigRegion.PermissionModule.CanDelinkObject; //NOT YET IMPLEMENTED
1043 VirtualRegion.Permissions.OnBuyLand += BigRegion.PermissionModule.CanBuyLand; //NOT YET IMPLEMENTED
1044 VirtualRegion.Permissions.OnViewNotecard += BigRegion.PermissionModule.CanViewNotecard; //NOT YET IMPLEMENTED
1045 VirtualRegion.Permissions.OnViewScript += BigRegion.PermissionModule.CanViewScript; //NOT YET IMPLEMENTED
1046 VirtualRegion.Permissions.OnEditNotecard += BigRegion.PermissionModule.CanEditNotecard; //NOT YET IMPLEMENTED
1047 VirtualRegion.Permissions.OnEditScript += BigRegion.PermissionModule.CanEditScript; //NOT YET IMPLEMENTED
1048 VirtualRegion.Permissions.OnCreateObjectInventory += BigRegion.PermissionModule.CanCreateObjectInventory; //NOT IMPLEMENTED HERE
1049 VirtualRegion.Permissions.OnEditObjectInventory += BigRegion.PermissionModule.CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED
1050 VirtualRegion.Permissions.OnCopyObjectInventory += BigRegion.PermissionModule.CanCopyObjectInventory; //NOT YET IMPLEMENTED
1051 VirtualRegion.Permissions.OnDeleteObjectInventory += BigRegion.PermissionModule.CanDeleteObjectInventory; //NOT YET IMPLEMENTED
1052 VirtualRegion.Permissions.OnResetScript += BigRegion.PermissionModule.CanResetScript;
1053 VirtualRegion.Permissions.OnCreateUserInventory += BigRegion.PermissionModule.CanCreateUserInventory; //NOT YET IMPLEMENTED
1054 VirtualRegion.Permissions.OnCopyUserInventory += BigRegion.PermissionModule.CanCopyUserInventory; //NOT YET IMPLEMENTED
1055 VirtualRegion.Permissions.OnEditUserInventory += BigRegion.PermissionModule.CanEditUserInventory; //NOT YET IMPLEMENTED
1056 VirtualRegion.Permissions.OnDeleteUserInventory += BigRegion.PermissionModule.CanDeleteUserInventory; //NOT YET IMPLEMENTED
1057 VirtualRegion.Permissions.OnTeleport += BigRegion.PermissionModule.CanTeleport; //NOT YET IMPLEMENTED
1058 }
1059
1060 #region console commands
1061
1062 public void FixPhantoms(string module, string[] cmdparams)
1063 {
1064 List<Scene> scenes = new List<Scene>(m_startingScenes.Values);
1065
1066 foreach (Scene s in scenes)
1067 {
1068 MainConsole.Instance.OutputFormat("Fixing phantoms for {0}", s.RegionInfo.RegionName);
1069
1070 s.ForEachSOG(so => so.AbsolutePosition = so.AbsolutePosition);
1071 }
1072 }
1073
1074 #endregion
1075 }
1076}
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs
deleted file mode 100644
index 7c662c9..0000000
--- a/OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs
+++ /dev/null
@@ -1,270 +0,0 @@
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/RegionCombinerModule/RegionConnections.cs b/OpenSim/Region/RegionCombinerModule/RegionConnections.cs
deleted file mode 100644
index fba51d2..0000000
--- a/OpenSim/Region/RegionCombinerModule/RegionConnections.cs
+++ /dev/null
@@ -1,94 +0,0 @@
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 X * Constants.RegionSize; } }
68
69 /// <summary>
70 /// The Y meters co-ordinate of this connection.
71 /// </summary>
72 public uint PosY { get { return Y * Constants.RegionSize; } }
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/RegionCombinerModule/RegionCourseLocation.cs b/OpenSim/Region/RegionCombinerModule/RegionCourseLocation.cs
deleted file mode 100644
index 224ac99..0000000
--- a/OpenSim/Region/RegionCombinerModule/RegionCourseLocation.cs
+++ /dev/null
@@ -1,43 +0,0 @@
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/RegionCombinerModule/RegionData.cs b/OpenSim/Region/RegionCombinerModule/RegionData.cs
deleted file mode 100644
index bd0e398..0000000
--- a/OpenSim/Region/RegionCombinerModule/RegionData.cs
+++ /dev/null
@@ -1,39 +0,0 @@
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 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
deleted file mode 100644
index 13cb8b6..0000000
--- a/OpenSim/Region/RegionCombinerModule/Resources/RegionCombinerModule.addin.xml
+++ /dev/null
@@ -1,14 +0,0 @@
1<Addin id="OpenSim.RegionModules.RegionCombinerModule" 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.RegionCombinerModule.RegionCombinerModule" />
12 </Extension>
13
14</Addin>