Struct base::world::World
[−]
[src]
pub struct World { pub chunks: HashMap<ChunkIndex, Chunk>, }
Represents a whole game world consisting of multiple Chunk
s.
Chunks are parallelograms (roughly) that are placed next to each other in the world.
Fields
chunks: HashMap<ChunkIndex, Chunk>
Methods
impl World
[src]
fn empty() -> Self
Creates an empty world without any chunks.
fn replace_chunk(&mut self, index: ChunkIndex, chunk: Chunk)
Inserts the given chunk into the world and replaces the chunk that might have been at the given position before.
fn add_chunk(&mut self, index: ChunkIndex, chunk: Chunk) -> Result<(), Chunk>
Inserts the given chunk at the given position, if there wasn't a chunk at that position before. In the latter case the given chunk is returned.
fn pillar_at(&self, pos: PillarIndex) -> Option<&HexPillar>
Returns the hex pillar at the given world position, iff the corresponding chunk is loaded.
fn pillar_at_mut(&mut self, pos: PillarIndex) -> Option<&mut HexPillar>
Returns the hex pillar at the given world position, iff the corresponding chunk is loaded.
fn chunk_from_pillar(&self, pos: PillarIndex) -> Option<&Chunk>
Returns the chunk in which the given pillar exists.
fn chunk_at(&self, pos: ChunkIndex) -> Option<&Chunk>
Returns the requested chunk.