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 --- meson.build | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'meson.build') diff --git a/meson.build b/meson.build index 02e2d3a..df9208e 100644 --- a/meson.build +++ b/meson.build @@ -174,3 +174,13 @@ executable('sim_check', 'tools/sim_check.cpp', dependencies: [lua_dep, glm_dep, sol2_dep], cpp_args: extra_cpp_args, ) + +# Device-on-strut-graph collapse test. Constructs a minimal fort, mounts a +# device, cuts the supports, and asserts the device falls and is destroyed. +# Pure graph test — no Lua data, no SDL. +executable('device_collapse_test', 'tools/device_collapse_test.cpp', + 'src/game/build_graph.cpp', + include_directories: [engine_inc] + extra_inc, + dependencies: [glm_dep], + cpp_args: extra_cpp_args, +) -- cgit v1.3