From f43f81629e4e2b91e1f8940105f919d360b37bfa Mon Sep 17 00:00:00 2001 From: Najeeb Al-Shabibi Date: Thu, 20 Jun 2024 18:18:16 +0100 Subject: [PATCH] added script commute-sentence to commute the prison sentence of a selected unit --- commute-sentence.lua | 19 +++++++++++++++++++ docs/commute-sentence.rst | 16 ++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 commute-sentence.lua create mode 100644 docs/commute-sentence.rst diff --git a/commute-sentence.lua b/commute-sentence.lua new file mode 100644 index 0000000000..8e2a15cb93 --- /dev/null +++ b/commute-sentence.lua @@ -0,0 +1,19 @@ +local utils = require('utils') +local argparse = require('argparse') + +local function commute_sentence(unit) + for _,punishment in ipairs(df.global.plotinfo.punishments) do + if punishment.criminal == unit.id then + punishment.prison_counter = 0 + return + end + end + qerror('Unit is not currently serving a sentence!') +end + +unit = dfhack.gui.getSelectedUnit(true) +if not unit then + qerror('No unit selected!') +else + commute_sentence(unit) +end diff --git a/docs/commute-sentence.rst b/docs/commute-sentence.rst new file mode 100644 index 0000000000..f2f36bbaa1 --- /dev/null +++ b/docs/commute-sentence.rst @@ -0,0 +1,16 @@ +commute-sentence +================ + +.. dfhack-tool:: + :summary: Commute the prison sentences of convicted criminals. + :tags: fort armok units + +If a unit is currently serving out their sentence but you want them released +for whatever reason, this tool can commute their sentence. Just select the unit +and run the command. + +usage +----- + +:: + commute-sentence