From 39053dae4541ca64c41d5c231bf9425e6bdee45c Mon Sep 17 00:00:00 2001 From: Sinner Date: Mon, 11 Oct 2021 10:22:59 +0200 Subject: [PATCH] Don't path away from sentry if it doesn't have ammo (#1544) Don't path away from sentry if it doesn't have ammo Co-authored-by: BenCat07 --- src/navparser.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/navparser.cpp b/src/navparser.cpp index 61f5a00d..7da689e1 100644 --- a/src/navparser.cpp +++ b/src/navparser.cpp @@ -368,7 +368,9 @@ public: // Should we even ignore the sentry? // Soldier/Heavy do not care about Level 1 or mini sentries bool is_strong_class = g_pLocalPlayer->clazz == tf_soldier || g_pLocalPlayer->clazz == tf_heavy; - if (is_strong_class && (CE_BYTE(ent, netvar.m_bMiniBuilding) || CE_INT(ent, netvar.iUpgradeLevel) == 1)) + int bullet = CE_INT(ent, netvar.m_iAmmoShells); + int rocket = CE_INT(ent, netvar.m_iAmmoRockets); + if ((is_strong_class && (CE_BYTE(ent, netvar.m_bMiniBuilding) || CE_INT(ent, netvar.iUpgradeLevel) == 1)) || (bullet == 0 && (CE_INT(ent, netvar.iUpgradeLevel) != 3 || rocket == 0))) continue; // It's still building/being sapped, ignore.