feat: Enable dynamic shovel pricing calculation (#15)
This commit is contained in:
@@ -74,4 +74,19 @@ impl Grid {
|
||||
*tile_state = mapper(&*tile_state);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub fn count_claimed_tiles(&self, tile_query: &Query<&TileState>) -> u32 {
|
||||
self.tiles
|
||||
.iter()
|
||||
.flatten()
|
||||
.filter(|&entity| {
|
||||
if let Ok(state) = tile_query.get(*entity) {
|
||||
!matches!(state, TileState::Unclaimed)
|
||||
} else {
|
||||
false
|
||||
}
|
||||
})
|
||||
.count() as u32
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user