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
1.2 KiB
GDScript
54 lines
1.2 KiB
GDScript
class_name GameplayRenderer
|
|
extends Node2D
|
|
## Base class for renderers that should pause when a fullscreen implant app
|
|
## covers the gameplay view (D-170).
|
|
##
|
|
## Subclasses override _gameplay_process(delta) and _gameplay_draw() instead
|
|
## of _process() and _draw(). These are only called when gameplay is visible.
|
|
##
|
|
## Usage:
|
|
## extends GameplayRenderer
|
|
## func _gameplay_process(delta: float) -> void: ...
|
|
## func _gameplay_draw() -> void: ...
|
|
|
|
var gameplay_occluded: bool = false
|
|
|
|
|
|
func _ready() -> void:
|
|
HudGroups.gameplay_occluded.connect(_on_gameplay_occluded)
|
|
_renderer_ready()
|
|
|
|
|
|
## Override this instead of _ready() in subclasses.
|
|
func _renderer_ready() -> void:
|
|
pass
|
|
|
|
|
|
func _on_gameplay_occluded(occluded: bool) -> void:
|
|
gameplay_occluded = occluded
|
|
if occluded:
|
|
# Force a blank redraw so stale frames don't linger
|
|
queue_redraw()
|
|
|
|
|
|
func _process(delta: float) -> void:
|
|
if gameplay_occluded:
|
|
return
|
|
_gameplay_process(delta)
|
|
|
|
|
|
func _draw() -> void:
|
|
if gameplay_occluded:
|
|
return
|
|
_gameplay_draw()
|
|
|
|
|
|
## Override in subclasses — called every frame when gameplay is visible.
|
|
func _gameplay_process(_delta: float) -> void:
|
|
pass
|
|
|
|
|
|
## Override in subclasses — called for draw when gameplay is visible.
|
|
func _gameplay_draw() -> void:
|
|
pass
|