using System.Collections.Generic; public class ConsoleCmdPrintDebug_TE : ConsoleCmdAbstract { public override bool IsExecuteOnClient => true; public override bool AllowedInMainMenu => false; public override int DefaultPermissionLevel => 1000; public static void PrintInfo(EntityPlayer player) { if (player != null) { Log.Out("============================================================================================================="); Log.Out($"Current game Origin: {Origin.position}"); Log.Out($"Printing debug info for Player: {player}, Game pos: {player.position}, world pos: {player.transform.position}"); Log.Out($"- IsIgnoredByAI: {player.IsIgnoredByAI()}"); Log.Out($"- Faction: {player.Buffs.GetCustomVar("$faction")}"); //Log.Out($"Player Parent: {playerParent.name}"); Log.Out("Player CVars:"); foreach (var cvar in player.Buffs.CVars) { Log.Out($" CVar: {cvar.Key}, Val: {cvar.Value}"); } Log.Out("Player Buffs:"); foreach (var b in player.Buffs.ActiveBuffs) { Log.Out($" Buff: {b.BuffName}, Duration: {b.DurationInTicks}, Started: {b.Started}, Finished: {b.Finished}, Invalid: {b.Invalid}, Paused: {b.Paused}"); } foreach (var c in player.GetComponentsInChildren(true)) { Log.Out($" C: {c} - Layer: {c.gameObject.layer} - Tag: {c.tag} - Active: {c.gameObject.activeSelf} - Position: {c.gameObject.transform.position}"); if (c is Collider) { Collider collider = (Collider)c; Log.Out(" COLLIDER Enabled: " + collider.enabled); } } int minMax = 5; List entitiesInBounds = player.world.GetEntitiesInBounds(typeof(EntityZombieSDX), BoundsUtils.BoundsForMinMax(player.position.x - minMax, player.position.y - minMax, player.position.z - minMax, player.position.x + minMax, player.position.y + minMax, player.position.z + minMax), new List()); if (entitiesInBounds.Count > 0) { Log.Out("============================================================================================================="); Log.Out($"Printing debug info for Zombies"); foreach (EntityZombieSDX entity in entitiesInBounds) { Log.Out($"Zombie: [{entity.EntityClass.entityClassName}], Game pos: {entity.position}, World pos: {entity.transform.position}"); Log.Out($"- Faction: {entity.Buffs.GetCustomVar("$faction")}"); Log.Out("Zombie CVars:"); foreach (var cvar in entity.Buffs.CVars) { Log.Out($" CVar: {cvar.Key}, Val: {cvar.Value}"); } Log.Out("Zombie Buffs:"); foreach (var b in entity.Buffs.ActiveBuffs) { Log.Out($" Buff: {b.BuffName}, Duration: {b.DurationInTicks}, Started: {b.Started}, Finished: {b.Finished}, Invalid: {b.Invalid}, Paused: {b.Paused}"); } foreach (var c in entity.GetComponentsInChildren(true)) { Log.Out($" C: {c} - Layer: {c.gameObject.layer} - Tag: {c.tag} - Active: {c.gameObject.activeSelf} - Position: {c.gameObject.transform.position}"); if (c is Collider) { Collider collider = (Collider)c; Log.Out(" COLLIDER Enabled: " + collider.enabled); } } Log.Out("============================================================================================================="); } } /*minMax = 50; entitiesInBounds = player.world.GetEntitiesInBounds(typeof(EntityAliveV2), BoundsUtils.BoundsForMinMax(player.position.x - minMax, player.position.y - minMax, player.position.z - minMax, player.position.x + minMax, player.position.y + minMax, player.position.z + minMax), new List()); if (entitiesInBounds.Count > 0) { Log.Out("============================================================================================================="); Log.Out($"Printing debug info for NPCs"); foreach (EntityAliveV2 entity in entitiesInBounds) { var npcParent = entity.gameObject.transform.parent; if (npcParent != null) { Log.Out($"NPC Parent: {npcParent.name} [" + entity.EntityClass.entityClassName + "]"); foreach (var c in entity.GetComponentsInChildren()) { Log.Out($" C: {c} - Layer: {c.gameObject.layer} - Tag: {c.tag} - Active: {c.gameObject.activeSelf} - Position: {c.gameObject.transform.position}"); if (c is Collider) { Collider collider = (Collider)c; Log.Out("COLLIDER Enabled: " + collider.enabled); } } Log.Out("============================================================================================================="); } } }*/ /*minMax = 5; entitiesInBounds = player.world.GetEntitiesInBounds(typeof(EntityTrader), BoundsUtils.BoundsForMinMax(player.position.x - minMax, player.position.y - minMax, player.position.z - minMax, player.position.x + minMax, player.position.y + minMax, player.position.z + minMax), new List()); if (entitiesInBounds.Count > 0) { Log.Out("============================================================================================================="); Log.Out($"Printing debug info for NPCs"); foreach (EntityTrader entity in entitiesInBounds) { //MethodInfo FixedUpdate = AccessTools.Method(entity.GetType(), "FixedUpdate", new Type[] { }); //FixedUpdate.Invoke(entity, new object[] { }); var npcParent = entity.gameObject.transform.parent; if (npcParent != null) { Log.Out($"NPC Parent: {npcParent.name} [" + entity.EntityClass.entityClassName + "]"); foreach (var c in entity.GetComponentsInChildren()) { Log.Out($" C: {c} - Layer: {c.gameObject.layer} - Tag: {c.tag} - Active: {c.gameObject.activeSelf} - Position: {c.gameObject.transform.position}"); } Log.Out("============================================================================================================="); } } }*/ } } public override void Execute(List _params, CommandSenderInfo _senderInfo) { var isLocal = _senderInfo.IsLocalGame; //Log.Out($"Execute PrintDebug - IsLocalGame: {isLocal}"); if (isLocal) { var player = GameManager.Instance.World.GetPrimaryPlayer(); PrintInfo(player); if (!SingletonMonoBehaviour.Instance.IsServer) { SingletonMonoBehaviour.Instance.SendToServer(NetPackageManager.GetPackage().Setup(player.entityId), false); } } } public override string[] getCommands() { return new string[1] { "ted" }; } public override string getHelp() { return "ted will print out a long list of info for the local player that issued this command"; } public override string getDescription() { return "Prints out a debug list of character and zombie info to the log file for inspection"; } }