Skip to content

Labor Control Overlay #1463

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

unboundlopez
Copy link

@unboundlopez unboundlopez commented Jun 1, 2025

Recording.2025-06-01.122635.1.mp4

Select Lock Overlay

This is a DFHack overlay plugin for Dwarf Fortress that simulates the selection and locking of multiple units within the Work Details screen. It provides a simple UI interface to batch-toggle units' labor assignments, either by selecting, locking, or both.

Features

  • Overlay Interface: Integrated directly into the LABOR/WORK_DETAILS viewscreen.
  • Action Modes: Choose between Select only, Lock only, or Select + Lock.
  • Batch Processing: Specify how many entries to affect and apply actions with one click.
  • Non-Intrusive: Uses DFHack GUI input simulation to trigger existing functionality.

Usage

Once the plugin is loaded and you're in the Work Details screen (e.g., y -> Work Details), the overlay will automatically appear.

  1. Use the Mode dropdown to select what action(s) to simulate:

    • Select only: Just toggles unit selection.
    • Lock only: Just toggles the lock status.
    • Select + Lock: Toggles both selection and lock.
  2. Adjust the number of entries to apply actions to (default is 100).

  3. Press the RUN button (or the hotkey defined for it) to execute the actions.

unboundlopez and others added 6 commits June 1, 2025 12:39
…L_RIGHT')

added         gui.simulateInput(dfhack.gui.getCurViewscreen(), 'STANDARDSCROLL_RIGHT')
reason: in the event that the user does not select a unit and the selection is only the labor choices(by default). This line will select the first unit on the list.
@unboundlopez
Copy link
Author

pre-commit.ci autofix

@ryanbennitt
Copy link
Contributor

I haven't tried it so it may be buggy or non-functional, but there's a bit of code in gui/manipulator that seems to deal with work details, does this help you avoid the UI approach?

https://github.com/DFHack/scripts/blob/master/gui/manipulator.lua#L657

I think 7 as a default is reasonable compared to 100
@unboundlopez
Copy link
Author

I haven't tried it so it may be buggy or non-functional, but there's a bit of code in gui/manipulator that seems to deal with work details, does this help you avoid the UI approach?

https://github.com/DFHack/scripts/blob/master/gui/manipulator.lua#L657

Hello ryanbennitt

It’s definitely possible to make this run instantly using an interface. However, achieving that would require significantly more code and interactions with variables that I don’t fully understand yet.

Yesterday, while working on a different program, I experimented with enabling and disabling the checkbox for all labors. Visually, everything appeared to work correctly, but the dwarves didn’t actually perform the tasks. Because of that, I believe sticking with a true macro is the best option for simplicity.

Previously, before using this labor control overlay interface, I relied on a third-party macro tool called VoiceAttack, which I still use for other tasks.

Also, if someone runs this program extremely fast say, within 1 frame it does execute successfully, but the checkboxes may appear disabled even though they are actually enabled. I was surprised to see this behavior, but confirmed that if the user exits and re-enters the labor menu, all the labors are indeed selected and locked as expected.

This is the path to enable/disable the checboxes: gui/gm-editor df.global.plotinfo.labor_info.work_details[x].flags

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants