using System; using System.Collections.Generic; using Verse; namespace BlaxLaws { /// /// Shared mod detection. Laws has no hard dependency on any other mod and, in this release, calls no /// other mod's code: it only asks whether a mod is active. This file is the only part of the class. A /// later feature that reacts to one mod adds its package id here, with the source it was read from, or /// in a partial file of its own. /// /// Package ids of the Blax mods, from their own About/About.xml (2026-12-01). /// public static partial class Compat { public const string BlaxCastes = "blax.castes"; public const string BlaxSlaves = "blax.slaves"; public const string BlaxZones = "blax.zones"; public const string BlaxDefaults = "blax.defaults"; /// /// Package ids tests treat as active. 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 Laws uses it. /// public static bool IsActive(string packageId) => SimulatedActive.Contains(packageId) || ModLister.GetActiveModWithIdentifier(packageId, ignorePostfix: true) != null; public static bool CastesActive => IsActive(BlaxCastes); public static bool SlavesActive => IsActive(BlaxSlaves); } }