from destroyed nodes.
* `0` is something that is directly accessible at the start of gameplay
* There is no upper limit
-* `dig_immediate`: (player can always pick up node without tool wear)
- * `2`: node is removed without tool wear after 0.5 seconds (rail, sign)
- * `3`: node is removed without tool wear after 0.15 seconds (torch)
+* `dig_immediate`: (player can always pick up node without reducing tool wear)
+ * `2`: the node always gets the digging time 0.5 seconds (rail, sign)
+ * `3`: the node always gets the digging time 0 seconds (torch)
* `disable_jump`: Player (and possibly other things) cannot jump from node
* `fall_damage_add_percent`: damage speed = `speed * (1 + value/100)`
* `bouncy`: value is bounce speed in percent
for this group, and unable to dig the rating `1`, which is the toughest.
Unless there is a matching group that enables digging otherwise.
+If the result digging time is 0, a delay of 0.15 seconds is added between
+digging nodes; If the player releases LMB after digging, this delay is set to 0,
+i.e. players can more quickly click the nodes away instead of holding LMB.
+
#### Damage groups
List of damage for groups of entities. See "Entity damage mechanism".
If `light` is false, no light calculations happen, and you should correct
all modified blocks with `minetest.fix_light()` as soon as possible.
Keep in mind that modifying the map where light is incorrect can cause
- more lighting bugs.
+ more lighting bugs.
* `get_node_at(pos)`: Returns a `MapNode` table of the node currently loaded in
the `VoxelManip` at that position
* `set_node_at(pos, node)`: Sets a specific `MapNode` in the `VoxelManip` at that position
PointedThing pointed_old;
bool digging;
bool ldown_for_dig;
+ bool dig_instantly;
bool left_punch;
bool update_wielded_item_trigger;
bool reset_jump_timer;
client->setCrack(-1, v3s16(0, 0, 0));
runData.dig_time = 0.0;
}
+ } else if (runData.dig_instantly && getLeftReleased()) {
+ // Remove e.g. torches faster when clicking instead of holding LMB
+ runData.nodig_delay_timer = 0;
+ runData.dig_instantly = false;
}
if (!runData.digging && runData.ldown_for_dig && !isLeftPressed()) {
ClientMap &map = client->getEnv().getClientMap();
MapNode n = client->getEnv().getClientMap().getNodeNoEx(nodepos);
- if (!runData.digging) {
- infostream << "Started digging" << std::endl;
- if (client->moddingEnabled() && 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
params = getDigParams(nodedef_manager->get(n).groups, tp);
}
+ if (!runData.digging) {
+ infostream << "Started digging" << std::endl;
+ runData.dig_instantly = params.time == 0;
+ if (client->moddingEnabled() && client->getScript()->on_punchnode(nodepos, n))
+ return;
+ client->interact(0, pointed);
+ runData.digging = true;
+ runData.ldown_for_dig = true;
+ }
+
if (!params.diggable) {
// I guess nobody will wait for this long
runData.dig_time_complete = 10000000.0;
}
}
- if (runData.dig_time_complete >= 0.001) {
+ if (!runData.dig_instantly) {
runData.dig_index = (float)crack_animation_length
* runData.dig_time
/ runData.dig_time_complete;
} else {
- // This is for torches
+ // This is for e.g. torches
runData.dig_index = crack_animation_length;
}
runData.nodig_delay_timer =
runData.dig_time_complete / (float)crack_animation_length;
- // We don't want a corresponding delay to
- // very time consuming nodes
+ // We don't want a corresponding delay to very time consuming nodes
+ // and nodes without digging time (e.g. torches) get a fixed delay.
if (runData.nodig_delay_timer > 0.3)
runData.nodig_delay_timer = 0.3;
+ else if (runData.dig_instantly)
+ runData.nodig_delay_timer = 0.15;
bool is_valid_position;
MapNode wasnode = map.getNodeNoEx(nodepos, &is_valid_position);