diff --git a/client/scripts/main.gd b/client/scripts/main.gd index 1fdca8f..66e3275 100644 --- a/client/scripts/main.gd +++ b/client/scripts/main.gd @@ -1083,7 +1083,7 @@ func _is_combat_active() -> bool: func _resolve_hud_npc_rows() -> Dictionary: return NpcCombatHudHelpers.resolve_hud_npc_rows( - _last_target_state, _npc_runtime_snapshot, _dev_player_id() + _last_target_state, _npc_runtime_snapshot, _dev_player_id(), _npc_runtime_client ) @@ -1158,30 +1158,25 @@ func _render_player_combat_hp_label() -> void: func _render_npc_combat_hud_labels() -> void: - _render_npc_state_label() - _render_telegraph_label() - _npc_combat_hud_needs_tick = _has_interpolated_telegraph_display() - - -func _has_interpolated_telegraph_display() -> bool: - return NpcCombatHudHelpers.has_interpolated_telegraph_display( - _resolve_hud_npc_rows(), _npc_runtime_hud_state + var rows: Dictionary = _resolve_hud_npc_rows() + _render_npc_state_label(rows) + _render_telegraph_label(rows) + _npc_combat_hud_needs_tick = NpcCombatHudHelpers.has_interpolated_telegraph_display( + rows, _npc_runtime_hud_state ) -func _render_npc_state_label() -> void: +func _render_npc_state_label(rows: Dictionary) -> void: if not is_instance_valid(_npc_state_label): return - _npc_state_label.text = NpcCombatHudHelpers.build_npc_state_label( - _resolve_hud_npc_rows(), _npc_runtime_sync_error - ) + _npc_state_label.text = NpcCombatHudHelpers.build_npc_state_label(rows, _npc_runtime_sync_error) -func _render_telegraph_label() -> void: +func _render_telegraph_label(rows: Dictionary) -> void: if not is_instance_valid(_telegraph_label): return _telegraph_label.text = NpcCombatHudHelpers.build_telegraph_label( - _resolve_hud_npc_rows(), _npc_runtime_hud_state, _npc_runtime_sync_error + rows, _npc_runtime_hud_state, _npc_runtime_sync_error ) diff --git a/client/scripts/npc_combat_hud_helpers.gd b/client/scripts/npc_combat_hud_helpers.gd index d8c0e2d..540b0d7 100644 --- a/client/scripts/npc_combat_hud_helpers.gd +++ b/client/scripts/npc_combat_hud_helpers.gd @@ -35,12 +35,18 @@ static func is_combat_active( static func resolve_hud_npc_rows( - last_target_state: Dictionary, npc_runtime_snapshot: Dictionary, dev_player_id: String + last_target_state: Dictionary, + npc_runtime_snapshot: Dictionary, + dev_player_id: String, + runtime_client: Node = null ) -> Dictionary: var lock_id := locked_target_id_from_state(last_target_state) var locked_row: Dictionary = {} if is_known_npc_id(lock_id): - locked_row = NpcRuntimeClient.npc_row_in_snapshot(lock_id, npc_runtime_snapshot) + if is_instance_valid(runtime_client) and runtime_client.has_method("npc_row"): + locked_row = runtime_client.call("npc_row", lock_id, npc_runtime_snapshot) as Dictionary + else: + locked_row = NpcRuntimeClient.npc_row_in_snapshot(lock_id, npc_runtime_snapshot) var incoming_row: Dictionary = {} var aggro_row: Dictionary = incoming_aggro_row(dev_player_id, npc_runtime_snapshot) if not aggro_row.is_empty():