MCPcopy Create free account
hub / github.com/DFHack/dfhack / is_diggable

Function is_diggable

plugins/dig-now.cpp:435–456  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

433};
434
435static bool is_diggable(MapExtras::MapCache &map, const DFCoord &pos,
436 df::tiletype tt) {
437 df::tiletype_material mat = tileMaterial(tt);
438 switch (mat) {
439 case df::tiletype_material::CONSTRUCTION:
440 case df::tiletype_material::TREE:
441 case df::tiletype_material::ROOT:
442 case df::tiletype_material::MAGMA:
443 case df::tiletype_material::HFS:
444 case df::tiletype_material::UNDERWORLD_GATE:
445 return false;
446 default:
447 break;
448 }
449
450 MaterialInfo mi;
451 mi.decode(map.baseMaterialAt(pos));
452 if (mi.material != nullptr && mi.material->flags.is_set(df::material_flags::UNDIGGABLE))
453 return false;
454
455 return true;
456}
457
458static bool dig_tile(color_ostream &out, MapExtras::MapCache &map,
459 const DFCoord &pos, df::tile_dig_designation designation,

Callers 1

dig_tileFunction · 0.85

Calls 3

tileMaterialFunction · 0.85
is_setMethod · 0.80
decodeMethod · 0.45

Tested by

no test coverage detected