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

Punchwear (improved) (#8959)

This commit is contained in:
sfan5 2019-09-22 22:12:21 +02:00 committed by GitHub
parent fec30e37ac
commit 70f9e1aafa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 73 additions and 31 deletions

View file

@ -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) {