Skip to content

Commit

Permalink
added script commute-sentence to commute the prison sentence of a sel…
Browse files Browse the repository at this point in the history
…ected unit
  • Loading branch information
master-spike committed Jun 20, 2024
1 parent 834b9e2 commit f43f816
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
19 changes: 19 additions & 0 deletions commute-sentence.lua
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions docs/commute-sentence.rst
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit f43f816

Please sign in to comment.