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

Call on_secondary_use when object is right-clicked

This commit is contained in:
sfan5 2019-11-10 00:36:29 +01:00
parent 3b0df9760b
commit 4d668f32a6
4 changed files with 15 additions and 7 deletions

View file

@ -1316,6 +1316,13 @@ void Server::handleCommand_Interact(NetworkPacket *pkt)
<< pointed_object->getDescription() << std::endl;
// Do stuff
if (m_script->item_OnSecondaryUse(
selected_item, playersao, pointed)) {
if (playersao->setWieldedItem(selected_item)) {
SendInventory(playersao, true);
}
}
pointed_object->rightClick(playersao);
} else if (m_script->item_OnPlace(
selected_item, playersao, pointed)) {
@ -1376,8 +1383,10 @@ void Server::handleCommand_Interact(NetworkPacket *pkt)
actionstream << player->getName() << " activates "
<< selected_item.name << std::endl;
pointed.type = POINTEDTHING_NOTHING; // can only ever be NOTHING
if (m_script->item_OnSecondaryUse(
selected_item, playersao)) {
selected_item, playersao, pointed)) {
if (playersao->setWieldedItem(selected_item)) {
SendInventory(playersao, true);
}