Blax Laws 1.0.0: lawbook, act catalogue, enforcement and jail
- Laws tab with the lawbook and the case log; the book starts empty and
the mod watches nothing until a law exists.
- Act catalogue built from the game's defs (breaks, food, drugs, usables,
interactions, recorded acts, records, bills) plus special acts, with
groups, break links and a starter lawbook.
- Enforcement: warn, guilty, subdue, jail for N days and subdue then jail,
one case per incident, danger waits, role holders and mechanitors held
for Arrest now.
- Headless test suite green in every DLC combination, core only and with
the compat mods.
2026-12-02 20:07:17 +00:00
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using Verse;
|
|
|
|
|
|
|
|
|
|
namespace BlaxLaws
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
Blax Laws 1.0.0: tests for every shipped claim, escape and custody fixes
- Tests for the end-to-end subdue and jail, halved pain, the role hold,
every way a sentence ends, pruning, the nobody-to-enforce letter and
performance; each fails when its feature is broken.
- A jailed colonist that escapes closes as Escaped, also when the world
deletes it before the sentence check or a save falls in between. One
sold, given away, kidnapped or lost with a map closes with its own
message instead of "escaped".
- The release fallback also frees a prisoner on a caravan.
- An arrest waits while the offender carries someone, and ends an
offender job that holds reservations, so no reservation errors.
- Release text says a colonist, not a warden: Basic work also releases
prisoners.
- Test harness: test order, fixture hardening, roof cleanup and logging.
2026-12-03 14:46:28 +00:00
|
|
|
/// 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.
|
Blax Laws 1.0.0: lawbook, act catalogue, enforcement and jail
- Laws tab with the lawbook and the case log; the book starts empty and
the mod watches nothing until a law exists.
- Act catalogue built from the game's defs (breaks, food, drugs, usables,
interactions, recorded acts, records, bills) plus special acts, with
groups, break links and a starter lawbook.
- Enforcement: warn, guilty, subdue, jail for N days and subdue then jail,
one case per incident, danger waits, role holders and mechanitors held
for Arrest now.
- Headless test suite green in every DLC combination, core only and with
the compat mods.
2026-12-02 20:07:17 +00:00
|
|
|
///
|
|
|
|
|
/// Package ids of the Blax mods, from their own About/About.xml (2026-12-01).
|
|
|
|
|
/// </summary>
|
|
|
|
|
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";
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Package ids tests treat as active. 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 Laws uses it.
|
|
|
|
|
/// </summary>
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|