NEO-25: satisfy gdlint/gdformat for pre-push hook

pull/48/head
VinPropane 2026-04-24 20:56:04 -04:00
parent c17526e611
commit ac2916bfee
5 changed files with 22 additions and 17 deletions

View File

@ -1,6 +1,7 @@
extends Node
## NEO-25: fetches `GET /game/world/interactables` and exposes descriptor rows for world build + glow preview.
## NEO-25: fetches `GET /game/world/interactables`; exposes descriptor rows for world build and
## glow preview.
signal catalog_ready(descriptors: Array)
signal catalog_failed(reason: String)

View File

@ -8,8 +8,9 @@ const EMISSION_DIM := 0.12
const EMISSION_BRIGHT := 7.0
var _player: CharacterBody3D
## Each element: [code]anchor[/code] [Vector3], [code]radius[/code] [float], [code]material[/code]
## [StandardMaterial3D], [code]markers[/code] [Array] of [MeshInstance3D] (optional; emission driven via material).
## Each element: [code]anchor[/code] [Vector3], [code]radius[/code] [float],
## [code]material[/code] [StandardMaterial3D], [code]markers[/code] [Array] of [MeshInstance3D]
## (optional; emission driven via material).
var _glow_groups: Array = []

View File

@ -1,8 +1,9 @@
extends Node
## NS-18 / NEO-25: POST InteractionRequest; prints server allow/deny to Output (prototype).
## [kbd]E[/kbd] → [code]prototype_terminal[/code]; [kbd]R[/kbd] → [code]prototype_resource_node_alpha[/code]
## (stable contract ids — must match server registry). Key handling is delegated from
## [kbd]E[/kbd] → [code]prototype_terminal[/code]; [kbd]R[/kbd] →
## [code]prototype_resource_node_alpha[/code] (stable contract ids — must match server registry).
## Key handling is delegated from
## [code]main.gd[/code] [method Node._unhandled_key_input] (see [method post_interact_terminal] /
## [method post_interact_resource]) so the embedded Game dock still receives E/R reliably.
@ -16,8 +17,9 @@ const ID_RESOURCE_NODE := "prototype_resource_node_alpha"
var _http: Node
var _busy: bool = false
## While an HTTP POST is in flight, the latest [code]interactableId[/code] from a new press overwrites
## this slot (last wins); [method _try_flush_pending] runs the next POST after [signal HTTPRequest.request_completed].
## While an HTTP POST is in flight, the latest [code]interactableId[/code] from a new press
## overwrites this slot (last wins); [method _try_flush_pending] runs the next POST after
## [signal HTTPRequest.request_completed].
var _pending_interactable_id: String = ""
var _current_interactable_id: String = ""
@ -87,13 +89,9 @@ func _on_request_completed(
var allowed: bool = bool(d.get("allowed", false))
var reason: Variant = d.get("reasonCode", null)
if allowed:
print(
"Interaction [%s]: allowed=true (reasonCode omitted on success)" % id_echo
)
print("Interaction [%s]: allowed=true (reasonCode omitted on success)" % id_echo)
else:
print(
"Interaction [%s]: allowed=false reasonCode=%s" % [id_echo, str(reason)]
)
print("Interaction [%s]: allowed=false reasonCode=%s" % [id_echo, str(reason)])
_try_flush_pending()
return
print("Interaction [%s]: HTTP %s body=%s" % [id_echo, response_code, text])

View File

@ -370,7 +370,10 @@ func _on_interactables_catalog_ready(descriptors: Array) -> void:
func _on_interactables_catalog_failed(reason: String) -> void:
# `InteractablesCatalogClient` already `push_error`s; this hook exists for wiring clarity.
var readme := "Interaction + range preview (NEO-9 + NEO-25)"
push_warning(
"Interactables catalog failed (%s) — start the game server first; see client README section \"Interaction + range preview (NEO-9 + NEO-25)\"."
% reason
(
"Interactables catalog failed (%s) — start the game server first; see client README (%s)."
% [reason, readme]
)
)

View File

@ -2,6 +2,8 @@ extends GdUnitTestSuite
## NEO-25: parse `GET /game/world/interactables` JSON into descriptor rows.
const _CATALOG_SCRIPT := preload("res://scripts/interactables_catalog_client.gd")
func test_parse_catalog_json_orders_and_fields() -> void:
var json := (
@ -12,7 +14,7 @@ func test_parse_catalog_json_orders_and_fields() -> void:
+ '"anchor":{"x":0,"y":0.5,"z":0},"interactionRadius":3}'
+ "]}"
)
var rows: Variant = load("res://scripts/interactables_catalog_client.gd").call("parse_catalog_json", json)
var rows: Variant = _CATALOG_SCRIPT.parse_catalog_json(json)
assert_that(rows is Array).is_true()
var arr: Array = rows
assert_that(arr.size()).is_equal(2)
@ -27,5 +29,5 @@ func test_parse_catalog_json_orders_and_fields() -> void:
func test_parse_catalog_json_returns_empty_on_garbage() -> void:
var rows2: Variant = load("res://scripts/interactables_catalog_client.gd").call("parse_catalog_json", "[]")
var rows2: Variant = _CATALOG_SCRIPT.parse_catalog_json("[]")
assert_that((rows2 as Array).is_empty()).is_true()