- Seeded weather (clear/cloudy/rain/storm, snow and blizzards on cold days and above the snowline), lightning, synthesised rain/wind/thunder sound - Rain/snow particles stopped by roofs; wet ground, settled snow and wind via global shader uniforms - Snap-together wood floor, wall, door, roof and gable with structural support, collapse and X to dismantle - Shelter detection: dry under a roof, warmer and Rested inside with a fire; rain burns an uncovered campfire faster - Bed sets the spawn point and lets you sleep through the night - Trees, boulders and ground pickups regrow; timers saved - Grass cleared under floors; shorter HUD hint - New test_weather_building suite (62 checks) and tests/run_all.sh, which also fails on script errors
19 lines
626 B
GDScript
19 lines
626 B
GDScript
extends "res://scripts/building/piece.gd"
|
|
## Bed: E sets your spawn point here. Once it's yours, E at night sleeps until
|
|
## morning, if the bed is under a roof with walls around it.
|
|
|
|
func display_name() -> String:
|
|
return "Bed"
|
|
|
|
func is_spawn() -> bool:
|
|
var w := get_parent().get_parent()
|
|
return w.get("bed_spawn") != null and w.has_bed_spawn and (w.bed_spawn as Vector3).distance_to(global_position) < 0.3
|
|
|
|
func interact_prompt(_player: Node) -> String:
|
|
if not is_spawn():
|
|
return "Bed [E] Set spawn point"
|
|
return "Bed (your spawn point) [E] Sleep"
|
|
|
|
func interact(player: Node) -> void:
|
|
Actions.use_bed(player, self)
|