aboutsummaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorANAND <ClobberXD@protonmail.com>2020-06-05 18:36:35 +0530
committerceleron55 <celeron55@gmail.com>2020-08-15 12:19:20 +0300
commit291a6b70d674d9003f522b5875a60f7e2753e32b (patch)
treeeb4368dfc8d0055b53bd1160b5a8836726245ffb /src/network
parentfff03931871b68e092e12bfce9056f760e8ec9dd (diff)
downloadminetest-291a6b70d674d9003f522b5875a60f7e2753e32b.tar.gz
minetest-291a6b70d674d9003f522b5875a60f7e2753e32b.tar.bz2
minetest-291a6b70d674d9003f522b5875a60f7e2753e32b.zip
Allow binding dig, place actions to keys; remove LMB/RMB hardcoding
Co-authored-by: Sam Caulfield <sam@samcaulfield.com>
Diffstat (limited to 'src/network')
-rw-r--r--src/network/serverpackethandler.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/network/serverpackethandler.cpp b/src/network/serverpackethandler.cpp
index b3008bb50..dcbb114bf 100644
--- a/src/network/serverpackethandler.cpp
+++ b/src/network/serverpackethandler.cpp
@@ -491,17 +491,18 @@ void Server::process_PlayerPos(RemotePlayer *player, PlayerSAO *playersao,
playersao->setPlayerYaw(yaw);
playersao->setFov(fov);
playersao->setWantedRange(wanted_range);
+
player->keyPressed = keyPressed;
- player->control.up = (keyPressed & 1);
- player->control.down = (keyPressed & 2);
- player->control.left = (keyPressed & 4);
- player->control.right = (keyPressed & 8);
- player->control.jump = (keyPressed & 16);
- player->control.aux1 = (keyPressed & 32);
- player->control.sneak = (keyPressed & 64);
- player->control.LMB = (keyPressed & 128);
- player->control.RMB = (keyPressed & 256);
- player->control.zoom = (keyPressed & 512);
+ player->control.up = (keyPressed & (0x1 << 0));
+ player->control.down = (keyPressed & (0x1 << 1));
+ player->control.left = (keyPressed & (0x1 << 2));
+ player->control.right = (keyPressed & (0x1 << 3));
+ player->control.jump = (keyPressed & (0x1 << 4));
+ player->control.aux1 = (keyPressed & (0x1 << 5));
+ player->control.sneak = (keyPressed & (0x1 << 6));
+ player->control.dig = (keyPressed & (0x1 << 7));
+ player->control.place = (keyPressed & (0x1 << 8));
+ player->control.zoom = (keyPressed & (0x1 << 9));
if (playersao->checkMovementCheat()) {
// Call callbacks
@@ -1670,7 +1671,7 @@ void Server::handleCommand_SrpBytesM(NetworkPacket* pkt)
if (client->chosen_mech != AUTH_MECHANISM_SRP &&
client->chosen_mech != AUTH_MECHANISM_LEGACY_PASSWORD) {
actionstream << "Server: got SRP _M packet, while auth"
- << "is going on with mech " << client->chosen_mech << " from "
+ << "is going on with mech " << client->chosen_mech << " from "
<< addr_s << " (wantSudo=" << wantSudo << "). Denying." << std::endl;
if (wantSudo) {
DenySudoAccess(peer_id);