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
parent
ab0debd0b4
commit
bd1dd6b01f
|
|
@ -2,10 +2,10 @@ extends Control
|
||||||
|
|
||||||
## NEO-74: scrollable prototype recipe list with per-row Craft buttons.
|
## 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)
|
signal craft_requested(recipe_id: String)
|
||||||
|
|
||||||
|
const PrototypeHudTheme := preload("res://scripts/prototype_hud_theme.gd")
|
||||||
|
|
||||||
var _item_defs_client: Node = null
|
var _item_defs_client: Node = null
|
||||||
var _craft_buttons: Array[Button] = []
|
var _craft_buttons: Array[Button] = []
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -377,9 +377,7 @@ func _setup_npc_combat_sync() -> void:
|
||||||
add_child(_player_combat_health_client)
|
add_child(_player_combat_health_client)
|
||||||
_apply_authority_http_config_to_client(_player_combat_health_client)
|
_apply_authority_http_config_to_client(_player_combat_health_client)
|
||||||
if _npc_runtime_client.has_signal("runtime_received"):
|
if _npc_runtime_client.has_signal("runtime_received"):
|
||||||
_npc_runtime_client.connect(
|
_npc_runtime_client.connect("runtime_received", Callable(self, "_on_npc_runtime_received"))
|
||||||
"runtime_received", Callable(self, "_on_npc_runtime_received")
|
|
||||||
)
|
|
||||||
if _npc_runtime_client.has_signal("runtime_sync_failed"):
|
if _npc_runtime_client.has_signal("runtime_sync_failed"):
|
||||||
_npc_runtime_client.connect(
|
_npc_runtime_client.connect(
|
||||||
"runtime_sync_failed", Callable(self, "_on_npc_runtime_sync_failed")
|
"runtime_sync_failed", Callable(self, "_on_npc_runtime_sync_failed")
|
||||||
|
|
@ -1154,7 +1152,8 @@ func _render_player_combat_hp_label() -> void:
|
||||||
return
|
return
|
||||||
var current: int = int(_player_combat_health_snapshot.get("currentHp", 0))
|
var current: int = int(_player_combat_health_snapshot.get("currentHp", 0))
|
||||||
var max_hp: int = int(_player_combat_health_snapshot.get("maxHp", 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]
|
_player_combat_hp_label.text = "Player HP: %d/%d%s" % [current, max_hp, defeated_suffix]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,9 @@ static func is_known_npc_id(target_id: String) -> bool:
|
||||||
return PrototypeTargetConstants.ANCHORS.has(target_id.strip_edges())
|
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():
|
if npc_runtime_snapshot.is_empty():
|
||||||
return {}
|
return {}
|
||||||
return NpcRuntimeClient.row_for_aggro_holder(dev_player_id, npc_runtime_snapshot)
|
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}
|
return {"locked": locked_row, "incoming": incoming_row}
|
||||||
|
|
||||||
|
|
||||||
static func build_npc_state_label(
|
static func build_npc_state_label(rows: Dictionary, runtime_sync_error: String = "") -> String:
|
||||||
rows: Dictionary, runtime_sync_error: String = ""
|
|
||||||
) -> String:
|
|
||||||
var lines: PackedStringArray = PackedStringArray()
|
var lines: PackedStringArray = PackedStringArray()
|
||||||
var locked_row: Dictionary = rows.get("locked", {}) as Dictionary
|
var locked_row: Dictionary = rows.get("locked", {}) as Dictionary
|
||||||
if not locked_row.is_empty():
|
if not locked_row.is_empty():
|
||||||
var locked_id: String = str(locked_row.get("npcInstanceId", ""))
|
var locked_id: String = str(locked_row.get("npcInstanceId", ""))
|
||||||
lines.append(
|
(
|
||||||
|
lines
|
||||||
|
. append(
|
||||||
|
(
|
||||||
"NPC state: %s → %s"
|
"NPC state: %s → %s"
|
||||||
% [
|
% [
|
||||||
PrototypeTargetConstants.display_short_name(locked_id),
|
PrototypeTargetConstants.display_short_name(locked_id),
|
||||||
str(locked_row.get("state", "unknown")),
|
str(locked_row.get("state", "unknown")),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
var incoming_row: Dictionary = rows.get("incoming", {}) as Dictionary
|
var incoming_row: Dictionary = rows.get("incoming", {}) as Dictionary
|
||||||
if not incoming_row.is_empty():
|
if not incoming_row.is_empty():
|
||||||
var incoming_id: String = str(incoming_row.get("npcInstanceId", ""))
|
var incoming_id: String = str(incoming_row.get("npcInstanceId", ""))
|
||||||
lines.append(
|
(
|
||||||
|
lines
|
||||||
|
. append(
|
||||||
|
(
|
||||||
"Incoming: %s → %s"
|
"Incoming: %s → %s"
|
||||||
% [
|
% [
|
||||||
PrototypeTargetConstants.display_short_name(incoming_id),
|
PrototypeTargetConstants.display_short_name(incoming_id),
|
||||||
str(incoming_row.get("state", "unknown")),
|
str(incoming_row.get("state", "unknown")),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
if lines.is_empty():
|
if lines.is_empty():
|
||||||
if not runtime_sync_error.is_empty():
|
if not runtime_sync_error.is_empty():
|
||||||
return "NPC state: — (%s)" % runtime_sync_error
|
return "NPC state: — (%s)" % runtime_sync_error
|
||||||
|
|
@ -112,9 +122,7 @@ static func build_telegraph_label(
|
||||||
return line
|
return line
|
||||||
|
|
||||||
|
|
||||||
static func has_interpolated_telegraph_display(
|
static func has_interpolated_telegraph_display(rows: Dictionary, hud_state: RefCounted) -> bool:
|
||||||
rows: Dictionary, hud_state: RefCounted
|
|
||||||
) -> bool:
|
|
||||||
if hud_state == null:
|
if hud_state == null:
|
||||||
return false
|
return false
|
||||||
for key: String in ["locked", "incoming"]:
|
for key: String in ["locked", "incoming"]:
|
||||||
|
|
|
||||||
|
|
@ -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:
|
static func apply_to_label(label: Label, primary: bool = true) -> void:
|
||||||
if not is_instance_valid(label):
|
if not is_instance_valid(label):
|
||||||
return
|
return
|
||||||
var font_size: int = (
|
var font_size: int = Constants.FONT_SIZE_PRIMARY if primary else Constants.FONT_SIZE_SECONDARY
|
||||||
Constants.FONT_SIZE_PRIMARY if primary else Constants.FONT_SIZE_SECONDARY
|
|
||||||
)
|
|
||||||
label.add_theme_font_size_override("font_size", font_size)
|
label.add_theme_font_size_override("font_size", font_size)
|
||||||
label.add_theme_constant_override("outline_size", Constants.OUTLINE_SIZE)
|
label.add_theme_constant_override("outline_size", Constants.OUTLINE_SIZE)
|
||||||
label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
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:
|
static func apply_to_button(button: BaseButton, primary: bool = true) -> void:
|
||||||
if not is_instance_valid(button):
|
if not is_instance_valid(button):
|
||||||
return
|
return
|
||||||
var font_size: int = (
|
var font_size: int = Constants.FONT_SIZE_PRIMARY if primary else Constants.FONT_SIZE_SECONDARY
|
||||||
Constants.FONT_SIZE_PRIMARY if primary else Constants.FONT_SIZE_SECONDARY
|
|
||||||
)
|
|
||||||
button.add_theme_font_size_override("font_size", font_size)
|
button.add_theme_font_size_override("font_size", font_size)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -97,9 +97,7 @@ func test_row_for_aggro_holder_returns_elite_row() -> void:
|
||||||
# Arrange
|
# Arrange
|
||||||
var parsed: Variant = NpcRuntimeClient.parse_runtime_json(_runtime_snapshot_json())
|
var parsed: Variant = NpcRuntimeClient.parse_runtime_json(_runtime_snapshot_json())
|
||||||
# Act
|
# Act
|
||||||
var row: Dictionary = NpcRuntimeClient.row_for_aggro_holder(
|
var row: Dictionary = NpcRuntimeClient.row_for_aggro_holder("dev-local-1", parsed as Dictionary)
|
||||||
"dev-local-1", parsed as Dictionary
|
|
||||||
)
|
|
||||||
# Assert
|
# Assert
|
||||||
assert_that(str(row.get("npcInstanceId", ""))).is_equal("prototype_npc_elite")
|
assert_that(str(row.get("npcInstanceId", ""))).is_equal("prototype_npc_elite")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue