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

Method dug_tile_info

plugins/dig-now.cpp:395–432  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

393 t_matpair imat; // matpair of boulder/gem potentially generated at this pos
394
395 dug_tile_info(MapExtras::MapCache &map, const DFCoord &pos) {
396 this->pos = pos;
397
398 df::tiletype tt = map.tiletypeAt(pos);
399 tmat = tileMaterial(tt);
400
401 itype = df::item_type::BOULDER;
402 imat = -1;
403
404 df::tiletype_shape shape = tileShape(tt);
405 if (shape != df::tiletype_shape::WALL && shape != df::tiletype_shape::FORTIFICATION)
406 return;
407
408 switch (tmat) {
409 case df::tiletype_material::STONE:
410 case df::tiletype_material::MINERAL:
411 case df::tiletype_material::FEATURE:
412 case df::tiletype_material::LAVA_STONE:
413 imat = map.baseMaterialAt(pos);
414 break;
415 case df::tiletype_material::FROZEN_LIQUID:
416 // assume frozen water
417 // we can't use baseMaterialAt here because it will return the underlying river bed material
418 imat = t_matpair(df::builtin_mats::WATER, -1);
419 break;
420 default:
421 return;
422 }
423
424 MaterialInfo mi;
425 mi.decode(imat);
426 if (mi.type == -1 || !mi.material)
427 return;
428
429 if (mi.material->isGem()) {
430 itype = df::item_type::ROUGH;
431 }
432 }
433};
434
435static bool is_diggable(MapExtras::MapCache &map, const DFCoord &pos,

Callers

nothing calls this directly

Calls 6

tileMaterialFunction · 0.85
tileShapeFunction · 0.85
t_matpairClass · 0.85
tiletypeAtMethod · 0.80
isGemMethod · 0.80
decodeMethod · 0.45

Tested by

no test coverage detected