mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-11-20 09:29:44 +00:00
add world.get_logic, set_logic 'block_ticks', 'random_ticks' runtime world parameters
This commit is contained in:
parent
bccc6e154f
commit
d0803fce0c
5 changed files with 110 additions and 9 deletions
|
|
@ -130,14 +130,26 @@ void BlocksController::updateBlock(int x, int y, int z) {
|
|||
}
|
||||
|
||||
void BlocksController::update(float delta, uint padding) {
|
||||
if (int parts = randTickClock.update(delta)) {
|
||||
for (int i = 0; i < parts; i++) {
|
||||
randomTick(randTickClock.convertPart(i), randTickClock.getParts(), padding);
|
||||
auto& worldInfo = level.getWorld().getInfo();
|
||||
|
||||
if (worldInfo.getLogicFlag("random_ticks", true)) {
|
||||
if (int parts = randTickClock.update(delta)) {
|
||||
for (int i = 0; i < parts; i++) {
|
||||
randomTick(
|
||||
randTickClock.convertPart(i),
|
||||
randTickClock.getParts(),
|
||||
padding
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (int parts = blocksTickClock.update(delta)) {
|
||||
for (int i = 0; i < parts; i++) {
|
||||
onBlocksTick(blocksTickClock.convertPart(i), blocksTickClock.getParts());
|
||||
if (worldInfo.getLogicFlag("block_ticks", true)) {
|
||||
if (int parts = blocksTickClock.update(delta)) {
|
||||
for (int i = 0; i < parts; i++) {
|
||||
onBlocksTick(
|
||||
blocksTickClock.convertPart(i), blocksTickClock.getParts()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (worldTickClock.update(delta)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue