From af1fdef816a65b6153524c5e4fb448cc3ae6194c Mon Sep 17 00:00:00 2001 From: VinPropane Date: Mon, 27 Apr 2026 20:45:48 -0400 Subject: [PATCH] NEO-31: single authority mirror for hotbar and ability cast clients --- client/scripts/main.gd | 15 +++++---------- client/test/ability_cast_client_test.gd | 1 + docs/reviews/2026-04-27-NEO-31.md | 2 +- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/client/scripts/main.gd b/client/scripts/main.gd index 141d23b..76f9996 100644 --- a/client/scripts/main.gd +++ b/client/scripts/main.gd @@ -235,27 +235,22 @@ func _setup_hotbar_loadout_sync() -> void: _hotbar_client = load("res://scripts/hotbar_loadout_client.gd").new() _hotbar_client.name = "HotbarLoadoutClient" add_child(_hotbar_client) + _ability_cast_client = load("res://scripts/ability_cast_client.gd").new() + _ability_cast_client.name = "AbilityCastClient" + add_child(_ability_cast_client) if is_instance_valid(_authority): var authority_base_url: Variant = _authority.get("base_url") var authority_player_id: Variant = _authority.get("dev_player_id") if authority_base_url is String and not (authority_base_url as String).is_empty(): _hotbar_client.set("base_url", authority_base_url) + _ability_cast_client.set("base_url", authority_base_url) if authority_player_id is String and not (authority_player_id as String).is_empty(): _hotbar_client.set("dev_player_id", authority_player_id) + _ability_cast_client.set("dev_player_id", authority_player_id) if _hotbar_client.has_method("set_hotbar_state"): _hotbar_client.call("set_hotbar_state", _hotbar_state) if _hotbar_client.has_method("request_sync_from_server"): _hotbar_client.call("request_sync_from_server") - _ability_cast_client = load("res://scripts/ability_cast_client.gd").new() - _ability_cast_client.name = "AbilityCastClient" - add_child(_ability_cast_client) - if is_instance_valid(_authority): - var authority_base_url2: Variant = _authority.get("base_url") - var authority_player_id2: Variant = _authority.get("dev_player_id") - if authority_base_url2 is String and not (authority_base_url2 as String).is_empty(): - _ability_cast_client.set("base_url", authority_base_url2) - if authority_player_id2 is String and not (authority_player_id2 as String).is_empty(): - _ability_cast_client.set("dev_player_id", authority_player_id2) ## Combines cached server state (`_last_target_state`) with per-anchor horizontal diff --git a/client/test/ability_cast_client_test.gd b/client/test/ability_cast_client_test.gd index 8b92f69..a8efc2c 100644 --- a/client/test/ability_cast_client_test.gd +++ b/client/test/ability_cast_client_test.gd @@ -1,5 +1,6 @@ extends GdUnitTestSuite +# main.gd sets base_url/dev_player_id on AbilityCastClient from the same authority block as HotbarLoadoutClient (NEO-31). const CastClient := preload("res://scripts/ability_cast_client.gd") diff --git a/docs/reviews/2026-04-27-NEO-31.md b/docs/reviews/2026-04-27-NEO-31.md index c8114e8..83460a1 100644 --- a/docs/reviews/2026-04-27-NEO-31.md +++ b/docs/reviews/2026-04-27-NEO-31.md @@ -35,7 +35,7 @@ NEO-31 adds the prototype `POST /game/players/{id}/ability-cast` route, client d ## Nits -- Nit: The new `main.gd` variables `authority_base_url2` and `authority_player_id2` are clear enough, but `ability_base_url` / `ability_player_id` would be easier to scan if this setup grows. +- ~~Nit: The new `main.gd` variables `authority_base_url2` and `authority_player_id2` are clear enough, but `ability_base_url` / `ability_player_id` would be easier to scan if this setup grows.~~ **Done.** One `_authority` read applies `base_url` / `dev_player_id` to both HTTP clients after both nodes exist. ## Verification