diff options
author | nokoe <nokoe@mailbox.org> | 2025-06-21 01:52:33 +0200 |
---|---|---|
committer | nokoe <nokoe@mailbox.org> | 2025-06-21 01:52:33 +0200 |
commit | 16f72d038c37a2f5dd60a960f034ee2c3ff53f5b (patch) | |
tree | 9af64de6fe8b2b47a5e46b87adabde94ccd8b88b /client/map/tile_factory.gd | |
parent | 44ca1fe3780b76c73e03070fc20189607c414860 (diff) | |
download | hurrycurry-16f72d038c37a2f5dd60a960f034ee2c3ff53f5b.tar hurrycurry-16f72d038c37a2f5dd60a960f034ee2c3ff53f5b.tar.bz2 hurrycurry-16f72d038c37a2f5dd60a960f034ee2c3ff53f5b.tar.zst |
generalize floor meshing; fixes #278
Diffstat (limited to 'client/map/tile_factory.gd')
-rw-r--r-- | client/map/tile_factory.gd | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/client/map/tile_factory.gd b/client/map/tile_factory.gd index 7ba575c3..ca6c0f81 100644 --- a/client/map/tile_factory.gd +++ b/client/map/tile_factory.gd @@ -20,14 +20,21 @@ class TileCC: var tile_name: String var position: Vector2i var neighbors: Array - var floor_mesher: FloorMesher + var floor_meshers: Dictionary[String, FloorMesher] -static func produce(tile_name: String, position: Vector2i, neighbors: Array, floor_mesher) -> Tile: +var floor_meshers: Dictionary[String, FloorMesher] = { + "floor": FloorMesher.new(Floor.floor_mesh()), + "path": FloorMesher.new(Path.floor_mesh()), + "grass": GrassMesher.new(Grass.floor_mesh()), + "street": FloorMesher.new(Street.floor_mesh()) +} + +func produce(tile_name: String, position: Vector2i, neighbors: Array) -> Tile: var ctx := TileCC.new() ctx.tile_name = tile_name ctx.position = position ctx.neighbors = neighbors - ctx.floor_mesher = floor_mesher + ctx.floor_meshers = floor_meshers match tile_name: "black-hole-counter": return ItemPortal.new(ctx, false) "black-hole": return PlayerPortal.new(ctx, false) |