using System; using Verse; namespace BlaxZones { /// /// The API other mods bind by reflection (design: "Works with the other Blax mods"). Version 1 is /// frozen: Blax Slaves binds TryFindDropSpot by exact delegate type and reads Version as a property. /// Members are only ever added, each with a higher Version. /// public static class ZonesApi { public static int Version => 1; /// /// A cell for one drop pod holding exactly this thing, by the orbital rules: the zone's orbital /// checkbox, its filter and priority, the pod rule and the overflow setting. False when no zone /// fits, always false for a Pawn, never throws. The caller spawns the pod exactly at the cell /// (TradeUtility.SpawnDropPod or DropPodUtility.MakeDropPodAt) and calls again per thing after /// spawning the last pod, because a falling pod is what marks its cell as taken. /// public static bool TryFindDropSpot(Map map, Thing thing, out IntVec3 cell) { cell = IntVec3.Invalid; try { if (map == null || thing == null || thing is Pawn) return false; return DeliveryRouter.TryFindDropSpot(map, thing, DeliverySource.Orbital, out cell); } catch (Exception e) { ZonesLog.Once("ZonesApi.TryFindDropSpot", e); cell = IntVec3.Invalid; return false; } } } }