Files
war-in-tunnels/src/app/states/skirmish_states/structures/collapsed_tunnel.rs
T
GarandPLG d293f95174
Nix package / build (push) Successful in 8m38s
Linux package builds (test) / linux (push) Successful in 2m19s
Linux package builds (test) / aur (push) Successful in 8m29s
Rust checks / check (push) Successful in 4m3s
Add support structures and stress mechanics
Introduce support structures (roof supports) and a stress system that
propagates from bases through tunnels, causing collapses when stress
reaches 100 %.  Add auto‑support feature with toggleable tasks, new
keybindings (Tasks, AutoSupports, Stress), and a support‑building tab.
Implement collapsed tunnels, support work progress, and related UI
rendering (stress view, auto‑support indicators).  Extend board resize
logic, update game state structs, and adjust keybinding actions.  Update
documentation (README, AGENTS, CODE_MAP, PROGRESS, TESTING) to reflect
new features.  Add flake.nix dependencies (bash, gitea‑actions‑runner,
docker).  Add extensive tests for tunnel stress, support building,
auto‑supports, and related mechanics.
2026-10-24 19:33:38 +02:00

50 lines
1.0 KiB
Rust

use crate::app::states::skirmish_states::{Players, structures::Structure};
use ratatui::style::Color;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct CollapsedTunnel {
durability: u16,
}
impl Default for CollapsedTunnel {
fn default() -> Self {
Self::new()
}
}
impl CollapsedTunnel {
pub fn new() -> Self {
Self { durability: 750 }
}
pub fn take_damage(&mut self, damage: u16) -> () {
self.durability = self.durability.saturating_sub(damage);
}
}
impl Structure for CollapsedTunnel {
fn get_tag(&self) -> char {
'#'
}
fn get_color(&self) -> Color {
Color::DarkGray
}
fn get_level(&self) -> char {
' '
}
fn get_stress(&self) -> u8 {
100
}
fn get_durability(&self) -> u16 {
self.durability
}
fn get_max_durability(&self) -> u16 {
750
}
fn get_name(&self) -> &'static str {
"Collapsed tunnel"
}
fn get_owner(&self) -> Players {
Players::Unclaimed
}
}