P4 hazards: food spoilage with rot speed setting, smoking rack and salt, food poisoning, harsher blizzards, hard winters with lake ice, lightning on trees, snow on roofs (protocol 11)
This commit is contained in:
@@ -81,7 +81,7 @@ func _process(delta: float) -> void:
|
||||
for kind in BUDGET:
|
||||
if _cooldown[kind] > 0.0:
|
||||
continue
|
||||
if alive(kind).size() < budget(kind, everyone.size()):
|
||||
if alive(kind).size() < winter_budget(kind, everyone.size()):
|
||||
var who: Node3D = everyone[0] if everyone.size() == 1 else everyone[_rng.randi() % everyone.size()]
|
||||
if _spawn_near(kind, RING_MIN, RING_MAX, who.global_position) != null:
|
||||
_cooldown[kind] = RESPAWN_DELAY * 0.25
|
||||
@@ -91,6 +91,13 @@ func _process(delta: float) -> void:
|
||||
static func budget(kind: String, players: int) -> int:
|
||||
return BUDGET[kind] * clampi(players, 1, 2)
|
||||
|
||||
## In a hard winter (P4) half as many: the animals are holed up.
|
||||
func winter_budget(kind: String, players: int) -> int:
|
||||
var b := budget(kind, players)
|
||||
if world != null and world.weather != null and world.weather.in_hard_winter():
|
||||
b = maxi(b / 2, 1)
|
||||
return b
|
||||
|
||||
func _on_died(c: Node) -> void:
|
||||
_cooldown[c.kind] = RESPAWN_DELAY
|
||||
|
||||
|
||||
Reference in New Issue
Block a user