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