From a05be7bd651fb48b522af1ee94e0aa602ceb480a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 31 Oct 2014 21:44:31 +0000 Subject: Add "region set" console command. This current allows one to set two region parameters agent-limit will set the current root agent limit for the region, as also settable through the viewer, though some impose a max setting (e.g. 100). max-agent-limit will set the maximum allowed root agent limit. This can also be set via the MaxAgent parameter in region config. --- .../World/Region/RegionCommandsModule.cs | 74 +++++++++++++++++++++- 1 file changed, 73 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs b/OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs index c2be5c5..b0caaf9 100644 --- a/OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs +++ b/OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs @@ -97,6 +97,15 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands "Some parameters can be set with the \"region set\" command.\n" + "Others must be changed via a viewer (usually via the region/estate dialog box).", HandleShowRegion); + + m_console.Commands.AddCommand( + "Regions", false, "region set", + "region get", + "Set control information for the currently selected region.", + "Currently, the following parameters can be set:\n" + + "agent-limit - Current root agent limit.\n" + + "max-agent-limit - Maximum root agent limit. agent-limit cannot exceed this.", + HandleRegionSet); } public void RemoveRegion(Scene scene) @@ -132,8 +141,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands dispList.AddRow("External endpoint", ri.ExternalEndPoint); dispList.AddRow("Internal endpoint", ri.InternalEndPoint); dispList.AddRow("Access level", ri.AccessLevel); + dispList.AddRow("Agent limit", rs.AgentLimit); dispList.AddRow("Max agent limit", ri.AgentCapacity); - dispList.AddRow("Current agent limit", rs.AgentLimit); dispList.AddRow("Linkset capacity", ri.LinksetCapacity <= 0 ? "not set" : ri.LinksetCapacity.ToString()); dispList.AddRow("Prim capacity", ri.ObjectCapacity); dispList.AddRow("Prim bonus", rs.ObjectBonus); @@ -175,6 +184,69 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands MainConsole.Instance.Output(sb.ToString()); } + private void HandleRegionSet(string module, string[] args) + { + if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_scene)) + return; + + if (args.Length != 4) + { + MainConsole.Instance.OutputFormat("Usage: region set "); + return; + } + + string param = args[2]; + string rawValue = args[3]; + + if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_scene)) + return; + + RegionInfo ri = m_scene.RegionInfo; + RegionSettings rs = ri.RegionSettings; + + if (param == "agent-limit") + { + int newValue; + + if (!ConsoleUtil.TryParseConsoleNaturalInt(MainConsole.Instance, rawValue, out newValue)) + return; + + if (newValue > ri.AgentCapacity) + { + MainConsole.Instance.OutputFormat( + "Cannot set {0} to {1} in {2} as max-agent-limit is {3}", "agent-limit", + newValue, m_scene.Name, ri.AgentCapacity); + } + else + { + rs.AgentLimit = newValue; + + MainConsole.Instance.OutputFormat( + "{0} set to {1} in {2}", "agent-limit", newValue, m_scene.Name); + } + } + else if (param == "max-agent-limit") + { + int newValue; + + if (!ConsoleUtil.TryParseConsoleNaturalInt(MainConsole.Instance, rawValue, out newValue)) + return; + + ri.AgentCapacity = newValue; + + MainConsole.Instance.OutputFormat( + "{0} set to {1} in {2}", "max-agent-limit", newValue, m_scene.Name); + + if (ri.AgentCapacity < rs.AgentLimit) + { + rs.AgentLimit = ri.AgentCapacity; + + MainConsole.Instance.OutputFormat( + "Reducing {0} to {1} in {2}", "agent-limit", rs.AgentLimit, m_scene.Name); + } + } + } + private void HandleShowScene(string module, string[] cmd) { if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_scene)) -- cgit v1.1