diff --git a/client/scripts/rendering/entity_renderer.gd b/client/scripts/rendering/entity_renderer.gd index f32061438..91586f77f 100644 --- a/client/scripts/rendering/entity_renderer.gd +++ b/client/scripts/rendering/entity_renderer.gd @@ -109,7 +109,10 @@ func _create_entity_node(entity_id: int, entity_data: Dictionary) -> void: # Load sprite for current facing direction var direction := _entity_direction(entity_id, entity_data) _entity_facing[entity_id] = direction - entity_node.texture = _load_sprite_texture(direction) + var tex := _load_sprite_texture(direction) + if tex == null: + push_error("EntityRenderer: no texture for entity %d direction '%s' — entity will be invisible" % [entity_id, direction]) + entity_node.texture = tex # D-033: self_modulate for relationship tinting; modulate.a is reserved for D-015 dimming. entity_node.self_modulate = _color_for_kind(entity_data) @@ -153,7 +156,10 @@ func _update_entity_node(entity_id: int, entity_data: Dictionary) -> void: var new_dir := _entity_direction(entity_id, entity_data) if new_dir != _entity_facing.get(entity_id, ""): _entity_facing[entity_id] = new_dir - (node as Sprite2D).texture = _load_sprite_texture(new_dir) + var new_tex := _load_sprite_texture(new_dir) + if new_tex != null: + (node as Sprite2D).texture = new_tex + # null: keep previous texture rather than going invisible mid-game # #521: Detect relationship change → fade D-033 self_modulate (0.5s via _process) var new_rel: String = entity_data.get("relationship", "Unknown") @@ -218,7 +224,9 @@ static func _octant_to_direction(octant: String) -> String: "Northeast", "East": return "east" "Southeast", "South": return "south" "Southwest", "West": return "west" - _: return "south" + _: + push_warning("EntityRenderer: unrecognised octant '%s' — defaulting to south" % octant) + return "south" # Load the sprite texture for the given 4-direction key.