P06-01: Implement approved A06 finite Mana reserve (MP-01-r02 recommended)

Initial 100, capacity 300, world tree +20 per 10 game minutes. Each boundary
pays registered upkeep demand before storing surplus; overflow is discarded
and recorded, 0 stops the whole tower. Furnace offers are judged after
generation and demand payment. New saves carry mana_reserve and Operations
rollback includes it; legacy saves keep a 0..300 amount and reject others.

Outage tests that relied on Mana 0 persisting now hold the outage with a
disabled demand sink, since the world tree recovers at the next boundary.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Takeshi
2026-10-19 17:20:04 +09:00
co-authored by Claude Opus 5.5
parent c366012446
commit ae0f998ff4
18 changed files with 424 additions and 17 deletions
+18
View File
@@ -0,0 +1,18 @@
extends RefCounted
## Test-only sustained reserve outage under the A06 finite Mana contract.
## Zeroing the reserve alone recovers at the next 10-minute boundary because the
## world tree keeps generating. A disabled consumer adds upkeep demand that the
## reserve must pay but takes no local network allocation, so the tower stays
## at 0 until release() without changing any other consumer's supply.
const SINK_ID := &"test.mana_outage_sink"
const SINK_DEMAND := 1000
static func hold(runtime: Variant, state: Variant) -> void:
if runtime.mana_network_service.get_node(SINK_ID).is_empty():
runtime.mana_network_service.register_consumer(SINK_ID, SINK_DEMAND, ManaNetworkService.ConsumerPriority.NORMAL, false)
state.set_resource(&"mana", 0)
static func release(runtime: Variant, state: Variant, amount := 100) -> void:
runtime.mana_network_service.unregister_node(SINK_ID)
state.set_resource(&"mana", amount)