magicciv/infra/terraform/test-fleet/main.tf
Natalie 158ef4d1bd feat(@projects/@magic-civilization): 🩹 p3-29 T2 — Rust turn emits UnitHealed
The live GDScript turn emitted `unit_healed` inline; the headless healing
phase recovered HP silently. The healing phase runs in the end-of-turn
`fn(&mut GameState)` registry (no event sink), so follow the FloraSuccession
buffer pattern: stash `(player, unit_id, applied_amount, col, row)` into a new
transient `GameState.pending_heal_events`, drain it in `step()` into
`TurnEvent::UnitHealed`. The buffered amount is the CLAMPED delta actually
applied (not the nominal heal rate). No wire surface — dispatch drops it; the
live UI consumes it via the kind-tagged `event_to_dict` dict.

Verified headless: mc-replay 19/0 (unit_healed_serde), mc-turn 289/0
(healing_buffers_unit_heal_event_with_applied_amount +
healing_buffers_clamped_amount_near_full_hp + event_collector_wiring).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 06:12:07 -04:00

45 lines
1.5 KiB
HCL

# Distributed test/train fleet — disposable cattle from the Packer golden image.
# No persistent volume: workers are stateless. The golden image carries the warm
# clone + toolchain + prebuilt .so; results leave via the dispatch layer (scp).
resource "hcloud_ssh_key" "fleet" {
name = "${var.name}-key"
public_key = file(pathexpand(var.ssh_public_key_path))
}
# Resolve the newest golden snapshot by label. Skipped entirely when
# var.base_image is set (bootstrap path), so `terraform plan` works before any
# snapshot exists.
data "hcloud_image" "golden" {
count = var.base_image == "" ? 1 : 0
with_selector = var.golden_selector
with_architecture = "x86"
most_recent = true
}
locals {
image = var.base_image != "" ? var.base_image : data.hcloud_image.golden[0].id
}
resource "hcloud_server" "worker" {
count = var.workers
name = "${var.name}-${count.index}"
server_type = var.server_type
location = var.location
image = local.image
ssh_keys = [hcloud_ssh_key.fleet.id]
# Thin cloud-init: copy the injected key to the build user and fast-forward
# the warm clone to the requested ref. The golden image already holds the
# toolchain + prebuilt GDExtension, so there is nothing heavy to install here.
user_data = templatefile("${path.module}/cloud-init.yaml", {
git_remote = var.git_remote
git_ref = var.git_ref
remote_user = var.remote_user
})
labels = {
project = "magic-civilization"
role = "test-fleet"
}
}