using RimWorld; using Verse; namespace BlaxZones { /// /// Package Tab. Copied delivery zone settings for the copy/paste gizmos: a copy of the choices /// (filter, priority, sources, camp), never a Zone, so no game state sits in a static (design: /// "Rules every feature follows"). Paste goes through Zone_Delivery.CopySettingsFrom or the same fields. /// /// Like vanilla's StorageSettingsClipboard (StorageSettingsClipboard.cs:8-27) it keeps a detached /// ThingFilter: defs only, no settings-changed callback, so it survives loading another game. /// public static class DeliveryClipboard { private static ThingFilter filter; private static StoragePriority priority = StoragePriority.Normal; private static bool acceptOrbital = true; private static bool acceptRewards = true; private static bool acceptCaravan = true; private static bool campHere; private static bool copied; public static bool HasCopy => copied; /// Copies the zone's filter, priority, sources and camp flag. Never the zone, its cells or its label. public static void Copy(Zone_Delivery zone) { if (zone == null) return; filter ??= new ThingFilter(); if (zone.filter != null) filter.CopyAllowancesFrom(zone.filter); else filter.CopyAllowancesFrom(DeliveryFilters.NewDefaultFilter()); priority = zone.priority; acceptOrbital = zone.acceptOrbital; acceptRewards = zone.acceptRewards; acceptCaravan = zone.acceptCaravan; campHere = zone.campHere; copied = true; } /// /// Writes the copied settings into the zone, the same fields Zone_Delivery.CopySettingsFrom /// writes. Does nothing before the first copy. The zone's cells and label stay. /// public static void PasteInto(Zone_Delivery zone) { if (zone == null || !copied) return; zone.filter ??= new ThingFilter(); if (filter != null) zone.filter.CopyAllowancesFrom(filter); zone.priority = priority; zone.acceptOrbital = acceptOrbital; zone.acceptRewards = acceptRewards; zone.acceptCaravan = acceptCaravan; zone.campHere = campHere; } } }