diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Land')
3 files changed, 120 insertions, 17 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs index 1ad4db2..9e27ef0 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs | |||
@@ -64,7 +64,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
64 | #endregion | 64 | #endregion |
65 | 65 | ||
66 | private readonly Scene m_scene; | 66 | private readonly Scene m_scene; |
67 | private readonly LandManagementModule m_landManagementModule; | 67 | private readonly LandManagementModule m_landManagementModule; |
68 | 68 | ||
69 | public LandChannel(Scene scene, LandManagementModule landManagementMod) | 69 | public LandChannel(Scene scene, LandManagementModule landManagementMod) |
70 | { | 70 | { |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index d9812df..cb8c5de 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 |
@@ -135,19 +142,27 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
135 | m_scene.EventManager.OnRequestParcelPrimCountUpdate += EventManagerOnRequestParcelPrimCountUpdate; | 142 | m_scene.EventManager.OnRequestParcelPrimCountUpdate += EventManagerOnRequestParcelPrimCountUpdate; |
136 | m_scene.EventManager.OnParcelPrimCountTainted += EventManagerOnParcelPrimCountTainted; | 143 | m_scene.EventManager.OnParcelPrimCountTainted += EventManagerOnParcelPrimCountTainted; |
137 | m_scene.EventManager.OnRegisterCaps += EventManagerOnRegisterCaps; | 144 | m_scene.EventManager.OnRegisterCaps += EventManagerOnRegisterCaps; |
145 | m_scene.EventManager.OnPluginConsole += EventManagerOnPluginConsole; | ||
138 | 146 | ||
139 | lock (m_scene) | 147 | lock (m_scene) |
140 | { | 148 | { |
141 | m_scene.LandChannel = (ILandChannel)landChannel; | 149 | m_scene.LandChannel = (ILandChannel)landChannel; |
142 | } | 150 | } |
151 | |||
152 | InstallInterfaces(); | ||
143 | } | 153 | } |
144 | 154 | ||
145 | public void RegionLoaded(Scene scene) | 155 | public void RegionLoaded(Scene scene) |
146 | { | 156 | { |
157 | m_userManager = m_scene.RequestModuleInterface<IUserManagement>(); | ||
147 | } | 158 | } |
148 | 159 | ||
149 | public void RemoveRegion(Scene scene) | 160 | public void RemoveRegion(Scene scene) |
150 | { | 161 | { |
162 | // TODO: Also release other event manager listeners here | ||
163 | |||
164 | m_scene.EventManager.OnPluginConsole -= EventManagerOnPluginConsole; | ||
165 | m_scene.UnregisterModuleCommander(m_commander.Name); | ||
151 | } | 166 | } |
152 | 167 | ||
153 | // private bool OnVerifyUserConnection(ScenePresence scenePresence, out string reason) | 168 | // private bool OnVerifyUserConnection(ScenePresence scenePresence, out string reason) |
@@ -156,6 +171,29 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
156 | // reason = "You are not allowed to enter this sim."; | 171 | // reason = "You are not allowed to enter this sim."; |
157 | // return nearestParcel != null; | 172 | // return nearestParcel != null; |
158 | // } | 173 | // } |
174 | |||
175 | /// <summary> | ||
176 | /// Processes commandline input. Do not call directly. | ||
177 | /// </summary> | ||
178 | /// <param name="args">Commandline arguments</param> | ||
179 | protected void EventManagerOnPluginConsole(string[] args) | ||
180 | { | ||
181 | if (args[0] == "land") | ||
182 | { | ||
183 | if (args.Length == 1) | ||
184 | { | ||
185 | m_commander.ProcessConsoleCommand("help", new string[0]); | ||
186 | return; | ||
187 | } | ||
188 | |||
189 | string[] tmpArgs = new string[args.Length - 2]; | ||
190 | int i; | ||
191 | for (i = 2; i < args.Length; i++) | ||
192 | tmpArgs[i - 2] = args[i]; | ||
193 | |||
194 | m_commander.ProcessConsoleCommand(args[1], tmpArgs); | ||
195 | } | ||
196 | } | ||
159 | 197 | ||
160 | void EventManagerOnNewClient(IClientAPI client) | 198 | void EventManagerOnNewClient(IClientAPI client) |
161 | { | 199 | { |
@@ -217,11 +255,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
217 | } | 255 | } |
218 | } | 256 | } |
219 | 257 | ||
220 | |||
221 | public void PostInitialise() | ||
222 | { | ||
223 | } | ||
224 | |||
225 | public void Close() | 258 | public void Close() |
226 | { | 259 | { |
227 | } | 260 | } |
@@ -231,11 +264,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
231 | get { return "LandManagementModule"; } | 264 | get { return "LandManagementModule"; } |
232 | } | 265 | } |
233 | 266 | ||
234 | public bool IsSharedModule | ||
235 | { | ||
236 | get { return false; } | ||
237 | } | ||
238 | |||
239 | #endregion | 267 | #endregion |
240 | 268 | ||
241 | #region Parcel Add/Remove/Get/Create | 269 | #region Parcel Add/Remove/Get/Create |
@@ -1932,5 +1960,44 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1932 | } | 1960 | } |
1933 | } | 1961 | } |
1934 | } | 1962 | } |
1963 | |||
1964 | protected void InstallInterfaces() | ||
1965 | { | ||
1966 | Command showCommand = | ||
1967 | new Command("show", CommandIntentions.COMMAND_STATISTICAL, ShowParcelsCommand, "Shows all parcels on the current region."); | ||
1968 | |||
1969 | m_commander.RegisterCommand("show", showCommand); | ||
1970 | |||
1971 | // Add this to our scene so scripts can call these functions | ||
1972 | m_scene.RegisterModuleCommander(m_commander); | ||
1973 | } | ||
1974 | |||
1975 | protected void ShowParcelsCommand(Object[] args) | ||
1976 | { | ||
1977 | StringBuilder report = new StringBuilder(); | ||
1978 | |||
1979 | report.AppendFormat("Land information for {0}\n", m_scene.RegionInfo.RegionName); | ||
1980 | report.AppendFormat( | ||
1981 | "{0,-20} {1,-9} {2,-18} {3,-18} {4,-20}\n", | ||
1982 | "Parcel Name", | ||
1983 | "Area", | ||
1984 | "Starts", | ||
1985 | "Ends", | ||
1986 | "Owner"); | ||
1987 | |||
1988 | lock (m_landList) | ||
1989 | { | ||
1990 | foreach (ILandObject lo in m_landList.Values) | ||
1991 | { | ||
1992 | LandData ld = lo.LandData; | ||
1993 | |||
1994 | report.AppendFormat( | ||
1995 | "{0,-20} {1,-9} {2,-18} {3,-18} {4,-20}\n", | ||
1996 | ld.Name, ld.Area, lo.StartPoint, lo.EndPoint, m_userManager.GetUserName(ld.OwnerID)); | ||
1997 | } | ||
1998 | } | ||
1999 | |||
2000 | MainConsole.Instance.Output(report.ToString()); | ||
2001 | } | ||
1935 | } | 2002 | } |
1936 | } | 2003 | } |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index a00b6b2..7723eb4 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs | |||
@@ -77,7 +77,43 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
77 | { | 77 | { |
78 | get { return m_scene.RegionInfo.RegionID; } | 78 | get { return m_scene.RegionInfo.RegionID; } |
79 | } | 79 | } |
80 | 80 | ||
81 | public Vector3 StartPoint | ||
82 | { | ||
83 | get | ||
84 | { | ||
85 | for (int y = 0; y < landArrayMax; y++) | ||
86 | { | ||
87 | for (int x = 0; x < landArrayMax; x++) | ||
88 | { | ||
89 | if (LandBitmap[x, y]) | ||
90 | return new Vector3(x * 4, y * 4, 0); | ||
91 | } | ||
92 | } | ||
93 | |||
94 | return new Vector3(-1, -1, -1); | ||
95 | } | ||
96 | } | ||
97 | |||
98 | public Vector3 EndPoint | ||
99 | { | ||
100 | get | ||
101 | { | ||
102 | for (int y = landArrayMax - 1; y >= 0; y--) | ||
103 | { | ||
104 | for (int x = landArrayMax - 1; x >= 0; x--) | ||
105 | { | ||
106 | if (LandBitmap[x, y]) | ||
107 | { | ||
108 | return new Vector3(x * 4, y * 4, 0); | ||
109 | } | ||
110 | } | ||
111 | } | ||
112 | |||
113 | return new Vector3(-1, -1, -1); | ||
114 | } | ||
115 | } | ||
116 | |||
81 | #region Constructors | 117 | #region Constructors |
82 | 118 | ||
83 | public LandObject(UUID owner_id, bool is_group_owned, Scene scene) | 119 | public LandObject(UUID owner_id, bool is_group_owned, Scene scene) |
@@ -96,7 +132,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
96 | #region Member Functions | 132 | #region Member Functions |
97 | 133 | ||
98 | #region General Functions | 134 | #region General Functions |
99 | 135 | ||
100 | /// <summary> | 136 | /// <summary> |
101 | /// Checks to see if this land object contains a point | 137 | /// Checks to see if this land object contains a point |
102 | /// </summary> | 138 | /// </summary> |