scripts icon indicating copy to clipboard operation
scripts copied to clipboard

Make `gui/workorder-details` and `gui/workshop-job` work again

Open TymurGubayev opened this issue 1 year ago • 11 comments

This PR merges the gui/workorder-details.lua into gui/workshop-job.lua and updates the result to work with DF50.

image

TymurGubayev avatar Aug 13 '23 17:08 TymurGubayev

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 in onRenderBody -- we'll keep it as is for now
  • [ ] also, I haven't tested it beyond ensuring the UI is kind of working

TymurGubayev avatar Aug 13 '23 17:08 TymurGubayev

  • [ ] 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 in onRenderBody

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.

myk002 avatar Aug 13 '23 18:08 myk002

  • [x] I'm not quite sure what is the replacement for dlg.showMessage -- don't replace it

TymurGubayev avatar Sep 03 '23 17:09 TymurGubayev

  • [ ] 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.

myk002 avatar Sep 03 '23 17:09 myk002

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?

TymurGubayev avatar Sep 03 '23 18:09 TymurGubayev

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.

myk002 avatar Sep 03 '23 19:09 myk002

what does the 20 mean? image

something changed somewhere and now we have for some reason a set bit without a name:

image

(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.

TymurGubayev avatar Nov 05 '23 19:11 TymurGubayev

what does the 20 mean?

That might require a structure update. I'll look into it

myk002 avatar Nov 06 '23 00:11 myk002

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".

myk002 avatar Nov 06 '23 22:11 myk002

testing notes:

  1. the alignment seems off (screen dimensions: 150x66): image
  2. maybe don't enable the Configure job inputs HotkeyLabel if there is nothing that can be configured: image
  3. The ability to reset to defaults would be very nice
  4. 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() returns false)
  5. I've learned from showmood that people want to see whole item quantities, not the internal counters. could we display 1 here instead of 150 (similar for cloth and thread) image
  6. The Esc hotkey hint probably isn't necessary. Most other windows don't have that.
  7. "quantity: 1" would be clearer than "x1"

myk002 avatar Nov 07 '23 01:11 myk002

  1. the alignment seems off (screen dimensions: 150x66):

changed it to work based on window size instead of reading the screen

  1. maybe don't enable the Configure job inputs HotkeyLabel if there is nothing that can be configured:

did that

  1. 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

  1. 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() returns false)

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.

  1. I've learned from showmood that people want to see whole item quantities, not the internal counters. could we display 1 here instead of 150 (similar for cloth and thread)

changed that. Now I'm not sure anything but 1 is even possible... Maybe in a modded game?

  1. The Esc hotkey hint probably isn't necessary. Most other windows don't have that.

removed that

  1. "quantity: 1" would be clearer than "x1"

changed that. Btw, there are two modes: work order and active job, with slightly different texts

image

image

It's possible we can only ever see 0 of 1 for an active job.

TymurGubayev avatar Nov 07 '23 18:11 TymurGubayev