dont render tiles that are hidden

This commit is contained in:
zoe 2022-05-08 18:53:27 +02:00
parent 5b58f246a0
commit 1de09f7014
5 changed files with 21 additions and 2 deletions

View file

@ -48,6 +48,11 @@ impl StateServer {
fn get_tile_at(&self, _owner: &Node, x: usize, y: usize, z: usize) -> u16 {
self.world.get_tile_at(x, y, z)
}
#[export]
fn is_tile_hidden(&self, _owner: &Node, x: usize, y: usize, z: usize) -> bool{
self.world.is_tile_hidden(x, y, z)
}
}
// signals

View file

@ -14,6 +14,13 @@ impl World {
//TODO: error handling, or maybe just do that in godot
self.tiles[x][y][z] as u16
}
pub fn is_tile_hidden(&self, x: usize, y: usize, z: usize) -> bool{
if x == self.xsize - 1 || y == self.ysize -1 || z == self.zsize - 1{
return false;
}
true
}
pub fn generate(&mut self) -> Vector3Array{
self.tiles = get_vec3(self.xsize, self.ysize, self.zsize);
let mut ret: Vector3Array = Vector3Array::new();

View file

@ -23,6 +23,12 @@ pub struct Tile {
can_be_above: Vec<Tiletypes>,
#[builder(default = "vec![]")]
can_be_next_to: Vec<Tiletypes>,
#[builder(default = "true")]
hide_top_left: bool,
#[builder(default = "true")]
hide_top_right: bool,
#[builder(default = "true")]
hide_below: bool,
}
impl Tile {