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