diff options
author | tpart <tpart120@proton.me> | 2025-09-28 15:20:46 +0200 |
---|---|---|
committer | tpart <tpart120@proton.me> | 2025-09-28 15:20:46 +0200 |
commit | 02a1f6e2a7f09bee86a4264cce286a5ad84a1dc9 (patch) | |
tree | 5c0ad274b0ecbe3e7478724b7ab8f9ea858def52 /client/map | |
parent | b0b593bdb1d6501c984b799144ed317af4dde696 (diff) | |
download | hurrycurry-02a1f6e2a7f09bee86a4264cce286a5ad84a1dc9.tar hurrycurry-02a1f6e2a7f09bee86a4264cce286a5ad84a1dc9.tar.bz2 hurrycurry-02a1f6e2a7f09bee86a4264cce286a5ad84a1dc9.tar.zst |
Use Vector2i as key in tile_by_pos dictionary
Diffstat (limited to 'client/map')
-rw-r--r-- | client/map/map.gd | 10 |
1 files changed, 5 insertions, 5 deletions
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 |