diff options
author | BlueWall | 2011-01-27 08:53:57 -0500 |
---|---|---|
committer | BlueWall | 2011-01-27 08:53:57 -0500 |
commit | d89d9d1b1310d494fbb7712057eab8a196e10a04 (patch) | |
tree | 62834b7f5954aa8f013a159ee2fc3ccee385e673 /OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |
parent | Make FireAndForgetWrapper a singleton class (diff) | |
parent | Make it work (diff) | |
download | opensim-SC_OLD-d89d9d1b1310d494fbb7712057eab8a196e10a04.zip opensim-SC_OLD-d89d9d1b1310d494fbb7712057eab8a196e10a04.tar.gz opensim-SC_OLD-d89d9d1b1310d494fbb7712057eab8a196e10a04.tar.bz2 opensim-SC_OLD-d89d9d1b1310d494fbb7712057eab8a196e10a04.tar.xz |
Merge branch 'master' of /home/opensim/src/OpenSim/Core
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | 97 |
1 files changed, 82 insertions, 15 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 4f8e205..70767f7 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -30,6 +30,7 @@ using System.Collections; | |||
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Diagnostics; | 31 | using System.Diagnostics; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using System.Text; | ||
33 | using log4net; | 34 | using log4net; |
34 | using Nini.Config; | 35 | using Nini.Config; |
35 | using OpenMetaverse; | 36 | using OpenMetaverse; |
@@ -37,19 +38,22 @@ using OpenMetaverse.StructuredData; | |||
37 | using OpenMetaverse.Messages.Linden; | 38 | using OpenMetaverse.Messages.Linden; |
38 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
39 | using OpenSim.Framework.Capabilities; | 40 | using OpenSim.Framework.Capabilities; |
41 | using OpenSim.Framework.Console; | ||
40 | using OpenSim.Framework.Servers; | 42 | using OpenSim.Framework.Servers; |
41 | using OpenSim.Framework.Servers.HttpServer; | 43 | using OpenSim.Framework.Servers.HttpServer; |
42 | using OpenSim.Services.Interfaces; | 44 | using OpenSim.Region.CoreModules.Framework.InterfaceCommander; |
43 | using OpenSim.Region.Framework.Interfaces; | 45 | using OpenSim.Region.Framework.Interfaces; |
44 | using OpenSim.Region.Framework.Scenes; | 46 | using OpenSim.Region.Framework.Scenes; |
45 | using OpenSim.Region.Physics.Manager; | 47 | using OpenSim.Region.Physics.Manager; |
46 | using Caps=OpenSim.Framework.Capabilities.Caps; | 48 | using OpenSim.Services.Interfaces; |
49 | using Caps = OpenSim.Framework.Capabilities.Caps; | ||
47 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 50 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
48 | 51 | ||
49 | namespace OpenSim.Region.CoreModules.World.Land | 52 | namespace OpenSim.Region.CoreModules.World.Land |
50 | { | 53 | { |
51 | // used for caching | 54 | // used for caching |
52 | internal class ExtendedLandData { | 55 | internal class ExtendedLandData |
56 | { | ||
53 | public LandData LandData; | 57 | public LandData LandData; |
54 | public ulong RegionHandle; | 58 | public ulong RegionHandle; |
55 | public uint X, Y; | 59 | public uint X, Y; |
@@ -65,6 +69,9 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
65 | 69 | ||
66 | private LandChannel landChannel; | 70 | private LandChannel landChannel; |
67 | private Scene m_scene; | 71 | private Scene m_scene; |
72 | protected Commander m_commander = new Commander("land"); | ||
73 | |||
74 | protected IUserManagement m_userManager; | ||
68 | 75 | ||
69 | // Minimum for parcels to work is 64m even if we don't actually use them. | 76 | // Minimum for parcels to work is 64m even if we don't actually use them. |
70 | #pragma warning disable 0429 | 77 | #pragma warning disable 0429 |
@@ -127,19 +134,27 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
127 | m_scene.EventManager.OnRequestParcelPrimCountUpdate += EventManagerOnRequestParcelPrimCountUpdate; | 134 | m_scene.EventManager.OnRequestParcelPrimCountUpdate += EventManagerOnRequestParcelPrimCountUpdate; |
128 | m_scene.EventManager.OnParcelPrimCountTainted += EventManagerOnParcelPrimCountTainted; | 135 | m_scene.EventManager.OnParcelPrimCountTainted += EventManagerOnParcelPrimCountTainted; |
129 | m_scene.EventManager.OnRegisterCaps += EventManagerOnRegisterCaps; | 136 | m_scene.EventManager.OnRegisterCaps += EventManagerOnRegisterCaps; |
137 | m_scene.EventManager.OnPluginConsole += EventManagerOnPluginConsole; | ||
130 | 138 | ||
131 | lock (m_scene) | 139 | lock (m_scene) |
132 | { | 140 | { |
133 | m_scene.LandChannel = (ILandChannel)landChannel; | 141 | m_scene.LandChannel = (ILandChannel)landChannel; |
134 | } | 142 | } |
143 | |||
144 | InstallInterfaces(); | ||
135 | } | 145 | } |
136 | 146 | ||
137 | public void RegionLoaded(Scene scene) | 147 | public void RegionLoaded(Scene scene) |
138 | { | 148 | { |
149 | m_userManager = m_scene.RequestModuleInterface<IUserManagement>(); | ||
139 | } | 150 | } |
140 | 151 | ||
141 | public void RemoveRegion(Scene scene) | 152 | public void RemoveRegion(Scene scene) |
142 | { | 153 | { |
154 | // TODO: Also release other event manager listeners here | ||
155 | |||
156 | m_scene.EventManager.OnPluginConsole -= EventManagerOnPluginConsole; | ||
157 | m_scene.UnregisterModuleCommander(m_commander.Name); | ||
143 | } | 158 | } |
144 | 159 | ||
145 | // private bool OnVerifyUserConnection(ScenePresence scenePresence, out string reason) | 160 | // private bool OnVerifyUserConnection(ScenePresence scenePresence, out string reason) |
@@ -148,6 +163,29 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
148 | // reason = "You are not allowed to enter this sim."; | 163 | // reason = "You are not allowed to enter this sim."; |
149 | // return nearestParcel != null; | 164 | // return nearestParcel != null; |
150 | // } | 165 | // } |
166 | |||
167 | /// <summary> | ||
168 | /// Processes commandline input. Do not call directly. | ||
169 | /// </summary> | ||
170 | /// <param name="args">Commandline arguments</param> | ||
171 | protected void EventManagerOnPluginConsole(string[] args) | ||
172 | { | ||
173 | if (args[0] == "land") | ||
174 | { | ||
175 | if (args.Length == 1) | ||
176 | { | ||
177 | m_commander.ProcessConsoleCommand("help", new string[0]); | ||
178 | return; | ||
179 | } | ||
180 | |||
181 | string[] tmpArgs = new string[args.Length - 2]; | ||
182 | int i; | ||
183 | for (i = 2; i < args.Length; i++) | ||
184 | tmpArgs[i - 2] = args[i]; | ||
185 | |||
186 | m_commander.ProcessConsoleCommand(args[1], tmpArgs); | ||
187 | } | ||
188 | } | ||
151 | 189 | ||
152 | void EventManagerOnNewClient(IClientAPI client) | 190 | void EventManagerOnNewClient(IClientAPI client) |
153 | { | 191 | { |
@@ -209,11 +247,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
209 | } | 247 | } |
210 | } | 248 | } |
211 | 249 | ||
212 | |||
213 | public void PostInitialise() | ||
214 | { | ||
215 | } | ||
216 | |||
217 | public void Close() | 250 | public void Close() |
218 | { | 251 | { |
219 | } | 252 | } |
@@ -223,11 +256,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
223 | get { return "LandManagementModule"; } | 256 | get { return "LandManagementModule"; } |
224 | } | 257 | } |
225 | 258 | ||
226 | public bool IsSharedModule | ||
227 | { | ||
228 | get { return false; } | ||
229 | } | ||
230 | |||
231 | #endregion | 259 | #endregion |
232 | 260 | ||
233 | #region Parcel Add/Remove/Get/Create | 261 | #region Parcel Add/Remove/Get/Create |
@@ -1591,5 +1619,44 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1591 | 1619 | ||
1592 | UpdateLandObject(localID, land.LandData); | 1620 | UpdateLandObject(localID, land.LandData); |
1593 | } | 1621 | } |
1622 | |||
1623 | protected void InstallInterfaces() | ||
1624 | { | ||
1625 | Command showCommand = | ||
1626 | new Command("show", CommandIntentions.COMMAND_STATISTICAL, ShowParcelsCommand, "Shows all parcels on the current region."); | ||
1627 | |||
1628 | m_commander.RegisterCommand("show", showCommand); | ||
1629 | |||
1630 | // Add this to our scene so scripts can call these functions | ||
1631 | m_scene.RegisterModuleCommander(m_commander); | ||
1632 | } | ||
1633 | |||
1634 | protected void ShowParcelsCommand(Object[] args) | ||
1635 | { | ||
1636 | StringBuilder report = new StringBuilder(); | ||
1637 | |||
1638 | report.AppendFormat("Land information for {0}\n", m_scene.RegionInfo.RegionName); | ||
1639 | report.AppendFormat( | ||
1640 | "{0,-20} {1,-9} {2,-18} {3,-18} {4,-20}\n", | ||
1641 | "Parcel Name", | ||
1642 | "Area", | ||
1643 | "Starts", | ||
1644 | "Ends", | ||
1645 | "Owner"); | ||
1646 | |||
1647 | lock (m_landList) | ||
1648 | { | ||
1649 | foreach (ILandObject lo in m_landList.Values) | ||
1650 | { | ||
1651 | LandData ld = lo.LandData; | ||
1652 | |||
1653 | report.AppendFormat( | ||
1654 | "{0,-20} {1,-9} {2,-18} {3,-18} {4,-20}\n", | ||
1655 | ld.Name, ld.Area, lo.StartPoint, lo.EndPoint, m_userManager.GetUserName(ld.OwnerID)); | ||
1656 | } | ||
1657 | } | ||
1658 | |||
1659 | MainConsole.Instance.Output(report.ToString()); | ||
1660 | } | ||
1594 | } | 1661 | } |
1595 | } | 1662 | } \ No newline at end of file |