summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2019-09-22 22:12:21 +0200
committerGitHub <noreply@github.com>2019-09-22 22:12:21 +0200
commit70f9e1aafa6cd7a2b2d204609cab6cc26539cdb9 (patch)
tree7ae4b3532d6f7aee52b3c2c16628fe82c88775fa /src/network
parentfec30e37ac1d160a942777b05a7717b5395c4d99 (diff)
downloadminetest-70f9e1aafa6cd7a2b2d204609cab6cc26539cdb9.tar.gz
minetest-70f9e1aafa6cd7a2b2d204609cab6cc26539cdb9.tar.bz2
minetest-70f9e1aafa6cd7a2b2d204609cab6cc26539cdb9.zip
Punchwear (improved) (#8959)
Diffstat (limited to 'src/network')
-rw-r--r--src/network/serverpackethandler.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/network/serverpackethandler.cpp b/src/network/serverpackethandler.cpp
index 0169a57da..8c2ba823c 100644
--- a/src/network/serverpackethandler.cpp
+++ b/src/network/serverpackethandler.cpp
@@ -1163,9 +1163,13 @@ void Server::handleCommand_Interact(NetworkPacket *pkt)
u16 src_original_hp = pointed_object->getHP();
u16 dst_origin_hp = playersao->getHP();
- pointed_object->punch(dir, &toolcap, playersao,
+ u16 wear = pointed_object->punch(dir, &toolcap, playersao,
time_from_last_punch);
+ bool changed = punchitem.addWear(wear, m_itemdef);
+ if (changed)
+ playersao->setWieldedItem(punchitem);
+
// If the object is a player and its HP changed
if (src_original_hp != pointed_object->getHP() &&
pointed_object->getType() == ACTIVEOBJECT_TYPE_PLAYER) {