feat: add proper death from starvation and survival tasks urgency
This commit is contained in:
@@ -70,9 +70,14 @@ func update_priorities() -> void:
|
||||
print(get_priority_summary())
|
||||
|
||||
func apply_npc_task(npc: SimNPC) -> void:
|
||||
if npc.is_dead:
|
||||
return
|
||||
|
||||
var productivity := 1.0
|
||||
|
||||
if npc.energy < 20.0:
|
||||
if npc.is_starving:
|
||||
productivity = 0.35
|
||||
elif npc.energy < 20.0:
|
||||
productivity = 0.25
|
||||
elif npc.energy < 40.0:
|
||||
productivity = 0.5
|
||||
@@ -87,10 +92,21 @@ func apply_npc_task(npc: SimNPC) -> void:
|
||||
"study":
|
||||
knowledge += 1.0 * productivity
|
||||
"eat":
|
||||
food -= 1.0
|
||||
npc.hunger = max(npc.hunger - 35.0, 0.0)
|
||||
if food > 0:
|
||||
food -= 1.0
|
||||
npc.hunger = max(npc.hunger - 55.0, 0.0)
|
||||
npc.starvation_ticks = 0
|
||||
npc.is_starving = npc.hunger >= 90.0
|
||||
else:
|
||||
npc.hunger = min(npc.hunger + 5.0, 100.0)
|
||||
npc.is_starving = npc.hunger >= 90.0
|
||||
"rest":
|
||||
npc.energy = min(npc.energy + 35.0, 100.0)
|
||||
if npc.is_starving:
|
||||
npc.energy = min(npc.energy + 2.0, 100.0)
|
||||
elif npc.hunger > 75.0:
|
||||
npc.energy = min(npc.energy + 12.0, 100.0)
|
||||
else:
|
||||
npc.energy = min(npc.energy + 35.0, 100.0)
|
||||
"wander":
|
||||
safety -= 0.2
|
||||
|
||||
|
||||
Reference in New Issue
Block a user