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

Function tile_watery

plugins/plant.cpp:96–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94}
95
96static bool tile_watery(const df::coord &pos)
97{ // Determines if plant should be in wet or dry vector
98 int32_t x = pos.x, y = pos.y, z = pos.z - 1;
99
100 for (int32_t dx = -2; dx <= 2; dx++)
101 { // Check 5x5 area under tile, skipping corners
102 for (int32_t dy = -2; dy <= 2; dy++)
103 {
104 if (abs(dx) == 2 && abs(dy) == 2)
105 continue; // Skip corners
106
107 auto tt = Maps::getTileType(x+dx, y+dy, z);
108 if (!tt)
109 continue; // Invalid tile
110
111 auto mat = tileMaterial(*tt);
112 if (mat == tiletype_material::POOL ||
113 mat == tiletype_material::RIVER ||
114 tileShape(*tt) == tiletype_shape::BROOK_BED)
115 {
116 return true;
117 }
118 }
119 }
120
121 return false;
122}
123
124command_result df_createplant(color_ostream &out, const df::coord &pos, const plant_options &options)
125{

Callers 1

df_createplantFunction · 0.85

Calls 3

getTileTypeFunction · 0.85
tileMaterialFunction · 0.85
tileShapeFunction · 0.85

Tested by

no test coverage detected