-
Notifications
You must be signed in to change notification settings - Fork 221
Script to commute the prison sentence of a convicted criminal #1200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
e16f1cb to
f43f816
Compare
|
with just the one command ( |
d1081ea to
7b85a77
Compare
docs/justice.rst
Outdated
| ======= | ||
|
|
||
| .. dfhack-tool:: | ||
| :summary: Commands related to the justice system |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| :summary: Commands related to the justice system | |
| :summary: Commands related to the justice system. |
docs/justice.rst
Outdated
| This tool allows control over aspects of the justice system, such as the | ||
| ability to pardon criminals. | ||
|
|
||
| usage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| usage | |
| Usage |
docs/justice.rst
Outdated
| :: | ||
| justice pardon [--unit <id>] | ||
|
|
||
| Pardon the selected unit or the one specified by unit id if provided. Currently |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Pardon the selected unit or the one specified by unit id if provided. Currently | |
| Pardon the selected unit or the one specified by unit id (if provided). Currently |
docs/justice.rst
Outdated
| only applies to prison time and doesn't cancel beatings or hammerings. | ||
|
|
||
|
|
||
| options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| options | |
| Options |
| unit = df.unit.find(unit_id) | ||
| if not unit then qerror(("No unit with id %i"):format(unit_id)) end | ||
| end | ||
| if unit then pardon_unit(unit) end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if unit then pardon_unit(unit) end | |
| pardon_unit(unit) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we still need this check because unit can still be nil if a unit wasn't found by either of the methods
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if a unit was not found in either of the if branches above, then qerror will throw
justice.lua
Outdated
| end | ||
|
|
||
| qerror(("Unrecognised command: %s"):format(command)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| end | |
| qerror(("Unrecognised command: %s"):format(command)) | |
| elseif not command then | |
| qerror('missing command') | |
| else | |
| qerror(("Unrecognised command: %s"):format(command)) | |
| end |
myk002
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please also add a line to the changelog under New tools
7b85a77 to
987397e
Compare
|
pre-commit.ci autofix |
62739f7 to
474fde5
Compare
474fde5 to
fe1612e
Compare
fe1612e to
7d7baca
Compare
| unit = df.unit.find(unit_id) | ||
| if not unit then qerror(("No unit with id %i"):format(unit_id)) end | ||
| end | ||
| if unit then pardon_unit(unit) end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if a unit was not found in either of the if branches above, then qerror will throw
| if not unit then qerror("No unit selected!") end | ||
| else | ||
| unit = df.unit.find(unit_id) | ||
| if not unit then qerror(("No unit with id %i"):format(unit_id)) end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if not unit then qerror(("No unit with id %i"):format(unit_id)) end | |
| if not unit then qerror(("No unit with id %d"):format(unit_id)) end |
| if command == "pardon" then | ||
| command_pardon(unit_id) | ||
| elseif not command then | ||
| qerror('Missing command') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| qerror('Missing command') | |
| print(dfhack.script_help()) |
|
github doesn't seem to be able to merge this for some reason, so I'll do some git magic in #1341 |
resolve merge conflicts for #1200
Fixes DFHack/dfhack#4738