mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-11 16:33:43 +00:00
refactor(*): DRY up arena scenes, game modes, and HUD instruments
Arenas inherit from a new arena_base.tscn instead of restating ~40 shared lines each; only sky/ambient/glow/tint/decoration vary, exposed via new Arena exports since nested Environment properties aren't overridable through scene inheritance. Bot construction and score-keeping move onto GameMode, shared by match and spectate modes while preserving their differing GameSettings-override behavior and the HUD's score-row duck-typing. HUD instruments share a HudInstrument base for the smoothing-weight calc and angle-lerp helper. Also dedupes MAIN_MENU_SCENE_PATH into ScenePaths and documents why DIFFICULTIES tiers share one checkpoint.
This commit is contained in:
+25
-1
@@ -5,12 +5,36 @@ extends Node3D
|
||||
# spawn markers. An arena holds no rules and no state — game modes query it
|
||||
# for spawn transforms and goals, then spawn ships/ball themselves.
|
||||
|
||||
# Per-arena Environment tuning. These live as exports (rather than baked
|
||||
# into each arena's Environment sub-resource) because Godot's scene
|
||||
# inheritance can only override whole top-level node properties, not
|
||||
# properties nested inside a sub-resource — so each arena_0N.tscn overrides
|
||||
# these on the Arena root instead, and _ready() applies them here.
|
||||
@export var sky_material: Material
|
||||
@export var ambient_light_color := Color(0.55, 0.6, 0.75, 1)
|
||||
@export var ambient_light_energy := 0.4
|
||||
@export var glow_intensity := 0.9
|
||||
@export var glow_strength := 1.2
|
||||
@export var glow_bloom := 0.05
|
||||
@export var glow_hdr_threshold := 1.0
|
||||
|
||||
|
||||
func _ready():
|
||||
add_to_group("arena")
|
||||
var world_env := get_node_or_null("WorldEnvironment") as WorldEnvironment
|
||||
if world_env and world_env.environment:
|
||||
VideoSettings.apply_to_environment(world_env.environment)
|
||||
var env := world_env.environment
|
||||
if sky_material:
|
||||
if not env.sky:
|
||||
env.sky = Sky.new()
|
||||
env.sky.sky_material = sky_material
|
||||
env.ambient_light_color = ambient_light_color
|
||||
env.ambient_light_energy = ambient_light_energy
|
||||
env.glow_intensity = glow_intensity
|
||||
env.glow_strength = glow_strength
|
||||
env.glow_bloom = glow_bloom
|
||||
env.glow_hdr_threshold = glow_hdr_threshold
|
||||
VideoSettings.apply_to_environment(env)
|
||||
|
||||
|
||||
func get_ball_spawn() -> Transform3D:
|
||||
|
||||
Reference in New Issue
Block a user