diff --git a/src/lib.rs b/src/lib.rs index fdd39d5..c3165d0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -57,20 +57,23 @@ pub fn add_tiles(game_data: String, image: String, prefix: String) -> String { } } - game.add_tile(Tile { + let tile = Tile { /// "0" will get overwritten to a new, safe tile ID id: "0".to_string(), name: tile_name(&prefix, &tile_index), wall: None, animation_frames: vec![Image { pixels }], colour_id: None - }); + }; - tile_index += 1; + if !game.tiles.contains(&tile) { + game.add_tile(tile); + + tile_index += 1; + } } } - game.dedupe_tiles(); game.to_string() }