mirror of
https://git.kittycat.homes/zoe/codename-routes.git
synced 2024-08-15 03:18:26 +00:00
dont render tiles that are hidden
This commit is contained in:
parent
5b58f246a0
commit
1de09f7014
5 changed files with 21 additions and 2 deletions
Binary file not shown.
|
@ -21,8 +21,9 @@ func get_tile_at(pos: Vector3) -> String:
|
|||
|
||||
func update_tiles(tile_positions: PoolVector3Array):
|
||||
for tile in tile_positions:
|
||||
tilemaps[tile.z].set_tile_graphics(Vector2(tile.x, tile.y),
|
||||
get_tile_at(tile))
|
||||
if !StateServer.is_tile_hidden(int(tile.x), int(tile.y), int(tile.z)):
|
||||
tilemaps[tile.z].set_tile_graphics(Vector2(tile.x, tile.y),
|
||||
get_tile_at(tile))
|
||||
|
||||
func _on_StateServer_request_init():
|
||||
call_deferred("respawn_tilemaps")
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue