Scale back coordinate types for new 50 km limit

This commit is contained in:
crumblingstatue 2023-04-03 12:01:59 +02:00
parent 64735c7455
commit d41032dbcc
4 changed files with 10 additions and 7 deletions

View file

@ -18,9 +18,10 @@ impl WorldPos {
}
}
/// Horizontal center of the world
pub const CENTER: WorldPosScalar = WorldPosScalar::MAX / 2;
/// Vertical surface level
pub const SURFACE: WorldPosScalar = WorldPosScalar::MAX / 16;
pub const CENTER: WorldPosScalar =
(TilePosScalar::MAX / 2) as WorldPosScalar * TILE_SIZE as WorldPosScalar;
/// Vertical surface level. You can build 5,000 blocks upwards
pub const SURFACE: WorldPosScalar = 5000 * TILE_SIZE as WorldPosScalar;
pub const SURFACE_CENTER: Self = Self {
x: Self::CENTER,
y: Self::SURFACE,
@ -28,7 +29,7 @@ impl WorldPos {
}
pub fn wp_to_tp(wp: WorldPosScalar) -> TilePosScalar {
wp / TILE_SIZE as TilePosScalar
(wp / TILE_SIZE as WorldPosScalar) as TilePosScalar
}
#[test]