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

Function ripe

plugins/getplants.cpp:218–223  ·  view source on GitHub ↗

Formula for determination of the variance in plant growth maturation time, determined via disassembly. The coordinates are relative to the embark region.

Source from the content-addressed store, hash-verified

216// Formula for determination of the variance in plant growth maturation time, determined via disassembly.
217// The coordinates are relative to the embark region.
218bool ripe(int32_t x, int32_t y, int32_t z, int32_t start, int32_t end) {
219 DFHack::Random::SplitmixRNG rng((world->map.region_x * 48 + x) + (world->map.region_y * 48 + y) * 10000 + (world->map.region_z + z) * 100000000);
220 int32_t time = (rng.df_trandom(2000) + *cur_year_tick) % 403200;
221
222 return time >= start && (end == -1 || time <= end);
223}
224
225// Looks in the local creation zone's picked growths vector to see if a matching growth has been marked as picked.
226bool picked(const df::plant* plant, int32_t growth_subtype, int32_t growth_density) {

Callers 1

designateFunction · 0.85

Calls 1

df_trandomMethod · 0.45

Tested by

no test coverage detected