add missing files

master
cora 2021-03-27 22:25:11 +01:00
parent c15c97e0a7
commit 91cd5d1d01
12 changed files with 385 additions and 87 deletions

View File

@ -58,11 +58,11 @@ minetest.register_globalstep(function(dtime)
autoeat.eat()
end
end)
minetest.after(3, function()
local function get_hud()
local player = minetest.localplayer
local def
local i = -1
if not player then minetest.after(5,get_hud) end
repeat
i = i + 1
def = player:hud_get(i)
@ -70,6 +70,7 @@ minetest.after(3, function()
if def then
hud_id = i
end
end)
end
minetest.after(15,get_hud )
minetest.register_cheat("AutoEat", "Player", "autoeat")

View File

@ -78,9 +78,47 @@ function autofly.get2ddst(pos1,pos2)
end
local last_sprint = false
local hud_ah=nil
function autofly.update_ah()
local pos=vector.new(0,0,0)
local ppos=minetest.localplayer:get_pos()
local yaw=math.floor(minetest.localplayer:get_yaw())
local theta =(yaw * math.pi / 180)
pos.x= math.floor( 100 * math.cos(theta) )
pos.z= math.floor( 100 * math.sin(theta) )
pos=vector.add(ppos,pos)
pos.y=ppos.y
local nname=pos_to_string(pos).."\n"..yaw.."\n"..'__________________________________________________________________________________________________________________________________________________'
if hud_ah then
minetest.display_chat_message(pos.x..","..pos.z)
minetest.localplayer:hud_change(hud_ah, 'world_pos', pos)
minetest.localplayer:hud_change(hud_ah, 'name', nname)
else
hud_ah = minetest.localplayer:hud_add({
hud_elem_type = 'waypoint',
name = nname,
title = pos_to_string(pos),
text = '',
number = 0x00ff00,
world_pos = pos,
precision = 0,
width = 1000
})
end
end
minetest.register_globalstep(function()
if not minetest.localplayer then return end
-- autofly.update_ah()
end)
minetest.register_globalstep(function()
if not minetest.localplayer then return end
autofly.axissnap()
if minetest.settings:get_bool("autosprint") or (minetest.settings:get_bool("continuous_forward") and minetest.settings:get_bool("autofsprint")) then
core.set_keypress("special1", true)
@ -121,6 +159,10 @@ minetest.register_globalstep(function()
autofly.cruise()
end)
function autofly.get_speed()
return speed
end
function autofly.set_hud_wp(pos, title)
if hud_wp then
@ -153,8 +195,8 @@ function autofly.get_quad()
local lp=minetest.localplayer:get_pos()
local quad=""
if lp.z < 0 then quad="Q: South"
else quad="Q: North" end
if lp.z < 0 then quad="South"
else quad="North" end
if lp.x < 0 then quad=quad.."-west"
else quad=quad.."-east" end
@ -162,6 +204,13 @@ function autofly.get_quad()
return quad
end
function autofly.get_wdir()
local qd=autofly.get_quad()
end
function autofly.get_local_name()
local ww=autofly.getwps()
local lp=minetest.localplayer:get_pos()
@ -352,21 +401,7 @@ function autofly.cruise()
end
function autofly.aim(tpos)
local ppos=minetest.localplayer:get_pos()
--local dir=tpos
local dir=vector.direction(ppos,tpos)
local yyaw=0;
local pitch=0;
if dir.x < 0 then
yyaw = math.atan2(-dir.x, dir.z) + (math.pi * 2)
else
yyaw = math.atan2(-dir.x, dir.z)
end
yyaw = ws.round2(math.deg(yyaw),2)
pitch = ws.round2(math.deg(math.asin(-dir.y) * 1),2);
minetest.localplayer:set_yaw(yyaw)
minetest.localplayer:set_pitch(pitch)
return ws.aim(tpos)
end
function autofly.autotp(tpname)

View File

@ -119,6 +119,16 @@ minetest.register_globalstep(function(dtime)
elseif minetest.settings:get_bool("block_lava") then
local positions = minetest.find_nodes_near(pos, 5, {"mcl_core:lava_source", "mcl_core:lava_flowing"}, true)
for i, p in pairs(positions) do
if i > nodes_per_tick then return end
minetest.place_node(p)
end
elseif minetest.settings:get_bool("block_sources") then
local positions = minetest.find_nodes_near(pos, 5, {"mcl_core:lava_source","mcl_nether:nether_lava_source","mcl_core:water_source"}, true)
for i, p in pairs(positions) do
if p.y<2 then
if p.x>500 and p.z>500 then return end
end
if i > nodes_per_tick then return end
minetest.place_node(p)
end
@ -154,6 +164,7 @@ minetest.register_cheat("Scaffold", "World", "scaffold")
minetest.register_cheat("HighwayZ", "World", "highway_z")
minetest.register_cheat("BlockWater", "World", "block_water")
minetest.register_cheat("BlockLava", "World", "block_lava")
minetest.register_cheat("BlockSrc", "World", "block_sources")
minetest.register_cheat("PlaceOnTop", "World", "autotnt")
minetest.register_cheat("Replace", "World", "replace")
minetest.register_cheat("Nuke", "World", "nuke")

View File

@ -111,7 +111,7 @@ local function display(message)
-- strip title
if not is_dm and (hignore.strip[player] or minetest.settings:get_bool("hignore_strip_all")) then
message = message:match(".- | (.*)") or message
message = message:match(".- (.*)") or message
if hignore.highlight[player] == nil then
minetest.display_chat_message(message)
return true

View File

@ -7,11 +7,11 @@ incremental_tp.tpactive=false
-- for Clamity
incremental_tp.max_instantaneous_tp = {
x = 9,
y = 55,
z = 9
x = 6,
y = 50,
z = 6
}
local wason=false
local function sign(n)
if n == 0 then
return 0
@ -35,8 +35,13 @@ local function tpstep(target, time, second, variance,sfunc)
local pos = minetest.localplayer:get_pos()
local vec = vector.subtract(target, pos)
minetest.settings:set_bool("free_move",true)
if math.abs(vec.x) + math.abs(vec.y) + math.abs(vec.z) < 1 then
if not incremental_tp.tpactive and wason then
wason=false
return
end
wason=true
incremental_tp.tpactive=true
if math.abs(vec.x) + math.abs(vec.y) + math.abs(vec.z) < 1 then
minetest.localplayer:set_pos(target)
incremental_tp.tpactive=false
minetest.display_chat_message("Arrived at " .. minetest.pos_to_string(target))
@ -68,12 +73,12 @@ local function tpstep(target, time, second, variance,sfunc)
end
function incremental_tp.tp(target, time, variance)
incremental_tp.tpactive=true
if incremental_tp.tpactive then return end
tpstep(target, time, 1, variance)
end
function incremental_tp.tpafter(target,time,variance,sfunc)
incremental_tp.tpactive=true
if incremental_tp.tpactive then return end
tpstep(target,time,1,variance,sfunc)
end

View File

@ -46,7 +46,6 @@ load_mod_invrefill = true
load_mod_haxnotify = true
load_mod_incrementaltp = true
load_mod_test = true
load_mod_waller = false
load_mod_posman = false
load_mod_dodgebot = false
load_mod_aquarius = false
load_mod_furrybot = false
load_mod_antigone = false

View File

@ -10,7 +10,8 @@ local function remove_ents(texture)
for i, v in ipairs(obj) do
-- CAOs with water/lava textures are droplets
--minetest.log("ERROR",v:get_item_textures())
if v:get_item_textures():find("^" .. texture) then
--ws.dcm(v:get_item_textures())
if v:get_item_textures():find(texture) then
v:set_visible(false)
v:remove_from_scene(true)
end
@ -18,6 +19,22 @@ local function remove_ents(texture)
end
local function remove_hud()
local player = minetest.localplayer
local def
local i = -1
if not player then return end
repeat
i = i + 1
def = player:hud_get(i)
until not def or def.text:find("fire") or def.text:find("burning")
if def and type(def) == "string" then
minetest.localplayer:hud_remove(def)
end
end
core.register_on_spawn_particle(function(particle)
if minetest.settings:get_bool("noparticles") then return true end
end)
@ -25,10 +42,17 @@ end)
local epoch = os.clock()
minetest.register_globalstep(function()
if not minetest.localplayer then return end
if os.clock() > epoch + 1 then
if minetest.settings:get_bool("optimize_water_drops") then
remove_ents("default_water_source")
end
if minetest.settings:get_bool("optimize_burning") then
remove_ents("mcl_burning")
remove_ents("mcl_fire")
remove_ents("_animated")
remove_hud()
end
epoch = os.clock()
end
end)
@ -36,4 +60,4 @@ end)
minetest.register_cheat("NoParticles", "Render", "noparticles")
minetest.register_cheat("NoDroplets", "Render", "optimize_water_drops")
minetest.register_cheat("NoHearts", "Render", "optimize_hearts")
minetest.register_cheat("NoBurning", "Render", "optimize_burning")

View File

@ -0,0 +1,2 @@
nlist
turtle

View File

@ -151,9 +151,7 @@ local lastdig=0
local actint=10
function scaffold.place_if_needed(items, pos, place)
if not inside_constraints(pos) then return end
--if lastplc + actint > os.time() then return end
if not pos then return end
lastplc=os.time()
place = place or minetest.place_node

View File

@ -0,0 +1,18 @@
local Y=1337
local plnodes={'mcl_core:cobble','mcl_core:dirt','mcl_core:dirt_with_grass','mcl_core:obsidian'}
ws.rg("OW2Bot","Bots","ow2bot", function(pos)
local lp=minetest.localplayer:get_pos()
local r=3
local pos1=vector.add(lp,{x=r,y=0,z=r})
local pos2=vector.add(lp,{x=-r,y=0,z=-r})
pos1.y=Y
pos2.y=Y
ws.do_area(3,function(pos)
ws.place(pos,plnodes)
end,true)
end,function()
end)

View File

@ -1,5 +1,10 @@
-- CC0/Unlicense Emilia/cora 2020
-- south:5,1.5
--west:-x,1.5,-5
--east:-x,1.5,5
-- north 5,1.5(3096:2.5,25025:1.5),z
local storage = minetest.get_mod_storage()
local ground = {
"mesecons_torch:redstoneblock"
}
@ -12,15 +17,64 @@ local rails = {
local tunnelmaterial = {
'mcl_core:glass_light_blue',
'mcl_core:cobble',
'mcl_core:stone',
'mcl_nether:netherrack',
'mcl_core:dirt',
'mcl_core:andesite',
'mcl_core:diorite',
'mcl_core:granite',
"mesecons_torch:redstoneblock"
'mcl_core:granite'
--"mesecons_torch:redstoneblock"
}
local function is_rail(pos)
pos=vector.round(pos)
if pos.y ~= 1 then return false end
if pos.z > 5 then
if pos.x == -5 then return "north" end
elseif pos.z < -5 then
if pos.x == 5 then return "south" end
end
if pos.x > 5 then
if pos.z == 5 then return "east" end
elseif pos.x < -5 then
if pos.z == -5 then return "west" end
end
return false
end
local function get_railnode(pos)
if is_rail(pos) then
return "mcl_minecarts:golden_rail"
end
if is_rail(vector.add(pos,{x=0,y=1,x=0})) then
return "mesecons_torch:redstoneblock"
end
return false
end
local function is_lantern(pos)
local dir=ws.getdir()
pos=vector.round(pos)
if dir == "north" or dir == "south" then
if pos.z % 8 == 0 then
return true
end
else
if pos.x % 8 == 0 then
return true
end
end
return false
end
ws.rg('RailTool','Scaffold','railtool',function()
local poss=ws.get_reachable_positions(5)
for k,p in pairs(poss) do
local n=get_railnode(p)
if n then ws.place(p,n) end
end
end)
minetest.register_cheat("RailT",'Bots','scaffold_railtunnel')
@ -48,75 +102,71 @@ local function invcheck(item)
refill.refill_at(ws.dircoord(1,1,0),'railkit')
end
ws.rg("RailBot","Bots", "scaffold_rails", function()
local direction="north"
ws.rg("RailBot","Bots", "railbot", 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 lpn=minetest.get_node_or_nil(lp)
if bln and bln.name=="mesecons_torch:redstoneblock" and lpn and lpn.name == "mcl_minecarts:golden_rail_on" then
minetest.settings:set_bool('continuous_forward',true)
else
minetest.settings:set_bool('continuous_forward',false)
local goon=true
for i=-4,4,1 do
ws.dig(ws.dircoord(i,1,0))
if checknode(ws.dircoord(i,0,0)) then ws.dig(ws.dircoord(i,0,0)) end
if checknode(ws.dircoord(i,-1,0)) then ws.dig(ws.dircoord(i,-1,0)) end
scaffold.place_if_needed(ground, ws.dircoord(i,-1,0))
scaffold.place_if_needed(rails, ws.dircoord(i,0,0))
local lpn=minetest.get_node_or_nil(ws.dircoord(i,0,0))
local bln=minetest.get_node_or_nil(ws.dircoord(i,-1,0))
if not ( bln and bln.name=="mesecons_torch:redstoneblock" and lpn and lpn.name == "mcl_minecarts:golden_rail_on" ) then
goon=false
end
local lpos=ws.dircoord(i,2,0)
if is_lantern(lpos) then
local ln=minetest.get_node_or_nil(lpos)
if not ln or ln.name ~= 'mcl_ocean:sea_lantern' then
goon=false
ws.dig(lpos)
scaffold.place_if_needed({'mcl_ocean:sea_lantern'}, lpos)
end
end
end
minetest.after("0",function()
local frpos=ws.dircoord(1,0,0)
local fgpos=ws.dircoord(1,-1,0)
local rpos=ws.dircoord(0,0,0)
local gpos=ws.dircoord(0,-1,0)
scaffold.place_if_needed(ground, gpos)
scaffold.place_if_needed(rails, rpos)
scaffold.place_if_needed(ground, fgpos)
scaffold.place_if_needed(rails, frpos)
if (goon) then minetest.settings:set_bool('continuous_forward',true)
else minetest.settings:set_bool('continuous_forward',false) end
end)
if minetest.settings:get_bool('scaffold_railtunnel') then
scaffold.place_if_needed(tunnelmaterial, ws.dircoord(0,2,0))
scaffold.place_if_needed(tunnelmaterial, ws.dircoord(0,1,1))
scaffold.place_if_needed(tunnelmaterial, ws.dircoord(0,0,1))
scaffold.place_if_needed(tunnelmaterial, ws.dircoord(0,1,-1))
scaffold.place_if_needed(tunnelmaterial, ws.dircoord(0,0,-1))
end
end,
function()--startfunc
direction=ws.get_dir()
storage:set_string('BOTDIR', direction)
end,function() --stopfunc
direction=""
storage:set_string('BOTDIR',direction)
end,{'afly_axissnap','continuous_forward','autorefill'}) --'scaffold_ltbm'
end,{'scaffold_ltbm','snapyaw','continuous_forward'})
ws.on_connect(function()
sdir=storage:get_string('BOTDIR')
if sdir ~= "" then
ws.set_dir(sdir)
else
minetest.settings:set_bool('railbot',false)
end
end)
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
local pl=is_lantern(lp)
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()
scaffold.place_if_needed({'mcl_ocean:sea_lantern'}, lpos)
ws.place(lpos,'mcl_ocean:sea_lantern')
end)
end

View File

@ -0,0 +1,155 @@
local sq_pos1={x=-30800,y=1,z=-30800}
local sq_pos2={x=-30880,y=80,z=-30880}
local digging=false
local flying=false
local target=vector.new(0,0,0)
local function between(x, y, z) return y <= x and x <= z end -- x is between y and z (inclusive)
local function in_cube(tpos,wpos1,wpos2)
local xmax=wpos2.x
local xmin=wpos1.x
local ymax=wpos2.y
local ymin=wpos1.y
local zmax=wpos2.z
local zmin=wpos1.z
if wpos1.x > wpos2.x then
xmax=wpos1.x
xmin=wpos2.x
end
if wpos1.y > wpos2.y then
ymax=wpos1.y
ymin=wpos2.y
end
if wpos1.z > wpos2.z then
zmax=wpos1.z
zmin=wpos2.z
end
if between(tpos.x,xmin,xmax) and between(tpos.y,ymin,ymax) and between(tpos.z,zmin,zmax) then
return true
end
return false
end
local function get_nodes_in_range(range,air)
local lp=minetest.localplayer:get_pos()
local p1=vector.add(lp,{x=range,y=range,z=range})
local p2=vector.add(lp,{x=-range,y=-range,z=-range})
local nn=nlist.get_mclnodes()
if air then table.insert(nn,'air') end
local nds,cnt=minetest.find_nodes_in_area(p1,p2,nn,true)
local rt={}
for k,v in pairs(nds) do for kk,vv in pairs(v) do
local nd=minetest.get_node_or_nil(vv)
if nd then table.insert(rt,vv) end
end end
return rt
end
local function get_randompos(wpos1,wpos2)
local xmax=wpos2.x
local xmin=wpos1.x
local ymax=wpos2.y
local ymin=wpos1.y
local zmax=wpos2.z
local zmin=wpos1.z
if wpos1.x > wpos2.x then
xmax=wpos1.x
xmin=wpos2.x
end
if wpos1.y > wpos2.y then
ymax=wpos1.y
ymin=wpos2.y
end
if wpos1.z > wpos2.z then
zmax=wpos1.z
zmin=wpos2.z
end
return vector.new(math.random(xmin,xmax),math.random(ymin,ymax),math.random(zmin,zmax))
end
local nextdig=0
local function flythere(pos)
flying=true
minetest.settings:set_bool('noclip',false)
minetest.settings:set_bool('scaffold_quarrytool',true)
minetest.settings:set_bool("pitch_move",true)
minetest.settings:set_bool("free_move",true)
minetest.settings:set_bool("continuous_forward",true)
autofly.aim(pos)
core.set_keypress("special1", true)
end
local function stopflight()
flying=false
digging=true
minetest.settings:set_bool("continuous_forward",false)
minetest.settings:set_bool('scaffold_walltool',false)
minetest.settings:set_bool("noclip",false)
minetest.settings:set_bool("pitch_move",false)
core.set_keypress("special1", false)
end
local function do_nodes_in_range(action)
local nds={}
if action == 'dig' then nds=get_nodes_in_range(6)
else nds=get_nodes_in_range(6,true) end
if #nds > 0 then diggin=true else diggin=false end
for k,v in pairs(nds) do
if v then
--minetest.switch_to_item("mcl_books:book_written")
if action == 'dig' then
minetest.select_best_tool(minetest.get_node_or_nil(v).name)
minetest.dig_node(v)
else
local headpos=vector.add(minetest.localplayer:get_pos(),{x=0,y=0,z=0})
if vector.distance(headpos,v) == 0 then return end
scaffold.place_if_able(v)
end
end
end
end
--randomseed(os.clock())
scaffold.register_template_scaffold("QuarryTool", "scaffold_quarrytool", function(pos)
do_nodes_in_range('dig')
end)
scaffold.register_template_scaffold("PlaceRange", "scaffold_placer", function(pos)
do_nodes_in_range()
local headpos=vector.add(minetest.localplayer:get_pos(),vector.new(0,1,0))
local headnod=minetest.get_node_or_nil(headpos)
if headnod.name ~= 'air' then scaffold.dig(headpos) end
end)
local qbot_wason=false
ws.register_globalhacktemplate("QuarryBot", "Bots", "scaffold_quarrybot", function(pos)
local lp=minetest.localplayer:get_pos()
if not digging and not flying then
local nds=get_nodes_in_range(50)
if #nds == 0 then
target=get_randompos(sq_pos1,sq_pos2)
else
target=nds[math.random(#nds)]
end
flythere(target)
elseif vector.distance(lp,target) < 5 then
stopflight()
end
end,function()
scaffold.set_pos1(sq_pos1)
scaffold.set_pos2(sq_pos2)
minetest.settings:set_bool('scaffold_constrain',true)
minetest.settings:set_bool('scaffold_quarrytool',true)
end,function()
qbot_wason=false
flying=false
digging=false
minetest.settings:set_bool('scaffold_quarrytool',false)
stopflight()
end)