using System; using System.Collections.Generic; using System.Linq; using Global.API.Util; using Sandbox.Game.Entities; using Torch.Commands; using Torch.Commands.Permissions; using VRage.Game.ModAPI; namespace Global { [Category("global")] public class GlobalCommands : CommandModule { [Command("debug", "does thing.")] [Permission(MyPromoteLevel.Admin)] public void ReloadConfig() { Context.Respond($"There are {MyEntities.m_entityNameDictionary.Count} entities in the dictionary."); var dictionary = new Dictionary(); foreach (var key in MyEntities.m_entityNameDictionary) { var type = key.Value.GetType(); dictionary.SetOrAdd(type, t => 1, e => e + 1); } foreach (var (k, v) in dictionary) Context.Respond($"{k.Name} : {v}"); } [Command("crash")] [Permission(MyPromoteLevel.Admin)] public void Crash() { Context.Torch.Invoke(() => throw new Exception("This is a crash")); } } }