fix(client): address PR #109 review — 6 warnings + 5 suggestions
Star map (W1-W3, S3): - _process visibility guard + dirty flag (no redraw when hidden/unchanged) - _system_hash masked to 31-bit positive range - Extracted _find_nearest_system() shared helper game_state.gd (W4): - Inline load() in apply_snapshot() replaces per-tick overhead; safe at runtime because script is already in resource cache Data pipeline (W5-W6): - Script-relative path resolution via __file__ - --check mode + make check-star-map staleness target Minor (S1-S2, S5): - Removed redundant bone_idx assignment - Simplified double-negative test assertion - Documented autoload parse-order convention in CLAUDE.md Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -367,10 +367,14 @@ func apply_snapshot(snapshot: Dictionary) -> void:
|
||||
# Server persists the descriptor and includes it in ObserverSnapshot after load.
|
||||
# Only update when field is present (null means no change).
|
||||
if snapshot.has("character_visual_descriptor") and snapshot.character_visual_descriptor is Dictionary:
|
||||
# load() returns a cached script — safe to call per-tick once the resource is in cache.
|
||||
# Cannot use CharacterVisualDescriptor directly: autoloads compile before global class_names
|
||||
# are registered, causing a parse-time "not declared" error.
|
||||
var CVD := load("res://scripts/rendering/character_visual_descriptor.gd")
|
||||
var restored = CVD.from_dict(snapshot.character_visual_descriptor)
|
||||
if restored != null:
|
||||
character_visual_descriptor = restored
|
||||
if CVD != null:
|
||||
var restored = CVD.from_dict(snapshot.character_visual_descriptor)
|
||||
if restored != null:
|
||||
character_visual_descriptor = restored
|
||||
|
||||
# v14: player_knowledge (#264, D-041) — partial KG dump for journal panel.
|
||||
# Only update when field is present (null means no change, server sends when KG changes).
|
||||
|
||||
@@ -331,7 +331,6 @@ func _create_overhead_anchor() -> void:
|
||||
return
|
||||
_overhead_attachment = BoneAttachment3D.new()
|
||||
_overhead_attachment.bone_name = "Head"
|
||||
_overhead_attachment.bone_idx = bone_idx
|
||||
_overhead_attachment.name = "OverheadAttachment"
|
||||
_skeleton.add_child(_overhead_attachment)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user