DFHack / dfhack

Memory hacking library for Dwarf Fortress and a set of tools that use it
Other
1.86k stars 468 forks source link

`tweak hide-priority` doesn't persist reliably #1068

Closed lethosor closed 3 years ago

lethosor commented 7 years ago

Specifically, it sets designation.priority_set to false, but DF changes it back to true when making new designations, which causes priorities to be displayed again.

See 2acdede03bde2f486479099787d7a4a09b7f3c00

huuxfluux commented 3 years ago

This bug pisses me off. I'd pay for it to be fixed but i't seems like all i can do is write this comment :P GL!

lethosor commented 3 years ago

Because of how DF behaves here, it is tricky to design a solution that pleases everyone.

I think one option that might work is to add two pieces of state on DFHack's side, to keep track of whether alt-P has been pressed as well as the last value of the designation.priority_set flag set by pressing alt-P. If the former is true, designation.priority_set would be overwritten with the latter when opening the menu. This would not persist across save/load cycles, though (tweaks typically don't do that). It would cut down on keypresses for people who are making lots of designations and don't want to see priorities, but would require people who do want to see priorities after they make a designation to press alt-P if they were hidden (I suppose this is likely less common).

I would be happy to look over a PR for this, at any rate. (Small implementation detail: any state defined in tweak hooks like I described above would need to be static.)