scripts
scripts copied to clipboard
Make `gui/workorder-details` and `gui/workshop-job` work again
This PR merges the gui/workorder-details.lua
into gui/workshop-job.lua
and updates the result to work with DF50.
issues:
- [x]
Ctrl+D
opens another DFHack screen as well -- https://github.com/DFHack/dfhack/pull/3727 - [x] I haven't found a better way to hide the widget when in the wrong context, other than
self.subviews.button.visible = false
inonRenderBody
-- we'll keep it as is for now - [ ] also, I haven't tested it beyond ensuring the UI is kind of working
- [ ]
Ctrl+D
opens another DFHack screen as well
This can likely be solved by changing the gui/design
keybinding from @dwarfmode
to @dwarfmode/Default
in dfhack.keybindings.init
- [ ] I haven't found a better way to hide the widget when in the wrong context, other than
self.subviews.button.visible = false
inonRenderBody
The preferred solution here is to modify modules/Gui.cpp
to produce the more specific focus string that you need. If that is not sufficient, then yes you can set the button invisible in onRender[Whatever]
- [ ] also, I haven't tested it beyond ensuring the UI is kind of working
The UI definitely needs some updating and testing. It uses code from gui/workshop-job
, which itself hasn't been looked at since v50 dropped. It also should use a ZScreen and draggable windows to fit in with the modern UI themes.
- [x] I'm not quite sure what is the replacement for
dlg.showMessage
-- don't replace it
- [ ] I'm not quite sure what is the replacement for
dlg.showMessage
That's still fine to use. At some point, I'll swap out the implementation to use a ZScreenModal, but that should be transparent to the callers.
Sphinx is complaining because of docs/changelogs/news.rst:861:undefined label: gui/workorder-details
What's the approach with removed scripts here, should I keep the referenced docs as is, or maybe make its only content a reference to the new script?
Tool removal is a tad janky since it crosses repos. You have to add an entry to https://github.com/DFHack/dfhack/blob/develop/docs/about/Removed.rst, but CI for both repos will fail until everything is consistent.
what does the
20
mean?
something changed somewhere and now we have for some reason a set bit without a name:
(even though df.job_item_flags3[20] == nil
)
and this is how the list is filled from a bitfield:
local function list_flags(list, bitfield)
for name,val in pairs(bitfield) do
if val then
table.insert(list, name)
end
end
end
Might this be a bug? Or maybe it should've been unknown
?
To avoid confusion, I'll change the method above to exclude those.
what does the
20
mean?
That might require a structure update. I'll look into it
I identified the flags and pushed the updated build to the Steam testing
branch if you'd like to test with it. Flag 20 is (unsurprisingly, given the context) "gem".
testing notes:
- the alignment seems off (screen dimensions: 150x66):
- maybe don't enable the Configure job inputs HotkeyLabel if there is nothing that can be configured:
- The ability to reset to defaults would be very nice
- The ability to remove traits (or change the item type) could be considered an exploit. Could we only offer that capability if armok mode is enabled? (
dfhack.getHideArmokTools()
returnsfalse
) - I've learned from
showmood
that people want to see whole item quantities, not the internal counters. could we display1
here instead of150
(similar for cloth and thread) - The Esc hotkey hint probably isn't necessary. Most other windows don't have that.
- "quantity: 1" would be clearer than "x1"
- the alignment seems off (screen dimensions: 150x66):
changed it to work based on window size instead of reading the screen
- maybe don't enable the Configure job inputs HotkeyLabel if there is nothing that can be configured:
did that
- The ability to reset to defaults would be very nice
defaults is hard - I'd have to know them for every job type in advance. I added a Ctrl-Z
to reset changes
- The ability to remove traits (or change the item type) could be considered an exploit. Could we only offer that capability if armok mode is enabled? (
dfhack.getHideArmokTools()
returnsfalse
)
change item type is now disabled if armok tools aren't present. Traits have same problem as defaults: I'd need to know in advance what the defaults are, to prevent the user from removing the non-default ones.
- I've learned from
showmood
that people want to see whole item quantities, not the internal counters. could we display1
here instead of150
(similar for cloth and thread)
changed that. Now I'm not sure anything but 1
is even possible... Maybe in a modded game?
- The Esc hotkey hint probably isn't necessary. Most other windows don't have that.
removed that
- "quantity: 1" would be clearer than "x1"
changed that. Btw, there are two modes: work order and active job, with slightly different texts
It's possible we can only ever see 0 of 1
for an active job.