Skip to content
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

Use pathability groups (thanks @myk002) to detect stranded citizens #833

Merged
merged 32 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
9c331bd
Use pathability groups (thanks @myk002) to detect stranded citizens
azrazalea Sep 11, 2023
09a3431
Add documentation and enable warn-stranded in control panel
azrazalea Sep 11, 2023
97910b8
warn-stranded: Add GUI to allow persistently ignoring units in
azrazalea Sep 11, 2023
91ac082
Apply suggestions from code review
azrazalea Sep 11, 2023
fa39450
Manual fixes from review
azrazalea Sep 11, 2023
3850f58
Second round review fixes
azrazalea Sep 11, 2023
1e38a3a
Fix indentation
azrazalea Sep 11, 2023
d3b7828
Refactor: Main group is biggest group, lists all stranded groups
azrazalea Sep 12, 2023
07a2bfb
Bugfix: Use coherent method to determine if no stranded units
azrazalea Sep 12, 2023
f08f09e
Add command-line status command with ids and walkGroup options
azrazalea Sep 15, 2023
1580704
Flip order to be ascending by group size
azrazalea Sep 15, 2023
ceb7413
Refactor to better reuse code and organize
azrazalea Sep 15, 2023
e2cf30f
Add ignore and unignore command line commands
azrazalea Sep 18, 2023
453a842
Improve GUI, now decently happy with it
azrazalea Sep 19, 2023
f96cdfa
Add proper toggle group option to GUI only
azrazalea Sep 19, 2023
2f1a751
Update help
azrazalea Sep 19, 2023
6b78003
Fix minor display bug from self-review
azrazalea Sep 19, 2023
4b86576
Update help to match new usage/commands after review
azrazalea Oct 6, 2023
15d42a3
Implement remaining review changes
azrazalea Oct 6, 2023
b7ab411
Fix first round of testing bugs post review changes
azrazalea Oct 6, 2023
3609a8d
Fix typo in unignore group
azrazalea Oct 6, 2023
81a24a8
Remove jarring selection reset on every action
azrazalea Oct 6, 2023
3255e57
Update docs/warn-stranded.rst wording from review
azrazalea Oct 6, 2023
748bff5
Attempt to implement review refactors
azrazalea Oct 7, 2023
d1c1829
Remove attempt at using const
azrazalea Oct 7, 2023
f3befea
Fix post-review-change bugs
azrazalea Oct 7, 2023
5d3de5c
Remove debug prints
azrazalea Oct 7, 2023
60a9a3e
Apply easy fixes from code review
azrazalea Oct 7, 2023
5d11aa5
Update getIgnoredUnits and rename to loadIgnoredUnits
azrazalea Oct 9, 2023
da14516
Attempt at making a GUI layout that better uses space
azrazalea Oct 10, 2023
5dbbcf5
Apply suggestions from code review
myk002 Oct 16, 2023
d141a51
Update warn-stranded.lua
myk002 Oct 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ Template for new versions:

## New Features

## New Scripts
- `warn-stranded`: new repeatable maintenance script to check for stranded units, similar to `warn-starving`

## Fixes
- `suspendmanager`: fix errors when constructing near the map edge
- `gui/sandbox`: fix scrollbar moving double distance on click
Expand Down
53 changes: 53 additions & 0 deletions docs/warn-stranded.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
warn-stranded
=============

.. dfhack-tool::
:summary: Reports citizens that are stranded and can't reach any other citizens.
:tags: fort units

If any (live) groups of fort citizens are stranded from the main (largest) group,
the game will pause and you'll get a warning dialog telling you which citizens are isolated.
This gives you a chance to rescue them before they get overly stressed or start starving.

Each citizen will be put into a group with the other citizens stranded together.

There is a command line interface that can print status of citizens without pausing or bringing up a window.

The GUI and command-line both also have the ability to ignore citizens so they don't trigger a pause and window.

You can enable ``warn-stranded`` notifications in `gui/control-panel` on the "Maintenance" tab.

Usage
-----

::

warn-stranded
azrazalea marked this conversation as resolved.
Show resolved Hide resolved
warn-stranded status
warn-stranded clear
warn-stranded (ignore|ignoregroup|unignore|unignoregroup) <id>

Examples
--------

``warn-stranded``
Standard command that checks citizens and pops up a warning if any are stranded.
Does nothing when there are no unignored stranded citizens.

``warn-stranded status``
List all stranded citizens and all ignored citizens. Includes citizen unit ids.

``warn-stranded clear``
Clear (unignore) all ignored citizens.

``warn-stranded ignore 1``
Ignore citizen with unit id 1.

``warn-stranded ignoregroup 2``
Ignore stranded citizen group 2.

``warn-stranded unignore 1``
Unignore citizen with unit id 1.

``warn-stranded unignoregroup 3``
Unignore stranded citizen group 3.
3 changes: 3 additions & 0 deletions gui/control-panel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ local REPEATS = {
['warn-starving']={
desc='Show a warning dialog when units are starving or dehydrated.',
command={'--time', '10', '--timeUnits', 'days', '--command', '[', 'warn-starving', ']'}},
['warn-stranded']={
desc='Show a warning dialog when units are stranded from all others.',
command={'--time', '0.25', '--timeUnits', 'days', '--command', '[', 'warn-stranded', ']'}},
['empty-wheelbarrows']={
desc='Empties wheelbarrows which have rocks stuck in them.',
command={'--time', '1', '--timeUnits', 'days', '--command', '[', 'fix/empty-wheelbarrows', '-q', ']'}},
Expand Down
Loading