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

Function produces_item

plugins/dig-now.cpp:712–735  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

710}
711
712static bool produces_item(const boulder_percent_options &options,
713 MapExtras::MapCache &map, Random::MersenneRNG &rng,
714 const dug_tile_info &info) {
715 uint32_t probability;
716 if (info.tmat == df::tiletype_material::FEATURE)
717 probability = options.deep;
718 else {
719 switch (map.BlockAtTile(info.pos)->veinTypeAt(info.pos)) {
720 case df::inclusion_type::CLUSTER:
721 case df::inclusion_type::VEIN:
722 probability = options.vein;
723 break;
724 case df::inclusion_type::CLUSTER_ONE:
725 case df::inclusion_type::CLUSTER_SMALL:
726 probability = options.small_cluster;
727 break;
728 default:
729 probability = options.layer;
730 break;
731 }
732 }
733
734 return rng.random(100) < probability;
735}
736
737typedef std::map<std::pair<df::item_type, t_matpair>, std::vector<DFCoord>>
738 item_coords_t;

Callers 1

do_digFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected