From ca94301470433e572f0907e09c0f90cf7244e3e0 Mon Sep 17 00:00:00 2001 From: scarf Date: Sun, 2 Aug 2026 17:00:53 +0900 Subject: [PATCH 1/2] NO-JIRA fix: damage hostile pawns hit by vehicles previously vehicles weren't dealing hit damage to manhunting animals because they lacked faction Assisted-by: pi:gpt-5.6-sol Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com> --- .../Components/Vehicles/VehiclePawn/VehiclePawn_Combat.cs | 2 +- Source/Vehicles/Utility/Helpers/TargetingHelper.cs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Source/Vehicles/Components/Vehicles/VehiclePawn/VehiclePawn_Combat.cs b/Source/Vehicles/Components/Vehicles/VehiclePawn/VehiclePawn_Combat.cs index 80e67c0d..3aefedec 100644 --- a/Source/Vehicles/Components/Vehicles/VehiclePawn/VehiclePawn_Combat.cs +++ b/Source/Vehicles/Components/Vehicles/VehiclePawn/VehiclePawn_Combat.cs @@ -69,7 +69,7 @@ public void CheckForCollisions(float moveSpeed) { if (Map.thingGrid.ThingAt(cell, ThingCategory.Pawn) is Pawn pawn and not VehiclePawn) { - if (pawn.Faction.HostileTo(Faction) || Faction == null || + if (TargetingHelper.IsHostileToVehicleOrFaction(this, pawn) || Faction == null || Rand.Chance(VehicleDamager.FriendlyFireChance(this, pawn))) { (float pawnDamage, float vehicleDamage) = CalculateImpactDamage(pawn, this, moveSpeed); diff --git a/Source/Vehicles/Utility/Helpers/TargetingHelper.cs b/Source/Vehicles/Utility/Helpers/TargetingHelper.cs index a823529c..0dd56499 100644 --- a/Source/Vehicles/Utility/Helpers/TargetingHelper.cs +++ b/Source/Vehicles/Utility/Helpers/TargetingHelper.cs @@ -36,6 +36,11 @@ public static bool TryGetTarget(this VehicleTurret turret, out LocalTargetInfo t return false; } + internal static bool IsHostileToVehicleOrFaction(VehiclePawn vehicle, Thing target) + { + return vehicle.HostileTo(target) || target.HostileTo(vehicle.Faction); + } + /// /// Best attack target for VehicleTurret /// From e57b4d9e385b0cbc64fcf6b45072c7530c648727 Mon Sep 17 00:00:00 2001 From: scarf Date: Sun, 2 Aug 2026 17:04:06 +0900 Subject: [PATCH 2/2] NO-JIRA fix: make vehicles target hostiles Assisted-by: pi:gpt-5.6-sol Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com> --- Source/Vehicles/Utility/Helpers/TargetingHelper.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Source/Vehicles/Utility/Helpers/TargetingHelper.cs b/Source/Vehicles/Utility/Helpers/TargetingHelper.cs index 0dd56499..b34d6a5c 100644 --- a/Source/Vehicles/Utility/Helpers/TargetingHelper.cs +++ b/Source/Vehicles/Utility/Helpers/TargetingHelper.cs @@ -86,7 +86,7 @@ private static IAttackTarget BestAttackTarget(VehicleTurret turret, TargetScanFl { return false; } - if (!searcherPawn.HostileTo(thing)) + if (!IsHostileToVehicleOrFaction(searcherPawn, thing)) { return false; } @@ -167,8 +167,14 @@ private static IAttackTarget BestAttackTarget(VehicleTurret turret, TargetScanFl return true; }; - List tmpTargets = - [.. searcherPawn.Map.attackTargetsCache.GetPotentialTargetsFor(searcherPawn)]; + var attackTargetsCache = searcherPawn.Map.attackTargetsCache; + HashSet targetSet = [.. attackTargetsCache.GetPotentialTargetsFor(searcherPawn)]; + if (searcherPawn.Faction != null) + { + targetSet.UnionWith(attackTargetsCache.TargetsHostileToFaction(searcherPawn.Faction)); + } + List tmpTargets = [.. targetSet]; + bool flag = false; for (int i = 0; i < tmpTargets.Count; i++) {