dfhack icon indicating copy to clipboard operation
dfhack copied to clipboard

petitions.lua: Expired/Overwritten Petitions not culled

Open Hevlikn opened this issue 2 years ago • 8 comments

https://github.com/DFHack/scripts/pull/321 @TymurGubayev

Case 1:

You ignore/deny a residency petition (don't judge me!); when the unit leaves the site, the info field goes blank and the petition can no longer be addressed through the Petitions (shift-P) screen

image

Desired behaviour would be to cull petitions these petitions; this might require special handling as these petitions do not have the intermediate 'accepted' state like Temples/Guildhalls

possible solution could involve new petition.status flag 'Rejected', with additional handling in getAgreementDetails() line 184 and petitions:refresh()

Case 2:

image

An updated petition for a tier 2 location* will be marked as fulfilled, while the original one will still show up as 'Accepted' Pending

*This doesn't actually occur in this save for one of my guilds; a possibility that the Tier 1 Temple expired before completion.

Can create separate issues for these if necessary: PS: Note in second screengrab, dates are separated by 3 years, but only display delta for days/months

PPS: wrapping petition summaries between pages is a PITA when they vary in length between 6 lines (in the case of an unfulfilled Residency petition) and 8 lines (in the case of a fulfilled Location petition) - could be resolved by displaying 16 lines and padding the short ones, or having pg up/down anchor to the first line of a petition. Workaroundable with by-line scrolling with up/down, but still a notable QOL issue

Hevlikn avatar May 29 '22 09:05 Hevlikn

Changing the height should be easy: increase the value of frame_height = 16, in line 222 of the script. There is no wrapping or anything, all petitions together just build a single text, and this text is then displayed. This means that jumping between single petitions won't be easy to implement - and I'm not quite sure why: I'm usually only looking at unfulfilled petitions and there aren't that many of them.

Also, could you upload a save? I haven't played in a while.

TymurGubayev avatar May 29 '22 10:05 TymurGubayev

Changing the height should be easy: increase the value of frame_height = 16, in line 222 of the script. There is no wrapping or anything, all petitions together just build a single text, and this text is then displayed. This means that jumping between single petitions won't be easy to implement - and I'm not quite sure why: I'm usually only looking at unfulfilled petitions and there aren't that many of them.

I can adopt it if it's orphaned; would also suggest some changes re: SiteGovernment (which is moot in fortress mode); is that redundancy for AdvMode?

Also, could you upload a save? I haven't played in a while.

One of those games isn't it? I picked it up again, and then realised why I got stuck, because i was switching back and forth trying to select the right detail to decorate my halls.

Save file

Hevlikn avatar May 29 '22 14:05 Hevlikn

There is no wrapping or anything, all petitions together just build a single text, and this text is then displayed. This means that jumping between single petitions won't be easy to implement

If each entry is a consistent number of lines, it might be useful to display them using a dialogs.ListBox (or just a widgets.List if you need to control more of the dialog). Then the petitions can be scrolled one unit at a time, and it will be much easier to scan to a specific one. The text of a List entry has the full power of Labels, so you can still color parts of the lines as you do now. I use a List with entries of height 2 for the quickfort file chooser dialog, for example.

Lists also support dynamic filtering, but that might be overkill for this.

myk002 avatar May 30 '22 05:05 myk002

Each entry seems to take up 8 lines, at least on my end (in a fort with 755 entries in world.agreements.all!). Some lines are blank for some petitions, but that should be fine in a ListBox.

lethosor avatar Jun 02 '22 00:06 lethosor

@Hevlikn

With the https://github.com/DFHack/scripts/pull/398 merged most of the issues raised here are addressed, I think. One remaining missing feature is scroll by items instead of line by line, which is a bigger problem, especially because of the potentially variable number of lines.

TymurGubayev avatar Jun 12 '22 11:06 TymurGubayev

Since the only remaining item is just a usability improvement, I'll tag this bug as "idea" and remove it as a blocker for the next release

myk002 avatar Jun 13 '22 15:06 myk002

@TymurGubayev what would make the number of lines per entry variable? I wasn't able to find a case where an entry wasn't 8 lines above.

lethosor avatar Jun 22 '22 07:06 lethosor

@lethosor The description of a historic figure has two lines, but not every petition has a historic figure. Also, a "user-friendly" description of an agreement (last line) is currently only provided for Location and Residency -- because I have only seen those, but probably Citizenship, PromisePosition, and maybe Parley are possible.

TymurGubayev avatar Jun 22 '22 08:06 TymurGubayev