1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Server-side authority for attached players (#10952)

The server must have authority about attachments. This commit ignores any player movement packets as long they're attached.
This commit is contained in:
SmallJoker 2021-02-15 20:41:19 +01:00 committed by GitHub
parent f018737b06
commit 7832b6843e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 35 deletions

View file

@ -488,8 +488,12 @@ void Server::process_PlayerPos(RemotePlayer *player, PlayerSAO *playersao,
pitch = modulo360f(pitch);
yaw = wrapDegrees_0_360(yaw);
playersao->setBasePosition(position);
player->setSpeed(speed);
if (!playersao->isAttached()) {
// Only update player positions when moving freely
// to not interfere with attachment handling
playersao->setBasePosition(position);
player->setSpeed(speed);
}
playersao->setLookPitch(pitch);
playersao->setPlayerYaw(yaw);
playersao->setFov(fov);