|
@@ -1207,6 +1207,21 @@ Array TileMap::get_used_cells() const {
|
|
|
return a;
|
|
|
}
|
|
|
|
|
|
+Array TileMap::get_used_cells_by_id(int p_id) const {
|
|
|
+
|
|
|
+ Array a;
|
|
|
+ a.clear();
|
|
|
+ for (Map<PosKey, Cell>::Element *E = tile_map.front(); E; E = E->next()) {
|
|
|
+
|
|
|
+ if (E->value().id == p_id) {
|
|
|
+ Vector2 p(E->key().x, E->key().y);
|
|
|
+ a.push_back(p);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return a;
|
|
|
+}
|
|
|
+
|
|
|
Rect2 TileMap::get_used_rect() { // Not const because of cache
|
|
|
|
|
|
if (used_size_cache_dirty) {
|
|
@@ -1325,6 +1340,7 @@ void TileMap::_bind_methods() {
|
|
|
ObjectTypeDB::bind_method(_MD("clear"), &TileMap::clear);
|
|
|
|
|
|
ObjectTypeDB::bind_method(_MD("get_used_cells"), &TileMap::get_used_cells);
|
|
|
+ ObjectTypeDB::bind_method(_MD("get_used_cells_by_id", "id"), &TileMap::get_used_cells_by_id);
|
|
|
ObjectTypeDB::bind_method(_MD("get_used_rect"), &TileMap::get_used_rect);
|
|
|
|
|
|
ObjectTypeDB::bind_method(_MD("map_to_world", "mappos", "ignore_half_ofs"), &TileMap::map_to_world, DEFVAL(false));
|