| 361 | } |
| 362 | |
| 363 | List<PreviewTile> BeamMiningTool::previewTiles(bool shifting) const { |
| 364 | List<PreviewTile> result; |
| 365 | auto ownerp = owner(); |
| 366 | auto worldp = world(); |
| 367 | |
| 368 | if (ownerp && worldp) { |
| 369 | if (ownerp->isAdmin() || ownerp->inToolRange()) { |
| 370 | Color lightColor = ownerp->favoriteColor(); |
| 371 | if (!ready()) |
| 372 | lightColor *= Color::rgbaf(0.75f, 0.75f, 0.75f, 1.0f); |
| 373 | Vec3B light = lightColor.toRgb(); |
| 374 | int radius = !shifting ? m_blockRadius : m_altBlockRadius; |
| 375 | for (auto pos : tileAreaBrush(radius, ownerp->aimPosition(), true)) { |
| 376 | if (worldp->tileIsOccupied(pos, TileLayer::Foreground, true)) { |
| 377 | result.append({pos, true, light, true}); |
| 378 | } else if (worldp->tileIsOccupied(pos, TileLayer::Background, true)) { |
| 379 | result.append({pos, false, light, true}); |
| 380 | } |
| 381 | } |
| 382 | } |
| 383 | } |
| 384 | return result; |
| 385 | } |
| 386 | |
| 387 | void BeamMiningTool::init(ToolUserEntity* owner, ToolHand hand) { |
| 388 | FireableItem::init(owner, hand); |
no test coverage detected