using System; using System.Collections.Generic; using Verse; namespace BlaxZones { /// /// Shared mod detection. Zones has no hard dependency on any other mod. Package ids of the other /// Blax mods are listed here; ids of mods a single feature reacts to live in that feature's partial /// file of this class (Compat.TradingSpots.cs), each with the source it was read from. /// public static partial class Compat { public const string BlaxCastes = "blax.castes"; public const string BlaxSlaves = "blax.slaves"; public const string BlaxDefaults = "blax.defaults"; /// /// Package ids tests treat as active, the Castes overlap-warning pattern. Only tests write it; /// the runner clears it after every test. /// public static readonly HashSet SimulatedActive = new HashSet(StringComparer.OrdinalIgnoreCase); /// /// Active by packageId, local or Steam copy, or simulated by a test. ModsConfig.IsActive misses a /// mod that is installed both ways (the Steam copy gets a "_steam" postfix), so nothing in Blax /// Zones uses it. /// public static bool IsActive(string packageId) => SimulatedActive.Contains(packageId) || ModLister.GetActiveModWithIdentifier(packageId, ignorePostfix: true) != null; /// Blax Slaves routes its payouts through ZonesApi; the orbital checkbox's tooltip says so. public static bool SlavesActive => IsActive(BlaxSlaves); } }