NEO-25: satisfy gdlint/gdformat for pre-push hook
parent
c17526e611
commit
ac2916bfee
|
|
@ -1,6 +1,7 @@
|
||||||
extends Node
|
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_ready(descriptors: Array)
|
||||||
signal catalog_failed(reason: String)
|
signal catalog_failed(reason: String)
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,9 @@ const EMISSION_DIM := 0.12
|
||||||
const EMISSION_BRIGHT := 7.0
|
const EMISSION_BRIGHT := 7.0
|
||||||
|
|
||||||
var _player: CharacterBody3D
|
var _player: CharacterBody3D
|
||||||
## Each element: [code]anchor[/code] [Vector3], [code]radius[/code] [float], [code]material[/code]
|
## Each element: [code]anchor[/code] [Vector3], [code]radius[/code] [float],
|
||||||
## [StandardMaterial3D], [code]markers[/code] [Array] of [MeshInstance3D] (optional; emission driven via material).
|
## [code]material[/code] [StandardMaterial3D], [code]markers[/code] [Array] of [MeshInstance3D]
|
||||||
|
## (optional; emission driven via material).
|
||||||
var _glow_groups: Array = []
|
var _glow_groups: Array = []
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
## NS-18 / NEO-25: POST InteractionRequest; prints server allow/deny to Output (prototype).
|
## 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]
|
## [kbd]E[/kbd] → [code]prototype_terminal[/code]; [kbd]R[/kbd] →
|
||||||
## (stable contract ids — must match server registry). Key handling is delegated from
|
## [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] /
|
## [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.
|
## [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 _http: Node
|
||||||
var _busy: bool = false
|
var _busy: bool = false
|
||||||
## While an HTTP POST is in flight, the latest [code]interactableId[/code] from a new press overwrites
|
## While an HTTP POST is in flight, the latest [code]interactableId[/code] from a new press
|
||||||
## this slot (last wins); [method _try_flush_pending] runs the next POST after [signal HTTPRequest.request_completed].
|
## overwrites this slot (last wins); [method _try_flush_pending] runs the next POST after
|
||||||
|
## [signal HTTPRequest.request_completed].
|
||||||
var _pending_interactable_id: String = ""
|
var _pending_interactable_id: String = ""
|
||||||
var _current_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 allowed: bool = bool(d.get("allowed", false))
|
||||||
var reason: Variant = d.get("reasonCode", null)
|
var reason: Variant = d.get("reasonCode", null)
|
||||||
if allowed:
|
if allowed:
|
||||||
print(
|
print("Interaction [%s]: allowed=true (reasonCode omitted on success)" % id_echo)
|
||||||
"Interaction [%s]: allowed=true (reasonCode omitted on success)" % id_echo
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
print(
|
print("Interaction [%s]: allowed=false reasonCode=%s" % [id_echo, str(reason)])
|
||||||
"Interaction [%s]: allowed=false reasonCode=%s" % [id_echo, str(reason)]
|
|
||||||
)
|
|
||||||
_try_flush_pending()
|
_try_flush_pending()
|
||||||
return
|
return
|
||||||
print("Interaction [%s]: HTTP %s body=%s" % [id_echo, response_code, text])
|
print("Interaction [%s]: HTTP %s body=%s" % [id_echo, response_code, text])
|
||||||
|
|
|
||||||
|
|
@ -370,7 +370,10 @@ func _on_interactables_catalog_ready(descriptors: Array) -> void:
|
||||||
|
|
||||||
func _on_interactables_catalog_failed(reason: String) -> void:
|
func _on_interactables_catalog_failed(reason: String) -> void:
|
||||||
# `InteractablesCatalogClient` already `push_error`s; this hook exists for wiring clarity.
|
# `InteractablesCatalogClient` already `push_error`s; this hook exists for wiring clarity.
|
||||||
|
var readme := "Interaction + range preview (NEO-9 + NEO-25)"
|
||||||
push_warning(
|
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]
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ extends GdUnitTestSuite
|
||||||
|
|
||||||
## NEO-25: parse `GET /game/world/interactables` JSON into descriptor rows.
|
## 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:
|
func test_parse_catalog_json_orders_and_fields() -> void:
|
||||||
var json := (
|
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}'
|
+ '"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()
|
assert_that(rows is Array).is_true()
|
||||||
var arr: Array = rows
|
var arr: Array = rows
|
||||||
assert_that(arr.size()).is_equal(2)
|
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:
|
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()
|
assert_that((rows2 as Array).is_empty()).is_true()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue