fix(client): address PR #22 review — 3 critical bugs, 2 warnings, 8 suggestions

Critical fixes:
- fog_state: guard _compute_bounds() against all-invalid tiles (negative Rect2i crash)
- fog_shader: read Camera2D zoom dynamically instead of hardcoded Vector2(2,2)
- world_radial: set custom_minimum_size in _ready() from spoke geometry

Warnings:
- fog.gdshader: tighten PERIPHERAL_LOW 0.15→0.55 to match D-059 peripheral band
- Extract color_for_entity_kind() to Constants.gd, decouple CursorRenderer from EntityRenderer

Documentation: shallow copy assumption, gradual decay TODO, tween guard rationale,
fade timing rationale, ToggleInsert TODO, monologue consume-once, hover offset safety,
v6 fixture gap TODO.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-15 23:23:11 +01:00
co-authored by Claude Opus 4.6
parent 1b0953db25
commit 9e8ccb13bf
10 changed files with 44 additions and 17 deletions
+6 -1
View File
@@ -128,7 +128,7 @@ func _find_nearest_entity() -> Dictionary:
best_dist = dist
result.id = entity.entity_id
result.kind = entity.get("kind", {}).get("variant", "")
result.color = EntityRenderer._color_for_kind(entity)
result.color = Constants.color_for_entity_kind(entity)
result.offset = (xform * center) - mouse_screen
return result
@@ -191,6 +191,11 @@ func _interpolate() -> void:
# --- Drawing ---
func _draw() -> void:
# _hover_offset is computed in _detect_hover() during _process(), not recalculated
# here. This is safe because Camera2D (tree sibling, earlier in scene order) applies
# its smoothing transform before CursorRenderer._process() reads canvas_transform.
# Nothing modifies the canvas transform between _process() and _draw().
# Bloom pass — wider, semi-transparent glow
if _bloom > 0.01:
var bloom_mod := 1.0
+2 -11
View File
@@ -101,18 +101,9 @@ func _remove_entity_node(entity_id: int) -> void:
entity_node.queue_free()
entity_nodes.erase(entity_id)
# D-033 color by entity kind (Phase 1: defaults by kind, not relationship)
# D-033 color by entity kind — delegates to Constants.color_for_entity_kind
static func _color_for_kind(entity_data: Dictionary) -> Color:
var kind_variant: String = entity_data.get("kind", {}).get("variant", "")
match kind_variant:
"Player":
return Constants.ENTITY_COLOR_PLAYER
"Npc":
return Constants.ENTITY_COLOR_UNKNOWN
"Object", "Terrain":
return Constants.ENTITY_COLOR_OBJECT
_:
return Constants.ENTITY_COLOR_OBJECT
return Constants.color_for_entity_kind(entity_data)
# Add a facing direction indicator triangle to the player entity
func _add_facing_indicator(parent_node: Control) -> void:
+2 -1
View File
@@ -43,7 +43,8 @@ func update_fog() -> void:
# 2. Position ColorRect to cover the current viewport
var vp_size := get_viewport().get_visible_rect().size
var zoom := Vector2(2.0, 2.0) # Must match Camera2D zoom
var cam := get_viewport().get_camera_2d()
var zoom := cam.zoom if cam else Vector2(2.0, 2.0)
var camera_pos := GameState.player_position * TILE_SIZE
var half_view := vp_size / (2.0 * zoom)
_fog_rect.position = camera_pos - half_view