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

Function simulate_fall

plugins/channel-safely/channel-safely-plugin.cpp:116–131  ·  view source on GitHub ↗

dig-now.cpp

Source from the content-addressed store, hash-verified

114
115// dig-now.cpp
116df::coord simulate_fall(const df::coord &pos) {
117 if unlikely(!Maps::isValidTilePos(pos)) {
118 ERR(plugin).print("Error: simulate_fall(" COORD ") - invalid coordinate\n", COORDARGS(pos));
119 return {};
120 }
121 df::coord resting_pos(pos);
122
123 while (Maps::ensureTileBlock(resting_pos)) {
124 df::tiletype tt = *Maps::getTileType(resting_pos);
125 if (isWalkable(tt))
126 break;
127 --resting_pos.z;
128 }
129
130 return resting_pos;
131}
132
133df::coord simulate_area_fall(const df::coord &pos) {
134 df::coord neighbours[8]{};

Callers 2

simulate_area_fallFunction · 0.70
OnUpdateFunction · 0.70

Calls 5

isValidTilePosFunction · 0.85
ensureTileBlockFunction · 0.85
getTileTypeFunction · 0.85
isWalkableFunction · 0.85
printMethod · 0.45

Tested by

no test coverage detected