Skip to content

Commit e16f1cb

Browse files
committed
added script commute-sentence to commute the prison sentence of a selected unit
1 parent 834b9e2 commit e16f1cb

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

commute-sentence.lua

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
local utils = require('utils')
2+
local argparse = require('argparse')
3+
4+
local function commute_sentence(unit)
5+
for _,punishment in ipairs(df.global.plotinfo.punishments) do
6+
if punishment.criminal == unit.id then
7+
punishment.prison_counter = 0
8+
return
9+
end
10+
end
11+
qerror('Unit is not currently serving a sentence!')
12+
end
13+
14+
unit = dfhack.gui.getSelectedUnit(true)
15+
if not unit then
16+
qerror('No unit selected!')
17+
else
18+
commute_sentence(unit)
19+
end

docs/commute-sentence.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
commute-sentence
2+
================
3+
4+
.. dfhack-tool::
5+
:summary: Commute the prison sentences of convicted criminals.
6+
:tags: fort armok units
7+
8+
If a unit is currently serving out their sentence but you want them released
9+
for whatever reason, this tool can commute their sentence. Just select the unit
10+
and run the command.
11+
12+
usage
13+
-----
14+
15+
::
16+
commute-sentence

0 commit comments

Comments
 (0)