Fix bugs from the post-#72 review: arrow overdraw, duplicate signals, Pawns.tasks setter #124
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
These four bugs turned up in a whole-project review after #72 merged (
2ad4d63). None of them breaks gameplay today. Each one is either a visible defect or a signal that doesn't mean what it says.1. The entrance arrow is drawn twice (and is hard to see on sandy terrain)
PlacementController._build_entrance_arrow_mesh()(entities/buildings/placement_controller.gd:282-289) adds a second surface after the chevron. It is a plain triangle with its ratios hard-coded (0.35,0.30,0.20), not read from thearrow_*_ratioexports.In addition, the default colour of the arrow closely matches the sandy terrain colour and can be hard to see. Choose a new colour which is distinct from all terrain colours.
With the default ratios, that triangle is exactly the chevron's outline without the notch:
The ghost's arrow therefore shows as a triangle with a darker chevron inside it. The second surface came in with
d85335f, and looks like scaffolding left over from building the chevron.Fix: delete the second
surface_begin…surface_endblock.Check: look at it headed.
tools/screenshot_entrance_arrow.gd(#61) is the existing harness for this.2.
TaskManager.add_subtask()emitstask_addedtwiceadd_subtask()callsadd(), which emitstask_added(task_manager.gd:26). It then emits it again at line 150.test_add_subtask_emits_task_added_for_the_childusesassert_signal_emitted_with_parameters, which only checks that the signal fired at least once, so the duplicate gets through.Fix: delete line 150.
Test:
assert_signal_emit_count(manager, "task_added", 1)after a singleadd_subtask().3.
next_for()emitstask_unblockedfor tasks that were never blockedtask_manager.gd:122-124: every task that can start takes theelsebranch. That branch callstransition_to(PENDING), which is a no-op for a task already PENDING, and emitstask_unblockedanyway. It does this once per idle pawn per tick, for every startable task.Buildings._task_unblockedhas a guard, so nothing looks wrong, but any other listener would be told that tasks were unblocked when they never had been.Fix: only transition and emit when
task.status == Task.Status.BLOCKED.Test:
next_for()on a queue holding one ordinary PENDING task does not emittask_unblocked. A task that was blocked and can now start still does.4. The
Pawns.taskssetter never disconnects the previous managerBuildings.tasksdisconnects the old manager before connecting the new one (buildings.gd:43-45).Pawns.tasks(entities/pawns/pawns.gd:5-13) only connects. Reassigning it would leave the old manager'stask_completed/task_cancelled/task_releasedstill calling into the registry.Fix: copy the
Buildingspattern.Test: assign manager A, then manager B. Cancelling a task on A must not clear the task from a pawn.
Minor: the debug panel's pawn list goes stale
DebugLayer.populate_pawns_list()only runs when debug mode is toggled (ui/debug_layer.gd:43), and_update_pawns_list()only updates labels that already exist. After an R-reroll, the old pawns' labels are removed and the new pawns never get one. Each of those removals also logs apush_error, because it detects removal by callingPawns.get_pawn(), and that function errors on an unknown id.Fix: repopulate on
map.regenerated(or onpawn_spawned/pawn_removed), and checkpawns.all()rather than callingget_pawn().Acceptance criteria
task_addedfires exactly once peradd_subtask()task_unblockedfires only on a BLOCKED → PENDING transitionPawns.tasksdisconnects the previous managerpush_error