From e05438673159fd60a73c565e80ed6bb75f718170 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 14 Aug 2020 21:23:04 +0100 Subject: [PATCH] change show users again --- OpenSim/Region/Application/OpenSim.cs | 103 +++++++++++++++++--------- 1 file changed, 66 insertions(+), 37 deletions(-) diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index d5f30d9511..65370840e3 100755 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -930,47 +930,76 @@ namespace OpenSim switch (showParams[0]) { case "users": - IList agents; + bool includeChild = false; if (showParams.Length > 1 && showParams[1] == "full") - { - agents = SceneManager.GetCurrentScenePresences(); - } else - { - agents = SceneManager.GetCurrentSceneAvatars(); - } + includeChild = true; - MainConsole.Instance.Output(String.Format("\nAgents connected: {0}\n", agents.Count)); - - MainConsole.Instance.Output( - String.Format("{0,-16} {1,-16} {2,-37} {3,-11} {4,-16} {5,-30}", "Firstname", "Lastname", - "Agent ID", "Root/Child", "Region", "Position") - ); - - foreach (ScenePresence presence in agents) - { - RegionInfo regionInfo = presence.Scene.RegionInfo; - string regionName; - - if (regionInfo == null) + SceneManager.ForEachScene( + delegate (Scene scene) { - regionName = "Unresolvable"; - } else - { - regionName = regionInfo.RegionName; - } + RegionInfo regionInfo = scene.RegionInfo; + string regionName; + if (regionInfo == null) + regionName = "Unresolvable"; + else + regionName = regionInfo.RegionName; - MainConsole.Instance.Output( - String.Format( - "{0,-16} {1,-16} {2,-37} {3,-11} {4,-16} {5,-30}", - presence.Firstname, - presence.Lastname, - presence.UUID, - presence.IsChildAgent ? "Child" : "Root", - regionName, - presence.AbsolutePosition.ToString()) - ); - } + List agents = scene.GetScenePresences(); + List tmpagents = new List(); + int total = agents.Count; + int childcount = 0; + if (total > 0) + { + foreach(ScenePresence sp in agents) + { + if(sp.IsChildAgent) + { + if (includeChild) + tmpagents.Add(sp); + ++childcount; + } + else + tmpagents.Add(sp); + } + } + if(includeChild) + { + MainConsole.Instance.Output(String.Format("\nTotal agents in region {0}: {1} (root {2}, child {3})", + regionName, total, total - childcount, childcount)); + } + else + { + MainConsole.Instance.Output(String.Format("\nRoot agents in region {0}: {1} (root {2}, child {3})", + regionName, tmpagents.Count, total - childcount, childcount)); + } + if (tmpagents.Count == 0) + return; + + MainConsole.Instance.Output( + String.Format("{0,-16} {1,-16} {2,-37} {3,-11} {4,-30}", "Firstname", "Lastname", + "Agent ID", "Type", "Position") + ); + + foreach (ScenePresence presence in tmpagents) + { + string sptype; + if(presence.IsNPC) + sptype = presence.IsChildAgent ? "NPC Child" : "NPC Root"; + else + sptype = presence.IsChildAgent ? "Child" : "Root"; + + MainConsole.Instance.Output( + String.Format( + "{0,-16} {1,-16} {2,-37} {3,-11} {4,-30}", + presence.Firstname, + presence.Lastname, + presence.UUID, + sptype, + presence.AbsolutePosition.ToString()) + ); + } + }); MainConsole.Instance.Output(String.Empty); break; @@ -984,7 +1013,7 @@ namespace OpenSim case "modules": SceneManager.ForEachSelectedScene( - scene => + delegate (Scene scene) { MainConsole.Instance.Output("Loaded region modules in {0} are:", scene.Name);