#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:
parent
5dbad4c915
commit
4b86f655c4
17 changed files with 562 additions and 4 deletions
|
|
@ -8,6 +8,10 @@ extends RefCounted
|
|||
## stop rendering in 3D (they'd be pixelated) and ScreenLabels draws them as flat text where they
|
||||
## project, at least MIN_SIZE tall, only while shown and in front of the camera, and nudged apart
|
||||
## where they'd overlap.
|
||||
## The opening intro's hooks into the look and sound: DayNight.forced holds the morning or the
|
||||
## night look whatever the phase (and lets go again), lanterns_dark keeps the lanterns off, the
|
||||
## intro's sound cues have their sounds, and every scarecrow has its blue core glow in its chest
|
||||
## (on the chest bone, toon look, tint, and hit flash leaving it alone) until set_core_glow(false).
|
||||
|
||||
const TOON := "res://game/resources/toon.gdshader"
|
||||
const TOON_DOUBLE_SIDED := "res://game/resources/toon_double_sided.gdshader"
|
||||
|
|
@ -141,11 +145,68 @@ func _farm(r: GameTestRunner) -> void:
|
|||
and outline.cast_shadow == GeometryInstance3D.SHADOW_CASTING_SETTING_OFF
|
||||
and outline_mat.render_priority == Material.RENDER_PRIORITY_MIN,
|
||||
"the outline quad is in the world, casts no shadow, and draws under the transparent effects")
|
||||
_intro_hooks(r, sim, a)
|
||||
look.queue_free()
|
||||
farm.queue_free()
|
||||
await r.process_frame
|
||||
|
||||
|
||||
func _intro_hooks(r: GameTestRunner, sim: FarmSim, partner: Avatar) -> void:
|
||||
var dn := sim.day_night
|
||||
var c := sim.campaign
|
||||
c.begin_day()
|
||||
dn.forced = "night"
|
||||
dn.snap()
|
||||
r.check(dn.target() == DayNight.NIGHT and is_equal_approx(sim.sun.light_energy, float(DayNight.NIGHT["energy"]))
|
||||
and is_equal_approx(dn.lantern.light_energy, float(DayNight.NIGHT["lantern"])),
|
||||
"DayNight.forced = \"night\" holds the night look by day, the lantern lit")
|
||||
dn.lanterns_dark = true
|
||||
dn.snap()
|
||||
var lit := dn.lanterns.filter(func(l: OmniLight3D) -> bool: return l.light_energy != 0.0)
|
||||
r.check(dn.lanterns.size() == 2 and lit.is_empty(), "lanterns_dark keeps the lanterns off at night")
|
||||
dn.lanterns_dark = false
|
||||
dn.forced = "morning"
|
||||
dn.snap()
|
||||
r.check(dn.target() == DayNight.morning() and dn.target() != DayNight.DAY
|
||||
and is_equal_approx(sim.sun.light_energy, float(DayNight.morning()["energy"])),
|
||||
"forced = \"morning\" holds the morning look by day")
|
||||
dn.forced = ""
|
||||
dn.snap()
|
||||
r.check(dn.target() == DayNight.DAY and is_equal_approx(sim.sun.light_energy, float(DayNight.DAY["energy"]))
|
||||
and is_equal_approx(dn.lantern.light_energy, 0.0), "cleared, the phase's look comes back")
|
||||
|
||||
var audio := sim.audio
|
||||
var missing: Array[String] = []
|
||||
for cue in ["door_creak", "car_door", "ufo_hum", "ufo_whine", "part_fall", "life_flash", "ufo_zoom"]:
|
||||
if audio.stream_of(cue) == null or not FarmAudio.LOCAL_CUES.has(cue):
|
||||
missing.append(cue)
|
||||
var hum := audio.stream_of("ufo_hum") as AudioStreamWAV
|
||||
r.check(missing.is_empty() and hum != null and hum.loop_mode == AudioStreamWAV.LOOP_FORWARD,
|
||||
"the intro's sounds resolve and stay local, and the UFO's hum loops (missing: %s)" % [missing])
|
||||
|
||||
for body: PlayerCharacter in [sim.player, partner.body]:
|
||||
var who := "player 1's" if body == sim.player else "the partner's"
|
||||
var glow := body.core_glow
|
||||
var attach := glow.get_parent() as BoneAttachment3D if glow != null else null
|
||||
var gem := glow.get_node("Gem") as MeshInstance3D if glow != null else null
|
||||
var gem_mat := gem.get_active_material(0) as StandardMaterial3D if gem != null else null
|
||||
r.check(glow != null and glow.is_visible_in_tree() and attach != null and attach.bone_name == PlayerCharacter.CORE_BONE
|
||||
and gem_mat != null and gem_mat.albedo_color == PlayerCharacter.CORE_GEM_COLOR and gem.material_overlay == null,
|
||||
"%s scarecrow has its core glow on the chest bone, untinted, untouched by the toon look and the hit flash" % who)
|
||||
var rel := glow.global_position - body.global_position if glow != null else Vector3.ZERO
|
||||
var ahead := rel.dot(-body.model.global_basis.z)
|
||||
r.check(rel.y > 0.7 and rel.y < 1.2 and ahead > 0.15, "at chest height on its front (%.2f m up, %.2f m ahead)" % [rel.y, ahead])
|
||||
var mannequin := sim.player.model.find_children("Mannequin_Medium_*", "MeshInstance3D", true, false)
|
||||
r.check(mannequin.size() == 6 and mannequin.all(func(m: Node) -> bool: return (m as MeshInstance3D).material_overlay != null),
|
||||
"the hit flash still covers the scarecrow's body (%d parts)" % mannequin.size())
|
||||
var light := sim.player.core_glow.get_node("CoreLight") as OmniLight3D
|
||||
sim.player.set_core_glow(false)
|
||||
r.check(not sim.player.core_glow.visible and not light.is_visible_in_tree() and partner.body.core_glow.visible,
|
||||
"set_core_glow(false) hides it, light and all")
|
||||
sim.player.set_core_glow(true)
|
||||
r.check(light.is_visible_in_tree(), "and set_core_glow(true) shows it again")
|
||||
|
||||
|
||||
## The nodes under root still showing a lit StandardMaterial3D, by name.
|
||||
static func _lit_left(root: Node) -> Array[String]:
|
||||
var out: Array[String] = []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue