mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-10 21:41:50 +00:00
fix on_blocks_tick interval
This commit is contained in:
parent
47d9434a96
commit
cd43d9545a
2 changed files with 3 additions and 2 deletions
|
|
@ -24,7 +24,7 @@ BlocksController::BlocksController(const Level& level, Lighting* lighting)
|
||||||
chunks(*level.chunks),
|
chunks(*level.chunks),
|
||||||
lighting(lighting),
|
lighting(lighting),
|
||||||
randTickClock(20, 3),
|
randTickClock(20, 3),
|
||||||
blocksTickClock(20, 1),
|
blocksTickClock(20, 3),
|
||||||
worldTickClock(20, 1) {
|
worldTickClock(20, 1) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -124,7 +124,7 @@ void BlocksController::update(float delta, uint padding) {
|
||||||
randomTick(randTickClock.getPart(), randTickClock.getParts(), padding);
|
randomTick(randTickClock.getPart(), randTickClock.getParts(), padding);
|
||||||
}
|
}
|
||||||
if (blocksTickClock.update(delta)) {
|
if (blocksTickClock.update(delta)) {
|
||||||
onBlocksTick(blocksTickClock.getPart(), blocksTickClock.getParts());
|
onBlocksTick(blocksTickClock.getTickId(), blocksTickClock.getParts());
|
||||||
}
|
}
|
||||||
if (worldTickClock.update(delta)) {
|
if (worldTickClock.update(delta)) {
|
||||||
scripting::on_world_tick(worldTickClock.getTickRate());
|
scripting::on_world_tick(worldTickClock.getTickRate());
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ bool Clock::update(float delta) {
|
||||||
tickTimer = std::fmod(tickTimer, delay);
|
tickTimer = std::fmod(tickTimer, delay);
|
||||||
tickPartsUndone = tickParts - 1;
|
tickPartsUndone = tickParts - 1;
|
||||||
}
|
}
|
||||||
|
++tickId;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue