From d596e85516f3a69031cd332fddd87cca71a62287 Mon Sep 17 00:00:00 2001 From: Logan Perkins Date: Thu, 2 Nov 2023 00:13:25 -0700 Subject: [PATCH] always replace vehicle ammunition ThingFilter --- Source/VehiclesCompat/VehiclesCompat/VehiclesCompat.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Source/VehiclesCompat/VehiclesCompat/VehiclesCompat.cs b/Source/VehiclesCompat/VehiclesCompat/VehiclesCompat.cs index ca63c22cec..16e0d4c3ff 100644 --- a/Source/VehiclesCompat/VehiclesCompat/VehiclesCompat.cs +++ b/Source/VehiclesCompat/VehiclesCompat/VehiclesCompat.cs @@ -78,13 +78,17 @@ public static IEnumerable _GetUsedAmmo() if (asd != null) { cetddme._ammoSet = asd; - HashSet allowedAmmo = (HashSet)vtd.ammunition?.AllowedThingDefs; - allowedAmmo.Clear(); + var ammunition = vtd.ammunition = new ThingFilter(); + vtd.genericAmmo = false; + HashSet allowedAmmo = (HashSet)ammunition.AllowedThingDefs; + foreach (var al in asd.ammoTypes) { allowedAmmo.Add(al.ammo); yield return al.ammo; } + + vtd.ammunition.ResolveReferences(); } } }