P3 bear: one bear per island raids unattended food, palisades and closed huts keep it out, warns then charges, hide/fat/meat, fur rug (Cozy), death saved (protocol 8)
This commit is contained in:
@@ -75,6 +75,14 @@ func balanced_diet() -> bool:
|
||||
|
||||
var stone_room := false ## sheltered by mostly stone walls (P2): a little warmer
|
||||
const STONE_ROOM_WARMTH := 6.0
|
||||
var cozy := false ## sheltered with a fur rug near (P3, the bear)
|
||||
const COZY_WARMTH := 4.0
|
||||
|
||||
func _rug_near(p: Vector3) -> bool:
|
||||
for r in world.get_tree().get_nodes_in_group("rug"):
|
||||
if (r as Node3D).global_position.distance_to(p) < r.COZY_RADIUS:
|
||||
return true
|
||||
return false
|
||||
|
||||
var player: Node3D ## the local player, or a server_player.gd on a server
|
||||
var world: Node3D
|
||||
@@ -96,12 +104,14 @@ func step(dt: float) -> void:
|
||||
roofed = world.build.roofed_at(p)
|
||||
sheltered = roofed and world.build.enclosure_at(p) >= 0.74
|
||||
stone_room = sheltered and world.build.stone_walls_at(p) >= 0.5
|
||||
cozy = sheltered and _rug_near(p)
|
||||
# Rain soaks you unless there's a roof over your head.
|
||||
if not roofed and world.weather.rain_at(p) > 0.25:
|
||||
wet = WET_SECONDS
|
||||
# Resting: a while by a fire with a roof and walls around you.
|
||||
# Resting: a while by a fire with a roof and walls around you (half the
|
||||
# time on a fur rug).
|
||||
if sheltered and heat > 0.25:
|
||||
_rest_build += dt
|
||||
_rest_build += dt * (2.0 if cozy else 1.0)
|
||||
if _rest_build >= REST_AFTER:
|
||||
rested = maxf(rested, REST_SECONDS)
|
||||
else:
|
||||
@@ -111,6 +121,8 @@ func step(dt: float) -> void:
|
||||
var target: float = world.air_warmth(p, sheltered) + heat * 70.0 + float(wear.get("warmth", 0.0))
|
||||
if stone_room:
|
||||
target += STONE_ROOM_WARMTH
|
||||
if cozy:
|
||||
target += COZY_WARMTH
|
||||
if wet > 0.0:
|
||||
target -= 22.0 * float(wear.get("wet_chill", 1.0))
|
||||
wet = maxf(wet - dt * (3.0 if heat > 0.3 else 1.0), 0.0) # fires dry you off
|
||||
@@ -186,6 +198,8 @@ func _update_statuses() -> void:
|
||||
statuses.append("Balanced diet")
|
||||
if sheltered:
|
||||
statuses.append("Sheltered")
|
||||
if cozy:
|
||||
statuses.append("Cozy")
|
||||
if rested > 0.0:
|
||||
statuses.append("Rested")
|
||||
for id in buffs:
|
||||
|
||||
Reference in New Issue
Block a user