Skip to content

Commit

Permalink
Create ThingSetMaker_CountEnabledAmmoOnly.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
CMDR-Bill-Doors committed Aug 25, 2024
1 parent 88d45a3 commit 3c47a1e
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Source/CombatExtended/ThingSetMaker_CountEnabledAmmoOnly.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System.Collections.Generic;
using RimWorld;
using Verse;

namespace CombatExtended
{
public class ThingSetMaker_CountEnabledAmmoOnly : ThingSetMaker_Count
{
public override void Generate(ThingSetMakerParams parms, List<Thing> outThings)
{
parms.validator = delegate (ThingDef d)
{
if (d is AmmoDef ammodef && (ammodef.tradeTags?.Contains(AmmoInjector.destroyWithAmmoDisabledTag) ?? false))
{
return AmmoUtility.IsAmmoSystemActive(ammodef);
}
return true;
};
base.Generate(parms, outThings);
}
}
}

0 comments on commit 3c47a1e

Please sign in to comment.