P06-03: Show Mana supply, consumption and storage; prove new-PID recovery

HUD tooltip reports world tree supply, upkeep consumption, net, stored amount
and the last boundary's shortage/overflow. A writer/reader pair saves mid-outage,
recovers in a new process and matches the writer exactly while DESTROYED and
RAIDED suspensions stay in place.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Takeshi
2026-10-20 08:59:59 +09:00
co-authored by Claude Opus 5.5
parent db5ca62e42
commit 826ef606df
5 changed files with 187 additions and 1 deletions
+23 -1
View File
@@ -2583,6 +2583,7 @@ func _on_snapshot_published(_snapshot: Dictionary = {}, _digest: String = "") ->
_synchronize_elevator_pending()
_queue_dashboard_refresh()
_update_pause_and_speed()
_refresh_mana_tooltip()
var operation: Dictionary = _snapshot.get(&"systems", {}).get(&"runtime", {}).get(&"operations", {}).get(&"coordinator", {})
var summaries: Array = operation.get(&"day_summaries", [])
if summaries.is_empty():
@@ -2808,7 +2809,7 @@ func _on_resource_changed(resource_name: StringName, value: int) -> void:
if resource_name == &"mana":
label.text += "/%d" % MANA_RESERVE.CAPACITY
label.mouse_filter = Control.MOUSE_FILTER_STOP
label.tooltip_text = "世界樹が%d分ごとに%dマナを生成し、施設の維持マナを先に支払って残りを最大%dまで蓄えます。\n残量0で全館停止。接客・調理・搬入・エレベーターと新規入館が停止します。\n残量と配電が回復すると再開します。破壊・摘発による休止は解除されません。" % [MANA_RESERVE.INTERVAL_MINUTES, MANA_RESERVE.WORLD_TREE_GENERATION, MANA_RESERVE.CAPACITY]
_refresh_mana_tooltip(label)
if value <= 0:
label.text += "・停止"
label.add_theme_color_override("font_color", Color("ffb095"))
@@ -2816,6 +2817,27 @@ func _on_resource_changed(resource_name: StringName, value: int) -> void:
label.add_theme_color_override("font_color", _visual_color(&"text_light", Color("fff2d0")))
func _refresh_mana_tooltip(label: Label = null) -> void:
if label == null:
label = resource_labels.get(&"mana") as Label
if label == null:
return
var lines: Array[String] = []
if _runtime != null and _runtime.has_method(&"get_mana_reserve_report"):
var report: Dictionary = _runtime.call(&"get_mana_reserve_report")
lines.append("供給 +%d/%d分 消費 −%d/%d分 収支 %+d" % [int(report[&"generation"]), int(report[&"interval_minutes"]), int(report[&"demand"]), int(report[&"interval_minutes"]), int(report[&"net"])])
var flow: Dictionary = report[&"last_flow"]
var stored := "蓄積 %d/%d" % [int(report[&"amount"]), int(report[&"capacity"])]
if not flow.is_empty():
stored += "(直近:不足 %d・上限超過で破棄 %d)" % [int(flow[&"shortage"]), int(flow[&"overflow"])]
lines.append(stored)
else:
lines.append("世界樹が%d分ごとに%dマナを生成し、施設の維持マナを先に支払って残りを最大%dまで蓄えます。" % [MANA_RESERVE.INTERVAL_MINUTES, MANA_RESERVE.WORLD_TREE_GENERATION, MANA_RESERVE.CAPACITY])
lines.append("残量0で全館停止。接客・調理・搬入・エレベーターと新規入館が停止します。")
lines.append("残量と配電が回復すると再開します。破壊・摘発による休止は解除されません。")
label.tooltip_text = "\n".join(lines)
func _button(text_value: String, callback: Callable, minimum_width := 82) -> Button:
var button := Button.new()
button.text = text_value