mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41: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()) {
|
||||
continue;
|
||||
}
|
||||
if (playerTickClock.update(delta)) {
|
||||
if (player->getId() % playerTickClock.getParts() ==
|
||||
playerTickClock.getPart()) {
|
||||
|
||||
if (int parts = playerTickClock.update(delta)) {
|
||||
for (int i = 0; i < parts; i++) {
|
||||
if (player->getId() % playerTickClock.getParts() !=
|
||||
playerTickClock.convertPart(i)) {
|
||||
continue;
|
||||
}
|
||||
const auto& position = player->getPosition();
|
||||
if (player->chunks->get(
|
||||
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;
|
||||
}
|
||||
|
||||
int Clock::getPart() const {
|
||||
return currentTickPart;
|
||||
}
|
||||
|
||||
int Clock::getParts() const {
|
||||
return tickParts;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ namespace util {
|
|||
|
||||
int update(float delta);
|
||||
|
||||
int getPart() const;
|
||||
int getParts() const;
|
||||
int getTickRate() const;
|
||||
int getTickId() const;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue