private static void Postfix(BuildableDef buildable, ref Command __result) { if (__result != null && buildable is ThingDef def) { if (!PawnsFinder.AllMaps_FreeColonistsSpawned.Any((Pawn x) => RaceAddonTools.CheckBuilding(x.def, def))) { __result.disabled = true; __result.disabledReason = "RaceAddonRestriction_Designator".Translate(); } } }
private static void Postfix(Thing t, Pawn p, ref bool __result) { if (__result && t.def.entityDefToBuild is ThingDef def) { if (!RaceAddonTools.CheckBuilding(p.def, def)) { __result = false; JobFailReason.Is("RaceAddonRestriction_FloatMenu".Translate(), null); } } }
private static void Postfix(ref Designator d, ref bool __result) { if (__result && d is Designator_Build target && target.PlacingDef is ThingDef def && RaceAddonTools.BuildingRestrictions.Contains(def)) { if (!PawnsFinder.AllMaps_FreeColonistsSpawned.Any((Pawn x) => RaceAddonTools.CheckBuilding(x.def, def))) { d.disabled = true; d.disabledReason = "RaceAddonRestriction_Designator".Translate(); } } }