36 lines
1.6 KiB
C#
36 lines
1.6 KiB
C#
|
|
using System;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using Verse;
|
||
|
|
|
||
|
|
namespace BlaxZones
|
||
|
|
{
|
||
|
|
/// <summary>
|
||
|
|
/// 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.
|
||
|
|
/// </summary>
|
||
|
|
public static partial class Compat
|
||
|
|
{
|
||
|
|
public const string BlaxCastes = "blax.castes";
|
||
|
|
public const string BlaxSlaves = "blax.slaves";
|
||
|
|
public const string BlaxDefaults = "blax.defaults";
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Package ids tests treat as active, the Castes overlap-warning pattern. Only tests write it;
|
||
|
|
/// the runner clears it after every test.
|
||
|
|
/// </summary>
|
||
|
|
public static readonly HashSet<string> SimulatedActive = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// 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.
|
||
|
|
/// </summary>
|
||
|
|
public static bool IsActive(string packageId) =>
|
||
|
|
SimulatedActive.Contains(packageId) || ModLister.GetActiveModWithIdentifier(packageId, ignorePostfix: true) != null;
|
||
|
|
|
||
|
|
/// <summary>Blax Slaves routes its payouts through ZonesApi; the orbital checkbox's tooltip says so.</summary>
|
||
|
|
public static bool SlavesActive => IsActive(BlaxSlaves);
|
||
|
|
}
|
||
|
|
}
|