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

Method setSoilAt

library/modules/MapCache.cpp:433–469  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

431}
432
433bool MapExtras::Block::setSoilAt(df::coord2d pos, df::tiletype tile, bool kill_veins)
434{
435 using namespace df::enums::tiletype_material;
436
437 if (!block)
438 return false;
439
440 if (!isCoreMaterial(tile))
441 return false;
442
443 if (!basemats)
444 init_tiles(true);
445
446 pos = pos & 15;
447 auto &cur_tile = tiles->base_tiles[pos.x][pos.y];
448
449 tile = matchTileMaterial(tile, SOIL);
450 if (tile == tiletype::Void)
451 return false;
452
453 if (kill_veins && !setVeinMaterialAt(pos, -1))
454 return false;
455
456 if (cur_tile != tile)
457 {
458 dirty_tiles = true;
459 tiles->set_base_tile(pos, tile);
460 }
461
462 int mat = layerMaterialAt(pos);
463 if (BlockInfo::getGroundType(mat) == BlockInfo::G_STONE)
464 mat = biomeInfoAt(pos).default_soil;
465
466 basemats->set_base_mat(tiles, pos, 0, mat);
467
468 return true;
469}
470
471df::tiletype MapExtras::Block::tiletypeAt(df::coord2d p)
472{

Callers 2

write_block_tilesMethod · 0.80
dig_typeFunction · 0.80

Calls 4

isCoreMaterialFunction · 0.85
layerMaterialAtFunction · 0.85
set_base_tileMethod · 0.80
set_base_matMethod · 0.80

Tested by

no test coverage detected