1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-12 08:05:18 +02:00

Reorder client initialization (#15554)

Previously, ServerEnv created a player instance before they're fully initialized.
This commit moves all initialization steps and callbacks into TOSERVER_CLIENT_READY
^ which includes StageTwoClientInit for player loading or creation
This commit is contained in:
SmallJoker
2024-12-24 15:24:56 +01:00
committed by GitHub
parent c49ff76955
commit d1dd044455
5 changed files with 41 additions and 40 deletions

View File

@@ -156,12 +156,14 @@ public:
// Other
void updatePrivileges(const std::set<std::string> &privs, bool is_singleplayer)
void updatePrivileges(const std::set<std::string> &privs)
{
m_privs = privs;
m_is_singleplayer = is_singleplayer;
}
inline void setNewPlayer() { m_is_new_player = true; }
inline bool isNewPlayer() { return m_is_new_player; }
bool getCollisionBox(aabb3f *toset) const override;
bool getSelectionBox(aabb3f *toset) const override;
bool collideWithObjects() const override { return true; }
@@ -202,7 +204,8 @@ private:
// Cached privileges for enforcement
std::set<std::string> m_privs;
bool m_is_singleplayer;
const bool m_is_singleplayer;
bool m_is_new_player = false;
u16 m_breath = PLAYER_MAX_BREATH_DEFAULT;
f32 m_pitch = 0.0f;