mirror of
https://github.com/minetest/minetest.git
synced 2024-11-23 16:13:46 +01:00
Limit range of ABM timer initial value randomization
This commit is contained in:
parent
3e6f824e6c
commit
f9d7e399b2
@ -213,7 +213,10 @@ ABMWithState::ABMWithState(ActiveBlockModifier *abm_):
|
|||||||
{
|
{
|
||||||
// Initialize timer to random value to spread processing
|
// Initialize timer to random value to spread processing
|
||||||
float itv = abm->getTriggerInterval();
|
float itv = abm->getTriggerInterval();
|
||||||
timer = myrand_range(-0.51*itv, 0.51*itv);
|
itv = MYMAX(0.001, itv); // No less than 1ms
|
||||||
|
int minval = MYMAX(-0.51*itv, -60); // Clamp to
|
||||||
|
int maxval = MYMIN(0.51*itv, 60); // +-60 seconds
|
||||||
|
timer = myrand_range(minval, maxval);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user