diff --git a/Core/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/Core/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index 4377e6d2105..ae79ca14249 100644 --- a/Core/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/Core/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -9576,6 +9576,13 @@ Bool Pathfinder::isAttackViewBlockedByObstacle(const Object* attacker, const Coo } if (w) { +#if !RETAIL_COMPATIBLE_CRC + // TheSuperHackers @bugfix Stubbjax 23/08/2026 Don't consider the attack blocked if it is a contact weapon. + // This allows weapons such as suicide bombs to be triggered if the unit is blocked by building geometry. + if (w->isContactWeapon()) + return false; +#endif + Bool viewBlocked; if (victim) viewBlocked = !w->isClearGoalFiringLineOfSightTerrain(attacker, attackerPos, victim); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp index c49ae77d861..54f8920a92a 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp @@ -3399,7 +3399,13 @@ void AIUpdateInterface::privateAttackPosition( const Coord3D *pos, Int maxShotsT // this fixes an obscure bug with mine-clearing: if you tell someone to clear mines and put the centerpoint // inside a building, the dozer/worker will just go thru the building to that spot. ick. so if you find that // this clause (below) is problematic, you'll probably have to find another way to fix this mine-clearing bug. (srj) +#if RETAIL_COMPATIBLE_CRC if (weapon && weapon->isContactWeapon() && !isPathAvailable(&localPos)) +#else + // TheSuperHackers @bugfix Stubbjax 23/08/2026 Only find a new position if the target is not within the attack range of the weapon. + // This allows contact weapons such as suicide bombs to immediately detonate without first pathing to a nearby position. + if (weapon && weapon->isContactWeapon() && !weapon->isWithinAttackRange(getObject(), &localPos) && !isPathAvailable(&localPos)) +#endif { FindPositionOptions fpOptions; fpOptions.minRadius = 0.0f; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp index 977aec18670..0aa58f5b522 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp @@ -3554,7 +3554,13 @@ void AIUpdateInterface::privateAttackPosition( const Coord3D *pos, Int maxShotsT // this fixes an obscure bug with mine-clearing: if you tell someone to clear mines and put the centerpoint // inside a building, the dozer/worker will just go thru the building to that spot. ick. so if you find that // this clause (below) is problematic, you'll probably have to find another way to fix this mine-clearing bug. (srj) +#if RETAIL_COMPATIBLE_CRC if (weapon && weapon->isContactWeapon() && !isPathAvailable(&localPos)) +#else + // TheSuperHackers @bugfix Stubbjax 23/08/2026 Only find a new position if the target is not within the attack range of the weapon. + // This allows contact weapons such as suicide bombs to immediately detonate without first pathing to a nearby position. + if (weapon && weapon->isContactWeapon() && !weapon->isWithinAttackRange(getObject(), &localPos) && !isPathAvailable(&localPos)) +#endif { FindPositionOptions fpOptions; fpOptions.minRadius = 0.0f;