From eb6e919c66ff4efafe50a2b15c2fbf10bfba9680 Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Mon, 8 Apr 2019 19:17:20 +0300 Subject: [PATCH] (f832e24f5) Prevent bots jumping from too high. --- .../BarotraumaClient/Source/GameSession/CrewManager.cs | 3 --- .../Source/Characters/AI/HumanAIController.cs | 7 +++++-- Barotrauma/BarotraumaShared/Source/PlayerInput.cs | 10 ++++++++++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs b/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs index 6b9d55aee..1a7eaf05b 100644 --- a/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs +++ b/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs @@ -276,9 +276,6 @@ namespace Barotrauma characterInfos.Add(characterInfo); } - characterInfos.Add(characterInfo); - } - /// /// Remove the character from the crew (and crew menus). /// diff --git a/Barotrauma/BarotraumaShared/Source/Characters/AI/HumanAIController.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/HumanAIController.cs index f62bc7629..f41af8814 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/AI/HumanAIController.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/HumanAIController.cs @@ -128,11 +128,14 @@ namespace Barotrauma { if (currPath.CurrentNode.SimPosition.Y < Character.AnimController.GetColliderBottom().Y) { - ignorePlatforms = true; + // Don't allow to jump from too high. The formula might require tweaking. + float allowedJumpHeight = Character.AnimController.ImpactTolerance / 2; + float height = Math.Abs(currPath.CurrentNode.SimPosition.Y - Character.SimPosition.Y); + ignorePlatforms = height < allowedJumpHeight; } } - if (Character.IsClimbing && PathSteering.InLadders && PathSteering.IsNextLadderSameAsCurrent) + if (Character.IsClimbing && PathSteering.IsNextLadderSameAsCurrent) { Character.AnimController.TargetMovement = new Vector2(0.0f, Math.Sign(Character.AnimController.TargetMovement.Y)); } diff --git a/Barotrauma/BarotraumaShared/Source/PlayerInput.cs b/Barotrauma/BarotraumaShared/Source/PlayerInput.cs index a10a8c412..21475b092 100644 --- a/Barotrauma/BarotraumaShared/Source/PlayerInput.cs +++ b/Barotrauma/BarotraumaShared/Source/PlayerInput.cs @@ -145,6 +145,16 @@ namespace Barotrauma } #endif + public void SetState() + { + hit = binding.IsHit(); + if (hit) hitQueue = true; + + held = binding.IsDown(); + if (held) heldQueue = true; + } +#endif + public bool Hit { get