Change digging function to work better.
This commit is contained in:
parent
35b2b88bca
commit
04215df025
17
README.md
17
README.md
@ -49,11 +49,20 @@ To increase the grade, place a block on the gray node and select that before rig
|
|||||||
![Turns from 45°](images/dir45.png "Turns from 45")
|
![Turns from 45°](images/dir45.png "Turns from 45")
|
||||||
|
|
||||||
|
|
||||||
Notes
|
Update
|
||||||
-----
|
------
|
||||||
When used with minetest version 0.4.16, digging a tunnel causes the blocks to just disappear.
|
Switched digging function from dig_node to node_dig. This was based on what matyilona200 used for the tunneltest mod. Thanks matyilona! This gives several improvements:
|
||||||
|
|
||||||
When used with a recent 0.5.0 development version of minetest, digging a tunnel causes the blocks to rain down from the ceiling and collect on the floor. I'm not sure which is the better behavior to have, but I don't know how to change it in either case.
|
- When tunneling, the inventory adds only a single instance of each type of block dug. Still works if inventory is full.
|
||||||
|
- Works the same with minetest versions 0.4.16 and 0.5.0-dev—no more blocks raining down.
|
||||||
|
- Works with digall mod enabled. However, make sure digall is deactivated before tunneling!
|
||||||
|
|
||||||
|
|
||||||
|
Digging pattern reference
|
||||||
|
-------------------------
|
||||||
|
Here are all sixteen possible digging patterns for reference. The white blocks have a height of 5 blocks, while the light gray blocks on the sides have a height of 4 blocks. Ground fill is only done in white block area.
|
||||||
|
|
||||||
|
![Digging patterns](images/digging_patterns.png "Digging patterns")
|
||||||
|
|
||||||
|
|
||||||
Crafting guide
|
Crafting guide
|
||||||
|
BIN
images/digging_patterns.png
Normal file
BIN
images/digging_patterns.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
10
init.lua
10
init.lua
@ -2,6 +2,12 @@
|
|||||||
-- Another tunnel digging mod for minetest.
|
-- Another tunnel digging mod for minetest.
|
||||||
-- by David G (kestral246@gmail.com)
|
-- by David G (kestral246@gmail.com)
|
||||||
|
|
||||||
|
-- Version 0.8.0
|
||||||
|
-- Changed from dig_node to node_dig (based on what matyilona200 did for the Tunneltest mod)
|
||||||
|
-- Places only a single instance of each type of block dug in inventory
|
||||||
|
-- Doesn't cause blocks to drop in 0.5.0-dev
|
||||||
|
-- Works with digall mod, but make sure it's deactivated before tunneling!
|
||||||
|
|
||||||
-- Version 0.7.0
|
-- Version 0.7.0
|
||||||
-- Added test for fallable blocks in ceiling and replace them with cobblestone.
|
-- Added test for fallable blocks in ceiling and replace them with cobblestone.
|
||||||
-- Fixed bug where I was digging from lower blocks to higher blocks.
|
-- Fixed bug where I was digging from lower blocks to higher blocks.
|
||||||
@ -94,6 +100,7 @@ local images = {
|
|||||||
}
|
}
|
||||||
-- add reference block to point to next target location and to aid laying track
|
-- add reference block to point to next target location and to aid laying track
|
||||||
-- currently using default:cobble
|
-- currently using default:cobble
|
||||||
|
-- changing code to use biome appropriate fill blocks is left as a future exercise
|
||||||
local add_ref = function(x, z, user, pointed_thing)
|
local add_ref = function(x, z, user, pointed_thing)
|
||||||
local pos = vector.add(pointed_thing.under, {x=x, y=0, z=z})
|
local pos = vector.add(pointed_thing.under, {x=x, y=0, z=z})
|
||||||
if not minetest.is_protected(pos, user) then
|
if not minetest.is_protected(pos, user) then
|
||||||
@ -102,10 +109,11 @@ local add_ref = function(x, z, user, pointed_thing)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- delete single node, but not torches
|
-- delete single node, but not torches
|
||||||
|
-- version using get_node
|
||||||
local dig_single = function(x, y, z, user, pointed_thing)
|
local dig_single = function(x, y, z, user, pointed_thing)
|
||||||
local pos = vector.add(pointed_thing.under, {x=x, y=y, z=z})
|
local pos = vector.add(pointed_thing.under, {x=x, y=y, z=z})
|
||||||
if minetest.get_node(pos).name ~= "default:torch_ceiling" and not minetest.is_protected(pos, user) then
|
if minetest.get_node(pos).name ~= "default:torch_ceiling" and not minetest.is_protected(pos, user) then
|
||||||
minetest.dig_node(pos)
|
minetest.node_dig(pos, minetest.get_node(pos), user)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user