mirror of
https://git.kittycat.homes/zoe/codename-routes.git
synced 2024-08-15 03:18:26 +00:00
start work on placing tiles
This commit is contained in:
parent
13ae90769b
commit
2a47a75b91
5 changed files with 20 additions and 5 deletions
|
@ -59,8 +59,9 @@ impl StateServer {
|
|||
}
|
||||
|
||||
#[export]
|
||||
fn put_tile_at(&mut self, _owner: &Node, x: usize, y: usize, z: usize, id: usize){
|
||||
self.world.put_tile_at(x, y, z, id);
|
||||
fn put_tile_at(&mut self, _owner: &Node, x: usize, y: usize, z: usize, id: usize) -> bool{
|
||||
let success = self.world.put_tile_at(x, y, z, id);
|
||||
success
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -90,11 +90,18 @@ impl World {
|
|||
positions
|
||||
}
|
||||
|
||||
pub fn put_tile_at(&mut self, x: usize, y: usize, z: usize, id: usize){
|
||||
|
||||
pub fn put_tile_at(&mut self, x: usize, y: usize, z: usize, id: usize) -> bool{
|
||||
if !self.can_put_tile_at(x, y, z, id){
|
||||
return false;
|
||||
}
|
||||
self.tiles[x][y][z] = tiles::Tiletypes::from_repr(id as u8).unwrap();
|
||||
true
|
||||
}
|
||||
|
||||
pub fn can_put_tile_at(&self, x: usize, y: usize, z: usize, id: usize) -> bool{
|
||||
if self.tiles[x][y][z] == tiles::Tiletypes::Air{
|
||||
return true;
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue