61 lines
3.1 KiB
C#
61 lines
3.1 KiB
C#
|
|
using Verse;
|
||
|
|
|
||
|
|
namespace BlaxZones
|
||
|
|
{
|
||
|
|
/// <summary>
|
||
|
|
/// Package Camp. Trading-spot mods camping stands down for (design: 1.0 "Trader caravans camp at a
|
||
|
|
/// zone", Stand-down). Each id read from the mod's own About/About.xml (checked 2026-11-29):
|
||
|
|
/// - Trading Spot Rewritten (Workshop 3780903689): forge.elsie.cafe/NachoToast/TradingSpot, branch main,
|
||
|
|
/// the source link on its Workshop page. Supports 1.6 and 1.7.
|
||
|
|
/// - [KV] Trading Spot (1180719658): github.com/KiameV/rimworld-tradingspot, branch 1.2
|
||
|
|
/// (About/PublishedFileId.txt 1180719658). The master branch's About.xml carries another mod's
|
||
|
|
/// metadata ([KV] Change Dresser); Trading Control's About.xml lists the same id in incompatibleWith.
|
||
|
|
/// - [GMT] Trading Spot (2874517333): github.com/fl-modding/rimworld-TradingSpot, branch main
|
||
|
|
/// (About/PublishedFileId.txt 2874517333). The Workshop page links no source; this repository's
|
||
|
|
/// name, author (Grizzlemethis) and file id match it.
|
||
|
|
/// - Trading Control (2007107588): github.com/Toakan-Network/RW-TradingControl, branch main, the
|
||
|
|
/// repository its Workshop comments point to (About.xml url names 2007107588).
|
||
|
|
/// Not confirmed, so not listed: Trading Spot (3507108484, ProgrammerLily) and Trade Caravan Spot
|
||
|
|
/// (3733234194, Clown) publish no source, and reading their Workshop files needs a download.
|
||
|
|
/// None of these mods is installed on the test machine; the stand-down is tested with SimulatedActive.
|
||
|
|
/// </summary>
|
||
|
|
public static partial class Compat
|
||
|
|
{
|
||
|
|
public const string TradingSpotRewritten = "NachoToast.TradingSpot";
|
||
|
|
public const string TradingSpotKV = "tradingspot.kv.rw";
|
||
|
|
public const string TradingSpotGMT = "Grizzlemethis.TradingSpot.RW";
|
||
|
|
public const string TradingControl = "TradingControl.Tad.Rimworld.Core";
|
||
|
|
|
||
|
|
/// <summary>Every trading-spot mod camping stands down for.</summary>
|
||
|
|
public static readonly string[] TradingSpotMods = { TradingSpotRewritten, TradingSpotKV, TradingSpotGMT, TradingControl };
|
||
|
|
|
||
|
|
// The mod list can't change while the game runs, so the real detection runs once per process.
|
||
|
|
private static bool tradingSpotDetected;
|
||
|
|
private static string realTradingSpotMod;
|
||
|
|
|
||
|
|
/// <summary>The first active trading-spot mod (real or simulated), or null.</summary>
|
||
|
|
public static string ActiveTradingSpotMod()
|
||
|
|
{
|
||
|
|
if (!tradingSpotDetected)
|
||
|
|
{
|
||
|
|
realTradingSpotMod = null;
|
||
|
|
foreach (string id in TradingSpotMods)
|
||
|
|
{
|
||
|
|
if (ModLister.GetActiveModWithIdentifier(id, ignorePostfix: true) != null)
|
||
|
|
{
|
||
|
|
realTradingSpotMod = id;
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
tradingSpotDetected = true;
|
||
|
|
}
|
||
|
|
foreach (string id in TradingSpotMods)
|
||
|
|
{
|
||
|
|
if (id == realTradingSpotMod || SimulatedActive.Contains(id))
|
||
|
|
return id;
|
||
|
|
}
|
||
|
|
return null;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|