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

Load blocks and objects behind player when in third-persion front-view (#13431)

This commit is contained in:
lhofhansl
2023-05-29 10:26:42 -07:00
committed by GitHub
parent fc3d6c1dd9
commit a8ec6092e2
7 changed files with 41 additions and 20 deletions

View File

@@ -920,8 +920,10 @@ enum ToServerCommand
[2+12+12] s32 pitch*100
[2+12+12+4] s32 yaw*100
[2+12+12+4+4] u32 keyPressed
[2+12+12+4+4+1] u8 fov*80
[2+12+12+4+4+4] u8 fov*80
[2+12+12+4+4+4+1] u8 ceil(wanted_range / MAP_BLOCKSIZE)
[2+12+12+4+4+4+1+1] u8 camera_inverted (bool)
*/
TOSERVER_GOTBLOCKS = 0x24,

View File

@@ -478,11 +478,14 @@ void Server::process_PlayerPos(RemotePlayer *player, PlayerSAO *playersao,
f32 fov = 0;
u8 wanted_range = 0;
u8 bits = 0; // bits instead of bool so it is extensible later
*pkt >> keyPressed;
*pkt >> f32fov;
fov = (f32)f32fov / 80.0f;
*pkt >> wanted_range;
if (pkt->getRemainingBytes() >= 1)
*pkt >> bits;
v3f position((f32)ps.X / 100.0f, (f32)ps.Y / 100.0f, (f32)ps.Z / 100.0f);
v3f speed((f32)ss.X / 100.0f, (f32)ss.Y / 100.0f, (f32)ss.Z / 100.0f);
@@ -500,6 +503,7 @@ void Server::process_PlayerPos(RemotePlayer *player, PlayerSAO *playersao,
playersao->setPlayerYaw(yaw);
playersao->setFov(fov);
playersao->setWantedRange(wanted_range);
playersao->setCameraInverted(bits & 0x01);
player->control.unpackKeysPressed(keyPressed);