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

Function isSafe

plugins/reveal.cpp:62–87  ·  view source on GitHub ↗

* Anything that might reveal Hell or trigger gemstone pillar events is unsafe. */

Source from the content-addressed store, hash-verified

60 * Anything that might reveal Hell or trigger gemstone pillar events is unsafe.
61 */
62bool isSafe(df::coord c) {
63 // convert to block coordinates
64 c.x >>= 4;
65 c.y >>= 4;
66
67 // Don't reveal blocks that contain trigger events
68 if (trigger_cache.contains(c))
69 return false;
70
71 t_feature local_feature;
72 t_feature global_feature;
73 // get features of block
74 // error -> obviously not safe to manipulate
75 if(!Maps::ReadFeatures(c.x, c.y, c.z, &local_feature, &global_feature))
76 return false;
77
78 // Adamantine tubes and temples lead to Hell
79 if (local_feature.type == df::feature_type::deep_special_tube ||
80 local_feature.type == df::feature_type::deep_surface_portal)
81 return false;
82 // And Hell *is* Hell.
83 if (global_feature.type == df::feature_type::underworld_from_layer)
84 return false;
85 // otherwise it's safe.
86 return true;
87}
88
89static void update_minimap() {
90 game->minimap.update = 1;

Callers 2

do_reveal_adventureFunction · 0.85
do_reveal_fortFunction · 0.85

Calls 1

containsMethod · 0.80

Tested by

no test coverage detected