diff --git a/README.md b/README.md index 1dc47dd..98da265 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,10 @@ Features New features ------------ +- Try to play nicer with already placed advtrains track (dtrack*). +- Don't dig dtrack nodes. This allows expanding or extending tunnels where track has already been laid. +- If pointing to dtrack node, assume user actually wants to point to ground below track. + - I added a biome check when using minetest version 0.5.x, which will change the fill to desert stones for desert biomes. For version 0.4.x, tunnelmaker will still work, but will continue to just use regular stone fill. - I updated this mod to check for water while tunneling. Tunnelmaker will now add a glass wall around the tunnel to prevent water from entering the tunnel. A temporary glass endcap is also added to the end of the tunnel. What this means is that it is now possible to effectively dig tunnels through water. Now you can easily run trains to your underwater sea bases. diff --git a/init.lua b/init.lua index 5bc3d9f..5da915e 100644 --- a/init.lua +++ b/init.lua @@ -2,11 +2,26 @@ -- Another tunnel digging mod for minetest. -- by David G (kestral246@gmail.com) +-- Version 0.9.1 +-- 1. Try to play nicer with already placed advtrains track (dtrack*). +-- A. Don't dig dtrack nodes. +-- This allows expanding or extending tunnels where track has already been laid. +-- However this causes issues when using tunnelmaker to raise or lower track. +-- Trying to dig tunnel one node above track won't fill where placed track exists. +-- Trying to dig tunnel one node below track will cause existing track to drop. +-- B. If pointing to dtrack node, assume user actually wants to point to ground below track. +-- Lower positions of pointed_thing by one node, while keeping name the same. +-- This assumes that existing track is sitting on valid node. +-- 2. Restruction direction code to make it much shorter. +-- 3. Fixed bug in implementation of SSW digging pattern. +-- -- Version 0.9.0 -- 1. Updated digging patterns to fix minor irregularities. -- 2. Added protections for tunneling in water. -- Adds glass walls around tunnel whenever there is water. -- Adds glass endcap at end to protect from flooding while tunneling. +-- Note that this can place undesired glass when digging next to ground-level water. This +-- won't happen as long as you're one node higher than the water. -- 3. Restructured code again. Code is longer, but simpler to understand. -- Version 0.8.1 @@ -138,13 +153,14 @@ end -- delete single node, including water, but not torches or air -- test for air, since air is not diggable +-- update: don't dig advtrain track local dig_single = function(x, y, z, user, pointed_thing) local pos = vector.add(pointed_thing.under, {x=x, y=y, z=z}) local name = minetest.get_node(pos).name if not minetest.is_protected(pos, user) then if string.match(name, "water") then minetest.set_node(pos, {name = "air"}) - elseif name ~= "air" and name ~= "default:torch_ceiling" then + elseif name ~= "air" and name ~= "default:torch_ceiling" and not string.match(name, "dtrack") then minetest.node_dig(pos, minetest.get_node(pos), user) end end @@ -192,83 +208,6 @@ local add_light = function(spacing, user, pointed_thing) end end --- dig rectangular shape, check ceiling and floor --- must dig from high to low, to properly deal with blocks that can fall ---local dig_rect = function(xmin, xmax, ymax, zmin, zmax, user, pointed_thing) --- for x=xmin,xmax do --- for z=zmin,zmax do --- replace_ceiling(x, ymax+1, z, user, pointed_thing) --- if ymax == 5 then --- replace_floor(x, 0, z, user, pointed_thing) --- end --- for y=ymax,1,-1 do --- dig_single(x, y, z, user, pointed_thing) --- end --- end --- end ---end - - --- add stone if water--debug function ---local add_stone = function(x, y, z, user, pointed_thing) --- local pos = vector.add(pointed_thing.under, {x=x, y=y, z=z}) --- if not minetest.is_protected(pos, user) then --- local name = minetest.get_node(pos).name ----- if string.match(name, "water") then --- minetest.set_node(pos, {name = "default:stone"}) -- change to glass ----- end --- end ---end - --- add glass if water ---local add_glass = function(x, y, z, user, pointed_thing) --- local pos = vector.add(pointed_thing.under, {x=x, y=y, z=z}) --- if not minetest.is_protected(pos, user) then --- local name = minetest.get_node(pos).name ----- if string.match(name, "water") then --- minetest.set_node(pos, {name = "default:glass"}) ----- end --- end ---end - --- add rectangular glass wall for all blocks that are water (currently stone) ---local add_wall = function(xmin, xmax, ymin, ymax, zmin, zmax, user, pointed_thing) --- for x=xmin,xmax do --- for z=zmin,zmax do --- for y=ymin,ymax do --- add_stone(x, y, z, user, pointed_thing) --debug --- end --- end --- end ---end - --- add glass endcaps for all blocks that are water (currently all) ---local add_endc = function(xmin, xmax, ymin, ymax, zmin, zmax, user, pointed_thing) --- for x=xmin,xmax do --- for z=zmin,zmax do --- for y=ymin,ymax do --- add_glass(x, y, z, user, pointed_thing) --- end --- end --- end ---end - - --- add rectangular glass wall, and check floor too ---local add_wflr = function(xmin, xmax, ymin, ymax, zmin, zmax, user, pointed_thing) --- for x=xmin,xmax do --- for z=zmin,zmax do --- for y=ymin,ymax do --- add_stone(x, y, z, user, pointed_thing) --debug --- end --- add_stone(x, 0, z, user, pointed_thing) --debug --- end --- end ---end - ------------------------------------------------------------------- --- new version functions ------------------------------------------------------------------- -- build glass barrier to water -- if node is water, replace with glass local check_for_water = function(x, y, z, user, pointed_thing) @@ -281,28 +220,6 @@ local check_for_water = function(x, y, z, user, pointed_thing) end end --- debug, force node to stone -local check_for_water_stone = function(x, y, z, user, pointed_thing) - local pos = vector.add(pointed_thing.under, {x=x, y=y, z=z}) - if not minetest.is_protected(pos, user) then - local name = minetest.get_node(pos).name - -- if string.match(name, "water") then - minetest.set_node(pos, {name = "default:stone"}) - -- end - end -end - --- debug, force node to glass -local check_for_water_glass = function(x, y, z, user, pointed_thing) - local pos = vector.add(pointed_thing.under, {x=x, y=y, z=z}) - if not minetest.is_protected(pos, user) then - local name = minetest.get_node(pos).name - -- if string.match(name, "water") then - minetest.set_node(pos, {name = "default:glass"}) - -- end - end -end - -- convenience function to call all the ceiling checks local check_ceiling = function(x, y, z, user, pointed_thing) -- first check that ceiling isn't node that can fall @@ -312,9 +229,6 @@ local check_ceiling = function(x, y, z, user, pointed_thing) -- check_for_water_stone(x, y, z, user, pointed_thing) --debug end - - - -- add wall if necessary to protect from water (pink) local aw = function(x, z, user, pointed_thing) for y=0, 5 do @@ -362,668 +276,172 @@ local dt = function(x, z, user, pointed_thing) replace_floor(x, 0, z, user, pointed_thing) end - +-- To shorten the code, this function takes a list of lists with {function, x-coord, y-coord} and executes them in sequence. +local run_list = function(dir_list, user, pointed_thing) + for i,v in ipairs(dir_list) do + v[1](v[2], v[3], user, pointed_thing) + end +end -- dig tunnel based on direction given local dig_tunnel = function(cdir, user, pointed_thing) if minetest.check_player_privs(user, "tunneling") then if cdir == 0 then -- pointed north - aw(-3, 0, user, pointed_thing) - aw( 3, 0, user, pointed_thing) - aw(-3, 1, user, pointed_thing) - - aw( 3, 1, user, pointed_thing) - aw(-3, 2, user, pointed_thing) - aw( 3, 2, user, pointed_thing) - - es(-3, 3, user, pointed_thing) - et(-2, 3, user, pointed_thing) - et(-1, 3, user, pointed_thing) - et( 0, 3, user, pointed_thing) - et( 1, 3, user, pointed_thing) - et( 2, 3, user, pointed_thing) - es( 3, 3, user, pointed_thing) - - - ds(-2, 0, user, pointed_thing) - dt(-1, 0, user, pointed_thing) - dt( 0, 0, user, pointed_thing) - dt( 1, 0, user, pointed_thing) - ds( 2, 0, user, pointed_thing) - - ds(-2, 1, user, pointed_thing) - dt(-1, 1, user, pointed_thing) - dt( 0, 1, user, pointed_thing) - dt( 1, 1, user, pointed_thing) - ds( 2, 1, user, pointed_thing) - - ds(-2, 2, user, pointed_thing) - dt(-1, 2, user, pointed_thing) - dt( 0, 2, user, pointed_thing) - dt( 1, 2, user, pointed_thing) - ds( 2, 2, user, pointed_thing) - - add_ref(0, 2, user, pointed_thing) - + run_list( {{aw,-3, 0},{aw, 3, 0},{aw,-3, 1}, + {aw, 3, 1},{aw,-3, 2},{aw, 3, 2}, + {es,-3, 3},{et,-2, 3},{et,-1, 3},{et, 0, 3},{et, 1, 3},{et, 2, 3},{es, 3, 3}, + {ds,-2, 0},{dt,-1, 0},{dt, 0, 0},{dt, 1, 0},{ds, 2, 0}, + {ds,-2, 1},{dt,-1, 1},{dt, 0, 1},{dt, 1, 1},{ds, 2, 1}, + {ds,-2, 2},{dt,-1, 2},{dt, 0, 2},{dt, 1, 2},{ds, 2, 2}, + {add_ref,0,2}}, user, pointed_thing) elseif cdir == 1 then -- pointed north-northwest - aw(-3,-1, user, pointed_thing) - aw(-3, 0, user, pointed_thing) - aw(-4, 0, user, pointed_thing) - aw(-4, 1, user, pointed_thing) - aw(-4, 2, user, pointed_thing) - - aw( 3, 1, user, pointed_thing) - aw( 3, 2, user, pointed_thing) - aw( 2, 2, user, pointed_thing) - aw( 2, 3, user, pointed_thing) - - es(-4, 3, user, pointed_thing) - et(-3, 3, user, pointed_thing) - et(-2, 3, user, pointed_thing) - et(-1, 3, user, pointed_thing) - et( 0, 3, user, pointed_thing) - et( 1, 3, user, pointed_thing) - - ds(-2, 0, user, pointed_thing) - dt(-1, 0, user, pointed_thing) - dt( 0, 0, user, pointed_thing) - dt( 1, 0, user, pointed_thing) - - ds(-3, 1, user, pointed_thing) - dt(-2, 1, user, pointed_thing) - dt(-1, 1, user, pointed_thing) - dt( 0, 1, user, pointed_thing) - dt( 1, 1, user, pointed_thing) - ds( 2, 1, user, pointed_thing) - - ds(-3, 2, user, pointed_thing) - dt(-2, 2, user, pointed_thing) - dt(-1, 2, user, pointed_thing) - dt( 0, 2, user, pointed_thing) - ds( 1, 2, user, pointed_thing) - - add_ref(-1, 2, user, pointed_thing) - + run_list( {{aw,-3,-1},{aw,-3, 0},{aw,-4, 0},{aw,-4, 1},{aw,-4, 2}, + {aw, 3, 1},{aw, 3, 2},{aw, 2, 2},{aw, 2, 3}, + {es,-4, 3},{et,-3, 3},{et,-2, 3},{et,-1, 3},{et, 0, 3},{et, 1, 3}, + {ds,-2, 0},{dt,-1, 0},{dt, 0, 0},{dt, 1, 0}, + {ds,-3, 1},{dt,-2, 1},{dt,-1, 1},{dt, 0, 1},{dt, 1, 1},{ds, 2, 1}, + {ds,-3, 2},{dt,-2, 2},{dt,-1, 2},{dt, 0, 2},{ds, 1, 2}, + {add_ref,-1, 2}}, user, pointed_thing) elseif cdir == 2 then -- pointed northwest - aw(-2,-3, user, pointed_thing) - aw(-2,-2, user, pointed_thing) - aw(-3,-2, user, pointed_thing) - aw(-3,-1, user, pointed_thing) - aw(-3,-2, user, pointed_thing) - - aw( 3, 2, user, pointed_thing) - aw( 2, 2, user, pointed_thing) - aw( 2, 3, user, pointed_thing) - aw( 1, 3, user, pointed_thing) - aw( 1, 4, user, pointed_thing) - - es(-4, 0, user, pointed_thing) - es(-4, 1, user, pointed_thing) - et(-3, 1, user, pointed_thing) - et(-2, 1, user, pointed_thing) - et(-2, 2, user, pointed_thing) - et(-1, 2, user, pointed_thing) - et(-1, 3, user, pointed_thing) - es(-1, 4, user, pointed_thing) - es( 0, 4, user, pointed_thing) --- - ds(-1,-2, user, pointed_thing) - - ds(-2,-1, user, pointed_thing) - dt(-1,-1, user, pointed_thing) - - ds(-3, 0, user, pointed_thing) - dt(-2, 0, user, pointed_thing) - dt(-1, 0, user, pointed_thing) - dt( 0, 0, user, pointed_thing) - - ds(-1, 1, user, pointed_thing) - dt( 0, 1, user, pointed_thing) - dt( 1, 1, user, pointed_thing) - ds( 2, 1, user, pointed_thing) - - dt( 0, 2, user, pointed_thing) - ds( 1, 2, user, pointed_thing) - - ds( 0, 3, user, pointed_thing) - - add_ref(-1, 1, user, pointed_thing) - + run_list( {{aw,-2,-3},{aw,-2,-2},{aw,-3,-2},{aw,-3,-1},{aw,-3,-2}, + {aw, 3, 2},{aw, 2, 2},{aw, 2, 3},{aw, 1, 3},{aw, 1, 4}, + {es,-4, 0},{es,-4, 1},{et,-3, 1},{et,-2, 1},{et,-2, 2},{et,-1, 2},{et,-1, 3},{es,-1, 4},{es, 0, 4}, + {ds,-1,-2}, + {ds,-2,-1},{dt,-1,-1}, + {ds,-3, 0},{dt,-2, 0},{dt,-1, 0},{dt, 0, 0}, + {ds,-1, 1},{dt, 0, 1},{dt, 1, 1},{ds, 2, 1}, + {dt, 0, 2},{ds, 1, 2}, + {ds, 0, 3}, + {add_ref,-1, 1}}, user, pointed_thing) elseif cdir == 3 then -- pointed west-northwest - aw(-1,-3, user, pointed_thing) - aw(-2,-3, user, pointed_thing) - aw(-2,-2, user, pointed_thing) - aw(-3,-2, user, pointed_thing) - - aw( 1, 3, user, pointed_thing) - aw( 0, 3, user, pointed_thing) - aw( 0, 4, user, pointed_thing) - aw(-1, 4, user, pointed_thing) - aw(-2, 4, user, pointed_thing) - - et(-3,-1, user, pointed_thing) - et(-3, 0, user, pointed_thing) - et(-3, 1, user, pointed_thing) - et(-3, 2, user, pointed_thing) - et(-3, 3, user, pointed_thing) - es(-3, 4, user, pointed_thing) - - ds(-1,-2, user, pointed_thing) - - ds(-2,-1, user, pointed_thing) - dt(-1,-1, user, pointed_thing) - dt( 0,-1, user, pointed_thing) - - dt(-2, 0, user, pointed_thing) - dt(-1, 0, user, pointed_thing) - dt( 0, 0, user, pointed_thing) - - dt(-2, 1, user, pointed_thing) - dt(-1, 1, user, pointed_thing) - dt( 0, 1, user, pointed_thing) - - dt(-2, 2, user, pointed_thing) - dt(-1, 2, user, pointed_thing) - ds( 0, 2, user, pointed_thing) - - ds(-2, 3, user, pointed_thing) - ds(-1, 3, user, pointed_thing) - - add_ref(-2, 1, user, pointed_thing) - + run_list( {{aw,-1,-3},{aw,-2,-3},{aw,-2,-2},{aw,-3,-2}, + {aw, 1, 3},{aw, 0, 3},{aw, 0, 4},{aw,-1, 4},{aw,-2, 4}, + {et,-3,-1},{et,-3, 0},{et,-3, 1},{et,-3, 2},{et,-3, 3},{es,-3, 4}, + {ds,-1,-2}, + {ds,-2,-1},{dt,-1,-1},{dt, 0,-1}, + {dt,-2, 0},{dt,-1, 0},{dt, 0, 0}, + {dt,-2, 1},{dt,-1, 1},{dt, 0, 1}, + {dt,-2, 2},{dt,-1, 2},{ds, 0, 2}, + {ds,-2, 3},{ds,-1, 3}, + {add_ref,-2, 1}}, user, pointed_thing) elseif cdir == 4 then -- pointed west - aw( 0,-3, user, pointed_thing) - aw(-1,-3, user, pointed_thing) - aw(-2,-3, user, pointed_thing) - - aw( 0, 3, user, pointed_thing) - aw(-1, 3, user, pointed_thing) - aw(-2, 3, user, pointed_thing) - - es(-3,-3, user, pointed_thing) - et(-3,-2, user, pointed_thing) - et(-3,-1, user, pointed_thing) - et(-3, 0, user, pointed_thing) - et(-3, 1, user, pointed_thing) - et(-3, 2, user, pointed_thing) - es(-3, 3, user, pointed_thing) - - ds(-2,-2, user, pointed_thing) - ds(-1,-2, user, pointed_thing) - ds( 0,-2, user, pointed_thing) - - dt(-2,-1, user, pointed_thing) - dt(-1,-1, user, pointed_thing) - dt( 0,-1, user, pointed_thing) - - dt(-2, 0, user, pointed_thing) - dt(-1, 0, user, pointed_thing) - dt( 0, 0, user, pointed_thing) - - dt(-2, 1, user, pointed_thing) - dt(-1, 1, user, pointed_thing) - dt( 0, 1, user, pointed_thing) - - ds(-2, 2, user, pointed_thing) - ds(-1, 2, user, pointed_thing) - ds( 0, 2, user, pointed_thing) - - add_ref(-2, 0, user, pointed_thing) - + run_list( {{aw, 0,-3},{aw,-1,-3},{aw,-2,-3}, + {aw, 0, 3},{aw,-1, 3},{aw,-2, 3}, + {es,-3,-3},{et,-3,-2},{et,-3,-1},{et,-3, 0},{et,-3, 1},{et,-3, 2},{es,-3, 3}, + {ds,-2,-2},{ds,-1,-2},{ds, 0,-2}, + {dt,-2,-1},{dt,-1,-1},{dt, 0,-1}, + {dt,-2, 0},{dt,-1, 0},{dt, 0, 0}, + {dt,-2, 1},{dt,-1, 1},{dt, 0, 1}, + {ds,-2, 2},{ds,-1, 2},{ds, 0, 2}, + {add_ref,-2, 0}}, user, pointed_thing) elseif cdir == 5 then -- pointed west-southwest - aw( 1,-3, user, pointed_thing) - aw( 0,-3, user, pointed_thing) - aw( 0,-4, user, pointed_thing) - aw(-1,-4, user, pointed_thing) - aw(-2,-4, user, pointed_thing) - - aw(-1, 3, user, pointed_thing) - aw(-2, 3, user, pointed_thing) - aw(-2, 2, user, pointed_thing) - aw(-3, 2, user, pointed_thing) - - es(-3,-4, user, pointed_thing) - et(-3,-3, user, pointed_thing) - et(-3,-2, user, pointed_thing) - et(-3,-1, user, pointed_thing) - et(-3, 0, user, pointed_thing) - et(-3, 1, user, pointed_thing) - - ds(-2,-3, user, pointed_thing) - ds(-1,-3, user, pointed_thing) - - dt(-2,-2, user, pointed_thing) - dt(-1,-2, user, pointed_thing) - ds( 0,-2, user, pointed_thing) - - dt(-2,-1, user, pointed_thing) - dt(-1,-1, user, pointed_thing) - dt( 0,-1, user, pointed_thing) - - dt(-2, 0, user, pointed_thing) - dt(-1, 0, user, pointed_thing) - dt( 0, 0, user, pointed_thing) - - ds(-2, 1, user, pointed_thing) - dt(-1, 1, user, pointed_thing) - dt( 0, 1, user, pointed_thing) - - ds(-1, 2, user, pointed_thing) - - add_ref(-2, -1, user, pointed_thing) - + run_list( {{aw, 1,-3},{aw, 0,-3},{aw, 0,-4},{aw,-1,-4},{aw,-2,-4}, + {aw,-1, 3},{aw,-2, 3},{aw,-2, 2},{aw,-3, 2}, + {es,-3,-4},{et,-3,-3},{et,-3,-2},{et,-3,-1},{et,-3, 0},{et,-3, 1}, + {ds,-2,-3},{ds,-1,-3}, + {dt,-2,-2},{dt,-1,-2},{ds, 0,-2}, + {dt,-2,-1},{dt,-1,-1},{dt, 0,-1}, + {dt,-2, 0},{dt,-1, 0},{dt, 0, 0}, + {ds,-2, 1},{dt,-1, 1},{dt, 0, 1}, + {ds,-1, 2}, + {add_ref,-2, -1}}, user, pointed_thing) elseif cdir == 6 then -- pointed southwest - aw( 3,-2, user, pointed_thing) - aw( 2,-2, user, pointed_thing) - aw( 2,-3, user, pointed_thing) - aw( 1,-3, user, pointed_thing) - aw( 1,-4, user, pointed_thing) - - aw(-2, 3, user, pointed_thing) - aw(-2, 2, user, pointed_thing) - aw(-3, 2, user, pointed_thing) - aw(-3, 1, user, pointed_thing) - aw(-4, 1, user, pointed_thing) - - es( 0,-4, user, pointed_thing) - es(-1,-4, user, pointed_thing) - et(-1,-3, user, pointed_thing) - et(-1,-2, user, pointed_thing) - et(-2,-2, user, pointed_thing) - et(-2,-1, user, pointed_thing) - et(-3,-1, user, pointed_thing) - es(-4,-1, user, pointed_thing) - es(-4, 0, user, pointed_thing) - - ds( 0,-3, user, pointed_thing) - - dt( 0,-2, user, pointed_thing) - ds( 1,-2, user, pointed_thing) - - dt(-1,-1, user, pointed_thing) - dt( 0,-1, user, pointed_thing) - dt( 1,-1, user, pointed_thing) - ds( 2,-1, user, pointed_thing) - - ds(-3, 0, user, pointed_thing) - dt(-2, 0, user, pointed_thing) - dt(-1, 0, user, pointed_thing) - dt( 0, 0, user, pointed_thing) - - ds(-2, 1, user, pointed_thing) - dt(-1, 1, user, pointed_thing) - - ds(-1, 2, user, pointed_thing) - - add_ref(-1, -1, user, pointed_thing) - + run_list( {{aw, 3,-2},{aw, 2,-2},{aw, 2,-3},{aw, 1,-3},{aw, 1,-4}, + {aw,-2, 3},{aw,-2, 2},{aw,-3, 2},{aw,-3, 1},{aw,-4, 1}, + {es, 0,-4},{es,-1,-4},{et,-1,-3},{et,-1,-2},{et,-2,-2},{et,-2,-1},{et,-3,-1},{es,-4,-1},{es,-4, 0}, + {ds, 0,-3}, + {dt, 0,-2},{ds, 1,-2}, + {dt,-1,-1},{dt, 0,-1},{dt, 1,-1},{ds, 2,-1}, + {ds,-3, 0},{dt,-2, 0},{dt,-1, 0},{dt, 0, 0}, + {ds,-2, 1},{dt,-1, 1}, + {ds,-1, 2}, + {add_ref,-1, -1}}, user, pointed_thing) elseif cdir == 7 then -- pointed south-southwest - aw( 3,-1, user, pointed_thing) - aw( 3,-2, user, pointed_thing) - aw( 2,-2, user, pointed_thing) - aw( 2,-3, user, pointed_thing) - - aw(-3, 1, user, pointed_thing) - aw(-3, 0, user, pointed_thing) - aw(-4, 0, user, pointed_thing) - aw(-4,-1, user, pointed_thing) - aw(-4,-2, user, pointed_thing) - - es( 1,-3, user, pointed_thing) - et( 0,-3, user, pointed_thing) - et(-1,-3, user, pointed_thing) - et(-2,-3, user, pointed_thing) - et(-3,-3, user, pointed_thing) - et(-4,-3, user, pointed_thing) - - ds(-3,-2, user, pointed_thing) - dt(-2,-2, user, pointed_thing) - dt(-1,-2, user, pointed_thing) - dt( 0,-2, user, pointed_thing) - ds( 1,-2, user, pointed_thing) - - ds(-3,-1, user, pointed_thing) - dt(-2,-1, user, pointed_thing) - dt(-1,-1, user, pointed_thing) - dt( 0,-1, user, pointed_thing) - dt( 1,-1, user, pointed_thing) - ds( 2,-1, user, pointed_thing) - - ds(-2, 0, user, pointed_thing) - dt(-1, 0, user, pointed_thing) - dt( 0, 0, user, pointed_thing) - dt( 1, 0, user, pointed_thing) - - add_ref(-1, -2, user, pointed_thing) - + run_list( {{aw, 3,-1},{aw, 3,-2},{aw, 2,-2},{aw, 2,-3}, + {aw,-3, 1},{aw,-3, 0},{aw,-4, 0},{aw,-4,-1},{aw,-4,-2}, + {et, 1,-3},{et, 0,-3},{et,-1,-3},{et,-2,-3},{et,-3,-3},{es,-4,-3}, + {ds,-3,-2},{dt,-2,-2},{dt,-1,-2},{dt, 0,-2},{ds, 1,-2}, + {ds,-3,-1},{dt,-2,-1},{dt,-1,-1},{dt, 0,-1},{dt, 1,-1},{ds, 2,-1}, + {ds,-2, 0},{dt,-1, 0},{dt, 0, 0},{dt, 1, 0}, + {add_ref,-1, -2}}, user, pointed_thing) elseif cdir == 8 then -- pointed south - aw( 3, 0, user, pointed_thing) - aw( 3,-1, user, pointed_thing) - aw( 3,-2, user, pointed_thing) - - aw(-3, 0, user, pointed_thing) - aw(-3,-1, user, pointed_thing) - aw(-3,-2, user, pointed_thing) - - es( 3,-3, user, pointed_thing) - et( 2,-3, user, pointed_thing) - et( 1,-3, user, pointed_thing) - et( 0,-3, user, pointed_thing) - et(-1,-3, user, pointed_thing) - et(-2,-3, user, pointed_thing) - es(-3,-3, user, pointed_thing) - - ds(-2,-2, user, pointed_thing) - dt(-1,-2, user, pointed_thing) - dt( 0,-2, user, pointed_thing) - dt( 1,-2, user, pointed_thing) - ds( 2,-2, user, pointed_thing) - - ds(-2,-1, user, pointed_thing) - dt(-1,-1, user, pointed_thing) - dt( 0,-1, user, pointed_thing) - dt( 1,-1, user, pointed_thing) - ds( 2,-1, user, pointed_thing) - - ds(-2, 0, user, pointed_thing) - dt(-1, 0, user, pointed_thing) - dt( 0, 0, user, pointed_thing) - dt( 1, 0, user, pointed_thing) - ds( 2, 0, user, pointed_thing) - - add_ref(0, -2, user, pointed_thing) - + run_list( {{aw, 3, 0},{aw, 3,-1},{aw, 3,-2}, + {aw,-3, 0},{aw,-3,-1},{aw,-3,-2}, + {es, 3,-3},{et, 2,-3},{et, 1,-3},{et, 0,-3},{et,-1,-3},{et,-2,-3},{es,-3,-3}, + {ds,-2,-2},{dt,-1,-2},{dt, 0,-2},{dt, 1,-2},{ds, 2,-2}, + {ds,-2,-1},{dt,-1,-1},{dt, 0,-1},{dt, 1,-1},{ds, 2,-1}, + {ds,-2, 0},{dt,-1, 0},{dt, 0, 0},{dt, 1, 0},{ds, 2, 0}, + {add_ref,0, -2}}, user, pointed_thing) elseif cdir == 9 then -- pointed south-southeast - aw( 3, 1, user, pointed_thing) - aw( 3, 0, user, pointed_thing) - aw( 4, 0, user, pointed_thing) - aw( 4,-1, user, pointed_thing) - aw( 4,-2, user, pointed_thing) - - aw(-3,-1, user, pointed_thing) - aw(-3,-2, user, pointed_thing) - aw(-2,-2, user, pointed_thing) - aw(-2,-3, user, pointed_thing) - - es( 4,-3, user, pointed_thing) - et( 3,-3, user, pointed_thing) - et( 2,-3, user, pointed_thing) - et( 1,-3, user, pointed_thing) - et( 0,-3, user, pointed_thing) - et(-1,-3, user, pointed_thing) - - ds(-1,-2, user, pointed_thing) - dt( 0,-2, user, pointed_thing) - dt( 1,-2, user, pointed_thing) - dt( 2,-2, user, pointed_thing) - ds( 3,-2, user, pointed_thing) - - ds(-2,-1, user, pointed_thing) - dt(-1,-1, user, pointed_thing) - dt( 0,-1, user, pointed_thing) - dt( 1,-1, user, pointed_thing) - dt( 2,-1, user, pointed_thing) - ds( 3,-1, user, pointed_thing) - - dt(-1, 0, user, pointed_thing) - dt( 0, 0, user, pointed_thing) - dt( 1, 0, user, pointed_thing) - ds( 2, 0, user, pointed_thing) - - add_ref(1, -2, user, pointed_thing) - + run_list( {{aw, 3, 1},{aw, 3, 0},{aw, 4, 0},{aw, 4,-1},{aw, 4,-2}, + {aw,-3,-1},{aw,-3,-2},{aw,-2,-2},{aw,-2,-3}, + {es, 4,-3},{et, 3,-3},{et, 2,-3},{et, 1,-3},{et, 0,-3},{et,-1,-3}, + {ds,-1,-2},{dt, 0,-2},{dt, 1,-2},{dt, 2,-2},{ds, 3,-2}, + {ds,-2,-1},{dt,-1,-1},{dt, 0,-1},{dt, 1,-1},{dt, 2,-1},{ds, 3,-1}, + {dt,-1, 0},{dt, 0, 0},{dt, 1, 0},{ds, 2, 0}, + {add_ref,1, -2}}, user, pointed_thing) elseif cdir == 10 then -- pointed southeast - aw( 2, 3, user, pointed_thing) - aw( 2, 2, user, pointed_thing) - aw( 3, 2, user, pointed_thing) - aw( 3, 1, user, pointed_thing) - aw( 4, 1, user, pointed_thing) - - aw(-3,-2, user, pointed_thing) - aw(-2,-2, user, pointed_thing) - aw(-2,-3, user, pointed_thing) - aw(-1,-3, user, pointed_thing) - aw(-1,-4, user, pointed_thing) - - es( 4, 0, user, pointed_thing) - es( 4,-1, user, pointed_thing) - et( 3,-1, user, pointed_thing) - et( 2,-1, user, pointed_thing) - et( 2,-2, user, pointed_thing) - et( 1,-2, user, pointed_thing) - et( 1,-3, user, pointed_thing) - es( 1,-4, user, pointed_thing) - es( 0,-4, user, pointed_thing) - - ds( 0,-3, user, pointed_thing) - - ds(-1,-2, user, pointed_thing) - dt( 0,-2, user, pointed_thing) - - ds(-2,-1, user, pointed_thing) - dt(-1,-1, user, pointed_thing) - dt( 0,-1, user, pointed_thing) - dt( 1,-1, user, pointed_thing) - - dt( 0, 0, user, pointed_thing) - dt( 1, 0, user, pointed_thing) - dt( 2, 0, user, pointed_thing) - ds( 3, 0, user, pointed_thing) - - dt( 1, 1, user, pointed_thing) - ds( 2, 1, user, pointed_thing) - - ds( 1, 2, user, pointed_thing) - - add_ref(1, -1, user, pointed_thing) - + run_list( {{aw, 2, 3},{aw, 2, 2},{aw, 3, 2},{aw, 3, 1},{aw, 4, 1}, + {aw,-3,-2},{aw,-2,-2},{aw,-2,-3},{aw,-1,-3},{aw,-1,-4}, + {es, 4, 0},{es, 4,-1},{et, 3,-1},{et, 2,-1},{et, 2,-2},{et, 1,-2},{et, 1,-3},{es, 1,-4},{es, 0,-4}, + {ds, 0,-3}, + {ds,-1,-2},{dt, 0,-2}, + {ds,-2,-1},{dt,-1,-1},{dt, 0,-1},{dt, 1,-1}, + {dt, 0, 0},{dt, 1, 0},{dt, 2, 0},{ds, 3, 0}, + {dt, 1, 1},{ds, 2, 1}, + {ds, 1, 2}, + {add_ref,1, -1}}, user, pointed_thing) elseif cdir == 11 then -- pointed east-southeast - aw( 1, 3, user, pointed_thing) - aw( 2, 3, user, pointed_thing) - aw( 2, 2, user, pointed_thing) - aw( 3, 2, user, pointed_thing) - - aw(-1,-3, user, pointed_thing) - aw( 0,-3, user, pointed_thing) - aw( 0,-4, user, pointed_thing) - aw( 1,-4, user, pointed_thing) - aw( 2,-4, user, pointed_thing) - - et( 3, 1, user, pointed_thing) - et( 3, 0, user, pointed_thing) - et( 3,-1, user, pointed_thing) - et( 3,-2, user, pointed_thing) - et( 3,-3, user, pointed_thing) - es( 3,-4, user, pointed_thing) - - ds( 1,-3, user, pointed_thing) - ds( 2,-3, user, pointed_thing) - - ds( 0,-2, user, pointed_thing) - dt( 1,-2, user, pointed_thing) - dt( 2,-2, user, pointed_thing) - - dt( 0,-1, user, pointed_thing) - dt( 1,-1, user, pointed_thing) - dt( 2,-1, user, pointed_thing) - - dt( 0, 0, user, pointed_thing) - dt( 1, 0, user, pointed_thing) - dt( 2, 0, user, pointed_thing) - - dt( 0, 1, user, pointed_thing) - dt( 1, 1, user, pointed_thing) - ds( 2, 1, user, pointed_thing) - - ds( 1, 2, user, pointed_thing) - - add_ref(2, -1, user, pointed_thing) - + run_list( {{aw, 1, 3},{aw, 2, 3},{aw, 2, 2},{aw, 3, 2}, + {aw,-1,-3},{aw, 0,-3},{aw, 0,-4},{aw, 1,-4},{aw, 2,-4}, + {et, 3, 1},{et, 3, 0},{et, 3,-1},{et, 3,-2},{et, 3,-3},{es, 3,-4}, + {ds, 1,-3},{ds, 2,-3}, + {ds, 0,-2},{dt, 1,-2},{dt, 2,-2}, + {dt, 0,-1},{dt, 1,-1},{dt, 2,-1}, + {dt, 0, 0},{dt, 1, 0},{dt, 2, 0}, + {dt, 0, 1},{dt, 1, 1},{ds, 2, 1}, + {ds, 1, 2}, + {add_ref,2, -1}}, user, pointed_thing) elseif cdir == 12 then -- pointed east - aw( 0, 3, user, pointed_thing) - aw( 1, 3, user, pointed_thing) - aw( 2, 3, user, pointed_thing) - - aw( 0,-3, user, pointed_thing) - aw( 1,-3, user, pointed_thing) - aw( 2,-3, user, pointed_thing) - - es( 3, 3, user, pointed_thing) - et( 3, 2, user, pointed_thing) - et( 3, 1, user, pointed_thing) - et( 3, 0, user, pointed_thing) - et( 3,-1, user, pointed_thing) - et( 3,-2, user, pointed_thing) - es( 3,-3, user, pointed_thing) - - ds( 0,-2, user, pointed_thing) - ds( 1,-2, user, pointed_thing) - ds( 2,-2, user, pointed_thing) - - dt( 0,-1, user, pointed_thing) - dt( 1,-1, user, pointed_thing) - dt( 2,-1, user, pointed_thing) - - dt( 0, 0, user, pointed_thing) - dt( 1, 0, user, pointed_thing) - dt( 2, 0, user, pointed_thing) - - dt( 0, 1, user, pointed_thing) - dt( 1, 1, user, pointed_thing) - dt( 2, 1, user, pointed_thing) - - ds( 0, 2, user, pointed_thing) - ds( 1, 2, user, pointed_thing) - ds( 2, 2, user, pointed_thing) - - add_ref(2, 0, user, pointed_thing) - + run_list( {{aw, 0, 3},{aw, 1, 3},{aw, 2, 3}, + {aw, 0,-3},{aw, 1,-3},{aw, 2,-3}, + {es, 3, 3},{et, 3, 2},{et, 3, 1},{et, 3, 0},{et, 3,-1},{et, 3,-2},{es, 3,-3}, + {ds, 0,-2},{ds, 1,-2},{ds, 2,-2}, + {dt, 0,-1},{dt, 1,-1},{dt, 2,-1}, + {dt, 0, 0},{dt, 1, 0},{dt, 2, 0}, + {dt, 0, 1},{dt, 1, 1},{dt, 2, 1}, + {ds, 0, 2},{ds, 1, 2},{ds, 2, 2}, + {add_ref,2, 0}}, user, pointed_thing) elseif cdir == 13 then -- pointed east-northeast - aw(-1, 3, user, pointed_thing) - aw( 0, 3, user, pointed_thing) - aw( 0, 4, user, pointed_thing) - aw( 1, 4, user, pointed_thing) - aw( 2, 4, user, pointed_thing) - - aw( 1,-3, user, pointed_thing) - aw( 2,-3, user, pointed_thing) - aw( 2,-2, user, pointed_thing) - aw( 3,-2, user, pointed_thing) - - es( 3, 4, user, pointed_thing) - et( 3, 3, user, pointed_thing) - et( 3, 2, user, pointed_thing) - et( 3, 1, user, pointed_thing) - et( 3, 0, user, pointed_thing) - et( 3,-1, user, pointed_thing) - - ds( 1,-2, user, pointed_thing) - - dt( 0,-1, user, pointed_thing) - dt( 1,-1, user, pointed_thing) - ds( 2,-1, user, pointed_thing) - - dt( 0, 0, user, pointed_thing) - dt( 1, 0, user, pointed_thing) - dt( 2, 0, user, pointed_thing) - - dt( 0, 1, user, pointed_thing) - dt( 1, 1, user, pointed_thing) - dt( 2, 1, user, pointed_thing) - - ds( 0, 2, user, pointed_thing) - dt( 1, 2, user, pointed_thing) - dt( 2, 2, user, pointed_thing) - - ds( 1, 3, user, pointed_thing) - ds( 2, 3, user, pointed_thing) - - add_ref(2, 1, user, pointed_thing) - + run_list( {{aw,-1, 3},{aw, 0, 3},{aw, 0, 4},{aw, 1, 4},{aw, 2, 4}, + {aw, 1,-3},{aw, 2,-3},{aw, 2,-2},{aw, 3,-2}, + {es, 3, 4},{et, 3, 3},{et, 3, 2},{et, 3, 1},{et, 3, 0},{et, 3,-1}, + {ds, 1,-2}, + {dt, 0,-1},{dt, 1,-1},{ds, 2,-1}, + {dt, 0, 0},{dt, 1, 0},{dt, 2, 0}, + {dt, 0, 1},{dt, 1, 1},{dt, 2, 1}, + {ds, 0, 2},{dt, 1, 2},{dt, 2, 2}, + {ds, 1, 3},{ds, 2, 3}, + {add_ref,2, 1}}, user, pointed_thing) elseif cdir == 14 then -- pointed northeast - aw(-3, 2, user, pointed_thing) - aw(-2, 2, user, pointed_thing) - aw(-2, 3, user, pointed_thing) - aw(-1, 3, user, pointed_thing) - aw(-1, 4, user, pointed_thing) - - aw( 2,-3, user, pointed_thing) - aw( 2,-2, user, pointed_thing) - aw( 3,-2, user, pointed_thing) - aw( 3,-1, user, pointed_thing) - aw( 4,-1, user, pointed_thing) - - es( 0, 4, user, pointed_thing) - es( 1, 4, user, pointed_thing) - et( 1, 3, user, pointed_thing) - et( 1, 2, user, pointed_thing) - et( 2, 2, user, pointed_thing) - et( 2, 1, user, pointed_thing) - et( 3, 1, user, pointed_thing) - es( 4, 1, user, pointed_thing) - es( 4, 0, user, pointed_thing) - - ds( 1,-2, user, pointed_thing) - - dt( 1,-1, user, pointed_thing) - ds( 2,-1, user, pointed_thing) - - - dt( 0, 0, user, pointed_thing) - dt( 1, 0, user, pointed_thing) - dt( 2, 0, user, pointed_thing) - ds( 3, 0, user, pointed_thing) - - ds(-2, 1, user, pointed_thing) - dt(-1, 1, user, pointed_thing) - dt( 0, 1, user, pointed_thing) - dt( 1, 1, user, pointed_thing) - - ds(-1, 2, user, pointed_thing) - dt( 0, 2, user, pointed_thing) - - ds( 0, 3, user, pointed_thing) - - add_ref(1, 1, user, pointed_thing) - + run_list( {{aw,-3, 2},{aw,-2, 2},{aw,-2, 3},{aw,-1, 3},{aw,-1, 4}, + {aw, 2,-3},{aw, 2,-2},{aw, 3,-2},{aw, 3,-1},{aw, 4,-1}, + {es, 0, 4},{es, 1, 4},{et, 1, 3},{et, 1, 2},{et, 2, 2},{et, 2, 1},{et, 3, 1},{es, 4, 1},{es, 4, 0}, + {ds, 1,-2}, + {dt, 1,-1},{ds, 2,-1}, + {dt, 0, 0},{dt, 1, 0},{dt, 2, 0},{ds, 3, 0}, + {ds,-2, 1},{dt,-1, 1},{dt, 0, 1},{dt, 1, 1}, + {ds,-1, 2},{dt, 0, 2}, + {ds, 0, 3}, + {add_ref,1, 1}}, user, pointed_thing) elseif cdir == 15 then -- pointed north-northeast - aw(-3, 1, user, pointed_thing) - aw(-3, 2, user, pointed_thing) - aw(-2, 2, user, pointed_thing) - aw(-2, 3, user, pointed_thing) - - aw( 3,-1, user, pointed_thing) - aw( 3, 0, user, pointed_thing) - aw( 4, 0, user, pointed_thing) - aw( 4, 1, user, pointed_thing) - aw( 4, 2, user, pointed_thing) - - et(-1, 3, user, pointed_thing) - et( 0, 3, user, pointed_thing) - et( 1, 3, user, pointed_thing) - et( 2, 3, user, pointed_thing) - et( 3, 3, user, pointed_thing) - es( 4, 3, user, pointed_thing) - - dt(-1, 0, user, pointed_thing) - dt( 0, 0, user, pointed_thing) - dt( 1, 0, user, pointed_thing) - ds( 2, 0, user, pointed_thing) - - ds(-2, 1, user, pointed_thing) - dt(-1, 1, user, pointed_thing) - dt( 0, 1, user, pointed_thing) - dt( 1, 1, user, pointed_thing) - dt( 2, 1, user, pointed_thing) - ds( 3, 1, user, pointed_thing) - - ds(-1, 2, user, pointed_thing) - dt( 0, 2, user, pointed_thing) - dt( 1, 2, user, pointed_thing) - dt( 2, 2, user, pointed_thing) - ds( 3, 2, user, pointed_thing) - - add_ref( 1, 2, user, pointed_thing) + run_list( {{aw,-3, 1},{aw,-3, 2},{aw,-2, 2},{aw,-2, 3}, + {aw, 3,-1},{aw, 3, 0},{aw, 4, 0},{aw, 4, 1},{aw, 4, 2}, + {et,-1, 3},{et, 0, 3},{et, 1, 3},{et, 2, 3},{et, 3, 3},{es, 4, 3}, + {dt,-1, 0},{dt, 0, 0},{dt, 1, 0},{ds, 2, 0}, + {ds,-2, 1},{dt,-1, 1},{dt, 0, 1},{dt, 1, 1},{dt, 2, 1},{ds, 3, 1}, + {ds,-1, 2},{dt, 0, 2},{dt, 1, 2},{dt, 2, 2},{ds, 3, 2}, + {add_ref, 1, 2}}, user, pointed_thing) end add_light(2, user, pointed_thing) -- change to 1 for more frequent lights end @@ -1063,6 +481,12 @@ for i,img in ipairs(images) do local creative_enabled = (creative and creative.is_enabled_for and creative.is_enabled_for(player_name)) if creative_enabled and pointed_thing.type=="node" then + -- If node is dtrack, I lower positions of pointed_thing to right below dtrack, but keep name the same. + local name = minetest.get_node(pointed_thing.under).name + if string.match(name, "dtrack") then + pointed_thing.under = vector.add(pointed_thing.under, {x=0, y=-1, z=0}) + pointed_thing.above = vector.add(pointed_thing.above, {x=0, y=-1, z=0}) -- don't currently use this + end dig_tunnel(i-1, placer, pointed_thing) end end,