Merge branch 'master' into chat-command-builder

This commit is contained in:
AFCMS 2021-04-07 09:31:40 +02:00
commit 0a802a2cc1
4 changed files with 13 additions and 23 deletions

View File

@ -26,11 +26,9 @@ local gateway_positions = {
local function spawn_gateway_portal(pos, dest_str)
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_end_gateway_portal.mts"
return mcl_structures.place_schematic(vector.add(pos, vector.new(-1, -2, -1)), path, "0", nil, true, nil, dest_str and function(p1, p2, size, orientation, pr, param)
-- minetest.get_voxel_manip():read_from_map(pos, pos)
minetest.get_meta(vector.add(p1, {x=1,y=2,z=1})):set_string("mcl_portals:gateway_destination", param.dest_str)
print(param.dest_str)
end, nil, {dest_str=dest_str})
return mcl_structures.place_schematic(vector.add(pos, vector.new(-1, -2, -1)), path, "0", nil, true, nil, dest_str and function()
minetest.get_meta(pos):set_string("mcl_portals:gateway_destination", dest_str)
end)
end
function mcl_portals.spawn_gateway_portal()
@ -88,20 +86,14 @@ local function teleport(pos, obj)
local minp = vector.subtract(dest_portal, vector.new(5, 40, 5))
local maxp = vector.add(dest_portal, vector.new(5, 10, 5))
preparing[pos_str] = true
minetest.emerge_area(
minp,
maxp,
function(blockpos, action, calls_remaining, param)
if calls_remaining < 1 then
local minp, maxp, dest_portal, obj, pos_str = param.minp, param.maxp, param.dest_portal, param.obj, param.pos_str
if obj and obj:is_player() or obj:get_luaentity() then
obj:set_pos(find_destination_pos(minp, maxp) or vector.add(dest_portal, vector.new(0, 3.5, 0)))
end
preparing[pos_str] = false
minetest.emerge_area(minp, maxp, function(blockpos, action, calls_remaining, param)
if calls_remaining < 1 then
if obj and obj:is_player() or obj:get_luaentity() then
obj:set_pos(find_destination_pos(minp, maxp) or vector.add(dest_portal, vector.new(0, 3.5, 0)))
end
end,
{minp=vector.new(minp), maxp=vector.new(maxp), dest_portal=vector.new(dest_portal), obj=obj, pos_str=pos_str}
)
preparing[pos_str] = false
end
end)
end
minetest.register_abm({

View File

@ -318,11 +318,11 @@ end
mcl_structures.generate_end_exit_portal = function(pos, rot)
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_end_exit_portal.mts"
return mcl_structures.place_schematic(pos, path, rot or "0", nil, true)
return mcl_structures.place_schematic(pos, path, rot or "0", {["mcl_portals:portal_end"] = "air"}, true)
end
mcl_structures.generate_end_exit_portal_open = function(pos, rot)
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_end_exit_portal_open.mts"
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_end_exit_portal.mts"
return mcl_structures.place_schematic(pos, path, rot or "0", nil, true)
end
@ -548,7 +548,7 @@ end
-- Debug command
minetest.register_chatcommand("spawnstruct", {
params = "desert_temple | desert_well | igloo | witch_hut | boulder | ice_spike_small | ice_spike_large | fossil | end_exit_portal | end_exit_portal_opens | end_portal_shrine | nether_portal | gateway_portal | dungeon",
params = "desert_temple | desert_well | igloo | witch_hut | boulder | ice_spike_small | ice_spike_large | fossil | end_exit_portal | end_exit_portal_open | end_gateway_portal | end_portal_shrine | nether_portal | dungeon",
description = S("Generate a pre-defined structure near your position."),
privs = {debug = true},
func = function(name, param)
@ -590,8 +590,6 @@ minetest.register_chatcommand("spawnstruct", {
mcl_dungeons.spawn_dungeon(pos, rot, pr)
elseif param == "nether_portal" and mcl_portals and mcl_portals.spawn_nether_portal then
mcl_portals.spawn_nether_portal(pos, rot, pr, name)
elseif param == "gateway_portal" and mcl_portals.spawn_gateway_portal then
mcl_portals.spawn_gateway_portal(pos, rot, pr, name)
elseif param == "" then
message = S("Error: No structure type given. Please use “/spawnstruct <type>”.")
errord = true