P3 alpha: wolf moon every 7th night, the alpha breaks wooden doors, iron-banded door, broken-door repair, alpha pelt and cloak (protocol 7)
This commit is contained in:
@@ -57,6 +57,17 @@ func clock_text() -> String:
|
||||
func is_night() -> bool:
|
||||
return daylight < 0.3
|
||||
|
||||
## Every 7th night is a wolf moon: the moon turns red and an alpha hunts with
|
||||
## the pack (wolf_pack.gd). Worked out from the day alone, so every game on a
|
||||
## server agrees without being told.
|
||||
static func wolf_moon_day(d: int) -> bool:
|
||||
return d >= 7 and d % 7 == 0
|
||||
|
||||
## Tonight's moon is a wolf moon (the small hours count as the night before).
|
||||
func wolf_moon_now() -> bool:
|
||||
var h := hours()
|
||||
return (h >= 19.5 or h < 5.5) and wolf_moon_day(day - (1 if h < 5.5 else 0))
|
||||
|
||||
func advance(seconds: float) -> void:
|
||||
time += seconds / day_length
|
||||
while time >= 1.0:
|
||||
@@ -103,7 +114,9 @@ func apply(force: bool) -> void:
|
||||
|
||||
var moon_dir := Vector3(-to_sun.x, absf(to_sun.y) * 0.8 + 0.25, -to_sun.z * 0.5).normalized()
|
||||
moon.global_basis = Basis.looking_at(-moon_dir, Vector3.FORWARD)
|
||||
moon.light_energy = 0.38 * (1.0 - daylight) * (1.0 - 0.6 * overcast)
|
||||
var red := wolf_moon_now()
|
||||
moon.light_color = Color(1.0, 0.38, 0.3) if red else Color(0.55, 0.65, 1.0)
|
||||
moon.light_energy = (0.5 if red else 0.38) * (1.0 - daylight) * (1.0 - 0.6 * overcast)
|
||||
moon.visible = moon.light_energy > 0.01
|
||||
moon.shadow_enabled = moon.visible and not sun.visible
|
||||
|
||||
@@ -121,7 +134,10 @@ func apply(force: bool) -> void:
|
||||
for i in range(3):
|
||||
var dayc: Color = DAY_COLS[i].lerp(DUSK_COLS[i], low * daylight * (1.0 - overcast * 0.7))
|
||||
dayc = dayc.lerp(OVERCAST_COLS[i], overcast * 0.85)
|
||||
cols.append(NIGHT_COLS[i].lerp(dayc, daylight))
|
||||
var night: Color = NIGHT_COLS[i]
|
||||
if red:
|
||||
night = night.lerp(Color(0.2, 0.04, 0.04), 0.5) # a blood-red night sky
|
||||
cols.append(night.lerp(dayc, daylight))
|
||||
env.fog_light_color = cols[2]
|
||||
if sky_mat != null:
|
||||
sky_mat.set_shader_parameter("zenith_col", cols[0])
|
||||
|
||||
Reference in New Issue
Block a user