aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs180
1 files changed, 126 insertions, 54 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 1789d6d..73c4d6c 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -42,7 +42,6 @@ using OpenSim.Framework.Capabilities;
42using OpenSim.Framework.Console; 42using OpenSim.Framework.Console;
43using OpenSim.Framework.Servers; 43using OpenSim.Framework.Servers;
44using OpenSim.Framework.Servers.HttpServer; 44using OpenSim.Framework.Servers.HttpServer;
45using OpenSim.Region.CoreModules.Framework.InterfaceCommander;
46using OpenSim.Region.Framework.Interfaces; 45using OpenSim.Region.Framework.Interfaces;
47using OpenSim.Region.Framework.Scenes; 46using OpenSim.Region.Framework.Scenes;
48using OpenSim.Region.Physics.Manager; 47using OpenSim.Region.Physics.Manager;
@@ -70,7 +69,6 @@ namespace OpenSim.Region.CoreModules.World.Land
70 69
71 private LandChannel landChannel; 70 private LandChannel landChannel;
72 private Scene m_scene; 71 private Scene m_scene;
73 protected Commander m_commander = new Commander("land");
74 72
75 protected IUserManagement m_userManager; 73 protected IUserManagement m_userManager;
76 protected IPrimCountModule m_primCountModule; 74 protected IPrimCountModule m_primCountModule;
@@ -140,14 +138,13 @@ namespace OpenSim.Region.CoreModules.World.Land
140 m_scene.EventManager.OnIncomingLandDataFromStorage += EventManagerOnIncomingLandDataFromStorage; 138 m_scene.EventManager.OnIncomingLandDataFromStorage += EventManagerOnIncomingLandDataFromStorage;
141 m_scene.EventManager.OnSetAllowForcefulBan += EventManagerOnSetAllowedForcefulBan; 139 m_scene.EventManager.OnSetAllowForcefulBan += EventManagerOnSetAllowedForcefulBan;
142 m_scene.EventManager.OnRegisterCaps += EventManagerOnRegisterCaps; 140 m_scene.EventManager.OnRegisterCaps += EventManagerOnRegisterCaps;
143 m_scene.EventManager.OnPluginConsole += EventManagerOnPluginConsole;
144 141
145 lock (m_scene) 142 lock (m_scene)
146 { 143 {
147 m_scene.LandChannel = (ILandChannel)landChannel; 144 m_scene.LandChannel = (ILandChannel)landChannel;
148 } 145 }
149 146
150 InstallInterfaces(); 147 RegisterCommands();
151 } 148 }
152 149
153 public void RegionLoaded(Scene scene) 150 public void RegionLoaded(Scene scene)
@@ -159,10 +156,7 @@ namespace OpenSim.Region.CoreModules.World.Land
159 156
160 public void RemoveRegion(Scene scene) 157 public void RemoveRegion(Scene scene)
161 { 158 {
162 // TODO: Also release other event manager listeners here 159 // TODO: Release event manager listeners here
163
164 m_scene.EventManager.OnPluginConsole -= EventManagerOnPluginConsole;
165 m_scene.UnregisterModuleCommander(m_commander.Name);
166 } 160 }
167 161
168// private bool OnVerifyUserConnection(ScenePresence scenePresence, out string reason) 162// private bool OnVerifyUserConnection(ScenePresence scenePresence, out string reason)
@@ -170,30 +164,7 @@ namespace OpenSim.Region.CoreModules.World.Land
170// ILandObject nearestParcel = m_scene.GetNearestAllowedParcel(scenePresence.UUID, scenePresence.AbsolutePosition.X, scenePresence.AbsolutePosition.Y); 164// ILandObject nearestParcel = m_scene.GetNearestAllowedParcel(scenePresence.UUID, scenePresence.AbsolutePosition.X, scenePresence.AbsolutePosition.Y);
171// reason = "You are not allowed to enter this sim."; 165// reason = "You are not allowed to enter this sim.";
172// return nearestParcel != null; 166// return nearestParcel != null;
173// } 167// }
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 }
197 168
198 void EventManagerOnNewClient(IClientAPI client) 169 void EventManagerOnNewClient(IClientAPI client)
199 { 170 {
@@ -1872,44 +1843,84 @@ namespace OpenSim.Region.CoreModules.World.Land
1872 m_Dialog.SendAlertToUser(remoteClient, "You are not allowed to set your home location in this parcel."); 1843 m_Dialog.SendAlertToUser(remoteClient, "You are not allowed to set your home location in this parcel.");
1873 } 1844 }
1874 1845
1875 1846 protected void RegisterCommands()
1876 protected void InstallInterfaces()
1877 { 1847 {
1878 Command clearCommand 1848 ICommands commands = MainConsole.Instance.Commands;
1879 = new Command("clear", CommandIntentions.COMMAND_HAZARDOUS, ClearCommand, "Clears all the parcels from the region.");
1880 Command showCommand
1881 = new Command("show", CommandIntentions.COMMAND_STATISTICAL, ShowParcelsCommand, "Shows all parcels on the region.");
1882 1849
1883 m_commander.RegisterCommand("clear", clearCommand); 1850 commands.AddCommand(
1884 m_commander.RegisterCommand("show", showCommand); 1851 "Land", false, "land clear",
1852 "land clear",
1853 "Clear all the parcels from the region.",
1854 "Command will ask for confirmation before proceeding.",
1855 HandleClearCommand);
1885 1856
1886 // Add this to our scene so scripts can call these functions 1857 commands.AddCommand(
1887 m_scene.RegisterModuleCommander(m_commander); 1858 "Land", false, "land show",
1859 "land show [<local-land-id>]",
1860 "Show information about the parcels on the region.",
1861 "If no local land ID is given, then summary information about all the parcels is shown.\n"
1862 + "If a local land ID is given then full information about that parcel is shown.",
1863 HandleShowCommand);
1888 } 1864 }
1889 1865
1890 protected void ClearCommand(Object[] args) 1866 protected void HandleClearCommand(string module, string[] args)
1891 { 1867 {
1868 if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_scene))
1869 return;
1870
1892 string response = MainConsole.Instance.CmdPrompt( 1871 string response = MainConsole.Instance.CmdPrompt(
1893 string.Format( 1872 string.Format(
1894 "Are you sure that you want to clear all land parcels from {0} (y or n)", 1873 "Are you sure that you want to clear all land parcels from {0} (y or n)", m_scene.Name),
1895 m_scene.RegionInfo.RegionName),
1896 "n"); 1874 "n");
1897 1875
1898 if (response.ToLower() == "y") 1876 if (response.ToLower() == "y")
1899 { 1877 {
1900 Clear(true); 1878 Clear(true);
1901 MainConsole.Instance.OutputFormat("Cleared all parcels from {0}", m_scene.RegionInfo.RegionName); 1879 MainConsole.Instance.OutputFormat("Cleared all parcels from {0}", m_scene.Name);
1902 } 1880 }
1903 else 1881 else
1904 { 1882 {
1905 MainConsole.Instance.OutputFormat("Aborting clear of all parcels from {0}", m_scene.RegionInfo.RegionName); 1883 MainConsole.Instance.OutputFormat("Aborting clear of all parcels from {0}", m_scene.Name);
1906 } 1884 }
1907 } 1885 }
1908 1886
1909 protected void ShowParcelsCommand(Object[] args) 1887 protected void HandleShowCommand(string module, string[] args)
1910 { 1888 {
1911 StringBuilder report = new StringBuilder(); 1889 if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_scene))
1912 1890 return;
1891
1892 StringBuilder report = new StringBuilder();
1893
1894 if (args.Length <= 2)
1895 {
1896 AppendParcelsSummaryReport(report);
1897 }
1898 else
1899 {
1900 int landLocalId;
1901
1902 if (!ConsoleUtil.TryParseConsoleInt(MainConsole.Instance, args[2], out landLocalId))
1903 return;
1904
1905 ILandObject lo;
1906
1907 lock (m_landList)
1908 {
1909 if (!m_landList.TryGetValue(landLocalId, out lo))
1910 {
1911 MainConsole.Instance.OutputFormat("No parcel found with local ID {0}", landLocalId);
1912 return;
1913 }
1914 }
1915
1916 AppendParcelReport(report, lo);
1917 }
1918
1919 MainConsole.Instance.Output(report.ToString());
1920 }
1921
1922 private void AppendParcelsSummaryReport(StringBuilder report)
1923 {
1913 report.AppendFormat("Land information for {0}\n", m_scene.RegionInfo.RegionName); 1924 report.AppendFormat("Land information for {0}\n", m_scene.RegionInfo.RegionName);
1914 report.AppendFormat( 1925 report.AppendFormat(
1915 "{0,-20} {1,-10} {2,-9} {3,-18} {4,-18} {5,-20}\n", 1926 "{0,-20} {1,-10} {2,-9} {3,-18} {4,-18} {5,-20}\n",
@@ -1931,8 +1942,69 @@ namespace OpenSim.Region.CoreModules.World.Land
1931 ld.Name, ld.LocalID, ld.Area, lo.StartPoint, lo.EndPoint, m_userManager.GetUserName(ld.OwnerID)); 1942 ld.Name, ld.LocalID, ld.Area, lo.StartPoint, lo.EndPoint, m_userManager.GetUserName(ld.OwnerID));
1932 } 1943 }
1933 } 1944 }
1934 1945 }
1935 MainConsole.Instance.Output(report.ToString()); 1946
1936 } 1947 private void AppendParcelReport(StringBuilder report, ILandObject lo)
1948 {
1949 LandData ld = lo.LandData;
1950
1951 ConsoleDisplayList cdl = new ConsoleDisplayList();
1952 cdl.AddRow("Parcel name", ld.Name);
1953 cdl.AddRow("Local ID", ld.LocalID);
1954 cdl.AddRow("Description", ld.Description);
1955 cdl.AddRow("Snapshot ID", ld.SnapshotID);
1956 cdl.AddRow("Area", ld.Area);
1957 cdl.AddRow("Starts", lo.StartPoint);
1958 cdl.AddRow("Ends", lo.EndPoint);
1959 cdl.AddRow("AABB Min", ld.AABBMin);
1960 cdl.AddRow("AABB Max", ld.AABBMax);
1961
1962 cdl.AddRow("Owner", m_userManager.GetUserName(ld.OwnerID));
1963 cdl.AddRow("Is group owned?", ld.IsGroupOwned);
1964 cdl.AddRow("GroupID", ld.GroupID);
1965
1966 cdl.AddRow("Status", ld.Status);
1967 cdl.AddRow("Flags", (ParcelFlags)ld.Flags);
1968
1969 cdl.AddRow("Landing Type", (LandingType)ld.LandingType);
1970 cdl.AddRow("User Location", ld.UserLocation);
1971 cdl.AddRow("User look at", ld.UserLookAt);
1972
1973 cdl.AddRow("Other clean time", ld.OtherCleanTime);
1974
1975 cdl.AddRow("Max Prims", lo.GetParcelMaxPrimCount());
1976 IPrimCounts pc = lo.PrimCounts;
1977 cdl.AddRow("Owner Prims", pc.Owner);
1978 cdl.AddRow("Group Prims", pc.Group);
1979 cdl.AddRow("Other Prims", pc.Others);
1980 cdl.AddRow("Selected Prims", pc.Selected);
1981 cdl.AddRow("Total Prims", pc.Total);
1982
1983 cdl.AddRow("Music URL", ld.MusicURL);
1984 cdl.AddRow("Obscure Music", ld.ObscureMusic);
1985
1986 cdl.AddRow("Media ID", ld.MediaID);
1987 cdl.AddRow("Media Autoscale", Convert.ToBoolean(ld.MediaAutoScale));
1988 cdl.AddRow("Media URL", ld.MediaURL);
1989 cdl.AddRow("Media Type", ld.MediaType);
1990 cdl.AddRow("Media Description", ld.MediaDescription);
1991 cdl.AddRow("Media Width", ld.MediaWidth);
1992 cdl.AddRow("Media Height", ld.MediaHeight);
1993 cdl.AddRow("Media Loop", ld.MediaLoop);
1994 cdl.AddRow("Obscure Media", ld.ObscureMedia);
1995
1996 cdl.AddRow("Parcel Category", ld.Category);
1997
1998 cdl.AddRow("Claim Date", ld.ClaimDate);
1999 cdl.AddRow("Claim Price", ld.ClaimPrice);
2000 cdl.AddRow("Pass Hours", ld.PassHours);
2001 cdl.AddRow("Pass Price", ld.PassPrice);
2002
2003 cdl.AddRow("Auction ID", ld.AuctionID);
2004 cdl.AddRow("Authorized Buyer ID", ld.AuthBuyerID);
2005 cdl.AddRow("Sale Price", ld.SalePrice);
2006
2007 cdl.AddToStringBuilder(report);
2008 }
1937 } 2009 }
1938} 2010} \ No newline at end of file