mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-11 05:51:51 +00:00
fix player ticks
This commit is contained in:
parent
957ef0aed3
commit
47f2bf75d7
3 changed files with 7 additions and 9 deletions
|
|
@ -104,10 +104,12 @@ void LevelController::update(float delta, bool pause) {
|
||||||
if (player->isSuspended()) {
|
if (player->isSuspended()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (playerTickClock.update(delta)) {
|
if (int parts = playerTickClock.update(delta)) {
|
||||||
if (player->getId() % playerTickClock.getParts() ==
|
for (int i = 0; i < parts; i++) {
|
||||||
playerTickClock.getPart()) {
|
if (player->getId() % playerTickClock.getParts() !=
|
||||||
|
playerTickClock.convertPart(i)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
const auto& position = player->getPosition();
|
const auto& position = player->getPosition();
|
||||||
if (player->chunks->get(
|
if (player->chunks->get(
|
||||||
std::floor(position.x),
|
std::floor(position.x),
|
||||||
|
|
@ -119,6 +121,7 @@ void LevelController::update(float delta, bool pause) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,6 @@ int Clock::update(float delta) {
|
||||||
return parts;
|
return parts;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Clock::getPart() const {
|
|
||||||
return currentTickPart;
|
|
||||||
}
|
|
||||||
|
|
||||||
int Clock::getParts() const {
|
int Clock::getParts() const {
|
||||||
return tickParts;
|
return tickParts;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ namespace util {
|
||||||
|
|
||||||
int update(float delta);
|
int update(float delta);
|
||||||
|
|
||||||
int getPart() const;
|
|
||||||
int getParts() const;
|
int getParts() const;
|
||||||
int getTickRate() const;
|
int getTickRate() const;
|
||||||
int getTickId() const;
|
int getTickId() const;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue