From 97908cc65670d3f6cf2e286390bfea10f653aaa8 Mon Sep 17 00:00:00 2001 From: Alex Ford Date: Wed, 18 Nov 2015 12:26:09 -0700 Subject: Add on_secondary_use when right clicking an item in the air --- src/game.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/game.cpp') diff --git a/src/game.cpp b/src/game.cpp index e6a1a2256..5e4f4cacf 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1525,6 +1525,7 @@ protected: void processPlayerInteraction(std::vector &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 &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 &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) -- cgit v1.2.3