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

Function simulate_fall

plugins/dig-now.cpp:837–848  ·  view source on GitHub ↗

if pos is empty space, teleport to a floor somewhere below if we fall out of the world (e.g. empty space or walls all the way down), returned position will be invalid

Source from the content-addressed store, hash-verified

835// if we fall out of the world (e.g. empty space or walls all the way down),
836// returned position will be invalid
837static DFCoord simulate_fall(const DFCoord &pos) {
838 DFCoord resting_pos(pos);
839
840 while (Maps::ensureTileBlock(resting_pos)) {
841 df::tiletype tt = *Maps::getTileType(resting_pos);
842 if (isWalkable(tt))
843 break;
844 --resting_pos.z;
845 }
846
847 return resting_pos;
848}
849
850static void create_boulders(color_ostream &out,
851 const item_coords_t &item_coords,

Callers 2

create_bouldersFunction · 0.70
post_process_dug_tilesFunction · 0.70

Calls 3

ensureTileBlockFunction · 0.85
getTileTypeFunction · 0.85
isWalkableFunction · 0.85

Tested by

no test coverage detected