M1c: weather, snap building, shelter, beds and regrowth

- 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
This commit is contained in:
Paul Bailey
2026-11-04 10:16:41 +00:00
parent fc7eb3cfed
commit fed96ef118
36 changed files with 2421 additions and 58 deletions

View File

@@ -23,7 +23,7 @@ void vertex() {
vec2 wd = normalize(wind_dir);
float gust = nz(wp.xz * 0.015 - TIME * 0.05 * wd);
float sway = sin(TIME * 1.8 + wp.x * 0.35 + wp.z * 0.25) * 0.35 + gust * 1.3 - 0.4;
float k = wind_strength * hfac * hfac;
float k = wind_strength * weather_wind * hfac * hfac;
vec3 off = vec3(wd.x * sway * k, -abs(sway) * k * 0.3, wd.y * sway * k);
VERTEX += (inverse(MODEL_MATRIX) * vec4(off, 0.0)).xyz;
}
@@ -35,6 +35,10 @@ void fragment() {
base *= 0.82 + 0.36 * nz(inst_pos.xz * 0.17);
vec3 col = base * mix(0.55, 1.0, hfac); // darker at the root
col = mix(col, col * tip_tint * 1.3, smoothstep(0.6, 1.0, hfac) * 0.3);
// Snow weighs down on the blades from the root up; rain darkens them.
float snowy = clamp(weather_snow * 1.3 - hfac * 0.5 + (nz(inst_pos.xz * 0.17) - 0.5) * 0.4, 0.0, 0.85);
col = mix(col, vec3(0.62, 0.65, 0.7), snowy); // greyer than ground snow: blades are lit as if flat
col = wet_albedo(col, weather_wet * 0.6 * (1.0 - snowy));
ALBEDO = col;
ROUGHNESS = 0.9;
SPECULAR = 0.2;