milan2018 #15

Merged
milan merged 5 commits from milan2018 into master 2020-05-23 12:31:47 +02:00
4 changed files with 112 additions and 56 deletions

View file

@ -72,4 +72,53 @@ netest/mods/mobs/api.lua:689: bad argument #2 to 'random' (interval is empty)
2020-05-20 21:24:08: ERROR[Main]: stack traceback:
2020-05-20 21:24:08: ERROR[Main]: (load):1: in function 'show_formspec'
2020-05-20 21:24:08: ERROR[Main]: (load):1: in function '?'
2020-05-20 21:24:08: ERROR[Main]: /usr/share/minetest/builtin/game/register.lua:420: in function </usr/share/minetest/builtin/game/register.lua:400>
2020-05-20 21:24:08: ERROR[Main]: /usr/share/minetest/builtin/game/register.lua:420: in function </usr/share/minetest/builtin/game/register.lua:400>
2020-05-20 21:47:24: ERROR[Main]: ModError: Failed to load and run script from /home/minetest/.minetest/mods/xdecor/init.lua:
2020-05-20 21:47:24: ERROR[Main]: ...ome/minetest/.minetest/mods/xdecor/src/workbench.lua:269: attempt to concatenate a nil value
2020-05-20 21:47:24: ERROR[Main]: stack traceback:
2020-05-20 21:47:24: ERROR[Main]: ...ome/minetest/.minetest/mods/xdecor/src/workbench.lua:269: in main chunk
2020-05-20 21:47:24: ERROR[Main]: [C]: in function 'dofile'
2020-05-20 21:47:24: ERROR[Main]: /home/minetest/.minetest/mods/xdecor/init.lua:43: in main chunk
2020-05-20 21:47:45: ERROR[Main]: ModError: Failed to load and run script from /home/minetest/.minetest/mods/xdecor/init.lua:
2020-05-20 21:47:45: ERROR[Main]: ...ome/minetest/.minetest/mods/xdecor/src/workbench.lua:269: attempt to concatenate a nil value
2020-05-20 21:47:45: ERROR[Main]: stack traceback:
2020-05-20 21:47:45: ERROR[Main]: ...ome/minetest/.minetest/mods/xdecor/src/workbench.lua:269: in main chunk
2020-05-20 21:47:45: ERROR[Main]: [C]: in function 'dofile'
2020-05-20 21:47:45: ERROR[Main]: /home/minetest/.minetest/mods/xdecor/init.lua:43: in main chunk
2020-05-20 21:48:07: ERROR[Main]: ModError: Failed to load and run script from /home/minetest/.minetest/mods/xdecor/init.lua:
2020-05-20 21:48:07: ERROR[Main]: ...ome/minetest/.minetest/mods/xdecor/src/workbench.lua:269: attempt to concatenate a nil value
2020-05-20 21:48:07: ERROR[Main]: stack traceback:
2020-05-20 21:48:07: ERROR[Main]: ...ome/minetest/.minetest/mods/xdecor/src/workbench.lua:269: in main chunk
2020-05-20 21:48:07: ERROR[Main]: [C]: in function 'dofile'
2020-05-20 21:48:07: ERROR[Main]: /home/minetest/.minetest/mods/xdecor/init.lua:43: in main chunk
2020-05-20 21:48:28: ERROR[Main]: ModError: Failed to load and run script from /home/minetest/.minetest/mods/xdecor/init.lua:
2020-05-20 21:48:28: ERROR[Main]: ...ome/minetest/.minetest/mods/xdecor/src/workbench.lua:269: attempt to concatenate a nil value
2020-05-20 21:48:28: ERROR[Main]: stack traceback:
2020-05-20 21:48:28: ERROR[Main]: ...ome/minetest/.minetest/mods/xdecor/src/workbench.lua:269: in main chunk
2020-05-20 21:48:28: ERROR[Main]: [C]: in function 'dofile'
2020-05-20 21:48:28: ERROR[Main]: /home/minetest/.minetest/mods/xdecor/init.lua:43: in main chunk
2020-05-20 21:48:49: ERROR[Main]: ModError: Failed to load and run script from /home/minetest/.minetest/mods/xdecor/init.lua:
2020-05-20 21:48:49: ERROR[Main]: ...ome/minetest/.minetest/mods/xdecor/src/workbench.lua:269: attempt to concatenate a nil value
2020-05-20 21:48:49: ERROR[Main]: stack traceback:
2020-05-20 21:48:49: ERROR[Main]: ...ome/minetest/.minetest/mods/xdecor/src/workbench.lua:269: in main chunk
2020-05-20 21:48:49: ERROR[Main]: [C]: in function 'dofile'
2020-05-20 21:48:49: ERROR[Main]: /home/minetest/.minetest/mods/xdecor/init.lua:43: in main chunk
2020-05-20 21:49:11: ERROR[Main]: ModError: Failed to load and run script from /home/minetest/.minetest/mods/xdecor/init.lua:
2020-05-20 21:49:11: ERROR[Main]: ...ome/minetest/.minetest/mods/xdecor/src/workbench.lua:269: attempt to concatenate a nil value
2020-05-20 21:49:11: ERROR[Main]: stack traceback:
2020-05-20 21:49:11: ERROR[Main]: ...ome/minetest/.minetest/mods/xdecor/src/workbench.lua:269: in main chunk
2020-05-20 21:49:11: ERROR[Main]: [C]: in function 'dofile'
2020-05-20 21:49:11: ERROR[Main]: /home/minetest/.minetest/mods/xdecor/init.lua:43: in main chunk
2020-05-20 21:49:32: ERROR[Main]: ModError: Failed to load and run script from /home/minetest/.minetest/mods/xdecor/init.lua:
2020-05-20 21:49:32: ERROR[Main]: ...ome/minetest/.minetest/mods/xdecor/src/workbench.lua:269: attempt to concatenate a nil value
2020-05-20 21:49:32: ERROR[Main]: stack traceback:
2020-05-20 21:49:32: ERROR[Main]: ...ome/minetest/.minetest/mods/xdecor/src/workbench.lua:269: in main chunk
2020-05-20 21:49:32: ERROR[Main]: [C]: in function 'dofile'
2020-05-20 21:49:32: ERROR[Main]: /home/minetest/.minetest/mods/xdecor/init.lua:43: in main chunk
2020-05-20 21:49:55: ERROR[Main]: ModError: Failed to load and run script from /home/minetest/.minetest/mods/xdecor/init.lua:
2020-05-20 21:49:55: ERROR[Main]: ...ome/minetest/.minetest/mods/xdecor/src/workbench.lua:269: attempt to concatenate a nil value
2020-05-20 21:49:55: ERROR[Main]: stack traceback:
2020-05-20 21:49:55: ERROR[Main]: ...ome/minetest/.minetest/mods/xdecor/src/workbench.lua:269: in main chunk
2020-05-20 21:49:55: ERROR[Main]: [C]: in function 'dofile'
2020-05-20 21:49:55: ERROR[Main]: /home/minetest/.minetest/mods/xdecor/init.lua:43: in main chunk

View file

@ -141,7 +141,7 @@ local function commandblock_action_on(pos, node)
end
local commands = resolve_commands(meta:get_string("commands"), pos)
for _, command in pairs(commands:split("\n")) do
for _, command in pairs(commands:split("\n/")) do
local pos = command:find(" ")
local cmd, param = command, ""
if pos then

View file

@ -1,52 +1,59 @@
--- Lua code execution functions.
-- @module worldedit.code
--- Executes `code` as a Lua chunk in the global namespace.
-- @return An error message if the code fails, or nil on success.
function worldedit.lua(code)
local func, err = loadstring(code)
if not func then -- Syntax error
return err
end
local good, err = pcall(func)
if not good then -- Runtime error
return err
end
return nil
end
--- Executes `code` as a Lua chunk in the global namespace with the variable
-- pos available, for each node in a region defined by positions `pos1` and
-- `pos2`.
-- @return An error message if the code fails, or nil on success.
function worldedit.luatransform(pos1, pos2, code)
pos1, pos2 = worldedit.sort_pos(pos1, pos2)
local factory, err = loadstring("return function(pos) " .. code .. " end")
if not factory then -- Syntax error
return err
end
local func = factory()
worldedit.keep_loaded(pos1, pos2)
local pos = {x=pos1.x, y=0, z=0}
while pos.x <= pos2.x do
pos.y = pos1.y
while pos.y <= pos2.y do
pos.z = pos1.z
while pos.z <= pos2.z do
local good, err = pcall(func, pos)
if not good then -- Runtime error
return err
end
pos.z = pos.z + 1
end
pos.y = pos.y + 1
end
pos.x = pos.x + 1
end
return nil
end
--- Lua code execution functions.
-- @module worldedit.code
--- Executes `code` as a Lua chunk in the global namespace.
-- @return An error message if the code fails, or nil on success.
function worldedit.lua(code)
local func, err = loadstring(code)
if not func then -- Syntax error
return err
end
local good, err = pcall(func)
if not good then -- Runtime error
return err
end
return nil
end
--- Executes `code` as a Lua chunk in the global namespace with the variable
-- pos available, for each node in a region defined by positions `pos1` and
-- `pos2`.
-- @return An error message if the code fails, or nil on success.
function worldedit.luatransform(pos1, pos2, code)
pos1, pos2 = worldedit.sort_pos(pos1, pos2)
local factory, err = loadstring("return function(pos) " .. code .. " end")
if not factory then -- Syntax error
return err
end
local func = factory()
worldedit.keep_loaded(pos1, pos2)
local pos = {x=pos1.x, y=0, z=0}
while pos.x <= pos2.x do
pos.y = pos1.y
while pos.y <= pos2.y do
pos.z = pos1.z
while pos.z <= pos2.z do
local good, err = pcall(func, pos)
if not good then -- Runtime error
return err
end
pos.z = pos.z + 1
end
pos.y = pos.y + 1
end
pos.x = pos.x + 1
end
return nil
end
local input = io.open(minetest.get_worldpath().."/init.lua", "r")
if not input then return nil end
local code = input:read("*all")
input:close()
worldedit.lua(code)

View file

@ -239,7 +239,7 @@ xdecor.register("workbench", {
allow_metadata_inventory_put = workbench.put,
allow_metadata_inventory_move = workbench.move
})
--[[
for _, d in pairs(workbench.defs) do
for i=1, #nodes do
local node = nodes[i]
@ -288,7 +288,7 @@ for i=1, #nodes do
end
end
end
--]]
-- Craft items
minetest.register_tool("xdecor:hammer", {