suon_position 0.1.0

Position and coordinate types for the Suon MMORPG framework
Documentation
  • Coverage
  • 69.23%
    18 out of 26 items documented6 out of 7 items with examples
  • Size
  • Source code size: 109.17 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 8.53 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 3m 23s Average build duration of successful builds.
  • all releases: 3m 23s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • suonengine/suon-outdated
    5 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • ramon-bernardo

Spatial position components shared across the Suon world.

This crate centralizes the lightweight ECS components used to represent where an entity is now and where it was previously, both in two-dimensional world coordinates and across floors.

Modules

  • [direction]: shared cardinal and diagonal facing/movement directions
  • [position]: current world-space tile coordinates
  • [floor]: current vertical layer
  • [previous_position]: previous world-space tile coordinates
  • [previous_floor]: previous vertical layer

Examples

use suon_position::{
    direction::Direction,
    floor::Floor,
    position::Position,
    previous_floor::PreviousFloor,
    previous_position::PreviousPosition,
};

let position = Position { x: 12, y: 34 };
let next_position = position + Direction::East;
let floor = Floor { z: 7 };
let previous_position = PreviousPosition { x: 11, y: 34 };
let previous_floor = PreviousFloor { z: 6 };

assert_eq!(position.x, 12);
assert_eq!(next_position.x, 13);
assert_eq!(*floor, 7);
assert_eq!(previous_position.y, 34);
assert_eq!(*previous_floor, 6);