From 6cdd436caf9e2103f516442ab6e70a870d4cba04 Mon Sep 17 00:00:00 2001 From: Vaino Kauppila Date: Thu, 30 Jul 2026 11:56:27 +0300 Subject: Mount devices on the strut graph so cutting supports destroys them Implements win-condition path (c): destroy the enemy reactor by cutting its supports so it falls. Previously devices sat at fixed map coordinates, structurally immune to collapse. - BuildGraph gains MountedDevice tracking: mount_device/unmount_device, is_device_alive/get_device_hp/damage_device, nearest_device, with a break_node index-shift fix so mount references stay correct as other geometry on the same fort is destroyed. update_fire now also damages any device mounted on a burning strut. - app.cpp mounts devices onto the nearest strut (within 2 units) at both map-load and interactive placement, and after each tick's structural collapse pass, zeroes a device's HP if its mount didn't survive -- which flows through the existing win-condition/cleanup code unchanged. - tools/device_collapse_test.cpp: 15 headless tests covering collapse, partial support loss, splash/beam/fire-through-mount damage, multiple devices, index stability, and clean unmount. Verified: full test suite passes (15/15), sim_check shows zero regressions across all 3 maps. Co-Authored-By: Claude Sonnet 5 --- requirements/milestones.org | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'requirements') diff --git a/requirements/milestones.org b/requirements/milestones.org index 7cc2e89..2fd12ee 100644 --- a/requirements/milestones.org +++ b/requirements/milestones.org @@ -162,19 +162,26 @@ Still missing from the vanilla roster / mechanics (see gameplay-gaps.org #5, #8) mortar, flak + point-defence, machinegun/sniper (hitscan), guided swarm missiles, EMP, and the per-shot METAL cost (only energy is charged). -* M5: Reactor, Resources & Game Loop [MOSTLY DONE] +* M5: Reactor, Resources & Game Loop [DONE] Goal: There's a reactor to destroy, and a real economy to build it with. - [X] Reactor entity -- large block, HP bar (a device with =is_core=) - [X] Player reactor on left, enemy reactor on right (via the enemy-fort mod) -- [~] Reactor takes damage from direct hits, fire, falling/collision - -- splash and beam damage hit devices; FIRE does not damage devices, and - devices are not attached to the strut graph, so they never fall. -- [~] Win condition: destroy reactor HP OR disconnect it from its foundation - (collapse) -- only the HP path exists. The round ends when a team has no - surviving =is_core= device. The collapse path needs devices mounted on - the graph (see M6 / gameplay-gaps.org #3). +- [X] Reactor takes damage from direct hits, fire, falling/collision -- + splash and beam damage hit devices; fire now damages devices too + (=update_fire= damages any device mounted on a burning strut); devices + are mounted onto the strut graph at placement (=BuildGraph::mount_device=, + nearest strut within 2 units) and fall/die when their mount nodes are + destroyed by structural collapse. +- [X] Win condition: destroy reactor HP OR disconnect it from its foundation + (collapse) -- both paths exist now. The round ends when a team has no + surviving =is_core= device, and that check already covered the collapse + path correctly once devices actually died from it -- the missing piece + was the strut-graph mount, not the win-condition logic itself. Verified + by =tools/device_collapse_test.cpp= (15/15, headless) including the + exact scenario: reactor mounted on a platform, all support struts cut, + reactor destroyed. - [X] Resource system (deferred from M2): mines on metal deposits, wind turbines for energy, generation rates, storage caps, build/fire costs. Build costs are now PER-MATERIAL (=cost_metal= / =cost_energy= in -- cgit v1.3