mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-12-25 02:42:25 +01:00
Fix crash in villagegen
This commit is contained in:
parent
5d26595f4a
commit
6b8236e8f3
@ -23,6 +23,7 @@ function table.update_nil(t, ...)
|
||||
end
|
||||
|
||||
function mcl_util.file_exists(name)
|
||||
if type(name) ~= "string" then return end
|
||||
local f = io.open(name)
|
||||
if not f then
|
||||
return false
|
||||
|
@ -32,8 +32,8 @@ local function ecb_place(blockpos, action, calls_remaining, param)
|
||||
end
|
||||
|
||||
function mcl_structures.place_schematic(pos, schematic, rotation, replacements, force_placement, flags, after_placement_callback, pr, callback_param)
|
||||
if not mcl_util.file_exists(schematic) then
|
||||
minetest.log("warning","[mcl_structures] schematic file "..schematic.." does not exist.")
|
||||
if type(schematic) ~= "table" and not mcl_util.file_exists(schematic) then
|
||||
minetest.log("warning","[mcl_structures] schematic file "..tostring(schematic).." does not exist.")
|
||||
return end
|
||||
local s = loadstring(minetest.serialize_schematic(schematic, "lua", {lua_use_comments = false, lua_num_indent_spaces = 0}) .. " return schematic")()
|
||||
if s and s.size then
|
||||
|
Loading…
Reference in New Issue
Block a user