Something went wrong. Try again.
HEXWORK - A Lantern in the Deep: 3D ASCII terminal roguelike RPG in Rust.
Entirely designed and built by Muse Spark 1.3 to evaluate if I like the model.
Something went wrong. Try again.
1.7 kB · 60 lines
Rust
at main
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061//! Actors: continuous positions in a voxel world (docs/04 §4.3).//!//! [`crate::state::State::actors`] is the sole simulation entity authority.//! [`crate::state::State::ecs`] is dormant infrastructure and actors are never//! mirrored into it. Voxel occupancy is likewise derived from actors, never//! authoritative — so falling, leaning, climbing, and riding work.
/// Body posture. Rendered as glyph variants (docs/05 §5.1).#[derive(Clone, Copy, Debug, PartialEq, Eq)]pub enum Stance { Stand, Crouch, Climb, Swim, Prone, Rope,}
impl Stance { /// Stable persistence tag; declaration order is not the wire protocol. #[must_use] pub const fn canonical_tag(self) -> u8 { match self { Self::Stand => 0, Self::Crouch => 1, Self::Climb => 2, Self::Swim => 3, Self::Prone => 4, Self::Rope => 5, } }}
/// A living (or unliving) thing with a continuous position.#[derive(Clone, Debug)]pub struct Actor { pub id: u64, pub position: crate::spatial::FixedVec3, pub body: crate::spatial::BodyExtents, pub heading: Option<crate::heading::Heading>, pub movement_remainder: crate::heading::MovementRemainder, pub stance: Stance, pub hp: i32, pub alive: bool,}
impl Actor { pub fn new(id: u64, position: crate::spatial::FixedVec3) -> Self { Self { id, position, body: crate::spatial::BodyExtents::PLAYER, heading: None, movement_remainder: crate::heading::MovementRemainder::ZERO, stance: Stance::Stand, hp: 10, alive: true, } }}