NEO-31: single authority mirror for hotbar and ability cast clients
parent
cc1c6f711e
commit
af1fdef816
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue