mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Add on_secondary_use when right clicking an item in the air
This commit is contained in:
parent
57b429574e
commit
97908cc656
8 changed files with 71 additions and 0 deletions
12
src/game.cpp
12
src/game.cpp
|
@ -1525,6 +1525,7 @@ protected:
|
|||
void processPlayerInteraction(std::vector<aabb3f> &highlight_boxes,
|
||||
GameRunData *runData, f32 dtime, bool show_hud,
|
||||
bool show_debug);
|
||||
void handlePointingAtNothing(GameRunData *runData, const ItemStack &playerItem);
|
||||
void handlePointingAtNode(GameRunData *runData,
|
||||
const PointedThing &pointed, const ItemDefinition &playeritem_def,
|
||||
const ToolCapabilities &playeritem_toolcap, f32 dtime);
|
||||
|
@ -3603,6 +3604,8 @@ void Game::processPlayerInteraction(std::vector<aabb3f> &highlight_boxes,
|
|||
} else if (input->getLeftState()) {
|
||||
// When button is held down in air, show continuous animation
|
||||
runData->left_punch = true;
|
||||
} else if (input->getRightClicked()) {
|
||||
handlePointingAtNothing(runData, playeritem);
|
||||
}
|
||||
|
||||
runData->pointed_old = pointed;
|
||||
|
@ -3618,6 +3621,15 @@ void Game::processPlayerInteraction(std::vector<aabb3f> &highlight_boxes,
|
|||
}
|
||||
|
||||
|
||||
void Game::handlePointingAtNothing(GameRunData *runData, const ItemStack &playerItem)
|
||||
{
|
||||
infostream << "Right Clicked in Air" << std::endl;
|
||||
PointedThing fauxPointed;
|
||||
fauxPointed.type = POINTEDTHING_NOTHING;
|
||||
client->interact(5, fauxPointed);
|
||||
}
|
||||
|
||||
|
||||
void Game::handlePointingAtNode(GameRunData *runData,
|
||||
const PointedThing &pointed, const ItemDefinition &playeritem_def,
|
||||
const ToolCapabilities &playeritem_toolcap, f32 dtime)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue