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

Method absorb_unit

plugins/steam-engine.cpp:283–312  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

281 // Absorbs a water item produced by stoke reaction into the engine.
282
283 bool absorb_unit(steam_engine_workshop *engine, df::item_liquid_miscst *liquid)
284 {
285 // Consume liquid inputs
286 df::coord water, magma;
287
288 if (!find_liquids(&water, &magma, engine->is_magma, 1))
289 {
290 // Destroy the item with enormous wear amount.
291 liquid->addWear(WEAR_TICKS*5, true, false);
292 return false;
293 }
294
295 decrement_flow(water, 1);
296 if (engine->is_magma)
297 decrement_flow(magma, 1);
298
299 // Update flags
300 liquid->flags.bits.in_building = true;
301 liquid->mat_state.whole |= liquid_hook::BOILING_FLAG;
302 liquid->temperature.whole = liquid->getBoilingPoint()-1;
303 liquid->temperature.fraction = 0;
304
305 // This affects where the steam appears to come from
306 if (engine->hearth_tile.isValid())
307 liquid->pos = df::coord(x1+engine->hearth_tile.x, y1+engine->hearth_tile.y, z);
308
309 // Enable block temperature updates
310 enable_updates_at(liquid->pos, false, true);
311 return true;
312 }
313
314 bool boil_unit(df::item_liquid_miscst *liquid)
315 {

Callers

nothing calls this directly

Calls 3

decrement_flowFunction · 0.85
enable_updates_atFunction · 0.85
isValidMethod · 0.45

Tested by

no test coverage detected