diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | 178 |
1 files changed, 125 insertions, 53 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 5b98d97..092dfa3 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; | |||
42 | using OpenSim.Framework.Console; | 42 | using OpenSim.Framework.Console; |
43 | using OpenSim.Framework.Servers; | 43 | using OpenSim.Framework.Servers; |
44 | using OpenSim.Framework.Servers.HttpServer; | 44 | using OpenSim.Framework.Servers.HttpServer; |
45 | using OpenSim.Region.CoreModules.Framework.InterfaceCommander; | ||
46 | using OpenSim.Region.Framework.Interfaces; | 45 | using OpenSim.Region.Framework.Interfaces; |
47 | using OpenSim.Region.Framework.Scenes; | 46 | using OpenSim.Region.Framework.Scenes; |
48 | using OpenSim.Region.Physics.Manager; | 47 | using OpenSim.Region.Physics.Manager; |
@@ -71,7 +70,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
71 | 70 | ||
72 | private LandChannel landChannel; | 71 | private LandChannel landChannel; |
73 | private Scene m_scene; | 72 | private Scene m_scene; |
74 | protected Commander m_commander = new Commander("land"); | ||
75 | 73 | ||
76 | protected IUserManagement m_userManager; | 74 | protected IUserManagement m_userManager; |
77 | protected IPrimCountModule m_primCountModule; | 75 | protected IPrimCountModule m_primCountModule; |
@@ -139,14 +137,13 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
139 | m_scene.EventManager.OnIncomingLandDataFromStorage += EventManagerOnIncomingLandDataFromStorage; | 137 | m_scene.EventManager.OnIncomingLandDataFromStorage += EventManagerOnIncomingLandDataFromStorage; |
140 | m_scene.EventManager.OnSetAllowForcefulBan += EventManagerOnSetAllowedForcefulBan; | 138 | m_scene.EventManager.OnSetAllowForcefulBan += EventManagerOnSetAllowedForcefulBan; |
141 | m_scene.EventManager.OnRegisterCaps += EventManagerOnRegisterCaps; | 139 | m_scene.EventManager.OnRegisterCaps += EventManagerOnRegisterCaps; |
142 | m_scene.EventManager.OnPluginConsole += EventManagerOnPluginConsole; | ||
143 | 140 | ||
144 | lock (m_scene) | 141 | lock (m_scene) |
145 | { | 142 | { |
146 | m_scene.LandChannel = (ILandChannel)landChannel; | 143 | m_scene.LandChannel = (ILandChannel)landChannel; |
147 | } | 144 | } |
148 | 145 | ||
149 | InstallInterfaces(); | 146 | RegisterCommands(); |
150 | } | 147 | } |
151 | 148 | ||
152 | public void RegionLoaded(Scene scene) | 149 | public void RegionLoaded(Scene scene) |
@@ -158,10 +155,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
158 | 155 | ||
159 | public void RemoveRegion(Scene scene) | 156 | public void RemoveRegion(Scene scene) |
160 | { | 157 | { |
161 | // TODO: Also release other event manager listeners here | 158 | // TODO: Release event manager listeners here |
162 | |||
163 | m_scene.EventManager.OnPluginConsole -= EventManagerOnPluginConsole; | ||
164 | m_scene.UnregisterModuleCommander(m_commander.Name); | ||
165 | } | 159 | } |
166 | 160 | ||
167 | // private bool OnVerifyUserConnection(ScenePresence scenePresence, out string reason) | 161 | // private bool OnVerifyUserConnection(ScenePresence scenePresence, out string reason) |
@@ -169,30 +163,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
169 | // ILandObject nearestParcel = m_scene.GetNearestAllowedParcel(scenePresence.UUID, scenePresence.AbsolutePosition.X, scenePresence.AbsolutePosition.Y); | 163 | // ILandObject nearestParcel = m_scene.GetNearestAllowedParcel(scenePresence.UUID, scenePresence.AbsolutePosition.X, scenePresence.AbsolutePosition.Y); |
170 | // reason = "You are not allowed to enter this sim."; | 164 | // reason = "You are not allowed to enter this sim."; |
171 | // return nearestParcel != null; | 165 | // return nearestParcel != null; |
172 | // } | 166 | // } |
173 | |||
174 | /// <summary> | ||
175 | /// Processes commandline input. Do not call directly. | ||
176 | /// </summary> | ||
177 | /// <param name="args">Commandline arguments</param> | ||
178 | protected void EventManagerOnPluginConsole(string[] args) | ||
179 | { | ||
180 | if (args[0] == "land") | ||
181 | { | ||
182 | if (args.Length == 1) | ||
183 | { | ||
184 | m_commander.ProcessConsoleCommand("help", new string[0]); | ||
185 | return; | ||
186 | } | ||
187 | |||
188 | string[] tmpArgs = new string[args.Length - 2]; | ||
189 | int i; | ||
190 | for (i = 2; i < args.Length; i++) | ||
191 | tmpArgs[i - 2] = args[i]; | ||
192 | |||
193 | m_commander.ProcessConsoleCommand(args[1], tmpArgs); | ||
194 | } | ||
195 | } | ||
196 | 167 | ||
197 | void EventManagerOnNewClient(IClientAPI client) | 168 | void EventManagerOnNewClient(IClientAPI client) |
198 | { | 169 | { |
@@ -1982,44 +1953,84 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1982 | m_Dialog.SendAlertToUser(remoteClient, "You are not allowed to set your home location in this parcel."); | 1953 | m_Dialog.SendAlertToUser(remoteClient, "You are not allowed to set your home location in this parcel."); |
1983 | } | 1954 | } |
1984 | 1955 | ||
1985 | 1956 | protected void RegisterCommands() | |
1986 | protected void InstallInterfaces() | ||
1987 | { | 1957 | { |
1988 | Command clearCommand | 1958 | ICommands commands = MainConsole.Instance.Commands; |
1989 | = new Command("clear", CommandIntentions.COMMAND_HAZARDOUS, ClearCommand, "Clears all the parcels from the region."); | ||
1990 | Command showCommand | ||
1991 | = new Command("show", CommandIntentions.COMMAND_STATISTICAL, ShowParcelsCommand, "Shows all parcels on the region."); | ||
1992 | 1959 | ||
1993 | m_commander.RegisterCommand("clear", clearCommand); | 1960 | commands.AddCommand( |
1994 | m_commander.RegisterCommand("show", showCommand); | 1961 | "Land", false, "land clear", |
1962 | "land clear", | ||
1963 | "Clear all the parcels from the region.", | ||
1964 | "Command will ask for confirmation before proceeding.", | ||
1965 | HandleClearCommand); | ||
1995 | 1966 | ||
1996 | // Add this to our scene so scripts can call these functions | 1967 | commands.AddCommand( |
1997 | m_scene.RegisterModuleCommander(m_commander); | 1968 | "Land", false, "land show", |
1969 | "land show [<local-land-id>]", | ||
1970 | "Show information about the parcels on the region.", | ||
1971 | "If no local land ID is given, then summary information about all the parcels is shown.\n" | ||
1972 | + "If a local land ID is given then full information about that parcel is shown.", | ||
1973 | HandleShowCommand); | ||
1998 | } | 1974 | } |
1999 | 1975 | ||
2000 | protected void ClearCommand(Object[] args) | 1976 | protected void HandleClearCommand(string module, string[] args) |
2001 | { | 1977 | { |
1978 | if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_scene)) | ||
1979 | return; | ||
1980 | |||
2002 | string response = MainConsole.Instance.CmdPrompt( | 1981 | string response = MainConsole.Instance.CmdPrompt( |
2003 | string.Format( | 1982 | string.Format( |
2004 | "Are you sure that you want to clear all land parcels from {0} (y or n)", | 1983 | "Are you sure that you want to clear all land parcels from {0} (y or n)", m_scene.Name), |
2005 | m_scene.RegionInfo.RegionName), | ||
2006 | "n"); | 1984 | "n"); |
2007 | 1985 | ||
2008 | if (response.ToLower() == "y") | 1986 | if (response.ToLower() == "y") |
2009 | { | 1987 | { |
2010 | Clear(true); | 1988 | Clear(true); |
2011 | MainConsole.Instance.OutputFormat("Cleared all parcels from {0}", m_scene.RegionInfo.RegionName); | 1989 | MainConsole.Instance.OutputFormat("Cleared all parcels from {0}", m_scene.Name); |
2012 | } | 1990 | } |
2013 | else | 1991 | else |
2014 | { | 1992 | { |
2015 | MainConsole.Instance.OutputFormat("Aborting clear of all parcels from {0}", m_scene.RegionInfo.RegionName); | 1993 | MainConsole.Instance.OutputFormat("Aborting clear of all parcels from {0}", m_scene.Name); |
2016 | } | 1994 | } |
2017 | } | 1995 | } |
2018 | 1996 | ||
2019 | protected void ShowParcelsCommand(Object[] args) | 1997 | protected void HandleShowCommand(string module, string[] args) |
2020 | { | 1998 | { |
2021 | StringBuilder report = new StringBuilder(); | 1999 | if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_scene)) |
2022 | 2000 | return; | |
2001 | |||
2002 | StringBuilder report = new StringBuilder(); | ||
2003 | |||
2004 | if (args.Length <= 2) | ||
2005 | { | ||
2006 | AppendParcelsSummaryReport(report); | ||
2007 | } | ||
2008 | else | ||
2009 | { | ||
2010 | int landLocalId; | ||
2011 | |||
2012 | if (!ConsoleUtil.TryParseConsoleInt(MainConsole.Instance, args[2], out landLocalId)) | ||
2013 | return; | ||
2014 | |||
2015 | ILandObject lo; | ||
2016 | |||
2017 | lock (m_landList) | ||
2018 | { | ||
2019 | if (!m_landList.TryGetValue(landLocalId, out lo)) | ||
2020 | { | ||
2021 | MainConsole.Instance.OutputFormat("No parcel found with local ID {0}", landLocalId); | ||
2022 | return; | ||
2023 | } | ||
2024 | } | ||
2025 | |||
2026 | AppendParcelReport(report, lo); | ||
2027 | } | ||
2028 | |||
2029 | MainConsole.Instance.Output(report.ToString()); | ||
2030 | } | ||
2031 | |||
2032 | private void AppendParcelsSummaryReport(StringBuilder report) | ||
2033 | { | ||
2023 | report.AppendFormat("Land information for {0}\n", m_scene.RegionInfo.RegionName); | 2034 | report.AppendFormat("Land information for {0}\n", m_scene.RegionInfo.RegionName); |
2024 | report.AppendFormat( | 2035 | report.AppendFormat( |
2025 | "{0,-20} {1,-10} {2,-9} {3,-18} {4,-18} {5,-20}\n", | 2036 | "{0,-20} {1,-10} {2,-9} {3,-18} {4,-18} {5,-20}\n", |
@@ -2041,8 +2052,69 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
2041 | ld.Name, ld.LocalID, ld.Area, lo.StartPoint, lo.EndPoint, m_userManager.GetUserName(ld.OwnerID)); | 2052 | ld.Name, ld.LocalID, ld.Area, lo.StartPoint, lo.EndPoint, m_userManager.GetUserName(ld.OwnerID)); |
2042 | } | 2053 | } |
2043 | } | 2054 | } |
2044 | 2055 | } | |
2045 | MainConsole.Instance.Output(report.ToString()); | 2056 | |
2046 | } | 2057 | private void AppendParcelReport(StringBuilder report, ILandObject lo) |
2058 | { | ||
2059 | LandData ld = lo.LandData; | ||
2060 | |||
2061 | ConsoleDisplayList cdl = new ConsoleDisplayList(); | ||
2062 | cdl.AddRow("Parcel name", ld.Name); | ||
2063 | cdl.AddRow("Local ID", ld.LocalID); | ||
2064 | cdl.AddRow("Description", ld.Description); | ||
2065 | cdl.AddRow("Snapshot ID", ld.SnapshotID); | ||
2066 | cdl.AddRow("Area", ld.Area); | ||
2067 | cdl.AddRow("Starts", lo.StartPoint); | ||
2068 | cdl.AddRow("Ends", lo.EndPoint); | ||
2069 | cdl.AddRow("AABB Min", ld.AABBMin); | ||
2070 | cdl.AddRow("AABB Max", ld.AABBMax); | ||
2071 | |||
2072 | cdl.AddRow("Owner", m_userManager.GetUserName(ld.OwnerID)); | ||
2073 | cdl.AddRow("Is group owned?", ld.IsGroupOwned); | ||
2074 | cdl.AddRow("GroupID", ld.GroupID); | ||
2075 | |||
2076 | cdl.AddRow("Status", ld.Status); | ||
2077 | cdl.AddRow("Flags", (ParcelFlags)ld.Flags); | ||
2078 | |||
2079 | cdl.AddRow("Landing Type", (LandingType)ld.LandingType); | ||
2080 | cdl.AddRow("User Location", ld.UserLocation); | ||
2081 | cdl.AddRow("User look at", ld.UserLookAt); | ||
2082 | |||
2083 | cdl.AddRow("Other clean time", ld.OtherCleanTime); | ||
2084 | |||
2085 | cdl.AddRow("Max Prims", lo.GetParcelMaxPrimCount()); | ||
2086 | IPrimCounts pc = lo.PrimCounts; | ||
2087 | cdl.AddRow("Owner Prims", pc.Owner); | ||
2088 | cdl.AddRow("Group Prims", pc.Group); | ||
2089 | cdl.AddRow("Other Prims", pc.Others); | ||
2090 | cdl.AddRow("Selected Prims", pc.Selected); | ||
2091 | cdl.AddRow("Total Prims", pc.Total); | ||
2092 | |||
2093 | cdl.AddRow("Music URL", ld.MusicURL); | ||
2094 | cdl.AddRow("Obscure Music", ld.ObscureMusic); | ||
2095 | |||
2096 | cdl.AddRow("Media ID", ld.MediaID); | ||
2097 | cdl.AddRow("Media Autoscale", Convert.ToBoolean(ld.MediaAutoScale)); | ||
2098 | cdl.AddRow("Media URL", ld.MediaURL); | ||
2099 | cdl.AddRow("Media Type", ld.MediaType); | ||
2100 | cdl.AddRow("Media Description", ld.MediaDescription); | ||
2101 | cdl.AddRow("Media Width", ld.MediaWidth); | ||
2102 | cdl.AddRow("Media Height", ld.MediaHeight); | ||
2103 | cdl.AddRow("Media Loop", ld.MediaLoop); | ||
2104 | cdl.AddRow("Obscure Media", ld.ObscureMedia); | ||
2105 | |||
2106 | cdl.AddRow("Parcel Category", ld.Category); | ||
2107 | |||
2108 | cdl.AddRow("Claim Date", ld.ClaimDate); | ||
2109 | cdl.AddRow("Claim Price", ld.ClaimPrice); | ||
2110 | cdl.AddRow("Pass Hours", ld.PassHours); | ||
2111 | cdl.AddRow("Pass Price", ld.PassPrice); | ||
2112 | |||
2113 | cdl.AddRow("Auction ID", ld.AuctionID); | ||
2114 | cdl.AddRow("Authorized Buyer ID", ld.AuthBuyerID); | ||
2115 | cdl.AddRow("Sale Price", ld.SalePrice); | ||
2116 | |||
2117 | cdl.AddToStringBuilder(report); | ||
2118 | } | ||
2047 | } | 2119 | } |
2048 | } | 2120 | } |