aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-01-26 21:12:41 +0000
committerJustin Clark-Casey (justincc)2011-01-26 21:12:41 +0000
commita0469daf759d09de040aa8b5287fab9a83555cc1 (patch)
tree59e3f732c1f4930d90c2e32ccaca4397513ce06c /OpenSim/Region
parentRemoved a few more spurious appearance saves. When an avatar (diff)
downloadopensim-SC-a0469daf759d09de040aa8b5287fab9a83555cc1.zip
opensim-SC-a0469daf759d09de040aa8b5287fab9a83555cc1.tar.gz
opensim-SC-a0469daf759d09de040aa8b5287fab9a83555cc1.tar.bz2
opensim-SC-a0469daf759d09de040aa8b5287fab9a83555cc1.tar.xz
Implement command "land show". This shows all the parcels on the currently selected region/s
This is useful for diagnostics. The command is "land show" rather than "show land" because it's implemented as a module specific subcommand.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandChannel.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs97
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs40
-rw-r--r--OpenSim/Region/Framework/Interfaces/ILandObject.cs4
4 files changed, 125 insertions, 18 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 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;
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
@@ -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
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 4e1f9c5..b90e307 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>
diff --git a/OpenSim/Region/Framework/Interfaces/ILandObject.cs b/OpenSim/Region/Framework/Interfaces/ILandObject.cs
index 585eb00..b7487e8 100644
--- a/OpenSim/Region/Framework/Interfaces/ILandObject.cs
+++ b/OpenSim/Region/Framework/Interfaces/ILandObject.cs
@@ -43,7 +43,11 @@ namespace OpenSim.Region.Framework.Interfaces
43 LandData LandData { get; set; } 43 LandData LandData { get; set; }
44 bool[,] LandBitmap { get; set; } 44 bool[,] LandBitmap { get; set; }
45 UUID RegionUUID { get; } 45 UUID RegionUUID { get; }
46 Vector3 StartPoint { get; }
47 Vector3 EndPoint { get; }
48
46 bool ContainsPoint(int x, int y); 49 bool ContainsPoint(int x, int y);
50
47 ILandObject Copy(); 51 ILandObject Copy();
48 52
49 void SendLandUpdateToAvatarsOverMe(); 53 void SendLandUpdateToAvatarsOverMe();