update player spawn point auto selection

This commit is contained in:
MihailRis 2026-01-09 03:26:32 +03:00
parent 5785060ffb
commit f602384a94
2 changed files with 3 additions and 5 deletions

View file

@ -105,10 +105,8 @@ void Player::postUpdate() {
if (flight && hitbox.grounded && !noclip) { if (flight && hitbox.grounded && !noclip) {
flight = false; flight = false;
} }
if (spawnpoint.y <= 0.1) { for (int i = 0; i < SPAWN_ATTEMPTS_PER_UPDATE && std::isnan(spawnpoint.x); i++) {
for (int i = 0; i < SPAWN_ATTEMPTS_PER_UPDATE; i++) { attemptToFindSpawnpoint();
attemptToFindSpawnpoint();
}
} }
} }

View file

@ -49,7 +49,7 @@ class Player : public Serializable {
int chosenSlot; int chosenSlot;
glm::vec3 position; glm::vec3 position;
glm::vec3 spawnpoint {}; glm::vec3 spawnpoint {std::nanf(""), std::nanf(""), std::nanf("")};
std::shared_ptr<Inventory> inventory; std::shared_ptr<Inventory> inventory;
bool suspended = false; bool suspended = false;
bool flight = false; bool flight = false;