From 70f9e1aafa6cd7a2b2d204609cab6cc26539cdb9 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sun, 22 Sep 2019 22:12:21 +0200 Subject: Punchwear (improved) (#8959) --- src/network/serverpackethandler.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/network') 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) { -- cgit v1.2.3