mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
implement player ticks in headless mode & prevent on_player_tick call if player chunk does not exists
This commit is contained in:
parent
8e7dfe3e0b
commit
1cd85b6f77
9 changed files with 70 additions and 41 deletions
|
|
@ -19,14 +19,13 @@
|
|||
#include "objects/Player.hpp"
|
||||
#include "objects/Players.hpp"
|
||||
|
||||
BlocksController::BlocksController(const Level& level, Lighting* lighting, uint padding)
|
||||
BlocksController::BlocksController(const Level& level, Lighting* lighting)
|
||||
: level(level),
|
||||
chunks(*level.chunks),
|
||||
lighting(lighting),
|
||||
randTickClock(20, 3),
|
||||
blocksTickClock(20, 1),
|
||||
worldTickClock(20, 1),
|
||||
padding(padding) {
|
||||
worldTickClock(20, 1) {
|
||||
}
|
||||
|
||||
void BlocksController::updateSides(int x, int y, int z) {
|
||||
|
|
@ -120,9 +119,9 @@ void BlocksController::updateBlock(int x, int y, int z) {
|
|||
}
|
||||
}
|
||||
|
||||
void BlocksController::update(float delta) {
|
||||
void BlocksController::update(float delta, uint padding) {
|
||||
if (randTickClock.update(delta)) {
|
||||
randomTick(randTickClock.getPart(), randTickClock.getParts());
|
||||
randomTick(randTickClock.getPart(), randTickClock.getParts(), padding);
|
||||
}
|
||||
if (blocksTickClock.update(delta)) {
|
||||
onBlocksTick(blocksTickClock.getPart(), blocksTickClock.getParts());
|
||||
|
|
@ -169,7 +168,7 @@ void BlocksController::randomTick(
|
|||
}
|
||||
}
|
||||
|
||||
void BlocksController::randomTick(int tickid, int parts) {
|
||||
void BlocksController::randomTick(int tickid, int parts, uint padding) {
|
||||
auto indices = level.content->getIndices();
|
||||
|
||||
std::set<uint64_t> chunksIterated;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue