NEO-97: fix gdlint and gdformat CI failures

Wrap long lines, restore signal-before-const order in craft_recipe_panel,
and run gdformat on flagged HUD files.
pull/136/head
VinPropane 2026-05-29 21:42:49 -04:00
parent ab0debd0b4
commit bd1dd6b01f
5 changed files with 35 additions and 34 deletions

View File

@ -2,10 +2,10 @@ extends Control
## NEO-74: scrollable prototype recipe list with per-row Craft buttons.
const PrototypeHudTheme := preload("res://scripts/prototype_hud_theme.gd")
signal craft_requested(recipe_id: String)
const PrototypeHudTheme := preload("res://scripts/prototype_hud_theme.gd")
var _item_defs_client: Node = null
var _craft_buttons: Array[Button] = []

View File

@ -377,9 +377,7 @@ func _setup_npc_combat_sync() -> void:
add_child(_player_combat_health_client)
_apply_authority_http_config_to_client(_player_combat_health_client)
if _npc_runtime_client.has_signal("runtime_received"):
_npc_runtime_client.connect(
"runtime_received", Callable(self, "_on_npc_runtime_received")
)
_npc_runtime_client.connect("runtime_received", Callable(self, "_on_npc_runtime_received"))
if _npc_runtime_client.has_signal("runtime_sync_failed"):
_npc_runtime_client.connect(
"runtime_sync_failed", Callable(self, "_on_npc_runtime_sync_failed")
@ -1154,7 +1152,8 @@ func _render_player_combat_hp_label() -> void:
return
var current: int = int(_player_combat_health_snapshot.get("currentHp", 0))
var max_hp: int = int(_player_combat_health_snapshot.get("maxHp", 0))
var defeated_suffix := " (defeated)" if bool(_player_combat_health_snapshot.get("defeated", false)) else ""
var defeated: bool = bool(_player_combat_health_snapshot.get("defeated", false))
var defeated_suffix := " (defeated)" if defeated else ""
_player_combat_hp_label.text = "Player HP: %d/%d%s" % [current, max_hp, defeated_suffix]

View File

@ -17,7 +17,9 @@ static func is_known_npc_id(target_id: String) -> bool:
return PrototypeTargetConstants.ANCHORS.has(target_id.strip_edges())
static func incoming_aggro_row(dev_player_id: String, npc_runtime_snapshot: Dictionary) -> Dictionary:
static func incoming_aggro_row(
dev_player_id: String, npc_runtime_snapshot: Dictionary
) -> Dictionary:
if npc_runtime_snapshot.is_empty():
return {}
return NpcRuntimeClient.row_for_aggro_holder(dev_player_id, npc_runtime_snapshot)
@ -48,30 +50,38 @@ static func resolve_hud_npc_rows(
return {"locked": locked_row, "incoming": incoming_row}
static func build_npc_state_label(
rows: Dictionary, runtime_sync_error: String = ""
) -> String:
static func build_npc_state_label(rows: Dictionary, runtime_sync_error: String = "") -> String:
var lines: PackedStringArray = PackedStringArray()
var locked_row: Dictionary = rows.get("locked", {}) as Dictionary
if not locked_row.is_empty():
var locked_id: String = str(locked_row.get("npcInstanceId", ""))
lines.append(
(
lines
. append(
(
"NPC state: %s%s"
% [
PrototypeTargetConstants.display_short_name(locked_id),
str(locked_row.get("state", "unknown")),
]
)
)
)
var incoming_row: Dictionary = rows.get("incoming", {}) as Dictionary
if not incoming_row.is_empty():
var incoming_id: String = str(incoming_row.get("npcInstanceId", ""))
lines.append(
(
lines
. append(
(
"Incoming: %s%s"
% [
PrototypeTargetConstants.display_short_name(incoming_id),
str(incoming_row.get("state", "unknown")),
]
)
)
)
if lines.is_empty():
if not runtime_sync_error.is_empty():
return "NPC state: — (%s)" % runtime_sync_error
@ -112,9 +122,7 @@ static func build_telegraph_label(
return line
static func has_interpolated_telegraph_display(
rows: Dictionary, hud_state: RefCounted
) -> bool:
static func has_interpolated_telegraph_display(rows: Dictionary, hud_state: RefCounted) -> bool:
if hud_state == null:
return false
for key: String in ["locked", "incoming"]:

View File

@ -8,9 +8,7 @@ const Constants := preload("res://scripts/prototype_hud_theme_constants.gd")
static func apply_to_label(label: Label, primary: bool = true) -> void:
if not is_instance_valid(label):
return
var font_size: int = (
Constants.FONT_SIZE_PRIMARY if primary else Constants.FONT_SIZE_SECONDARY
)
var font_size: int = Constants.FONT_SIZE_PRIMARY if primary else Constants.FONT_SIZE_SECONDARY
label.add_theme_font_size_override("font_size", font_size)
label.add_theme_constant_override("outline_size", Constants.OUTLINE_SIZE)
label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
@ -20,9 +18,7 @@ static func apply_to_label(label: Label, primary: bool = true) -> void:
static func apply_to_button(button: BaseButton, primary: bool = true) -> void:
if not is_instance_valid(button):
return
var font_size: int = (
Constants.FONT_SIZE_PRIMARY if primary else Constants.FONT_SIZE_SECONDARY
)
var font_size: int = Constants.FONT_SIZE_PRIMARY if primary else Constants.FONT_SIZE_SECONDARY
button.add_theme_font_size_override("font_size", font_size)

View File

@ -97,9 +97,7 @@ func test_row_for_aggro_holder_returns_elite_row() -> void:
# Arrange
var parsed: Variant = NpcRuntimeClient.parse_runtime_json(_runtime_snapshot_json())
# Act
var row: Dictionary = NpcRuntimeClient.row_for_aggro_holder(
"dev-local-1", parsed as Dictionary
)
var row: Dictionary = NpcRuntimeClient.row_for_aggro_holder("dev-local-1", parsed as Dictionary)
# Assert
assert_that(str(row.get("npcInstanceId", ""))).is_equal("prototype_npc_elite")