#30: forced lighting, intro sounds, scarecrow chest glow

- DayNight.forced ("" / "morning" / "night") overrides target(); snap()
  still works. DayNight.morning() is the MORNING phase's look.
  lanterns_dark keeps every lantern at 0.
- synth_audio.gd: ufo_hum (4 s loop), ufo_whine, part_fall, life_flash,
  ufo_zoom, car_door, each on its own seed (existing wavs unchanged).
  FarmAudio cues for those plus door_creak (kenney creak1/2), all in
  LOCAL_CUES.
- PlayerCharacter: a blue core glow on the chest bone (BoneAttachment3D):
  an unshaded gem, an additive halo pulled toward the camera, and a weak
  pulsing OmniLight3D. On for every scarecrow; set_core_glow(on) hides
  it. set_tint skips it; the hit flash overlay and ToonLook leave it alone.
- test_look: forced/lanterns_dark, the intro cues, the glow on both
  scarecrows, hit flash intact, set_core_glow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Forrest 2026-10-07 21:51:14 -04:00
parent 5dbad4c915
commit 4b86f655c4
17 changed files with 562 additions and 4 deletions

View file

@ -9,6 +9,8 @@ extends Node
## The scarecrow carries a lantern that lights up as it gets dark, and enemies glow faintly at
## night (night_glow in thief.gdshader and ufo.gdshader) so they stay readable. The current
## look eases toward the target, so phase changes never pop.
## A cutscene (the opening intro) can hold a look whatever the phase (forced: "morning" or
## "night") and keep the lanterns dark (lanterns_dark); both are cleared to give the phase back.
const NIGHTFALL := 8.0
const EASE := 2.5
@ -33,6 +35,11 @@ var lantern: OmniLight3D
## Co-op: player 2's lantern (add_lantern), lit the same.
var lanterns: Array[OmniLight3D] = []
var current := DAY.duplicate()
## "" follows the phase; "morning" holds the MORNING phase's look and "night" the NIGHT look
## (target() returns it; the current look eases toward it, or snap() jumps to it).
var forced := ""
## Every lantern stays off while set (the intro's scarecrow isn't alive yet).
var lanterns_dark := false
func setup(p_campaign: CampaignController, p_sun: DirectionalLight3D, p_env: Environment, player: Node3D,
@ -72,6 +79,11 @@ func snap() -> void:
func target() -> Dictionary:
match forced:
"morning":
return morning()
"night":
return NIGHT
var s := campaign.state
var cfg := campaign.config
var length := campaign.phase_length(s.phase)
@ -79,7 +91,7 @@ func target() -> Dictionary:
var p := clampf(elapsed / length, 0.0, 1.0) if is_finite(length) and length > 0.0 else 0.0
match s.phase:
CampaignController.Phase.MORNING:
return _mix(SUNRISE, DAY, 0.7)
return morning()
CampaignController.Phase.DUSK:
return _mix(DAY, SUNSET, p)
CampaignController.Phase.NIGHT:
@ -91,6 +103,11 @@ func target() -> Dictionary:
return DAY
## The MORNING phase's look: mostly day, a little sunrise.
static func morning() -> Dictionary:
return _mix(SUNRISE, DAY, 0.7)
func _process(delta: float) -> void:
if campaign == null:
return
@ -108,7 +125,7 @@ func _apply() -> void:
env.adjustment_saturation = current["sat"]
for l in lanterns:
if is_instance_valid(l):
l.light_energy = current["lantern"]
l.light_energy = 0.0 if lanterns_dark else float(current["lantern"])
for m in enemy_materials:
if m != null:
m.set_shader_parameter("night_glow", current["glow"])