New GameplayRenderer extends Node2D with built-in occlusion support. Subclasses override _gameplay_process() and _gameplay_draw() instead of _process() and _draw() — these are skipped when a fullscreen implant app covers gameplay. Migrated all 5 gameplay renderers: - CursorRenderer: hover detection + bracket drawing paused - EntityRenderer: position lerping paused - FogEntities: fog dot rendering paused - SoundIndicatorRenderer: directional arrows paused - WorldRenderer: tile/fog/entity updates paused No more manual occlusion wiring — the base class handles everything. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
54 lines
2.2 KiB
GDScript
54 lines
2.2 KiB
GDScript
extends GameplayRenderer
|
|
|
|
# World renderer — manages all visual representation from GameState
|
|
# Attached to the World node in main.tscn
|
|
#
|
|
# D-049 Z-level rendering pipeline (z-layer-gap-analysis.md):
|
|
# FogGroup (CanvasGroup) composites world content:
|
|
# FloorTiles (TileMapLayer) — z:0 ground plane
|
|
# FloorObjects (Node2D) — z:10 cosmetic detail (placeholder)
|
|
# YSortGroup (Node2D, y_sort) — z:100 furniture + entities (all z:0 relative)
|
|
# Furniture (Node2D, y_sort) — z:0 placed objects (placeholder)
|
|
# Entities (Node2D, y_sort) — z:0 entity sprites (D-033 colors)
|
|
# Overhead (Node2D) — z:300 ceiling/upper structure (placeholder)
|
|
# FogOverlay (Node2D) — z:900 fog shader (OUTSIDE FogGroup)
|
|
|
|
var _last_tick: int = -1
|
|
|
|
@onready var tile_renderer = $FogGroup/FloorTiles
|
|
@onready var fog_renderer = $FogOverlay
|
|
@onready var entity_renderer = $FogGroup/YSortGroup/Entities
|
|
@onready var sound_indicator_renderer = $SoundIndicators # #126 D-018 medium-range indicators
|
|
|
|
|
|
func _renderer_ready() -> void:
|
|
print("WorldRenderer: Initialized (D-049 z-stack)")
|
|
|
|
|
|
# Called each frame to update visuals from game state.
|
|
# Uses tick-based invalidation — re-renders all layers when a new snapshot arrives.
|
|
func update_from_state() -> void:
|
|
if gameplay_occluded:
|
|
return # D-170: skip rendering while fullscreen implant app is active
|
|
var tick := GameState.current_tick
|
|
if tick == _last_tick:
|
|
return
|
|
_last_tick = tick
|
|
|
|
# Update tiles (may include new chunks or modified tiles)
|
|
if tile_renderer and tile_renderer.has_method("update_tiles"):
|
|
if GameState.visible_tiles.size() > 0:
|
|
tile_renderer.update_tiles(GameState.visible_tiles)
|
|
|
|
# Update fog overlay — shader-based, reads from FogState autoload
|
|
if fog_renderer and fog_renderer.has_method("update_fog"):
|
|
fog_renderer.update_fog()
|
|
|
|
# Update entity sprites
|
|
if entity_renderer and entity_renderer.has_method("update_entities"):
|
|
entity_renderer.update_entities(GameState.visible_entities)
|
|
|
|
# D-018 #126: Update medium-range sound indicators
|
|
if sound_indicator_renderer and sound_indicator_renderer.has_method("update_sound_events"):
|
|
sound_indicator_renderer.update_sound_events(GameState.medium_sound_events)
|