Skip to content

Commit 358074b

Browse files
HybridDognerzhul
authored andcommittedMay 20, 2017
Fix instant digging (#5785)
Use runData.dig_time_complete instead of params.time to find out whether it's instant digging. runData.dig_time_complete is set to something very big if the node can't be dug, whereas param.time is 0 when digging is impossible or it's instant digging. So not using param.time fixes #5728.
1 parent a2bb776 commit 358074b

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed
 

‎src/game.cpp

+10-10
Original file line numberDiff line numberDiff line change
@@ -3903,16 +3903,6 @@ void Game::handleDigging(const PointedThing &pointed, const v3s16 &nodepos,
39033903
params = getDigParams(nodedef_manager->get(n).groups, tp);
39043904
}
39053905

3906-
if (!runData.digging) {
3907-
infostream << "Started digging" << std::endl;
3908-
runData.dig_instantly = params.time == 0;
3909-
if (client->moddingEnabled() && client->getScript()->on_punchnode(nodepos, n))
3910-
return;
3911-
client->interact(0, pointed);
3912-
runData.digging = true;
3913-
runData.ldown_for_dig = true;
3914-
}
3915-
39163906
if (!params.diggable) {
39173907
// I guess nobody will wait for this long
39183908
runData.dig_time_complete = 10000000.0;
@@ -3927,6 +3917,16 @@ void Game::handleDigging(const PointedThing &pointed, const v3s16 &nodepos,
39273917
}
39283918
}
39293919

3920+
if (!runData.digging) {
3921+
infostream << "Started digging" << std::endl;
3922+
runData.dig_instantly = runData.dig_time_complete == 0;
3923+
if (client->moddingEnabled() && client->getScript()->on_punchnode(nodepos, n))
3924+
return;
3925+
client->interact(0, pointed);
3926+
runData.digging = true;
3927+
runData.ldown_for_dig = true;
3928+
}
3929+
39303930
if (!runData.dig_instantly) {
39313931
runData.dig_index = (float)crack_animation_length
39323932
* runData.dig_time

0 commit comments

Comments
 (0)
Please sign in to comment.