magicciv/.project/objectives/p2-53a1-sentry-bridge-state-pipe.md
Natalie e5b9d10b61 feat(@projects/@magic-civilization): add lab and hud system components
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-05-01 22:23:54 -04:00

2.1 KiB

id title priority status scope owner parent updated_at evidence
p2-53a1 Sentry bridge state pipe — extend `GdUnitActions` signature to pass `is_sentrying` p2 done game1 simulator-infra p2-53a 2026-05-01
api-gdext/src/action.rs: legal_actions_for + can_invoke gain is_sentrying: bool param; hardcoded false removed
entities/unit.gd: is_sentrying: bool property added
scenes/hud/unit_panel.gd: _get_is_sentrying helper + is_sentry passed to bridge
test_unit_actions.gd: test_gd_unit_actions_bridge_sentrying_unit_shows_unsentry added; existing 3 bridge calls updated to 5-arg signature
cargo test -p mc-core: 87 passed 0 failed (apricot 2026-05-01)

Summary

p2-53a shipped the Sentry/Unsentry ActionKind end-to-end EXCEPT the GDExtension bridge: api-gdext/src/action.rs:58 and :96 hardcode is_sentrying: false with TODO comments. This means the unit panel in Godot cannot show the Unsentry button (it never thinks the unit is sentrying), only the Sentry button, regardless of actual state.

This sub-objective closes the loop. Tiny scope — one signature extension, one GDScript caller update, one test.

Acceptance

  • [✓] GdUnitActions::legal_actions_for signature gains is_sentrying: bool (after is_fortified). — api-gdext/src/action.rs:40-62
  • [✓] GdUnitActions::can_invoke same. — api-gdext/src/action.rs:73-104
  • [✓] unit_panel.gd::_refresh_action_buttons passes _get_is_sentrying(_selected_unit) (new helper reading unit.is_sentrying). — unit_panel.gd:185,190,560-566
  • [✓] Unit.gd (entities/unit.gd) exposes is_sentrying: bool property mirroring the Rust state field. — entities/unit.gd:67
  • [✓] Bridge test: sentrying unit's legal_actions_for returns Unsentry-enabled and Sentry-disabled with AlreadySentrying reason. — test_unit_actions.gd: test_gd_unit_actions_bridge_sentrying_unit_shows_unsentry
  • [✓] All gates green. — cargo test -p mc-core 87 passed 0 failed

Non-goals

  • Refactoring the bridge to take a Dictionary instead of accumulating positional bools (that's a separate cleanup; track if it grows further).