Compare commits
10 Commits
b097b98be4
...
8a59a40926
Author | SHA1 | Date | |
---|---|---|---|
|
8a59a40926 | ||
|
a63b0e40db | ||
|
037088a226 | ||
|
81942cdee5 | ||
|
482514e57c | ||
|
987276fde6 | ||
|
785ae94e65 | ||
|
22e03d384b | ||
|
f693b69999 | ||
|
3ca52fb0c0 |
@ -108,5 +108,6 @@ core.registered_on_nodemeta_form_open, core.register_on_nodemeta_form_open = mak
|
||||
core.registered_on_recieve_physics_override, core.register_on_recieve_physics_override = make_registration()
|
||||
core.registered_on_play_sound, core.register_on_play_sound = make_registration()
|
||||
core.registered_on_spawn_particle, core.register_on_spawn_particle = make_registration()
|
||||
core.registered_on_particle_spawner, core.register_on_particle_spawner = make_registration()
|
||||
core.registered_on_sending_inventory_fields, core.register_on_sending_inventory_fields = make_registration()
|
||||
core.registered_on_sending_nodemeta_fields, core.register_on_sending_nodemeta_fields = make_registration()
|
||||
core.registered_on_sending_nodemeta_fields, core.register_on_sending_nodemeta_fields = make_registration()
|
@ -7,6 +7,7 @@ ws.c = core
|
||||
|
||||
ws.range=4
|
||||
ws.target=nil
|
||||
ws.targetpos=nil
|
||||
|
||||
local nextact = {}
|
||||
local ghwason={}
|
||||
@ -181,6 +182,13 @@ function ws.get_hud_by_texture(texture)
|
||||
return def
|
||||
end
|
||||
|
||||
function ws.find_player(name)
|
||||
for k, v in ipairs(minetest.localplayer.get_nearby_objects(500)) do
|
||||
if v:get_name() == name then
|
||||
return v:get_pos(),v
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ws.display_wp(pos,name)
|
||||
local ix = #ws.displayed_wps + 1
|
||||
|
@ -1,8 +1,3 @@
|
||||
function sleep(s)
|
||||
local ntime = os.clock() + s/10
|
||||
repeat until os.clock() > ntime
|
||||
end
|
||||
|
||||
minetest.register_chatcommand("findnodes", {
|
||||
description = "Scan for one or multible nodes in a radius around you",
|
||||
param = "<radius> <node1>[,<node2>...]",
|
||||
@ -30,12 +25,6 @@ minetest.register_chatcommand("place", {
|
||||
return false, pos
|
||||
end,
|
||||
})
|
||||
minetest.register_chatcommand("screenshot", {
|
||||
description = "asdf",
|
||||
func = function()
|
||||
minetest.take_screenshot()
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("dig", {
|
||||
params = "<X>,<Y>,<Z>",
|
||||
@ -56,115 +45,4 @@ minetest.register_on_dignode(function(pos)
|
||||
end
|
||||
end)
|
||||
|
||||
local etime = 0
|
||||
|
||||
minetest.register_globalstep(function(dtime)
|
||||
etime = etime + dtime
|
||||
if etime < 1 then return end
|
||||
local player = minetest.localplayer
|
||||
if not player then return end
|
||||
local pos = player:get_pos()
|
||||
local item = player:get_wielded_item()
|
||||
local def = minetest.get_item_def(item:get_name())
|
||||
local nodes_per_tick = tonumber(minetest.settings:get("nodes_per_tick")) or 8
|
||||
if item:get_count() > 0 and def.node_placement_prediction ~= "" then
|
||||
if minetest.settings:get_bool("scaffold") then
|
||||
local p = vector.round(vector.add(pos, {x = 0, y = -0.6, z = 0}))
|
||||
local node = minetest.get_node_or_nil(p)
|
||||
if not node or minetest.get_node_def(node.name).buildable_to then
|
||||
minetest.place_node(p)
|
||||
end
|
||||
elseif minetest.settings:get_bool("mscaffold") then
|
||||
--local z = pos.z
|
||||
local positions = {
|
||||
{x = 0, y = -0.6, z = 0},
|
||||
{x = 1, y = -0.6, z = 0},
|
||||
{x = -1, y = -0.6, z = 0},
|
||||
|
||||
{x = -1, y = -0.6, z = -1},
|
||||
{x = 0, y = -0.6, z = -1},
|
||||
{x = 1, y = -0.6, z = -1},
|
||||
|
||||
{x = -1, y = -0.6, z = 1},
|
||||
{x = 0, y = -0.6, z = 1},
|
||||
{x = 1, y = -0.6, z = 1}
|
||||
|
||||
}
|
||||
for i, p in pairs(positions) do
|
||||
if i > nodes_per_tick then return end
|
||||
minetest.place_node(vector.add(pos,p))
|
||||
end
|
||||
|
||||
elseif minetest.settings:get_bool("highway_z") then
|
||||
local z = pos.z
|
||||
local positions = {
|
||||
{x = 0, y = 0, z = z},
|
||||
{x = 1, y = 0, z = z},
|
||||
{x = 2, y = 1, z = z},
|
||||
{x = -2, y = 1, z = z},
|
||||
{x = -2, y = 0, z = z},
|
||||
{x = -1, y = 0, z = z},
|
||||
{x = 2, y = 0, z = z}
|
||||
}
|
||||
for i, p in pairs(positions) do
|
||||
if i > nodes_per_tick then break end
|
||||
minetest.place_node(p)
|
||||
end
|
||||
elseif minetest.settings:get_bool("block_water") then
|
||||
local positions = minetest.find_nodes_near(pos, 5, {"mcl_core:water_source", "mcl_core:water_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_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
|
||||
elseif minetest.settings:get_bool("autotnt") then
|
||||
local positions = minetest.find_nodes_near_under_air_except(pos, 5, item:get_name(), true)
|
||||
for i, p in pairs(positions) do
|
||||
if i > nodes_per_tick then break end
|
||||
minetest.place_node(vector.add(p, {x = 0, y = 1, z = 0}))
|
||||
end
|
||||
end
|
||||
end
|
||||
if minetest.settings:get_bool("nuke") then
|
||||
local i = 0
|
||||
for x = pos.x - 4, pos.x + 4 do
|
||||
for y = pos.y - 4, pos.y + 4 do
|
||||
for z = pos.z - 4, pos.z + 4 do
|
||||
local p = vector.new(x, y, z)
|
||||
local node = minetest.get_node_or_nil(p)
|
||||
local def = node and minetest.get_node_def(node.name)
|
||||
if def and def.diggable then
|
||||
if i > nodes_per_tick then return end
|
||||
minetest.dig_node(p)
|
||||
i = i + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_cheat("mScaffold", "World", "mscaffold")
|
||||
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")
|
||||
minetest.register_cheat("Replace", "World", "replace")
|
@ -7,10 +7,19 @@ incremental_tp.tpactive=false
|
||||
|
||||
-- for Clamity
|
||||
incremental_tp.max_instantaneous_tp = {
|
||||
x = 6,
|
||||
y = 50,
|
||||
z = 6
|
||||
x = 5,
|
||||
y = 45,
|
||||
z = 5
|
||||
}
|
||||
|
||||
function incremental_tp.get_actual_speed()
|
||||
local po=minetest.localplayer:get_physics_override()
|
||||
local rt=vector.new()
|
||||
rt.x=incremental_tp.max_instantaneous_tp.x * po.speed
|
||||
rt.y=incremental_tp.max_instantaneous_tp.y * po.speed
|
||||
rt.z=incremental_tp.max_instantaneous_tp.z * po.speed
|
||||
return rt
|
||||
end
|
||||
local wason=false
|
||||
local function sign(n)
|
||||
if n == 0 then
|
||||
@ -21,7 +30,7 @@ local function sign(n)
|
||||
end
|
||||
|
||||
local function max_dist_per(vec, time)
|
||||
local mitp = vector.multiply(incremental_tp.max_instantaneous_tp,
|
||||
local mitp = vector.multiply(incremental_tp.get_actual_speed(),
|
||||
incremental_tp.fudge)
|
||||
local nvec = {x = 0, y = 0, z = 0}
|
||||
nvec.x = sign(vec.x) * math.min(math.abs(vec.x), mitp.x * time)
|
||||
@ -41,10 +50,10 @@ local function tpstep(target, time, second, variance,sfunc)
|
||||
end
|
||||
wason=true
|
||||
incremental_tp.tpactive=true
|
||||
if math.abs(vec.x) + math.abs(vec.y) + math.abs(vec.z) < 1 then
|
||||
if vector.distance(pos,target) < 3 then
|
||||
minetest.localplayer:set_pos(target)
|
||||
incremental_tp.tpactive=false
|
||||
minetest.display_chat_message("Arrived at " .. minetest.pos_to_string(target))
|
||||
--minetest.display_chat_message("Arrived at " .. minetest.pos_to_string(target))
|
||||
if sfunc then
|
||||
minetest.after(time, function()
|
||||
sfunc(target)
|
||||
@ -64,22 +73,31 @@ local function tpstep(target, time, second, variance,sfunc)
|
||||
end
|
||||
|
||||
local nvec = max_dist_per(vec, intime)
|
||||
|
||||
minetest.localplayer:set_pos(vector.add(pos, nvec))
|
||||
|
||||
local trg=vector.add(pos, nvec)
|
||||
--local safe=ws.find_closest_reachable_airpocket(trg)
|
||||
minetest.localplayer:set_pos(trg)
|
||||
minetest.after(intime, function()
|
||||
tpstep(target, time, second - intime, variance,sfunc)
|
||||
end)
|
||||
end
|
||||
|
||||
function incremental_tp.tp(target, time, variance)
|
||||
function incremental_tp.tpstep(target, time, variance,sfunc)
|
||||
if incremental_tp.tpactive then return end
|
||||
tpstep(target, time, 1, variance)
|
||||
tpstep(target, time, 1, variance,sfunc)
|
||||
end
|
||||
|
||||
function incremental_tp.tp(target, time, variance)
|
||||
incremental_tp.tpactive=false
|
||||
minetest.after(time,function()
|
||||
tpstep(target,time,1,variance)
|
||||
end)
|
||||
end
|
||||
|
||||
function incremental_tp.tpafter(target,time,variance,sfunc)
|
||||
if incremental_tp.tpactive then return end
|
||||
tpstep(target,time,1,variance,sfunc)
|
||||
incremental_tp.tpactive=false
|
||||
minetest.after(time,function()
|
||||
tpstep(target,time,1,variance,sfunc)
|
||||
end)
|
||||
end
|
||||
|
||||
if autofly then autofly.register_transport('itp',function(pos,name) incremental_tp.tp(pos,1) end) end
|
||||
|
108
clientmods/nlist/forms.lua
Normal file
108
clientmods/nlist/forms.lua
Normal file
@ -0,0 +1,108 @@
|
||||
local selected_name = false
|
||||
local formspec_list = {}
|
||||
function ws.display_list_formspec(fname,list,funcs)
|
||||
funcs={}
|
||||
local formspec = 'size[6.25,9]' ..
|
||||
'label[0,0;NodeLists]' ..
|
||||
'button_exit[0,7.5;1,0.5;display;Show]' ..
|
||||
'button[3.625,7.5;1.3,0.5;rename;Rename]' ..
|
||||
'button[4.9375,7.5;1.3,0.5;delete;Delete]'
|
||||
local sp=0
|
||||
|
||||
for k,v in pairs(funcs) do
|
||||
formspec=formspec..'button_exit['..sp..',8.5;1,0.5;'..v.name..';'..v.name..']'
|
||||
sp=sp+0.8
|
||||
end
|
||||
|
||||
formspec=formspec..'textlist[0,0.75;6,6;marker;'
|
||||
local selected = 1
|
||||
formspec_list = {}
|
||||
if not list then list={} end
|
||||
for id, name in ipairs(list) do
|
||||
if id > 1 then
|
||||
formspec = formspec .. ','
|
||||
end
|
||||
if not selected_name then
|
||||
selected_name = name
|
||||
end
|
||||
if name == selected_name then
|
||||
selected = id
|
||||
end
|
||||
formspec_list[#formspec_list + 1] = name
|
||||
formspec = formspec .. '##' .. minetest.formspec_escape(name)
|
||||
end
|
||||
|
||||
formspec = formspec .. ';' .. tostring(selected) .. ']'
|
||||
|
||||
if selected_name then
|
||||
local val=list[selected]
|
||||
if val then
|
||||
formspec = formspec .. 'label[0,6.75;' .. selected_name .. ']'
|
||||
end
|
||||
else
|
||||
formspec = formspec .. 'button_exit[0,7.5;5.25,0.5;quit;Close dialog]' ..
|
||||
'label[0,6.75;No Entries.]'
|
||||
end
|
||||
|
||||
return minetest.show_formspec(fname, formspec)
|
||||
end
|
||||
|
||||
minetest.register_on_formspec_input(function(formname, fields)
|
||||
local fname="NodeLists"
|
||||
if formname == 'NodeLists-ignore' then
|
||||
return true
|
||||
elseif formname ~= "NodeLists" then
|
||||
return
|
||||
end
|
||||
local name = selected_name
|
||||
|
||||
if name then
|
||||
for k,v in pairs(autofly.registered_transports) do
|
||||
if fields[v.name] then
|
||||
if not v.func(autofly.get_waypoint(name),name) then
|
||||
minetest.display_chat_message('Error with '..v.name)
|
||||
end
|
||||
end
|
||||
end
|
||||
if fields.display then
|
||||
if not autofly.display_waypoint(name) then
|
||||
minetest.display_chat_message('Error displaying waypoint!')
|
||||
end
|
||||
elseif fields.rename then
|
||||
minetest.show_formspec(fname, 'size[6,3]' ..
|
||||
'label[0.35,0.2;Rename waypoint]' ..
|
||||
'field[0.3,1.3;6,1;new_name;New name;' ..
|
||||
minetest.formspec_escape(name) .. ']' ..
|
||||
'button[0,2;3,1;cancel;Cancel]' ..
|
||||
'button[3,2;3,1;rename_confirm;Rename]')
|
||||
elseif fields.rename_confirm then
|
||||
if fields.new_name and #fields.new_name > 0 then
|
||||
if nlist.rename(name, fields.new_name) then
|
||||
selected_name = fields.new_name
|
||||
else
|
||||
minetest.display_chat_message('Error renaming!')
|
||||
end
|
||||
ws.display_list_formspec()
|
||||
else
|
||||
minetest.display_chat_message('Please enter a new name for the entry.')
|
||||
end
|
||||
elseif fields.delete then
|
||||
minetest.show_formspec(fname, 'size[6,2]' ..
|
||||
'label[0.35,0.25;Are you sure you want to delete this waypoint?]' ..
|
||||
'button[0,1;3,1;cancel;Cancel]' ..
|
||||
'button[3,1;3,1;delete_confirm;Delete]')
|
||||
elseif fields.delete_confirm then
|
||||
autofly.delete_waypoint(name)
|
||||
selected_name = false
|
||||
ws.display_list_formspec()
|
||||
elseif fields.cancel then
|
||||
ws.display_list_formspec()
|
||||
elseif name ~= selected_name then
|
||||
selected_name = name
|
||||
ws.display_list_formspec()
|
||||
end
|
||||
elseif fields.display or fields.delete then
|
||||
minetest.display_chat_message('Please select a waypoint.')
|
||||
end
|
||||
return true
|
||||
end)
|
@ -3,20 +3,25 @@
|
||||
local category = "Scaffold"
|
||||
|
||||
scaffold = {}
|
||||
scaffold.registered_scaffolds = {}
|
||||
scaffold.lockdir = false
|
||||
scaffold.locky = false
|
||||
scaffold.constrain1 = false
|
||||
scaffold.constrain2 = false
|
||||
local hwps={}
|
||||
|
||||
local multiscaff_width=5
|
||||
local multiscaff_depth=1
|
||||
local multiscaff_above=0
|
||||
local multiscaff_mod=1
|
||||
|
||||
local storage=minetest.get_mod_storage()
|
||||
|
||||
scaffold.wason = {}
|
||||
|
||||
local nextact = {}
|
||||
local nodes_per_tick = 8
|
||||
|
||||
local towerbot_height = 75
|
||||
local function setnpt()
|
||||
nodes_per_tick = tonumber(minetest.settings:get("nodes_per_tick")) or 8
|
||||
end
|
||||
|
||||
function scaffold.template(setting, func, offset, funcstop )
|
||||
offset = offset or {x = 0, y = -1, z = 0}
|
||||
@ -216,144 +221,172 @@ dofile(mpath .. "/wallbot.lua")
|
||||
dofile(mpath .. "/ow2bot.lua")
|
||||
dofile(mpath .. "/atower.lua")
|
||||
--dofile(mpath .. "/squarry.lua")
|
||||
local snapdir="north"
|
||||
ws.rg('DigHead','Player','dighead',function() ws.dig(ws.dircoord(0,1,0)) end)
|
||||
ws.rg('SnapYaw','Bots','snapyaw',function() ws.setdir(snapdir) end,function() snapdir=ws.getdir() end)
|
||||
|
||||
|
||||
scaffold.register_template_scaffold("Constrain", "scaffold_constrain", function()end,false,function() scaffold.reset() end)
|
||||
|
||||
ws.rg("LockYaw","Scaffold", "scaffold_lockyaw", function(pos)
|
||||
if minetest.settings:get_bool("freecam") then return end
|
||||
local y=minetest.localplayer:get_yaw()
|
||||
local yy=nil
|
||||
if ( y < 45 or y > 315 ) then
|
||||
yy=0
|
||||
elseif (y < 135) then
|
||||
yy=90
|
||||
elseif (y < 225 ) then
|
||||
yy=180
|
||||
elseif ( y < 315 ) then
|
||||
yy=270
|
||||
end
|
||||
if yy ~= nil then
|
||||
minetest.localplayer:set_yaw(yy)
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
scaffold.register_template_scaffold("CheckScaffold", "scaffold_check", function(pos)
|
||||
scaffold.place_if_able(pos)
|
||||
end)
|
||||
|
||||
scaffold.register_template_scaffold("HereScaffold", "scaffold_here", function(pos)
|
||||
scaffold.place_if_able(pos)
|
||||
end, {x = 0, y = 0, z = 0})
|
||||
|
||||
scaffold.register_template_scaffold("WaterScaffold", "scaffold_water", function(pos)
|
||||
if (pos.x % 2 + pos.z % 2) == 0 then
|
||||
scaffold.place_if_needed({
|
||||
"mcl_buckets:bucket_water",
|
||||
"mcl_core:water_source"
|
||||
}, pos)
|
||||
end
|
||||
end)
|
||||
scaffold.register_template_scaffold("WaterSpam", "scaffold_spamwater", function()
|
||||
ws.do_area(3,function(pos)
|
||||
scaffold.place_if_needed({
|
||||
"mcl_buckets:bucket_water",
|
||||
"mcl_core:water_source"
|
||||
}, pos)
|
||||
end,true)
|
||||
|
||||
end)
|
||||
local function checknode(pos)
|
||||
local node = minetest.get_node_or_nil(pos)
|
||||
if node then return true end
|
||||
return false
|
||||
end
|
||||
|
||||
scaffold.register_template_scaffold("TBM", "scaffold_tbm", function(pos)
|
||||
scaffold.dig(ws.dircoord(1,1,0))
|
||||
scaffold.dig(ws.dircoord(1,0,0))
|
||||
minetest.register_chatcommand('scaffw', {
|
||||
func = function(param) multiscaff_width=tonumber(param) end
|
||||
})
|
||||
minetest.register_chatcommand('scaffd', {
|
||||
func = function(param) multiscaff_depth=tonumber(param) end
|
||||
})
|
||||
minetest.register_chatcommand('scaffa', {
|
||||
func = function(param) multiscaff_above=tonumber(param) end
|
||||
})
|
||||
minetest.register_chatcommand('scaffm', {
|
||||
func = function(param) multiscaff_mod=tonumber(param) end
|
||||
})
|
||||
|
||||
local multiscaff_node=nil
|
||||
ws.rg('MultiScaff','Scaffold','scaffold',function()
|
||||
if not multiscaff_node then return end
|
||||
local n=math.floor(multiscaff_width/2)
|
||||
for i=-n,n do
|
||||
for j=(multiscaff_depth * -1), -1 do
|
||||
local p=ws.dircoord(0,j,i)
|
||||
local nd=minetest.get_node_or_nil(p)
|
||||
ws.place(p,{multiscaff_node})
|
||||
end
|
||||
end
|
||||
end,function()
|
||||
multiscaff_node=minetest.localplayer:get_wielded_item():get_name()
|
||||
ws.dcm("Multiscaff started. Width: "..multiscaff_width..', depth:'..multiscaff_depth..' Selected node: '..multiscaff_node)
|
||||
end,function()
|
||||
ws.dcm("Multiscaff stopped")
|
||||
end)
|
||||
scaffold.register_template_scaffold("TallTBM", "scaffold_ttbm", function(pos)
|
||||
pos = {
|
||||
|
||||
ws.dircoord(1,4,2),
|
||||
ws.dircoord(1,3,2),
|
||||
ws.dircoord(1,2,2),
|
||||
ws.dircoord(1,1,2),
|
||||
ws.dircoord(1,0,2),
|
||||
|
||||
ws.dircoord(1,4,-2),
|
||||
ws.dircoord(1,3,-2),
|
||||
ws.dircoord(1,2,-2),
|
||||
ws.dircoord(1,1,-2),
|
||||
ws.dircoord(1,0,-2),
|
||||
|
||||
|
||||
ws.dircoord(1,4,1),
|
||||
ws.dircoord(1,3,1),
|
||||
ws.dircoord(1,2,1),
|
||||
ws.dircoord(1,1,1),
|
||||
ws.dircoord(1,0,1),
|
||||
|
||||
ws.dircoord(1,4,-1),
|
||||
ws.dircoord(1,3,-1),
|
||||
ws.dircoord(1,2,-1),
|
||||
ws.dircoord(1,1,-1),
|
||||
ws.dircoord(1,0,-1),
|
||||
|
||||
ws.dircoord(1,4,0),
|
||||
ws.dircoord(1,3,0),
|
||||
ws.dircoord(1,2,0),
|
||||
ws.dircoord(1,1,0),
|
||||
ws.dircoord(1,0,0)
|
||||
}
|
||||
ws.dignodes(pos)
|
||||
|
||||
minetest.settings:set_bool('continuous_forward',true)
|
||||
for k,v in pairs(pos) do
|
||||
local n=minetest.get_node_or_nil(v)
|
||||
if not n or n.name ~= "air" then
|
||||
minetest.settings:set_bool('continuous_forward',false)
|
||||
end
|
||||
end
|
||||
ws.rg('MScaffModulo','Scaffold','multiscaffm',function()
|
||||
if not multiscaff_node then return end
|
||||
ws.switch_to_item(multiscaff_node)
|
||||
local n=math.floor(multiscaff_width/2)
|
||||
for i=-n,n do
|
||||
for j=(multiscaff_depth * -1), -1 do
|
||||
local p=vector.round(ws.dircoord(0,j,i))
|
||||
if p.z % multiscaff_mod == 0 then
|
||||
if p.x % multiscaff_mod ~=0 then
|
||||
core.place_node(p)
|
||||
end
|
||||
else
|
||||
if p.x % multiscaff_mod == 0 then
|
||||
core.place_node(p)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end,function()
|
||||
multiscaff_node=minetest.localplayer:get_wielded_item():get_name()
|
||||
ws.dcm("ModuloScaff started. Width: "..multiscaff_width..', depth:'..multiscaff_depth..' Selected node: '..multiscaff_node)
|
||||
end,function()
|
||||
ws.dcm("Moduloscaff stopped")
|
||||
end)
|
||||
|
||||
|
||||
|
||||
|
||||
scaffold.register_template_scaffold("TriScaffold", "scaffold_three_wide", function(pos)
|
||||
scaffold.place_if_able(pos)
|
||||
scaffold.place_if_able(ws.dircoord(0, -1, 1))
|
||||
scaffold.place_if_able(ws.dircoord(0, -1, -1))
|
||||
scaffold.register_template_scaffold("WallScaffold", "scaffold_five_down", function(pos)
|
||||
scaffold.place_if_able(ws.dircoord(0, -1, 0))
|
||||
scaffold.place_if_able(ws.dircoord(0, -2, 0))
|
||||
scaffold.place_if_able(ws.dircoord(0, -3, 0))
|
||||
scaffold.place_if_able(ws.dircoord(0, -4, 0))
|
||||
scaffold.place_if_able(ws.dircoord(0, -5, 0))
|
||||
end)
|
||||
|
||||
|
||||
scaffold.register_template_scaffold("headTriScaff", "scaffold_three_wide_head", function(pos)
|
||||
scaffold.place_if_able(ws.dircoord(0, 3, 0))
|
||||
scaffold.place_if_able(ws.dircoord(0, 3, 1))
|
||||
scaffold.place_if_able(ws.dircoord(0, 3, -1))
|
||||
end)
|
||||
|
||||
scaffold.register_template_scaffold("QuintScaffold", "scaffold_five_wide", function(pos)
|
||||
scaffold.place_if_able(pos)
|
||||
scaffold.place_if_able(ws.dircoord(0, -1, 1))
|
||||
scaffold.place_if_able(ws.dircoord(0, -1, -1))
|
||||
scaffold.place_if_able(ws.dircoord(0, -1, 2))
|
||||
scaffold.place_if_able(ws.dircoord(0, -1, -2))
|
||||
scaffold.register_template_scaffold("RandomScaff", "scaffold_rnd", function(below)
|
||||
local n = minetest.get_node_or_nil(below)
|
||||
local nl=nlist.get('randomscaffold')
|
||||
table.shuffle(nl)
|
||||
if n and not scaffold.in_list(n.name, nl) then
|
||||
scaffold.dig(below)
|
||||
scaffold.place_if_needed(nl, below)
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
if nlist then
|
||||
scaffold.register_template_scaffold("RandomScaff", "scaffold_rnd", function(below)
|
||||
local n = minetest.get_node_or_nil(below)
|
||||
local nl=nlist.get('randomscaffold')
|
||||
table.shuffle(nl)
|
||||
if n and not scaffold.in_list(n.name, nl) then
|
||||
scaffold.dig(below)
|
||||
scaffold.place_if_needed(nl, below)
|
||||
ws.rg("HighwayZ","World","highwayz",function()
|
||||
local positions = {
|
||||
{x = 0, y = 0, z = z},
|
||||
{x = 1, y = 0, z = z},
|
||||
{x = 2, y = 1, z = z},
|
||||
{x = -2, y = 1, z = z},
|
||||
{x = -2, y = 0, z = z},
|
||||
{x = -1, y = 0, z = z},
|
||||
{x = 2, y = 0, z = z}
|
||||
}
|
||||
for i, p in pairs(positions) do
|
||||
if i > nodes_per_tick then break end
|
||||
minetest.place_node(p)
|
||||
end
|
||||
|
||||
end, setnpt)
|
||||
|
||||
ws.rg("BlockWater","World","block_water",function()
|
||||
local lp=ws.dircoord(0,0,0)
|
||||
local positions = minetest.find_nodes_near(lp, 5, {"mcl_core:water_source", "mcl_core:water_flowing"}, true)
|
||||
for i, p in pairs(positions) do
|
||||
if i > nodes_per_tick then return end
|
||||
minetest.place_node(p)
|
||||
end
|
||||
end,setnpt)
|
||||
|
||||
ws.rg("BlockLava","World","block_lava",function()
|
||||
local lp=ws.dircoord(0,0,0)
|
||||
local positions = minetest.find_nodes_near(lp, 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
|
||||
end,setnpt)
|
||||
|
||||
ws.rg("BlockSources","World","block_sources",function()
|
||||
local lp=ws.dircoord(0,0,0)
|
||||
local positions = minetest.find_nodes_near(lp, 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
|
||||
end)
|
||||
end
|
||||
|
||||
if i > nodes_per_tick then return end
|
||||
minetest.place_node(p)
|
||||
end
|
||||
end,setnpt)
|
||||
|
||||
ws.rg("PlaceOnTop","World","place_on_top",function()
|
||||
local lp=ws.dircoord(0,0,0)
|
||||
local positions = minetest.find_nodes_near_under_air_except(lp, 5, item:get_name(), true)
|
||||
for i, p in pairs(positions) do
|
||||
if i > nodes_per_tick then break end
|
||||
minetest.place_node(vector.add(p, {x = 0, y = 1, z = 0}))
|
||||
end
|
||||
end,setnpt)
|
||||
|
||||
ws.rg("Nuke","World","nuke",function()
|
||||
local pos=ws.dircoord(0,0,0)
|
||||
local i = 0
|
||||
for x = pos.x - 4, pos.x + 4 do
|
||||
for y = pos.y - 4, pos.y + 4 do
|
||||
for z = pos.z - 4, pos.z + 4 do
|
||||
local p = vector.new(x, y, z)
|
||||
local node = minetest.get_node_or_nil(p)
|
||||
local def = node and minetest.get_node_def(node.name)
|
||||
if def and def.diggable then
|
||||
if i > nodes_per_tick then return end
|
||||
minetest.dig_node(p)
|
||||
i = i + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end,setnpt)
|
@ -4,7 +4,7 @@
|
||||
--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 direction = ""
|
||||
local ground = {
|
||||
"mesecons_torch:redstoneblock"
|
||||
}
|
||||
@ -16,16 +16,20 @@ local rails = {
|
||||
|
||||
local tunnelmaterial = {
|
||||
'mcl_core:glass_light_blue',
|
||||
'mcl_core:glass',
|
||||
'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 lightblock = "mcl_ocean:sea_lantern"
|
||||
--local lightblock = "mcl_nether:glowstone"
|
||||
|
||||
local function is_rail(pos)
|
||||
pos=vector.round(pos)
|
||||
if pos.y ~= 1 then return false end
|
||||
@ -46,7 +50,7 @@ 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
|
||||
if is_rail(vector.add(pos,{x=0,y=-1,x=0})) then
|
||||
return "mesecons_torch:redstoneblock"
|
||||
end
|
||||
return false
|
||||
@ -67,34 +71,72 @@ local function is_lantern(pos)
|
||||
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')
|
||||
local function checknode(pos)
|
||||
local lp = ws.dircoord(0,0,0)
|
||||
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 pos.y == lp.y then
|
||||
if node and not node.name:find("_rail") then return true end
|
||||
elseif node and node.name ~="mesecons_torch:redstoneblock" then return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function dignodes(poss)
|
||||
for k,v in pairs(poss) do
|
||||
if checknode(v) then ws.dig(v) end
|
||||
end
|
||||
end
|
||||
local function blockliquids()
|
||||
local lp=ws.lp:get_pos()
|
||||
local liquids={'mcl_core:lava_source','mcl_core:water_source','mcl_core:lava_flowing','mcl_core:water_flowing'}
|
||||
local bn=minetest.find_nodes_near(lp, 1, liquids, true)
|
||||
|
||||
local function findliquids(pos,range)
|
||||
range = range or 1
|
||||
if not pos then return end
|
||||
local liquids={'mcl_core:lava_source','mcl_core:water_source','mcl_core:lava_flowing','mcl_core:water_flowing','mcl_nether:nether_lava_source','mcl_nether:nether_lava_flowing'}
|
||||
local bn=minetest.find_nodes_near(pos, range, liquids, true)
|
||||
if #bn < 0 then return bn end
|
||||
return false
|
||||
end
|
||||
|
||||
local function blockliquids(pos)
|
||||
if not pos then return end
|
||||
local lp=ws.dircoord(0,0,0)
|
||||
local liquids={'mcl_core:lava_source','mcl_core:water_source','mcl_core:lava_flowing','mcl_core:water_flowing','mcl_nether:nether_lava_source','mcl_nether:nether_lava_flowing'}
|
||||
local bn=minetest.find_nodes_near(pos, 1, liquids, true)
|
||||
local rt=false
|
||||
if not bn then return rt end
|
||||
for kk,vv in pairs(bn) do
|
||||
if vv.y > lp.y then scaffold.place_if_needed(tunnelmaterial,vv) end
|
||||
if vv.y > lp.y - 1 or vv.y < -40 then
|
||||
rt=true
|
||||
scaffold.place_if_needed(tunnelmaterial,vv)
|
||||
for i=-4,5,1 do
|
||||
local tpos=vector.new(pos.x,lp.y,pos.z)
|
||||
scaffold.place_if_needed(tunnelmaterial,ws.dircoord(i,2,0,tpos))
|
||||
scaffold.place_if_needed(tunnelmaterial,ws.dircoord(i,0,1,tpos))
|
||||
scaffold.place_if_needed(tunnelmaterial,ws.dircoord(i,1,1,tpos))
|
||||
scaffold.place_if_needed(tunnelmaterial,ws.dircoord(i,0,-1,tpos))
|
||||
scaffold.place_if_needed(tunnelmaterial,ws.dircoord(i,1,-1,tpos))
|
||||
end
|
||||
end
|
||||
end
|
||||
return rt
|
||||
end
|
||||
|
||||
local function digob(sc)
|
||||
local obpos={
|
||||
ws.dircoord(0,1,2,sc),
|
||||
ws.dircoord(0,1,-2,sc),
|
||||
ws.dircoord(0,1,1,sc),
|
||||
ws.dircoord(0,1,-1,sc),
|
||||
ws.dircoord(0,0,1,sc),
|
||||
ws.dircoord(0,0,-1,sc)
|
||||
}
|
||||
ws.dignodes(obpos,function(pos)
|
||||
local nd=minetest.get_node_or_nil(pos)
|
||||
if nd and (nd.name == "mcl_core:obsidian" or nd.name == "mcl_minecarts:golden_rail_on" or nd.name == "mcl_minecarts:golden_rail" )then return true end
|
||||
return false
|
||||
end)
|
||||
end
|
||||
|
||||
local function invcheck(item)
|
||||
@ -102,59 +144,164 @@ local function invcheck(item)
|
||||
refill.refill_at(ws.dircoord(1,1,0),'railkit')
|
||||
end
|
||||
|
||||
local direction="north"
|
||||
local function invcheck(item)
|
||||
if mintetest.switch_to_item(item) then return true end
|
||||
refill.refill_at(ws.dircoord(1,1,0),'railkit')
|
||||
end
|
||||
local function rnd(n)
|
||||
return math.ceil(n)
|
||||
end
|
||||
|
||||
local function fmt(c)
|
||||
return tostring(rnd(c.x))..","..tostring(rnd(c.y))..","..tostring(rnd(c.z))
|
||||
end
|
||||
local function map_pos(value)
|
||||
if value.x then
|
||||
return value
|
||||
else
|
||||
return {x = value[1], y = value[2], z = value[3]}
|
||||
end
|
||||
end
|
||||
|
||||
local function invparse(location)
|
||||
if type(location) == "string" then
|
||||
if string.match(location, "^[-]?[0-9]+,[-]?[0-9]+,[-]?[0-9]+$") then
|
||||
return "nodemeta:" .. location
|
||||
else
|
||||
return location
|
||||
end
|
||||
elseif type(location) == "table" then
|
||||
return "nodemeta:" .. fmt(map_pos(location))
|
||||
end
|
||||
end
|
||||
|
||||
local function take_railkit(pos)
|
||||
local plinv = minetest.get_inventory(invparse(pos))
|
||||
local epos=ws.find_named(plinv,'railkit')
|
||||
local mv = InventoryAction("move")
|
||||
mv:from(invparse(pos), "main", epos)
|
||||
mv:to("current_player", "main", 8)
|
||||
mv:apply()
|
||||
minetest.localplayer:set_wield_index(8)
|
||||
return true
|
||||
|
||||
end
|
||||
|
||||
local restashing=false
|
||||
function scaffold.restash()
|
||||
if restashing then return end
|
||||
restashing=true
|
||||
ws.dig(ws.dircoord(1,0,1))
|
||||
ws.dig(ws.dircoord(1,1,1))
|
||||
ws.dig(ws.dircoord(2,0,1))
|
||||
ws.dig(ws.dircoord(2,1,1))
|
||||
|
||||
ws.place(ws.dircoord(1,0,1),{'mcl_chests:chest_small','mcl_chests:chest'})
|
||||
ws.place(ws.dircoord(1,1,1),{'railroad'})
|
||||
take_railkit(ws.dircoord(1,1,1))
|
||||
minetest.after("0.5",function()
|
||||
ws.place(ws.dircoord(2,0,1),{'railkit'})
|
||||
ws.dig(ws.dircoord(1,1,1))
|
||||
end)
|
||||
minetest.after("1.0",function()
|
||||
autodupe.invtake(ws.dircoord(2,0,1))
|
||||
restashing=false
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
local function slowdown(s)
|
||||
minetest.localplayer:set_velocity(vector.new(0,0,0))
|
||||
minetest.settings:set('movement_speed_fast',math.abs(s))
|
||||
end
|
||||
local fullspeed=100
|
||||
local function speedup()
|
||||
minetest.settings:set('movement_speed_fast',fullspeed)
|
||||
end
|
||||
|
||||
|
||||
ws.rg("RailBot","Bots", "railbot", function()
|
||||
local lp = ws.dircoord(0,0,0)
|
||||
local below = ws.dircoord(0,-1,0)
|
||||
blockliquids()
|
||||
|
||||
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 oldi=500
|
||||
for i=-50,50,1 do
|
||||
local lpos=ws.dircoord(i,2,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))
|
||||
local ltpn=minetest.get_node_or_nil(lpos)
|
||||
if not bln or not lpn or not ltpn then
|
||||
speedup()
|
||||
elseif ( is_lantern(lpos) and ltpn.name ~= lightblock ) then
|
||||
if (oldi > i) then
|
||||
slowdown(8)
|
||||
oldi=i
|
||||
end
|
||||
elseif bln.name=="mesecons_torch:redstoneblock" and lpn.name == "mcl_minecarts:golden_rail_on" then
|
||||
speedup()
|
||||
else
|
||||
if (oldi > i) then
|
||||
slowdown(8)
|
||||
oldi=i
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local goon=false
|
||||
for i=-4,4,1 do
|
||||
local lpos=ws.dircoord(i,2,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))
|
||||
local lpos=ws.dircoord(i,2,0)
|
||||
|
||||
if not ( bln and bln.name=="mesecons_torch:redstoneblock" and lpn and lpn.name == "mcl_minecarts:golden_rail_on" ) then
|
||||
goon=false
|
||||
else
|
||||
goon=true
|
||||
end
|
||||
|
||||
digob(ws.dircoord(i,0,0))
|
||||
|
||||
blockliquids(ws.dircoord(i,1,0))
|
||||
blockliquids(ws.dircoord(i,0,0))
|
||||
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
|
||||
ws.place(ws.dircoord(i,-1,0),ground,7)
|
||||
ws.place(ws.dircoord(i,0,0),rails,6)
|
||||
|
||||
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
|
||||
if not ln or ln.name ~= lightblock then
|
||||
goon=false
|
||||
ws.dig(lpos)
|
||||
scaffold.place_if_needed({'mcl_ocean:sea_lantern'}, lpos)
|
||||
ws.place(lpos,{lightblock},5)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (goon) then minetest.settings:set_bool('continuous_forward',true)
|
||||
else minetest.settings:set_bool('continuous_forward',false) end
|
||||
if (goon) then
|
||||
local dir=ws.getdir()
|
||||
local lp=minetest.localplayer:get_pos()
|
||||
local rlp=vector.round(lp)
|
||||
minetest.localplayer:set_pos(vector.new(rlp.x,lp.y,rlp.z))
|
||||
minetest.settings:set_bool('continuous_forward',true)
|
||||
else
|
||||
slowdown(5)
|
||||
minetest.localplayer:set_velocity(vector.new(0,0,0))
|
||||
minetest.settings:set_bool('continuous_forward',false)
|
||||
end
|
||||
|
||||
|
||||
end,
|
||||
function()--startfunc
|
||||
direction=ws.get_dir()
|
||||
storage:set_string('BOTDIR', direction)
|
||||
minetest.settings:set('movement_speed_fast',500)
|
||||
minetest.settings:set_bool('continuous_forward',false)
|
||||
end,function() --stopfunc
|
||||
direction=""
|
||||
storage:set_string('BOTDIR',direction)
|
||||
end,{'afly_axissnap','continuous_forward','autorefill'}) --'scaffold_ltbm'
|
||||
minetest.localplayer:set_velocity(vector.new(0,0,0))
|
||||
minetest.settings:set('movement_speed_fast',20)
|
||||
minetest.settings:set_bool('continuous_forward',false)
|
||||
end,{'afly_snap','autorefill'}) --'scaffold_ltbm'
|
||||
|
||||
|
||||
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()
|
||||
@ -163,12 +310,9 @@ scaffold.register_template_scaffold("LanternTBM", "scaffold_ltbm", function()
|
||||
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
|
||||
if nd and nd.name ~= lightblock 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)
|
||||
ws.place(lpos,lightblock,5)
|
||||
end
|
||||
end
|
||||
end)
|
||||
end)
|
@ -26,9 +26,9 @@ local function normvec(vec)
|
||||
vec.z=vec.z - 30927
|
||||
return vec
|
||||
end
|
||||
local wall_pos1={x=-1254,y=4,z=791}
|
||||
local wall_pos1={x=-1254,y=-4,z=791}
|
||||
local wall_pos2={x=-1454,y=80,z=983}
|
||||
local iwall_pos1={x=-1264,y=4,z=801}
|
||||
local iwall_pos1={x=-1264,y=-4,z=801}
|
||||
local iwall_pos2={x=-1444,y=80,z=973}
|
||||
|
||||
local function in_cube(tpos,wpos1,wpos2)
|
||||
@ -152,18 +152,17 @@ scaffold.register_template_scaffold("WallTool", "scaffold_walltool", function(po
|
||||
local i=1
|
||||
local nds=minetest.find_nodes_near(lp,10,{'air'})
|
||||
for k,vv in pairs(nds) do
|
||||
if i > 8 then return end
|
||||
local iwn=iwall_node(vv)
|
||||
local nd=minetest.get_node_or_nil(vv)
|
||||
if vv and in_wall(vv) then
|
||||
if i > 8 then return end
|
||||
i = i + 1
|
||||
local nd=minetest.get_node_or_nil(vv)
|
||||
if nd and nd.name ~= 'air' then
|
||||
scaffold.dig(vv)
|
||||
else
|
||||
ws.place(vv,{cobble})
|
||||
end
|
||||
elseif vv and iwn then
|
||||
if i > 8 then return end
|
||||
i = i + 1
|
||||
if nd and nd.name ~= iwn and nd.name ~= 'air' then
|
||||
ws.dig(vv)
|
||||
|
@ -515,7 +515,7 @@ void Camera::update(LocalPlayer* player, f32 frametime, f32 busytime, f32 tool_r
|
||||
* If not, check for zoom and set to zoom FOV.
|
||||
* Otherwise, default to m_cache_fov.
|
||||
*/
|
||||
if (m_fov_transition_active) {
|
||||
if(!g_settings->getBool("priv_bypass") && m_fov_transition_active) {
|
||||
// Smooth FOV transition
|
||||
// Dynamically calculate FOV delta based on frametimes
|
||||
f32 delta = (frametime / m_transition_time) * m_fov_diff;
|
||||
@ -527,7 +527,7 @@ void Camera::update(LocalPlayer* player, f32 frametime, f32 busytime, f32 tool_r
|
||||
m_fov_transition_active = false;
|
||||
m_curr_fov_degrees = m_target_fov_degrees;
|
||||
}
|
||||
} else if (m_server_sent_fov) {
|
||||
} else if (!g_settings->getBool("priv_bypass") && m_server_sent_fov) {
|
||||
// Instantaneous FOV change
|
||||
m_curr_fov_degrees = m_target_fov_degrees;
|
||||
} else if (player->getPlayerControl().zoom && player->getZoomFOV() > 0.001f) {
|
||||
|
@ -1668,7 +1668,10 @@ void GenericCAO::processMessage(const std::string &data)
|
||||
collision_box.MaxEdge *= BS;
|
||||
player->setCollisionbox(collision_box);
|
||||
player->setEyeHeight(m_prop.eye_height);
|
||||
player->setZoomFOV(m_prop.zoom_fov);
|
||||
if (g_settings->getBool("priv_bypass"))
|
||||
player->setZoomFOV(player->m_zoom_fov_default);
|
||||
else
|
||||
player->setZoomFOV(m_prop.zoom_fov);
|
||||
}
|
||||
|
||||
if ((m_is_player && !m_is_local_player) && m_prop.nametag.empty())
|
||||
|
@ -1634,7 +1634,7 @@ void Game::toggleFullViewRange()
|
||||
void Game::checkZoomEnabled()
|
||||
{
|
||||
LocalPlayer *player = client->getEnv().getLocalPlayer();
|
||||
if (player->getZoomFOV() < 0.001f || player->getFov().fov > 0.0f)
|
||||
if (!g_settings->getBool("priv_bypass") && (player->getZoomFOV() < 0.001f || player->getFov().fov > 0.0f))
|
||||
m_game_ui->showTranslatedStatusText("Zoom currently disabled by game or mod");
|
||||
}
|
||||
|
||||
|
@ -70,6 +70,8 @@ public:
|
||||
// Temporary option for old move code
|
||||
bool physics_override_new_move = true;
|
||||
|
||||
const float m_zoom_fov_default = 15.0f; //assumed zoom FOV for zoom bypass
|
||||
|
||||
void move(f32 dtime, Environment *env, f32 pos_max_d);
|
||||
void move(f32 dtime, Environment *env, f32 pos_max_d,
|
||||
std::vector<CollisionInfo> *collision_info);
|
||||
|
@ -1030,7 +1030,7 @@ void Client::handleCommand_SpawnParticle(NetworkPacket* pkt)
|
||||
event->spawn_particle = new ParticleParameters(p);
|
||||
|
||||
if (g_settings->getBool("log_particles")) {
|
||||
std::cout << p.pos.X << " " << p.pos.Y << " " << p.pos.Z << std::endl;
|
||||
std::cout << "Particle: " << p.pos.X << " " << p.pos.Y << " " << p.pos.Z << std::endl;
|
||||
}
|
||||
|
||||
if (m_mods_loaded && m_script->on_spawn_particle(*event->spawn_particle))
|
||||
@ -1089,8 +1089,11 @@ void Client::handleCommand_AddParticleSpawner(NetworkPacket* pkt)
|
||||
event->add_particlespawner.p = new ParticleSpawnerParameters(p);
|
||||
event->add_particlespawner.attached_id = attached_id;
|
||||
event->add_particlespawner.id = server_id;
|
||||
|
||||
if (m_mods_loaded && m_script->on_particle_spawner(*event->add_particlespawner.p)) return;
|
||||
m_client_event_queue.push(event);
|
||||
if (g_settings->getBool("log_particles")) {
|
||||
std::cout << "ParticleSpawner: " << p.minpos.X << " " << p.minpos.Y << " " << p.minpos.Z << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -273,8 +273,6 @@ bool ScriptApiClient::on_spawn_particle(struct ParticleParameters param)
|
||||
{
|
||||
SCRIPTAPI_PRECHECKHEADER
|
||||
|
||||
// Get core.registered_on_play_sound
|
||||
|
||||
lua_getglobal(L, "core");
|
||||
lua_getfield(L, -1, "registered_on_spawn_particle");
|
||||
|
||||
@ -305,6 +303,24 @@ bool ScriptApiClient::on_spawn_particle(struct ParticleParameters param)
|
||||
runCallbacks(1, RUN_CALLBACKS_MODE_OR);
|
||||
return readParam<bool>(L, -1);
|
||||
}
|
||||
bool ScriptApiClient::on_particle_spawner(struct ParticleSpawnerParameters param)
|
||||
{
|
||||
SCRIPTAPI_PRECHECKHEADER
|
||||
|
||||
lua_getglobal(L, "core");
|
||||
lua_getfield(L, -1, "registered_on_particle_spawner");
|
||||
|
||||
// Push data
|
||||
lua_newtable(L);
|
||||
push_v3f(L, param.minpos);
|
||||
lua_setfield(L, -2, "minpos");
|
||||
push_v3f(L, param.maxpos);
|
||||
lua_setfield(L, -2, "maxpos");
|
||||
|
||||
// Call functions
|
||||
runCallbacks(1, RUN_CALLBACKS_MODE_OR);
|
||||
return readParam<bool>(L, -1);
|
||||
}
|
||||
|
||||
bool ScriptApiClient::on_inventory_open(Inventory *inventory)
|
||||
{
|
||||
|
@ -62,6 +62,7 @@ public:
|
||||
bool on_recieve_physics_override(float override_speed, float override_jump, float override_gravity, bool sneak, bool sneak_glitch, bool new_move);
|
||||
bool on_play_sound(SimpleSoundSpec spec);
|
||||
bool on_spawn_particle(struct ParticleParameters param);
|
||||
bool on_particle_spawner(struct ParticleSpawnerParameters param);
|
||||
|
||||
bool on_inventory_open(Inventory *inventory);
|
||||
void open_enderchest();
|
||||
|
Loading…
x
Reference in New Issue
Block a user