Fix SOUND_EVENT_ASSETS walk-speed keys to match actual filename (sfx_footstep_metal_walk), add play_loop null guard, source indicator colors from Constants, extract CAMERA_DEFAULT_ZOOM, document consume-once semantics on close_sound_events. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
108 lines
5.6 KiB
GDScript
108 lines
5.6 KiB
GDScript
class_name Constants
|
||
|
||
# Shared constants used across rendering, game state, and protocol layers.
|
||
|
||
## Tile size in pixels — all renderers and coordinate conversions use this.
|
||
const TILE_SIZE: int = 32
|
||
|
||
# D-049 Z-level rendering pipeline — three-scope architecture.
|
||
# Full spec: docs/architecture/z-layer-gap-analysis.md
|
||
#
|
||
# WORLD SCOPE (z:-200 to z:900, inside FogGroup CanvasGroup)
|
||
# All world content composited into one texture, then fog drawn over it.
|
||
# Y-sort contract: all children of YSortGroup MUST use z_index = 0.
|
||
# z_index is PRIMARY sort, y-position is SECONDARY (Godot #62715).
|
||
const Z_FLOOR: int = 0 # Floor tiles — ground plane
|
||
const Z_FLOOR_OBJECTS: int = 10 # Floor objects — cosmetic, ground shadows
|
||
# z:20-99 reserved: liquid surface (z:110), surface effects
|
||
const Z_YSORT: int = 100 # YSortGroup — furniture + entities + walls, all z:0 relative
|
||
# z:110 reserved: liquid surface occlusion (alpha by depth)
|
||
# z:150-199 reserved: ground VFX (smoke origins, gas pools, sparks)
|
||
const Z_AIRBORNE: int = 200 # Projectiles, low-flying objects (scale ~1.0)
|
||
# z:250-299 reserved: mid-air VFX (rising smoke, floating particles)
|
||
const Z_OVERHEAD: int = 300 # Ceiling edges, upper structure, semi-transparent
|
||
# z:325-349 reserved: ceiling VFX (smoke through ceiling)
|
||
const Z_HIGH_AIRBORNE: int = 350 # Above-ceiling flying (scale 1.03-1.30, alpha fades)
|
||
const Z_UPPER_CONTENT: int = 400 # Upper-floor entities (rare with fixed camera)
|
||
# z:500-899 reserved: edge cases
|
||
const Z_FOG: int = 900 # FogOverlay — OUTSIDE FogGroup, fog shader
|
||
const Z_FOG_ENTITIES: int = 950 # FogEntities — cognitive delay blobs/pings (D-059/D-060)
|
||
# Lower floors: z:-100 per floor (floor-1: z:-100 to z:-1, floor-2: z:-200 to z:-101)
|
||
# z:-75 to z:-51 reserved: lower floor VFX
|
||
#
|
||
# INSERT SCOPE (CanvasLayer 10)
|
||
# Bloom-rendered, not affected by fog or camera transform.
|
||
const CANVAS_INSERT: int = 10 # CanvasLayer number for InsertOverlay
|
||
#
|
||
# UI SCOPE (CanvasLayer 20)
|
||
# HUD, monologue, cursor — always visible.
|
||
const CANVAS_UI: int = 20 # CanvasLayer number for UILayer
|
||
#
|
||
# MODAL SCOPE (CanvasLayer 30)
|
||
# Full-screen overlays: pause, inventory modal, death screen.
|
||
const CANVAS_MODAL: int = 30 # CanvasLayer number for ModalLayer
|
||
#
|
||
# Rendering ceiling: 10 floors (25m) above current floor.
|
||
# Above this: no sprites, ground shadows + environmental effects only.
|
||
const RENDER_CEILING_FLOORS: int = 10
|
||
# Visible floor window (looking down): current - 2 floors (detailed + parallax).
|
||
const VISIBLE_FLOOR_DEPTH: int = 2
|
||
|
||
# D-033: Entity relationship color palette
|
||
# Color represents the player's RELATIONSHIP to the entity, not an objective property.
|
||
# Phase 1: default colors mapped by entity kind (Player/Npc/Object/Terrain).
|
||
# Phase 2 (#361): colors derived from RelationshipState via the knowledge graph.
|
||
const ENTITY_COLOR_UNKNOWN: Color = Color("#4a9ebb") # Unknown/Neutral — cool teal
|
||
const ENTITY_COLOR_FRIENDLY: Color = Color("#6bc9a6") # Known/Friendly — soft green
|
||
const ENTITY_COLOR_POI: Color = Color("#e8c547") # Person of Interest — warm amber
|
||
const ENTITY_COLOR_HOSTILE: Color = Color("#d45d5d") # Hostile/Dangerous — muted red
|
||
const ENTITY_COLOR_OBJECT: Color = Color("#8b8ba0") # Static objects — muted grey
|
||
const ENTITY_COLOR_PLAYER: Color = Color("#e0e8ff") # Player character (detective)
|
||
|
||
# D-033 color lookup by relationship string (#521)
|
||
static func color_for_relationship(relationship: String) -> Color:
|
||
match relationship:
|
||
"Friendly": return ENTITY_COLOR_FRIENDLY
|
||
"PersonOfInterest": return ENTITY_COLOR_POI
|
||
"Hostile": return ENTITY_COLOR_HOSTILE
|
||
"Unknown": return ENTITY_COLOR_UNKNOWN
|
||
_: return ENTITY_COLOR_UNKNOWN
|
||
|
||
# D-033 color lookup by entity data — uses relationship for NPCs (#521)
|
||
static func color_for_entity_kind(entity_data: Dictionary) -> Color:
|
||
var kind_variant: String = entity_data.get("kind", {}).get("variant", "")
|
||
match kind_variant:
|
||
"Player": return ENTITY_COLOR_PLAYER
|
||
"Object", "Terrain": return ENTITY_COLOR_OBJECT
|
||
"Npc": return color_for_relationship(entity_data.get("relationship", "Unknown"))
|
||
_: return ENTITY_COLOR_OBJECT
|
||
|
||
# D-048/D-056: Insert-styled UI color palette
|
||
# Used by dialogue box, interaction list, radial menu, and other diegetic insert UI.
|
||
const INSERT_COLOR_TEXT: Color = Color("#c8d0e0") # Default insert text — white-blue
|
||
const INSERT_COLOR_HOVER: Color = Color("#e8c547") # Hover/highlight — amber POI
|
||
const INSERT_COLOR_ACTIVE: Color = Color("#6bc9a6") # Active/pressed — friendly green
|
||
|
||
# D-015: Peripheral vision dimming
|
||
const PERIPHERAL_ALPHA: float = 0.5
|
||
|
||
# Facing direction indicator
|
||
const FACING_INDICATOR_SIZE: float = 6.0
|
||
const FACING_INDICATOR_OFFSET: float = 14.0
|
||
|
||
# D-076 (OQ-29 resolution): Dialogue box max-width in pixels.
|
||
# 640px = 20 × TILE_SIZE (32px) — grid-aligned, ~33% of 1920px viewport.
|
||
# Tyre architecture review 2026-02-19: readability over max-width; fits
|
||
# two columns of text comfortably, leaves world game visible alongside.
|
||
const DIALOGUE_MAX_WIDTH: int = 640
|
||
|
||
# Default camera zoom — used as fallback when get_camera_2d() returns null
|
||
const CAMERA_DEFAULT_ZOOM: Vector2 = Vector2(2.0, 2.0)
|
||
|
||
# #517: Implant UI font color grading — avoid pure white, project through a lens
|
||
const IMPLANT_TEXT_COLOR: Color = Color("#E0F7FA") # Cyan-white — primary text
|
||
const IMPLANT_TEXT_DIM: Color = Color("#9EBFC4") # Dimmed variant — secondary text
|
||
const IMPLANT_PULSE_MIN: float = 0.85 # Alpha pulse floor
|
||
const IMPLANT_PULSE_MAX: float = 1.0 # Alpha pulse ceiling
|
||
const IMPLANT_PULSE_PERIOD: float = 2.5 # Seconds per pulse cycle
|