feat: give the player embodied hunger, energy, and starvation death

This commit is contained in:
2026-08-08 23:38:50 +02:00
parent 21b2eb06da
commit 9678526c5a
11 changed files with 488 additions and 65 deletions
+16 -1
View File
@@ -87,6 +87,7 @@ func _on_village_changed(village: SimVillage) -> void:
wood_rate = " (%.0f/d)" % rates["wood_per_day"]
var opportunity_text := _build_active_opportunity_display()
var standing_text := _build_standing_display()
var player_needs_text := _build_player_needs_display()
village_stats_label.text = (
"""
Village [%s]
@@ -100,7 +101,7 @@ func _on_village_changed(village: SimVillage) -> void:
Food Mod: %.2f
Safety Mod: %.2f
Knowledge Mod: %.2f
%s%s%s
%s%s%s%s
"""
% [
speed_text,
@@ -114,6 +115,7 @@ func _on_village_changed(village: SimVillage) -> void:
village.food_modifier,
village.safety_modifier,
village.knowledge_modifier,
player_needs_text,
standing_text,
opportunity_text,
event_text,
@@ -121,6 +123,19 @@ func _on_village_changed(village: SimVillage) -> void:
)
func _build_player_needs_display() -> String:
if not simulation_manager.has_method("get_player_state"):
return ""
var state: PlayerStateRecord = simulation_manager.get_player_state()
if state == null:
return ""
var status := "dead" if state.is_dead() else ("starving" if state.is_starving() else "ok")
return (
"\n\nYou\nHunger: %.0f Energy: %.0f (%s)"
% [state.get_hunger(), state.get_energy(), status]
)
func _build_standing_display() -> String:
if not simulation_manager.has_method("get_player_standing"):
return ""