rimworld-blax-slaves/Source/BlaxSlaves/Compat.cs

45 lines
1.9 KiB
C#
Raw Normal View History

using System.Collections.Generic;
using Verse;
namespace BlaxSlaves
{
/// <summary>
/// Shared mod detection and the list of mods Blax Slaves replaces. The third-party patches for
/// slave harm (War Crimes Expanded 2, Harvest Organs Post Mortem, Hospitality) live in SlaveHarm.cs.
/// </summary>
public static partial class Compat
{
public const string TradeAsSlaveOrColonist = "Rhajiit.tradepurchasemode";
public const string EverybodyBuysSlaves = "bblkepling.EverybodyBuysSlaves";
public const string SyrMoreSlaves = "Mlie.SYRMoreSlaves";
/// <summary>
/// Active by packageId, local or Steam copy. ModsConfig.IsActive misses a mod that is installed
/// both ways (the Steam copy gets a "_steam" postfix), so nothing in Blax Slaves uses it.
/// </summary>
public static bool IsActive(string packageId) => ModLister.GetActiveModWithIdentifier(packageId, ignorePostfix: true) != null;
public struct ReplacedMod
{
public string packageId;
public string name;
public string note; // translation key
public ReplacedMod(string packageId, string name, string note)
{
this.packageId = packageId;
this.name = name;
this.note = note;
}
}
/// <summary>Mods a Blax Slaves feature replaces, shown in the Compat tab when they are active.</summary>
public static readonly List<ReplacedMod> Replaced = new List<ReplacedMod>
{
new ReplacedMod(TradeAsSlaveOrColonist, "Trade as Slave or Colonist", "BlaxSlaves_CompatNoteBuyMode"),
new ReplacedMod(EverybodyBuysSlaves, "Everybody Buys Slaves", "BlaxSlaves_CompatNoteEverybodyBuys"),
new ReplacedMod(SyrMoreSlaves, "[SYR] More Slaves", "BlaxSlaves_CompatNoteMoreSlaves"),
};
}
}