fix railbot
This commit is contained in:
parent
2550294514
commit
f6b0042989
@ -21,8 +21,15 @@ end
|
|||||||
function ws.dcm(msg)
|
function ws.dcm(msg)
|
||||||
return minetest.display_chat_message(msg)
|
return minetest.display_chat_message(msg)
|
||||||
end
|
end
|
||||||
|
function ws.set_bool_bulk(settings,value)
|
||||||
|
if type(settings) ~= 'table' then return false end
|
||||||
|
for k,v in pairs(settings) do
|
||||||
|
minetest.settings:set_bool(v,value)
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
function ws.globalhacktemplate(setting,func,funcstart,funcstop)
|
function ws.globalhacktemplate(setting,func,funcstart,funcstop,daughters)
|
||||||
funcstart = funcstart or function() end
|
funcstart = funcstart or function() end
|
||||||
funcstop = funcstop or function() end
|
funcstop = funcstop or function() end
|
||||||
return function()
|
return function()
|
||||||
@ -31,9 +38,12 @@ function ws.globalhacktemplate(setting,func,funcstart,funcstop)
|
|||||||
if nextact[setting] and nextact[setting] > os.clock() then return end
|
if nextact[setting] and nextact[setting] > os.clock() then return end
|
||||||
nextact[setting] = os.clock() + 0.1
|
nextact[setting] = os.clock() + 0.1
|
||||||
if not ghwason[setting] then
|
if not ghwason[setting] then
|
||||||
funcstart()
|
if not funcstart() then
|
||||||
ws.dcm(setting.. " activated")
|
ws.set_bool_bulk(daughters,true)
|
||||||
ghwason[setting] = true
|
ghwason[setting] = true
|
||||||
|
ws.dcm(setting.. " activated")
|
||||||
|
else minetest.settings:set_bool(setting,false)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
func()
|
func()
|
||||||
end
|
end
|
||||||
@ -41,6 +51,7 @@ function ws.globalhacktemplate(setting,func,funcstart,funcstop)
|
|||||||
elseif ghwason[setting] then
|
elseif ghwason[setting] then
|
||||||
ghwason[setting] = false
|
ghwason[setting] = false
|
||||||
funcstop()
|
funcstop()
|
||||||
|
ws.set_bool_bulk(daughters,false)
|
||||||
ws.dcm(setting.. " deactivated")
|
ws.dcm(setting.. " deactivated")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -50,8 +61,8 @@ function ws.register_globalhack(func)
|
|||||||
table.insert(ws.registered_globalhacks,func)
|
table.insert(ws.registered_globalhacks,func)
|
||||||
end
|
end
|
||||||
|
|
||||||
function ws.register_globalhacktemplate(name,category,setting,func,funcstart,funcstop)
|
function ws.register_globalhacktemplate(name,category,setting,func,funcstart,funcstop,daughters)
|
||||||
ws.register_globalhack(ws.globalhacktemplate(setting,func,funcstart,funcstop))
|
ws.register_globalhack(ws.globalhacktemplate(setting,func,funcstart,funcstop,daughters))
|
||||||
minetest.register_cheat(name,category,setting)
|
minetest.register_cheat(name,category,setting)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -321,6 +332,6 @@ function ws.dig(pos)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
ws.rg('DigHead','Player','dighead',function()
|
local snapdir="north"
|
||||||
ws.dig(ws.dircoord(0,1,0))
|
ws.rg('DigHead','Player','dighead',function() ws.dig(ws.dircoord(0,1,0)) end)
|
||||||
end)
|
ws.rg('SnapYaw','Bots','snapyaw',function() ws.setdir(snapdir) end,function() snapdir=ws.getdir() end)
|
||||||
|
@ -108,7 +108,7 @@ minetest.register_chatcommand("sc_reset", { func = scaffold.reset })
|
|||||||
|
|
||||||
function scaffold.can_place_at(pos)
|
function scaffold.can_place_at(pos)
|
||||||
local node = minetest.get_node_or_nil(pos)
|
local node = minetest.get_node_or_nil(pos)
|
||||||
return (node and (node.name == "air" or minetest.get_node_def(node.name).buildable_to))
|
return (node and (node.name == "air" or node.name=="mcl_core:water_source" or node.name=="mcl_core:water_flowing" or node.name=="mcl_core:lava_source" or node.name=="mcl_core:lava_flowing" or minetest.get_node_def(node.name).buildable_to))
|
||||||
end
|
end
|
||||||
|
|
||||||
-- should check if wield is placeable
|
-- should check if wield is placeable
|
||||||
@ -152,7 +152,7 @@ function scaffold.place_if_needed(items, pos, place)
|
|||||||
--if lastplc + actint > os.time() then return end
|
--if lastplc + actint > os.time() then return end
|
||||||
if not pos then return end
|
if not pos then return end
|
||||||
lastplc=os.time()
|
lastplc=os.time()
|
||||||
if minetest.settings:get_bool('scaffold.locky') and math.round(pos.y) ~= math.round(scaffold.locky) then return end
|
|
||||||
place = place or minetest.place_node
|
place = place or minetest.place_node
|
||||||
|
|
||||||
local node = minetest.get_node_or_nil(pos)
|
local node = minetest.get_node_or_nil(pos)
|
||||||
@ -257,300 +257,79 @@ local function checknode(pos)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
if turtle then
|
scaffold.register_template_scaffold("TBM", "scaffold_tbm", function(pos)
|
||||||
scaffold.register_template_scaffold("TBM", "scaffold_tbm", function(pos)
|
scaffold.dig(ws.dircoord(1,1,0))
|
||||||
scaffold.dig(turtle.dircoord(1,1,0))
|
scaffold.dig(ws.dircoord(1,0,0))
|
||||||
scaffold.dig(turtle.dircoord(1,0,0))
|
end)
|
||||||
end)
|
scaffold.register_template_scaffold("TallTBM", "scaffold_ttbm", function(pos)
|
||||||
scaffold.register_template_scaffold("TallTBM", "scaffold_ttbm", function(pos)
|
pos = {
|
||||||
pos = {
|
|
||||||
|
|
||||||
turtle.dircoord(1,4,2),
|
ws.dircoord(1,4,2),
|
||||||
turtle.dircoord(1,3,2),
|
ws.dircoord(1,3,2),
|
||||||
turtle.dircoord(1,2,2),
|
ws.dircoord(1,2,2),
|
||||||
turtle.dircoord(1,1,2),
|
ws.dircoord(1,1,2),
|
||||||
turtle.dircoord(1,0,2),
|
ws.dircoord(1,0,2),
|
||||||
|
|
||||||
turtle.dircoord(1,4,-2),
|
ws.dircoord(1,4,-2),
|
||||||
turtle.dircoord(1,3,-2),
|
ws.dircoord(1,3,-2),
|
||||||
turtle.dircoord(1,2,-2),
|
ws.dircoord(1,2,-2),
|
||||||
turtle.dircoord(1,1,-2),
|
ws.dircoord(1,1,-2),
|
||||||
turtle.dircoord(1,0,-2),
|
ws.dircoord(1,0,-2),
|
||||||
|
|
||||||
|
|
||||||
turtle.dircoord(1,4,1),
|
ws.dircoord(1,4,1),
|
||||||
turtle.dircoord(1,3,1),
|
ws.dircoord(1,3,1),
|
||||||
turtle.dircoord(1,2,1),
|
ws.dircoord(1,2,1),
|
||||||
turtle.dircoord(1,1,1),
|
ws.dircoord(1,1,1),
|
||||||
turtle.dircoord(1,0,1),
|
ws.dircoord(1,0,1),
|
||||||
|
|
||||||
turtle.dircoord(1,4,-1),
|
ws.dircoord(1,4,-1),
|
||||||
turtle.dircoord(1,3,-1),
|
ws.dircoord(1,3,-1),
|
||||||
turtle.dircoord(1,2,-1),
|
ws.dircoord(1,2,-1),
|
||||||
turtle.dircoord(1,1,-1),
|
ws.dircoord(1,1,-1),
|
||||||
turtle.dircoord(1,0,-1),
|
ws.dircoord(1,0,-1),
|
||||||
|
|
||||||
turtle.dircoord(1,4,0),
|
ws.dircoord(1,4,0),
|
||||||
turtle.dircoord(1,3,0),
|
ws.dircoord(1,3,0),
|
||||||
turtle.dircoord(1,2,0),
|
ws.dircoord(1,2,0),
|
||||||
turtle.dircoord(1,1,0),
|
ws.dircoord(1,1,0),
|
||||||
turtle.dircoord(1,0,0)
|
ws.dircoord(1,0,0)
|
||||||
}
|
}
|
||||||
for k,v in pairs(pos) do
|
for k,v in pairs(pos) do
|
||||||
scaffold.dig(v)
|
scaffold.dig(v)
|
||||||
|
end
|
||||||
|
minetest.settings:set_bool('continuous_forward',true)
|
||||||
|
for k,v in pairs(pos) do
|
||||||
|
local n=minetest.get_node_or_nil(v)
|
||||||
|
if n and n.name ~= "air" then
|
||||||
|
minetest.settings:set_bool('continuous_forward',false)
|
||||||
end
|
end
|
||||||
minetest.settings:set_bool('continuous_forward',true)
|
end
|
||||||
for k,v in pairs(pos) do
|
end)
|
||||||
local n=minetest.get_node_or_nil(v)
|
|
||||||
if n and n.name ~= "air" then
|
|
||||||
minetest.settings:set_bool('continuous_forward',false)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
scaffold.register_template_scaffold("Cobbler", "scaffold_cobbler", function(pos)
|
|
||||||
if minetest.settings:get_bool('freecam') then return end
|
|
||||||
local fpos=turtle.dircoord(1,0,0)
|
|
||||||
local fn=minetest.get_node_or_nil(fpos)
|
|
||||||
pos = {
|
|
||||||
|
|
||||||
turtle.dircoord(2,4,2),
|
|
||||||
turtle.dircoord(2,3,2),
|
|
||||||
turtle.dircoord(2,2,2),
|
|
||||||
turtle.dircoord(2,1,2),
|
|
||||||
turtle.dircoord(2,0,2),
|
|
||||||
|
|
||||||
turtle.dircoord(2,4,-2),
|
|
||||||
turtle.dircoord(2,3,-2),
|
|
||||||
turtle.dircoord(2,2,-2),
|
|
||||||
turtle.dircoord(2,1,-2),
|
|
||||||
turtle.dircoord(2,0,-2),
|
|
||||||
|
|
||||||
turtle.dircoord(2,4,1),
|
|
||||||
turtle.dircoord(2,3,1),
|
|
||||||
turtle.dircoord(2,2,1),
|
|
||||||
turtle.dircoord(2,1,1),
|
|
||||||
turtle.dircoord(2,0,1),
|
|
||||||
|
|
||||||
turtle.dircoord(2,4,-1),
|
|
||||||
turtle.dircoord(2,3,-1),
|
|
||||||
turtle.dircoord(2,2,-1),
|
|
||||||
turtle.dircoord(2,1,-1),
|
|
||||||
turtle.dircoord(2,0,-1),
|
|
||||||
|
|
||||||
turtle.dircoord(2,4,0),
|
|
||||||
turtle.dircoord(2,3,0),
|
|
||||||
turtle.dircoord(2,2,0),
|
|
||||||
turtle.dircoord(2,1,0),
|
|
||||||
turtle.dircoord(2,0,0),
|
|
||||||
|
|
||||||
|
|
||||||
turtle.dircoord(3,4,2),
|
|
||||||
turtle.dircoord(3,3,2),
|
|
||||||
turtle.dircoord(3,2,2),
|
|
||||||
turtle.dircoord(3,1,2),
|
|
||||||
turtle.dircoord(3,0,2),
|
|
||||||
|
|
||||||
turtle.dircoord(3,4,-2),
|
|
||||||
turtle.dircoord(3,3,-2),
|
|
||||||
turtle.dircoord(3,2,-2),
|
|
||||||
turtle.dircoord(3,1,-2),
|
|
||||||
turtle.dircoord(3,0,-2),
|
|
||||||
|
|
||||||
|
|
||||||
turtle.dircoord(4,4,1),
|
scaffold.register_template_scaffold("TriScaffold", "scaffold_three_wide", function(pos)
|
||||||
turtle.dircoord(4,3,1),
|
scaffold.place_if_able(pos)
|
||||||
turtle.dircoord(4,2,1),
|
scaffold.place_if_able(ws.dircoord(0, -1, 1))
|
||||||
turtle.dircoord(4,1,1),
|
scaffold.place_if_able(ws.dircoord(0, -1, -1))
|
||||||
turtle.dircoord(4,0,1),
|
end)
|
||||||
|
|
||||||
turtle.dircoord(4,4,-1),
|
scaffold.register_template_scaffold("headTriScaff", "scaffold_three_wide_head", function(pos)
|
||||||
turtle.dircoord(4,3,-1),
|
scaffold.place_if_able(ws.dircoord(0, 3, 0))
|
||||||
turtle.dircoord(4,2,-1),
|
scaffold.place_if_able(ws.dircoord(0, 3, 1))
|
||||||
turtle.dircoord(4,1,-1),
|
scaffold.place_if_able(ws.dircoord(0, 3, -1))
|
||||||
turtle.dircoord(4,0,-1),
|
end)
|
||||||
|
|
||||||
turtle.dircoord(4,4,0),
|
scaffold.register_template_scaffold("QuintScaffold", "scaffold_five_wide", function(pos)
|
||||||
turtle.dircoord(4,3,0),
|
scaffold.place_if_able(pos)
|
||||||
turtle.dircoord(4,2,0),
|
scaffold.place_if_able(ws.dircoord(0, -1, 1))
|
||||||
turtle.dircoord(4,1,0),
|
scaffold.place_if_able(ws.dircoord(0, -1, -1))
|
||||||
turtle.dircoord(4,0,0),
|
scaffold.place_if_able(ws.dircoord(0, -1, 2))
|
||||||
|
scaffold.place_if_able(ws.dircoord(0, -1, -2))
|
||||||
|
end)
|
||||||
|
|
||||||
turtle.dircoord(5,4,2),
|
|
||||||
turtle.dircoord(5,3,2),
|
|
||||||
turtle.dircoord(5,2,2),
|
|
||||||
turtle.dircoord(5,1,2),
|
|
||||||
turtle.dircoord(5,0,2),
|
|
||||||
|
|
||||||
turtle.dircoord(5,4,-2),
|
|
||||||
turtle.dircoord(5,3,-2),
|
|
||||||
turtle.dircoord(5,2,-2),
|
|
||||||
turtle.dircoord(5,1,-2),
|
|
||||||
turtle.dircoord(5,0,-2),
|
|
||||||
|
|
||||||
|
|
||||||
turtle.dircoord(5,4,1),
|
|
||||||
turtle.dircoord(5,3,1),
|
|
||||||
turtle.dircoord(5,2,1),
|
|
||||||
turtle.dircoord(5,1,1),
|
|
||||||
turtle.dircoord(5,0,1),
|
|
||||||
|
|
||||||
turtle.dircoord(5,4,-1),
|
|
||||||
turtle.dircoord(5,3,-1),
|
|
||||||
turtle.dircoord(5,2,-1),
|
|
||||||
turtle.dircoord(5,1,-1),
|
|
||||||
turtle.dircoord(5,0,-1),
|
|
||||||
|
|
||||||
turtle.dircoord(5,4,0),
|
|
||||||
turtle.dircoord(5,3,0),
|
|
||||||
turtle.dircoord(5,2,0),
|
|
||||||
turtle.dircoord(5,1,0),
|
|
||||||
turtle.dircoord(5,0,0)
|
|
||||||
}
|
|
||||||
|
|
||||||
if fn and fn.name == "mcl_core:cobble" then
|
|
||||||
for k,v in pairs(pos) do
|
|
||||||
scaffold.place_if_needed({"mcl_core:cobble"},v)
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
|
|
||||||
scaffold.register_template_scaffold("LanternTBM", "scaffold_ltbm", function(pos)
|
|
||||||
--scaffold.dig(turtle.dircoord(1,1,0)) -- let lTBM just be additionally place lanterns mode - useful for rail too.
|
|
||||||
--scaffold.dig(turtle.dircoord(1,0,0))
|
|
||||||
local dir=turtle.getdir()
|
|
||||||
local pl=false
|
|
||||||
if dir == "north" or dir == "south" then
|
|
||||||
if pos.z % 8 == 0 then
|
|
||||||
pl=true
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if pos.x % 8 == 0 then
|
|
||||||
pl=true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if pl then
|
|
||||||
local lpos=turtle.dircoord(0,3,0)
|
|
||||||
local nd=minetest.get_node_or_nil(lpos)
|
|
||||||
if nd and nd.name ~= 'mcl_ocean:sea_lantern' then
|
|
||||||
scaffold.dig(lpos)
|
|
||||||
minetest.after("0.1",function() scaffold.place_if_needed({'mcl_ocean:sea_lantern'},lpos) end)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
scaffold.register_template_scaffold("TriScaffold", "scaffold_three_wide", function(pos)
|
|
||||||
scaffold.place_if_able(pos)
|
|
||||||
scaffold.place_if_able(turtle.dircoord(0, -1, 1))
|
|
||||||
scaffold.place_if_able(turtle.dircoord(0, -1, -1))
|
|
||||||
end)
|
|
||||||
scaffold.register_template_scaffold("WallBot", "scaffold_behind", function(pos)
|
|
||||||
minetest.settings:set_bool('scaffold_lockyaw',true)
|
|
||||||
minetest.settings:set('movement_speed_walk',1)
|
|
||||||
pos = {
|
|
||||||
|
|
||||||
turtle.dircoord(-2,4,2),
|
|
||||||
turtle.dircoord(-2,3,2),
|
|
||||||
turtle.dircoord(-2,2,2),
|
|
||||||
turtle.dircoord(-2,1,2),
|
|
||||||
turtle.dircoord(-2,0,2),
|
|
||||||
|
|
||||||
turtle.dircoord(-2,4,-2),
|
|
||||||
turtle.dircoord(-2,3,-2),
|
|
||||||
turtle.dircoord(-2,2,-2),
|
|
||||||
turtle.dircoord(-2,1,-2),
|
|
||||||
turtle.dircoord(-2,0,-2),
|
|
||||||
|
|
||||||
|
|
||||||
turtle.dircoord(-2,4,1),
|
|
||||||
turtle.dircoord(-2,3,1),
|
|
||||||
turtle.dircoord(-2,2,1),
|
|
||||||
turtle.dircoord(-2,1,1),
|
|
||||||
turtle.dircoord(-2,0,1),
|
|
||||||
|
|
||||||
turtle.dircoord(-2,4,-1),
|
|
||||||
turtle.dircoord(-2,3,-1),
|
|
||||||
turtle.dircoord(-2,2,-1),
|
|
||||||
turtle.dircoord(-2,1,-1),
|
|
||||||
turtle.dircoord(-2,0,-1),
|
|
||||||
|
|
||||||
turtle.dircoord(-2,4,0),
|
|
||||||
turtle.dircoord(-2,3,0),
|
|
||||||
turtle.dircoord(-2,2,0),
|
|
||||||
turtle.dircoord(-2,1,0),
|
|
||||||
turtle.dircoord(-2,0,0),
|
|
||||||
turtle.dircoord(-2,4,2),
|
|
||||||
turtle.dircoord(-2,3,2),
|
|
||||||
turtle.dircoord(-2,2,2),
|
|
||||||
turtle.dircoord(-2,1,2),
|
|
||||||
turtle.dircoord(-2,0,2),
|
|
||||||
|
|
||||||
turtle.dircoord(-3,4,-2),
|
|
||||||
turtle.dircoord(-3,3,-2),
|
|
||||||
turtle.dircoord(-3,2,-2),
|
|
||||||
turtle.dircoord(-3,1,-2),
|
|
||||||
turtle.dircoord(-3,0,-2),
|
|
||||||
|
|
||||||
|
|
||||||
turtle.dircoord(-3,4,1),
|
|
||||||
turtle.dircoord(-3,3,1),
|
|
||||||
turtle.dircoord(-3,2,1),
|
|
||||||
turtle.dircoord(-3,1,1),
|
|
||||||
turtle.dircoord(-3,0,1),
|
|
||||||
|
|
||||||
turtle.dircoord(-3,4,-1),
|
|
||||||
turtle.dircoord(-3,3,-1),
|
|
||||||
turtle.dircoord(-3,2,-1),
|
|
||||||
turtle.dircoord(-3,1,-1),
|
|
||||||
turtle.dircoord(-3,0,-1),
|
|
||||||
|
|
||||||
turtle.dircoord(-3,4,0),
|
|
||||||
turtle.dircoord(-3,3,0),
|
|
||||||
turtle.dircoord(-3,2,0),
|
|
||||||
turtle.dircoord(-3,1,0),
|
|
||||||
turtle.dircoord(-3,0,0)
|
|
||||||
}
|
|
||||||
|
|
||||||
local ngo=false
|
|
||||||
|
|
||||||
for k,v in pairs(pos) do
|
|
||||||
local n=minetest.get_node_or_nil(v)
|
|
||||||
if n and n.name ~= "mcl_core:cobble" then
|
|
||||||
scaffold.dig(v)
|
|
||||||
ngo=false
|
|
||||||
else ngo=true
|
|
||||||
end
|
|
||||||
if n == nil then ngo=false end
|
|
||||||
end
|
|
||||||
|
|
||||||
for k,v in pairs(pos) do
|
|
||||||
scaffold.place_if_needed({'mcl_core:cobble'},v)
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.settings:set_bool('continuous_forward',ngo)
|
|
||||||
end,false,function()
|
|
||||||
minetest.settings:set_bool('continuous_forward',false)
|
|
||||||
minetest.settings:set_bool('scaffold_locky',false)
|
|
||||||
minetest.settings:set_bool('scaffold_lockyaw',false)
|
|
||||||
minetest.settings:set_bool('scaffold_ltbm',false)
|
|
||||||
minetest.settings:set('movement_speed_walk',4)
|
|
||||||
end)
|
|
||||||
|
|
||||||
scaffold.register_template_scaffold("headTriScaff", "scaffold_three_wide_head", function(pos)
|
|
||||||
scaffold.place_if_able(turtle.dircoord(0, 3, 0))
|
|
||||||
scaffold.place_if_able(turtle.dircoord(0, 3, 1))
|
|
||||||
scaffold.place_if_able(turtle.dircoord(0, 3, -1))
|
|
||||||
end)
|
|
||||||
|
|
||||||
scaffold.register_template_scaffold("QuintScaffold", "scaffold_five_wide", function(pos)
|
|
||||||
scaffold.place_if_able(pos)
|
|
||||||
scaffold.place_if_able(turtle.dircoord(0, -1, 1))
|
|
||||||
scaffold.place_if_able(turtle.dircoord(0, -1, -1))
|
|
||||||
scaffold.place_if_able(turtle.dircoord(0, -1, 2))
|
|
||||||
scaffold.place_if_able(turtle.dircoord(0, -1, -2))
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
if nlist then
|
if nlist then
|
||||||
scaffold.register_template_scaffold("RandomScaff", "scaffold_rnd", function(below)
|
scaffold.register_template_scaffold("RandomScaff", "scaffold_rnd", function(below)
|
||||||
|
@ -16,66 +16,68 @@ local tunnelmaterial = {
|
|||||||
'mcl_core:dirt',
|
'mcl_core:dirt',
|
||||||
'mcl_core:andesite',
|
'mcl_core:andesite',
|
||||||
'mcl_core:diorite',
|
'mcl_core:diorite',
|
||||||
'mcl_core:granite'
|
'mcl_core:granite',
|
||||||
|
"mesecons_torch:redstoneblock"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
minetest.register_cheat("RailT",'Scaffold','scaffold_railtunnel')
|
|
||||||
|
minetest.register_cheat("RailT",'Bots','scaffold_railtunnel')
|
||||||
local function checknode(pos)
|
local function checknode(pos)
|
||||||
local node = minetest.get_node_or_nil(pos)
|
local node = minetest.get_node_or_nil(pos)
|
||||||
if node and node.name ~="mesecons_torch:redstoneblock" and not node.name:find("_rail") then return true end
|
if node and node.name ~="mesecons_torch:redstoneblock" and not node.name:find("_rail") then return true end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
local function dignodes(poss)
|
||||||
scaffold.register_template_scaffold("RailBot", "scaffold_rails", function(below)
|
for k,v in pairs(poss) do
|
||||||
if not scaffold.wason.scaffold_rails then
|
if checknode(v) then ws.dig(v) end
|
||||||
minetest.settings:set_bool('continuous_forward',true)
|
|
||||||
--minetest.settings:set_bool('scaffold_locky',true)
|
|
||||||
minetest.settings:set_bool('scaffold_lockyaw',true)
|
|
||||||
minetest.settings:set_bool('scaffold_ltbm',true)
|
|
||||||
end
|
end
|
||||||
local lp = turtle.dircoord(0,1,0)
|
end
|
||||||
|
local function blockliquids()
|
||||||
local fpos1=turtle.dircoord(1,2,0)
|
local lp=ws.lp:get_pos()
|
||||||
local fpos2=turtle.dircoord(1,1,0)
|
|
||||||
local fpos3=turtle.dircoord(1,0,0)
|
|
||||||
|
|
||||||
local fpos4=turtle.dircoord(2,1,0)
|
|
||||||
local fpos5=turtle.dircoord(2,0,0)
|
|
||||||
local fpos6=turtle.dircoord(2,-1,0)
|
|
||||||
|
|
||||||
if checknode(fpos1) then scaffold.dig(fpos1) end
|
|
||||||
if checknode(fpos3) then scaffold.dig(fpos3) end
|
|
||||||
if checknode(fpos2) then scaffold.dig(fpos2) end
|
|
||||||
|
|
||||||
local pos1=vector.add(lp,{x=-2,y=0,z=-2})
|
|
||||||
local pos2=vector.add(lp,{x=2,y=4,z=2})
|
|
||||||
local liquids={'mcl_core:lava_source','mcl_core:water_source','mcl_core:lava_flowing','mcl_core:water_flowing'}
|
local liquids={'mcl_core:lava_source','mcl_core:water_source','mcl_core:lava_flowing','mcl_core:water_flowing'}
|
||||||
local liquids={'mcl_core:lava_source','mcl_core:water_source'}
|
local bn=minetest.find_nodes_near(lp, 5, liquids, true)
|
||||||
|
|
||||||
local bn,cnt=minetest.find_nodes_in_area(pos1,pos2,liquids,false)
|
|
||||||
for kk,vv in pairs(bn) do
|
for kk,vv in pairs(bn) do
|
||||||
minetest.switch_to_item("mcl_nether:netherrack")
|
scaffold.place_if_needed(tunnelmaterial,vv)
|
||||||
minetest.place_node(vv)
|
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function invcheck(item)
|
||||||
|
if mintetest.switch_to_item(item) then return true end
|
||||||
|
refill.refill_at(ws.dircoord(1,1,0),'railkit')
|
||||||
|
end
|
||||||
|
|
||||||
|
ws.rg("RailBot","Bots", "scaffold_rails", function()
|
||||||
|
local lp = ws.dircoord(0,0,0)
|
||||||
|
local below = ws.dircoord(0,-1,0)
|
||||||
|
blockliquids()
|
||||||
|
local dpos= {
|
||||||
|
ws.dircoord(0,1,0),
|
||||||
|
ws.dircoord(0,0,0),
|
||||||
|
ws.dircoord(0,-1,0),
|
||||||
|
ws.dircoord(1,1,0),
|
||||||
|
ws.dircoord(1,0,0),
|
||||||
|
ws.dircoord(1,-1,0),
|
||||||
|
ws.dircoord(2,1,0),
|
||||||
|
ws.dircoord(2,0,0),
|
||||||
|
ws.dircoord(2,-1,0)
|
||||||
|
}
|
||||||
|
dignodes(dpos)
|
||||||
local bln=minetest.get_node_or_nil(below)
|
local bln=minetest.get_node_or_nil(below)
|
||||||
local lpn=minetest.get_node_or_nil(lp)
|
local lpn=minetest.get_node_or_nil(lp)
|
||||||
|
|
||||||
if bln and lpn and lpn.name == "mcl_minecarts:golden_rail_on" then
|
if bln and lpn and lpn.name == "mcl_minecarts:golden_rail_on" then
|
||||||
--bln.name == "mesecons_torch:redstoneblock" and
|
|
||||||
minetest.settings:set_bool('continuous_forward',true)
|
minetest.settings:set_bool('continuous_forward',true)
|
||||||
else
|
else
|
||||||
--if lpn and lpn.name then minetest.display_chat_message(lpn.name) end
|
|
||||||
minetest.settings:set_bool('continuous_forward',false)
|
minetest.settings:set_bool('continuous_forward',false)
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.after("0.1",function()
|
minetest.after("0",function()
|
||||||
local frpos=turtle.dircoord(1,1,0)
|
local frpos=ws.dircoord(1,0,0)
|
||||||
local fgpos=turtle.dircoord(1,0,0)
|
local fgpos=ws.dircoord(1,-1,0)
|
||||||
local rpos=turtle.dircoord(0,1,0)
|
local rpos=ws.dircoord(0,0,0)
|
||||||
local gpos=turtle.dircoord(0,0,0)
|
local gpos=ws.dircoord(0,-1,0)
|
||||||
local it = core.find_item("mesecons_torch:redstoneblock")
|
|
||||||
if not it then minetest.settings:set_bool('continuous_forward',false) end
|
|
||||||
scaffold.place_if_needed(ground, gpos)
|
scaffold.place_if_needed(ground, gpos)
|
||||||
scaffold.place_if_needed(rails, rpos)
|
scaffold.place_if_needed(rails, rpos)
|
||||||
scaffold.place_if_needed(ground, fgpos)
|
scaffold.place_if_needed(ground, fgpos)
|
||||||
@ -83,15 +85,38 @@ scaffold.register_template_scaffold("RailBot", "scaffold_rails", function(below)
|
|||||||
|
|
||||||
end)
|
end)
|
||||||
if minetest.settings:get_bool('scaffold_railtunnel') then
|
if minetest.settings:get_bool('scaffold_railtunnel') then
|
||||||
scaffold.place_if_needed(tunnelmaterial, turtle.dircoord(0,3,0))
|
scaffold.place_if_needed(tunnelmaterial, ws.dircoord(0,2,0))
|
||||||
scaffold.place_if_needed(tunnelmaterial, turtle.dircoord(0,2,1))
|
scaffold.place_if_needed(tunnelmaterial, ws.dircoord(0,1,1))
|
||||||
scaffold.place_if_needed(tunnelmaterial, turtle.dircoord(0,1,1))
|
scaffold.place_if_needed(tunnelmaterial, ws.dircoord(0,0,1))
|
||||||
scaffold.place_if_needed(tunnelmaterial, turtle.dircoord(0,2,-1))
|
scaffold.place_if_needed(tunnelmaterial, ws.dircoord(0,1,-1))
|
||||||
scaffold.place_if_needed(tunnelmaterial, turtle.dircoord(0,1,-1))
|
scaffold.place_if_needed(tunnelmaterial, ws.dircoord(0,0,-1))
|
||||||
end
|
end
|
||||||
end,false,function()
|
end,
|
||||||
minetest.settings:set_bool('continuous_forward',false)
|
function()--startfunc
|
||||||
minetest.settings:set_bool('scaffold_locky',false)
|
|
||||||
minetest.settings:set_bool('scaffold_lockyaw',false)
|
end,function() --stopfunc
|
||||||
minetest.settings:set_bool('scaffold_ltbm',false)
|
|
||||||
end)
|
end,{'scaffold_ltbm','snapyaw','continuous_forward'})
|
||||||
|
|
||||||
|
scaffold.register_template_scaffold("LanternTBM", "scaffold_ltbm", function()
|
||||||
|
local dir=ws.getdir()
|
||||||
|
local lp=vector.round(ws.dircoord(0,0,0))
|
||||||
|
local pl=false
|
||||||
|
if dir == "north" or dir == "south" then
|
||||||
|
if lp.z % 8 < 1 then
|
||||||
|
pl=true
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if lp.x % 8 < 1 then
|
||||||
|
pl=true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if pl then
|
||||||
|
local lpos=ws.dircoord(0,2,0)
|
||||||
|
local nd=minetest.get_node_or_nil(lpos)
|
||||||
|
if nd and nd.name ~= 'mcl_ocean:sea_lantern' then
|
||||||
|
ws.dig(lpos)
|
||||||
|
minetest.after("0",function() ws.place(lpos,'mcl_ocean:sea_lantern') end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user