From 02a1f6e2a7f09bee86a4264cce286a5ad84a1dc9 Mon Sep 17 00:00:00 2001 From: tpart Date: Sun, 28 Sep 2025 15:20:46 +0200 Subject: Use Vector2i as key in tile_by_pos dictionary --- client/map/map.gd | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'client') diff --git a/client/map/map.gd b/client/map/map.gd index 161b14fb..f6cb2f82 100644 --- a/client/map/map.gd +++ b/client/map/map.gd @@ -24,18 +24,18 @@ class TileInfo: var tile: Tile var neighbours: Array -var tile_by_pos: Dictionary[String, TileInfo] = {} +var tile_by_pos: Dictionary[Vector2i, TileInfo] = {} var autobake = false var currently_baked = false var floor_node := MeshInstance3D.new() var tile_factory = TileFactory.new() func get_tile_name(pos: Vector2i): # -> String? - var e = tile_by_pos.get(str(pos)) + var e = tile_by_pos.get(pos) if e != null: return e.name else: return null func get_tile_instance(pos: Vector2i) -> Tile: - var e = tile_by_pos.get(str(pos)) + var e = tile_by_pos.get(pos) if e != null: return e.tile else: return null @@ -44,7 +44,7 @@ func set_tile(pos: Vector2i, name_: String, neighbors: Array = [null,null,null,n var tile := tile_factory.produce(name_, pos, neighbors) add_child(tile) tile.position = Vector3(pos.x, 0, pos.y) - tile_by_pos[str(pos)] = TileInfo.new(pos, name_, tile, neighbors) + tile_by_pos[pos] = TileInfo.new(pos, name_, tile, neighbors) return tile func clear_tile(pos: Vector2i): @@ -56,7 +56,7 @@ func clear_tile(pos: Vector2i): if floor_mesher != null: floor_mesher.remove_tile(pos) tile.queue_free() - tile_by_pos.erase(str(pos)) + tile_by_pos.erase(pos) tile.name += "_queued_free" @onready var voxelgi: VoxelGI = $VoxelGI -- cgit v1.2.3-70-g09d2