MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / previewTiles

Method previewTiles

source/game/items/StarTools.cpp:363–385  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

361}
362
363List<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
387void BeamMiningTool::init(ToolUserEntity* owner, ToolHand hand) {
388 FireableItem::init(owner, hand);

Callers 1

renderMethod · 0.45

Calls 9

tileAreaBrushFunction · 0.85
toRgbMethod · 0.80
canModifyTileMethod · 0.80
isAdminMethod · 0.45
inToolRangeMethod · 0.45
favoriteColorMethod · 0.45
aimPositionMethod · 0.45
tileIsOccupiedMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected