forked from MineClone5/MineClone5
Try to wrap https://github.com/minetest/minetest/issues/10995 by cancelling redefinition of minetest.place_schematic
This commit is contained in:
parent
da606fa9d2
commit
54cd5007ed
|
@ -7,15 +7,14 @@ local rotations = {
|
||||||
"270"
|
"270"
|
||||||
}
|
}
|
||||||
|
|
||||||
mcl_structures.minetest_place_schematic = minetest.place_schematic
|
|
||||||
local function ecb_place(blockpos, action, calls_remaining, param)
|
local function ecb_place(blockpos, action, calls_remaining, param)
|
||||||
if calls_remaining >= 1 then return end
|
if calls_remaining >= 1 then return end
|
||||||
mcl_structures.minetest_place_schematic(param.pos, param.schematic, param.rotation, param.replacements, param.force_placement, param.flags)
|
minetest.place_schematic(param.pos, param.schematic, param.rotation, param.replacements, param.force_placement, param.flags)
|
||||||
if param.after_placement_callback and param.p1 and param.p2 then
|
if param.after_placement_callback and param.p1 and param.p2 then
|
||||||
param.after_placement_callback(param.p1, param.p2, param.size, param.rotation, param.pr)
|
param.after_placement_callback(param.p1, param.p2, param.size, param.rotation, param.pr)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
minetest.place_schematic = function(pos, schematic, rotation, replacements, force_placement, flags, after_placement_callback, pr)
|
mcl_structures.place_schematic = function(pos, schematic, rotation, replacements, force_placement, flags, after_placement_callback, pr)
|
||||||
local s = loadstring(minetest.serialize_schematic(schematic, "lua", {lua_use_comments = false, lua_num_indent_spaces = 0}) .. " return(schematic)")()
|
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
|
if s and s.size then
|
||||||
local x, z = s.size.x, s.size.z
|
local x, z = s.size.x, s.size.z
|
||||||
|
@ -37,7 +36,6 @@ minetest.place_schematic = function(pos, schematic, rotation, replacements, forc
|
||||||
minetest.emerge_area(p1, p2, ecb_place, param)
|
minetest.emerge_area(p1, p2, ecb_place, param)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
mcl_structures.place_schematic = minetest.place_schematic -- for direct usage
|
|
||||||
|
|
||||||
mcl_structures.get_struct = function(file)
|
mcl_structures.get_struct = function(file)
|
||||||
local localfile = minetest.get_modpath("mcl_structures").."/schematics/"..file
|
local localfile = minetest.get_modpath("mcl_structures").."/schematics/"..file
|
||||||
|
@ -97,7 +95,7 @@ end
|
||||||
mcl_structures.generate_desert_well = function(pos)
|
mcl_structures.generate_desert_well = function(pos)
|
||||||
local newpos = {x=pos.x,y=pos.y-2,z=pos.z}
|
local newpos = {x=pos.x,y=pos.y-2,z=pos.z}
|
||||||
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_desert_well.mts"
|
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_desert_well.mts"
|
||||||
return minetest.place_schematic(newpos, path, "0", nil, true)
|
return mcl_structures.place_schematic(newpos, path, "0", nil, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
mcl_structures.generate_igloo = function(pos, rotation, pr)
|
mcl_structures.generate_igloo = function(pos, rotation, pr)
|
||||||
|
@ -201,7 +199,7 @@ mcl_structures.generate_igloo_top = function(pos, pr)
|
||||||
local newpos = {x=pos.x,y=pos.y-1,z=pos.z}
|
local newpos = {x=pos.x,y=pos.y-1,z=pos.z}
|
||||||
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_igloo_top.mts"
|
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_igloo_top.mts"
|
||||||
local rotation = tostring(pr:next(0,3)*90)
|
local rotation = tostring(pr:next(0,3)*90)
|
||||||
return minetest.place_schematic(newpos, path, rotation, nil, true), rotation
|
return mcl_structures.place_schematic(newpos, path, rotation, nil, true), rotation
|
||||||
end
|
end
|
||||||
|
|
||||||
local function igloo_placement_callback(p1, p2, size, orientation, pr)
|
local function igloo_placement_callback(p1, p2, size, orientation, pr)
|
||||||
|
@ -266,7 +264,7 @@ mcl_structures.generate_boulder = function(pos, rotation, pr)
|
||||||
end
|
end
|
||||||
|
|
||||||
local newpos = {x=pos.x,y=pos.y-1,z=pos.z}
|
local newpos = {x=pos.x,y=pos.y-1,z=pos.z}
|
||||||
return minetest.place_schematic(newpos, path)
|
return mcl_structures.place_schematic(newpos, path)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function hut_placement_callback(p1, p2, size, orientation, pr)
|
local function hut_placement_callback(p1, p2, size, orientation, pr)
|
||||||
|
@ -287,12 +285,12 @@ end
|
||||||
|
|
||||||
mcl_structures.generate_ice_spike_small = function(pos)
|
mcl_structures.generate_ice_spike_small = function(pos)
|
||||||
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_ice_spike_small.mts"
|
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_ice_spike_small.mts"
|
||||||
return minetest.place_schematic(pos, path, "random", nil, false)
|
return mcl_structures.place_schematic(pos, path, "random", nil, false)
|
||||||
end
|
end
|
||||||
|
|
||||||
mcl_structures.generate_ice_spike_large = function(pos)
|
mcl_structures.generate_ice_spike_large = function(pos)
|
||||||
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_ice_spike_large.mts"
|
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_ice_spike_large.mts"
|
||||||
return minetest.place_schematic(pos, path, "random", nil, false)
|
return mcl_structures.place_schematic(pos, path, "random", nil, false)
|
||||||
end
|
end
|
||||||
|
|
||||||
mcl_structures.generate_fossil = function(pos, rotation, pr)
|
mcl_structures.generate_fossil = function(pos, rotation, pr)
|
||||||
|
@ -310,12 +308,12 @@ mcl_structures.generate_fossil = function(pos, rotation, pr)
|
||||||
}
|
}
|
||||||
local r = pr:next(1, #fossils)
|
local r = pr:next(1, #fossils)
|
||||||
local path = minetest.get_modpath("mcl_structures").."/schematics/"..fossils[r]
|
local path = minetest.get_modpath("mcl_structures").."/schematics/"..fossils[r]
|
||||||
return minetest.place_schematic(newpos, path, "random", nil, true)
|
return mcl_structures.place_schematic(newpos, path, "random", nil, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
mcl_structures.generate_end_exit_portal = function(pos)
|
mcl_structures.generate_end_exit_portal = function(pos)
|
||||||
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_end_exit_portal.mts"
|
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_end_exit_portal.mts"
|
||||||
return minetest.place_schematic(pos, path, "0", nil, true)
|
return mcl_structures.place_schematic(pos, path, "0", nil, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function shrine_placement_callback(p1, p2, size, rotation, pr)
|
local function shrine_placement_callback(p1, p2, size, rotation, pr)
|
||||||
|
@ -489,7 +487,7 @@ mcl_structures.generate_desert_temple = function(pos, rotation, pr)
|
||||||
if newpos == nil then
|
if newpos == nil then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
minetest.place_schematic(newpos, path, "random", nil, true, nil, temple_placement_callback, pr)
|
mcl_structures.place_schematic(newpos, path, "random", nil, true, nil, temple_placement_callback, pr)
|
||||||
end
|
end
|
||||||
|
|
||||||
local registered_structures = {}
|
local registered_structures = {}
|
||||||
|
|
|
@ -238,7 +238,7 @@ function settlements.place_schematics(settlement_info, pr)
|
||||||
local schematic = loadstring(schem_lua)()
|
local schematic = loadstring(schem_lua)()
|
||||||
-- build foundation for the building an make room above
|
-- build foundation for the building an make room above
|
||||||
-- place schematic
|
-- place schematic
|
||||||
minetest.place_schematic(
|
mcl_structures.place_schematic(
|
||||||
pos,
|
pos,
|
||||||
schematic,
|
schematic,
|
||||||
rotation,
|
rotation,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
mcl_util
|
mcl_util
|
||||||
mcl_mapgen_core
|
mcl_mapgen_core
|
||||||
|
mcl_structures
|
||||||
mcl_core
|
mcl_core
|
||||||
mcl_loot
|
mcl_loot
|
||||||
mcl_farming?
|
mcl_farming?
|
||||||
|
|
Loading…
Reference in New Issue