//! 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, 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, } } }