feat: resource consumption rate display in village panel
Village panel now shows daily consumption rates alongside stockpiles (e.g. Food: 15 (-2/d), Wood: 7 (-1/d)). Rates are computed over a rolling 200-tick (~1 day) window by summing item_consumed economic events. The rate display only appears when non-zero, keeping the panel clean until actual consumption occurs. Closes the feedback loop: events show individual transfers, rates show aggregate trends.
This commit is contained in:
+11
-2
@@ -68,12 +68,19 @@ func _on_village_changed(village: SimVillage) -> void:
|
||||
var speed_text := ""
|
||||
if simulation_manager.has_method("get_current_speed"):
|
||||
speed_text = simulation_manager.get_current_speed()
|
||||
var rates: Dictionary = simulation_manager.get_resource_rates()
|
||||
var food_rate := ""
|
||||
if rates["food_per_day"] > 0.01:
|
||||
food_rate = " (−%.0f/d)" % rates["food_per_day"]
|
||||
var wood_rate := ""
|
||||
if rates["wood_per_day"] > 0.01:
|
||||
wood_rate = " (−%.0f/d)" % rates["wood_per_day"]
|
||||
village_stats_label.text = (
|
||||
"""
|
||||
Village [%s]
|
||||
|
||||
Food: %s
|
||||
Wood: %s
|
||||
Food: %s%s
|
||||
Wood: %s%s
|
||||
Safety: %s
|
||||
Knowledge: %s
|
||||
Starving: %s
|
||||
@@ -86,7 +93,9 @@ func _on_village_changed(village: SimVillage) -> void:
|
||||
% [
|
||||
speed_text,
|
||||
round(village.food),
|
||||
food_rate,
|
||||
round(village.wood),
|
||||
wood_rate,
|
||||
round(village.safety),
|
||||
round(village.knowledge),
|
||||
simulation_manager.get_starving_count(),
|
||||
|
||||
Reference in New Issue
Block a user