diff --git a/godot/native/libroutes_native.so b/godot/native/libroutes_native.so index f273773..281b5e3 100755 Binary files a/godot/native/libroutes_native.so and b/godot/native/libroutes_native.so differ diff --git a/godot/world/Tilemaps.gd b/godot/world/Tilemaps.gd index f39a136..d131844 100644 --- a/godot/world/Tilemaps.gd +++ b/godot/world/Tilemaps.gd @@ -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") diff --git a/routes-native/src/stateserver.rs b/routes-native/src/stateserver.rs index c7d858f..5bc933c 100644 --- a/routes-native/src/stateserver.rs +++ b/routes-native/src/stateserver.rs @@ -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 diff --git a/routes-native/src/stateserver/world.rs b/routes-native/src/stateserver/world.rs index 44a89f0..3f744e4 100644 --- a/routes-native/src/stateserver/world.rs +++ b/routes-native/src/stateserver/world.rs @@ -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(); diff --git a/routes-native/src/stateserver/world/tiles.rs b/routes-native/src/stateserver/world/tiles.rs index dd126f2..5a299d7 100644 --- a/routes-native/src/stateserver/world/tiles.rs +++ b/routes-native/src/stateserver/world/tiles.rs @@ -23,6 +23,12 @@ pub struct Tile { can_be_above: Vec, #[builder(default = "vec![]")] can_be_next_to: Vec, + #[builder(default = "true")] + hide_top_left: bool, + #[builder(default = "true")] + hide_top_right: bool, + #[builder(default = "true")] + hide_below: bool, } impl Tile {