mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
[CSM] Add on_punchnode
callback
This commit is contained in:
parent
37df9cb7d7
commit
0727bb3ddd
6 changed files with 48 additions and 13 deletions
15
src/game.cpp
15
src/game.cpp
|
@ -3895,17 +3895,20 @@ void Game::handleDigging(GameRunData *runData,
|
|||
const PointedThing &pointed, const v3s16 &nodepos,
|
||||
const ToolCapabilities &playeritem_toolcap, f32 dtime)
|
||||
{
|
||||
if (!runData->digging) {
|
||||
infostream << "Started digging" << std::endl;
|
||||
client->interact(0, pointed);
|
||||
runData->digging = true;
|
||||
runData->ldown_for_dig = true;
|
||||
}
|
||||
|
||||
LocalPlayer *player = client->getEnv().getLocalPlayer();
|
||||
ClientMap &map = client->getEnv().getClientMap();
|
||||
MapNode n = client->getEnv().getClientMap().getNodeNoEx(nodepos);
|
||||
|
||||
if (!runData->digging) {
|
||||
infostream << "Started digging" << std::endl;
|
||||
if (client->getScript()->on_punchnode(nodepos, n))
|
||||
return;
|
||||
client->interact(0, pointed);
|
||||
runData->digging = true;
|
||||
runData->ldown_for_dig = true;
|
||||
}
|
||||
|
||||
// NOTE: Similar piece of code exists on the server side for
|
||||
// cheat detection.
|
||||
// Get digging parameters
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue