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:
Paul Bailey
2026-11-05 11:49:13 +00:00
parent 657c3140fe
commit 3389ec9a21
27 changed files with 1541 additions and 56 deletions

View File

@@ -622,14 +622,24 @@ func eat(player: Node3D, slot: int) -> bool:
var food: Dictionary = ItemDB.get_item(s.id).get("food", {})
if food.is_empty():
return false
if player.survival.sick > 0.0:
tell(player, "You feel too sick to eat")
return false
if player.survival.hunger >= FULL_HUNGER:
notify.emit("You're full")
return false
player.inventory.take_from(slot, 1)
player.survival.eat(food)
notify.emit("Ate %s" % ItemDB.item_name(s.id).to_lower())
# Raw meat and fish can make you ill (P4). Cooked, smoked or salted can't.
if food_rng.randf() < float(food.get("risk", 0.0)):
player.survival.poison()
tell(player, "Your stomach turns: food poisoning. Cook your meat!")
return true
## Rolls for food poisoning (tests seed it).
var food_rng := RandomNumberGenerator.new()
## Feeds a campfire from the player's inventory: wood first, then sticks.
func add_fuel(player: Node3D, fire: Node3D) -> bool: