From 21cc6001d4eb322dad93976ddc92b93dc5b9b089 Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Thu, 11 Apr 2019 18:25:29 +0300 Subject: [PATCH] (fc63971e1) Implement disabling the enemy ai. Fix enablecrewai command. --- .../Source/Characters/AI/EnemyAIController.cs | 5 ++++- .../BarotraumaShared/Source/DebugConsole.cs | 20 ++++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Barotrauma/BarotraumaShared/Source/Characters/AI/EnemyAIController.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/EnemyAIController.cs index 6a3befb3c..17e45f14a 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/AI/EnemyAIController.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/EnemyAIController.cs @@ -12,6 +12,8 @@ namespace Barotrauma { partial class EnemyAIController : AIController { + public static bool DisableEnemyAI; + class WallTarget { public Vector2 Position; @@ -249,7 +251,7 @@ namespace Barotrauma } } - public TargetingPriority GetTargetingPriority(string targetTag) + private TargetingPriority GetTargetingPriority(string targetTag) { if (targetingPriorities.TryGetValue(targetTag, out TargetingPriority priority)) { @@ -267,6 +269,7 @@ namespace Barotrauma public override void Update(float deltaTime) { + if (DisableEnemyAI) { return; } bool ignorePlatforms = (-Character.AnimController.TargetMovement.Y > Math.Abs(Character.AnimController.TargetMovement.X)); if (steeringManager is IndoorsSteeringManager) diff --git a/Barotrauma/BarotraumaShared/Source/DebugConsole.cs b/Barotrauma/BarotraumaShared/Source/DebugConsole.cs index 3cdabed81..d52d022ce 100644 --- a/Barotrauma/BarotraumaShared/Source/DebugConsole.cs +++ b/Barotrauma/BarotraumaShared/Source/DebugConsole.cs @@ -255,8 +255,10 @@ namespace Barotrauma commands.Add(new Command("disablecrewai", "disablecrewai: Disable the AI of the NPCs in the crew.", (string[] args) => { - ThrowError("Karma has not been fully implemented yet, and is disabled in this version of Barotrauma."); - return; + HumanAIController.DisableCrewAI = true; + NewMessage("Crew AI disabled", Color.Red); + // This is probably not where it should be? + //ThrowError("Karma has not been fully implemented yet, and is disabled in this version of Barotrauma."); /*if (GameMain.Server == null) return; GameMain.Server.KarmaEnabled = !GameMain.Server.KarmaEnabled;*/ })); @@ -264,7 +266,19 @@ namespace Barotrauma commands.Add(new Command("enablecrewai", "enablecrewai: Enable the AI of the NPCs in the crew.", (string[] args) => { HumanAIController.DisableCrewAI = false; - NewMessage("Crew AI enabled", Color.White); + NewMessage("Crew AI enabled", Color.Green); + }, isCheat: true)); + + commands.Add(new Command("disableenemyai", "disableenemyai: Disable the AI of the Enemy characters (monsters).", (string[] args) => + { + EnemyAIController.DisableEnemyAI = true; + NewMessage("Enemy AI disabled", Color.Red); + }, isCheat: true)); + + commands.Add(new Command("enableenemyai", "enableenemyai: Enable the AI of the Enemy characters (monsters).", (string[] args) => + { + EnemyAIController.DisableEnemyAI = false; + NewMessage("Enemy AI enabled", Color.Green); }, isCheat: true)); commands.Add(new Command("botcount", "botcount [x]: Set the number of bots in the crew in multiplayer.", null));