NEO-31: wrap long lines for gdlint pre-push
parent
af1fdef816
commit
18e55f717a
|
|
@ -22,9 +22,11 @@ func _ready() -> void:
|
|||
|
||||
|
||||
## [param target_id] server [code]lockedTargetId[/code] string, or [code]null[/code] if none.
|
||||
## Returns [code]true[/code] when the HTTP POST was **queued** ([method HTTPRequest.request] returned [code]OK[/code]);
|
||||
## [code]false[/code] if already [member _busy], request failed to start, or client invalid — use for
|
||||
## [code]ability_cast_requested[/code] dev / future telemetry so hooks match actual submit attempts.
|
||||
## Returns [code]true[/code] when the HTTP POST was **queued**
|
||||
## ([method HTTPRequest.request] returned [code]OK[/code]);
|
||||
## [code]false[/code] if already [member _busy], request failed to start, or client invalid —
|
||||
## use for [code]ability_cast_requested[/code] dev / future telemetry so hooks match actual submit
|
||||
## attempts.
|
||||
func request_cast(slot_index: int, ability_id: String, target_id: Variant) -> bool:
|
||||
if _busy:
|
||||
return false
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
extends Object
|
||||
|
||||
## Pure resolver for digit hotbar → cast intent (NEO-31). [code]main.gd[/code] delegates here so
|
||||
## GdUnit can cover unbound slots and [code]lockedTargetId[/code] sourcing without booting the scene.
|
||||
## GdUnit can cover unbound slots and [code]lockedTargetId[/code] sourcing without booting
|
||||
## the scene.
|
||||
## No [code]class_name[/code] — match [code]prototype_target_constants.gd[/code] preload pattern.
|
||||
|
||||
const KEY_OK := "ok"
|
||||
|
|
@ -16,14 +17,19 @@ const REASON_EMPTY_SLOT := "empty_slot"
|
|||
|
||||
## [param slots] snapshot from [code]HotbarState.slots_snapshot()[/code] (fixed length, entries
|
||||
## [code]null[/code] or [String] ability ids).
|
||||
## [param target_cached_state] from [code]TargetSelectionClient.cached_state()[/code] (may be empty).
|
||||
## [param target_cached_state] from [code]TargetSelectionClient.cached_state()[/code]
|
||||
## (may be empty).
|
||||
## Returns [code]{ "ok": true, "slotIndex", "abilityId", "targetId" }[/code] or
|
||||
## [code]{ "ok": false, "reason" }[/code].
|
||||
static func resolve(slot_index: int, slots: Array, target_cached_state: Dictionary) -> Dictionary:
|
||||
if slot_index < 0 or slot_index >= slots.size():
|
||||
return {KEY_OK: false, KEY_REASON: REASON_INVALID_SLOT}
|
||||
var ability_variant: Variant = slots[slot_index]
|
||||
if ability_variant == null or not (ability_variant is String) or (ability_variant as String).strip_edges().is_empty():
|
||||
if (
|
||||
ability_variant == null
|
||||
or not (ability_variant is String)
|
||||
or (ability_variant as String).strip_edges().is_empty()
|
||||
):
|
||||
return {KEY_OK: false, KEY_REASON: REASON_EMPTY_SLOT}
|
||||
var ability_id: String = (ability_variant as String).strip_edges()
|
||||
var target_id: Variant = null
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@ extends Node3D
|
|||
## Prototype: two random short bumps (sibling StaticBody3D under NavigationRegion3D; see
|
||||
## `random_floor_bumps.gd`) before nav bake.
|
||||
## Prototype: `PhysicsRampTest*` (+X extension: west slab ends before the dip;
|
||||
## `PhysicsRampTestFloorExtensionNorthFill` / `SouthFill` restore walkable floor past the dip in ±Z;
|
||||
## `PhysicsRampTestFloorExtensionNorthFill` / `SouthFill` restore walkable floor past the dip
|
||||
## in ±Z;
|
||||
## block; gentle ramp on **+Z**; steep on **+X**), plus `PhysicsSmoothHillTest` /
|
||||
## `PhysicsSmoothDipTest` (HeightMap collision).
|
||||
## Steep ramp: **2 m / 1.5 m** rise/run (~53°) so slope exceeds `Player` `floor_max_angle` (~50°)
|
||||
|
|
@ -208,7 +209,8 @@ func _on_authoritative_position(world: Vector3, apply_as_snap: bool) -> void:
|
|||
##
|
||||
## NEO-27 / NEO-31: `ability_cast_requested` is emitted as a dev [code]print[/code] from
|
||||
## [method _request_hotbar_cast_slot] only after [code]request_cast[/code] on
|
||||
## [code]AbilityCastClient[/code] returns [code]true[/code] (POST successfully queued on [code]HTTPRequest[/code]).
|
||||
## [code]AbilityCastClient[/code] returns [code]true[/code]
|
||||
## (POST successfully queued on [code]HTTPRequest[/code]).
|
||||
## [code]ability_cast_denied[/code] is surfaced via [code]push_warning[/code] from
|
||||
## `ability_cast_client.gd` on deny responses (TODO(E9.M1): telemetry schema + ingest).
|
||||
func _on_authoritative_ack_for_hud(world: Vector3) -> void:
|
||||
|
|
@ -365,15 +367,19 @@ func _request_hotbar_cast_slot(slot_index: int) -> void:
|
|||
var target_id: Variant = outcome.get(HotbarCastSlotResolver.KEY_TARGET_ID, null)
|
||||
var started: bool = false
|
||||
if is_instance_valid(_ability_cast_client) and _ability_cast_client.has_method("request_cast"):
|
||||
started = bool(_ability_cast_client.call("request_cast", resolved_slot, ability_id, target_id))
|
||||
started = bool(
|
||||
_ability_cast_client.call("request_cast", resolved_slot, ability_id, target_id)
|
||||
)
|
||||
if started:
|
||||
var target_label: String = "null"
|
||||
if target_id != null:
|
||||
target_label = str(target_id)
|
||||
print(
|
||||
(
|
||||
"ability_cast_requested slot=%d ability_id=%s targetId=%s"
|
||||
% [resolved_slot, ability_id, target_label]
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
func _forward_interact_post(method: String) -> void:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
extends GdUnitTestSuite
|
||||
|
||||
# main.gd sets base_url/dev_player_id on AbilityCastClient from the same authority block as HotbarLoadoutClient (NEO-31).
|
||||
# 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")
|
||||
|
||||
|
||||
|
|
@ -95,7 +97,10 @@ func test_request_cast_posts_target_id_string_when_set() -> void:
|
|||
var transport := MockHttpTransport.new()
|
||||
transport.enqueue(HTTPRequest.RESULT_SUCCESS, 200, '{"schemaVersion":1,"accepted":true}')
|
||||
var c := _make_client(transport)
|
||||
assert_that(bool(c.call("request_cast", 0, "prototype_pulse", "prototype_target_alpha"))).is_true()
|
||||
(
|
||||
assert_that(bool(c.call("request_cast", 0, "prototype_pulse", "prototype_target_alpha")))
|
||||
. is_true()
|
||||
)
|
||||
var parsed: Variant = JSON.parse_string(transport.last_body)
|
||||
var body: Dictionary = parsed
|
||||
assert_that(body.get("targetId")).is_equal("prototype_target_alpha")
|
||||
|
|
|
|||
Loading…
Reference in New Issue