Record why a task is blocked; surface only unreachable sites (#119) #134
No reviewers
Labels
No labels
assets
bug
duplicate
enhancement
help wanted
invalid
question
testing
ui
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
liamjd/UntitledColonyBuilder!134
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "119-blocked-task-reason"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Gives a blocked task a reason, so the player is warned about a site no pawn can reach but not about a building that is simply waiting on its own sub-tasks.
Changes
Task.BlockReason {NONE, NOT_READY, WAITING_ON_CHILDREN, UNREACHABLE}andTask.block_reason.Task.evaluate_block(ctx): a pure query. Precedence isUNREACHABLE>WAITING_ON_CHILDREN>NOT_READY.can_start()is nowevaluate_block() == NONE, socomplete()'s parent re-check is unchanged.TaskManager.next_for()callsevaluate_block()once per task and is the only writer ofblock_reason. It emitstask_blockedonce when a task enters BLOCKED or its reason changes, and not on a repeat. It clears the reason when the task is offered again.Buildings._task_blocked()setsconstruction_blockedtoblock_reason == UNREACHABLE, so a change of reason can clear the red as well as set it.ToastNotifier.for_blocked()only returns a message forUNREACHABLE, titled "Building entrance unreachable". That title also fits demolition, which goes through the same path._on_task_blocked()null-checks rather than repeating the rule.Decisions (recorded on #119)
UNREACHABLEis surfaced, as an allow-list.NOT_READYbecomes quiet as a result; today it only arises when a task outlives its building.Verification
606e3ca):test_task_block_reason.gd(new, 11 tests), plus additions totest_buildings.gdandtest_toast_notifier.gd. It was checked satisfiable against a throwaway implementation before this one was written.test_a_new_block_is_announced_oncewas added during review, after it caught a double emit on a first block.Not done
next_for()still emitstask_unblockedfor tasks that were never blocked, in the same branch touched here.Closes #119
🤖 Generated with Claude Code
Tests only; the implementation is still to be written. They pin: - Task.BlockReason {NONE, UNREACHABLE, WAITING_ON_CHILDREN, NOT_READY} and Task.evaluate_block(ctx), a pure query with UNREACHABLE taking precedence. can_start() is evaluate_block() == NONE. - next_for() recording the reason with the block, clearing it when the task is offered again, and re-emitting task_blocked on a change of reason, but not on a repeat. - Only UNREACHABLE marks a building or raises a toast. The notifier's blocked-task fixture now carries that reason. Checked against a throwaway implementation (all 765 passing), then discarded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>Task gains BlockReason {NONE, NOT_READY, WAITING_ON_CHILDREN, UNREACHABLE} and a block_reason field. evaluate_block(ctx) is the pure query, with UNREACHABLE taking precedence; can_start() is now evaluate_block() == NONE. next_for() calls evaluate_block() once per task and is the only writer of block_reason. It emits task_blocked once when a task enters BLOCKED or its reason changes, and clears the reason when the task is offered again. Only UNREACHABLE is surfaced. Buildings sets construction_blocked from the reason, so a change of reason can clear the red as well as set it, and ToastNotifier.for_blocked() returns null for the quiet reasons. The debug panel shows task status and reason by name, and pawn state by name. Adds test_a_new_block_is_announced_once, which caught a double emit on a first block. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>