scripts icon indicating copy to clipboard operation
scripts copied to clipboard

WIP: autojustice

Open Igualop opened this issue 2 years ago • 8 comments

autojustice

This is a script that automate most of the tedious parts of the justice system.

Features

  • Auto interview visitors.
  • Auto interview accused units.
  • Auto convict non-citizens confessed crimes.

Notes

  • There are a couple of things listed as TODO, but the core functions seems to be working fine.

  • This script was (afk) tested on a running fort for a dozen hours without issues, but since I'm totally new with df/dfhack/lua I can't guarantee that all the modifications made to the crime data are 100% correct.

  • "justicetools.lua" file contains helper methods used by the "autojustice.lua". Not sure if I should merge those two scripts or where to even put the "justicetools.lua".

  • I'm not sure I've correctly followed all naming conventions, feel free to comment on that.

  • There are a couple of options that can be added in case everything is working fine (i.e: auto convict citizens when the punishment is just jail time, add notifications to convictions and confessions).

  • Might need to test on worlds with multiple forts as crime reports seems to have a siteId field mapped on them.

Known Issues

  • I had a goblin poet getting convicted even though he did join my fortress. I'm not sure why he is not being considered as a citizen.

Igualop avatar Feb 04 '23 01:02 Igualop

  • I had a goblin poet getting convicted even though he did join my fortress. I'm not sure why he is not being considered as a citizen.

btw, this is because permanent residents are not "citizens". you might have to make a special check for this case

myk002 avatar Feb 07 '23 23:02 myk002

be sure to merge justicetools.lua into the main file (or move it into internal) to solve the docs build error

myk002 avatar Feb 07 '23 23:02 myk002

Looks good! If this is ready for merge, could you fix the pre-commit.ci errors and remove WIP from the PR title?

myk002 avatar Feb 14 '23 00:02 myk002

I would appreciate an option to not have the script handle automatic interrogations for visitors. I do find that some visitors who turn out to be innocent want to leave after an interrogation, so I don't think it's necessarily a good idea to interrogate absolutely everyone.

Following up implicated suspects is fine, that should be separated from this ideally.

drhead avatar Feb 17 '23 21:02 drhead

Testing the script out, I also noticed that goblins during sieges are queued for interrogation as if they were visitors.

drhead avatar Feb 18 '23 00:02 drhead

@Igualop could you address the issues drhead found before merge?

myk002 avatar Feb 23 '23 07:02 myk002

Has there been any progress on this PR?

myk002 avatar Mar 23 '23 01:03 myk002

I've been looking at this as I actually started working on a plugin with similar features that does the same thing, before it had been pointed out that this PR existed. @Igualop if you're still around and can remember stuff about this, I do have a question - for those unk_vector_...s that you noticed always had 1 element in them, I've not noticed them contain anything at all at any point. I've also noticed that when setting the convicted ids the fortress and victim doesn't get the relevant happy/sad thoughts, like they would hitting the convict button. Is it possible that those vectors are related to this?

master-spike avatar Sep 25 '23 17:09 master-spike