Skip to content

Commit

Permalink
always replace vehicle ammunition ThingFilter
Browse files Browse the repository at this point in the history
  • Loading branch information
perkinslr committed Nov 2, 2023
1 parent b7a6941 commit d596e85
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Source/VehiclesCompat/VehiclesCompat/VehiclesCompat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,17 @@ public static IEnumerable<ThingDef> _GetUsedAmmo()
if (asd != null)
{
cetddme._ammoSet = asd;
HashSet<ThingDef> allowedAmmo = (HashSet<ThingDef>)vtd.ammunition?.AllowedThingDefs;
allowedAmmo.Clear();
var ammunition = vtd.ammunition = new ThingFilter();
vtd.genericAmmo = false;
HashSet<ThingDef> allowedAmmo = (HashSet<ThingDef>)ammunition.AllowedThingDefs;

foreach (var al in asd.ammoTypes)
{
allowedAmmo.Add(al.ammo);
yield return al.ammo;
}

vtd.ammunition.ResolveReferences();
}
}
}
Expand Down

0 comments on commit d596e85

Please sign in to comment.