aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World
diff options
context:
space:
mode:
authorMelanie2011-01-27 05:18:28 +0000
committerMelanie2011-01-27 05:18:28 +0000
commit42c22f41ddfac9777484be136f80de4251ef6d00 (patch)
treeb13c6e256bcc3fb02a4f3f14ec487b6565c08d28 /OpenSim/Region/CoreModules/World
parentAdd a TeleportFlags member to SP so we can tell how we got there. (diff)
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-42c22f41ddfac9777484be136f80de4251ef6d00.zip
opensim-SC_OLD-42c22f41ddfac9777484be136f80de4251ef6d00.tar.gz
opensim-SC_OLD-42c22f41ddfac9777484be136f80de4251ef6d00.tar.bz2
opensim-SC_OLD-42c22f41ddfac9777484be136f80de4251ef6d00.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/CoreModules/World')
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandChannel.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs95
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs40
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;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Diagnostics; 31using System.Diagnostics;
32using System.Reflection; 32using System.Reflection;
33using System.Text;
33using log4net; 34using log4net;
34using Nini.Config; 35using Nini.Config;
35using OpenMetaverse; 36using OpenMetaverse;
@@ -37,19 +38,22 @@ using OpenMetaverse.StructuredData;
37using OpenMetaverse.Messages.Linden; 38using OpenMetaverse.Messages.Linden;
38using OpenSim.Framework; 39using OpenSim.Framework;
39using OpenSim.Framework.Capabilities; 40using OpenSim.Framework.Capabilities;
41using OpenSim.Framework.Console;
40using OpenSim.Framework.Servers; 42using OpenSim.Framework.Servers;
41using OpenSim.Framework.Servers.HttpServer; 43using OpenSim.Framework.Servers.HttpServer;
42using OpenSim.Services.Interfaces; 44using OpenSim.Region.CoreModules.Framework.InterfaceCommander;
43using OpenSim.Region.Framework.Interfaces; 45using OpenSim.Region.Framework.Interfaces;
44using OpenSim.Region.Framework.Scenes; 46using OpenSim.Region.Framework.Scenes;
45using OpenSim.Region.Physics.Manager; 47using OpenSim.Region.Physics.Manager;
46using Caps=OpenSim.Framework.Capabilities.Caps; 48using OpenSim.Services.Interfaces;
49using Caps = OpenSim.Framework.Capabilities.Caps;
47using GridRegion = OpenSim.Services.Interfaces.GridRegion; 50using GridRegion = OpenSim.Services.Interfaces.GridRegion;
48 51
49namespace OpenSim.Region.CoreModules.World.Land 52namespace 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>