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

Function aquifer_add

plugins/aquifer.cpp:232–250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

230}
231
232static int aquifer_add(color_ostream &out, string aq_type,
233 df::coord pos1, df::coord pos2, int skip_top, int levels, bool leaky)
234{
235 DEBUG(log,out).print("entering aquifer_add: aq_type={}, pos1={}, pos2={}, skip_top={}, levels={}, leaky={}\n",
236 aq_type, pos1, pos2, skip_top, levels, leaky);
237
238 const bool heavy_state = aq_type == "heavy";
239
240 int modified = Maps::setAreaAquifer(pos1, pos2, heavy_state, [&](df::coord pos, df::map_block* block) -> bool {
241 TRACE(log, out).print("examining tile: pos={}\n", pos);
242 return (leaky || !is_leaky(pos))
243 && (!Maps::isTileAquifer(pos) || Maps::isTileHeavyAquifer(pos) != heavy_state);
244 });
245
246 DEBUG(log, out).print("added aquifer tiles in area: pos1={}, pos2={}, heavy_state={}, count={}\n",
247 pos1, pos2, heavy_state, modified);
248
249 return modified;
250}
251
252DFHACK_PLUGIN_LUA_FUNCTIONS {
253 DFHACK_LUA_FUNCTION(aquifer_list),

Callers

nothing calls this directly

Calls 4

is_leakyFunction · 0.85
isTileAquiferFunction · 0.85
isTileHeavyAquiferFunction · 0.85
printMethod · 0.45

Tested by

no test coverage detected