(090be439c) Fix the bots not reacting to enemy attacks.

This commit is contained in:
Joonas Rikkonen
2019-04-25 17:46:08 +03:00
parent 9b8d0ffc51
commit 7d65c53bb6

View File

@@ -292,12 +292,12 @@ namespace Barotrauma
public override void OnAttacked(Character attacker, AttackResult attackResult)
{
// Damage from falling etc.
if (Character.LastDamageSource == null) { return; }
float damage = attackResult.Damage;
if (damage <= 0) { return; }
if (attacker == null || attacker.IsDead || attacker.Removed)
{
// Ignore damage from falling etc that we shouldn't react to.
if (Character.LastDamageSource == null) { return; }
AddCombatObjective(AIObjectiveCombat.CombatMode.Retreat, Rand.Range(0.5f, 1f, Rand.RandSync.Unsynced));
}
else if (IsFriendly(attacker))