Move end gateway portal to structure api

This commit is contained in:
cora 2022-09-12 15:43:21 +02:00
parent 56e10f6784
commit d52c57b653
2 changed files with 8 additions and 15 deletions

View File

@ -34,11 +34,15 @@ mcl_structures.register_structure("end_exit_portal",{
end end
}) })
mcl_structures.register_structure("end_exit_portal_open",{ mcl_structures.register_structure("end_exit_portal_open",{
--static_pos = { mcl_vars.mg_end_exit_portal_pos },
filenames = { filenames = {
modpath.."/schematics/mcl_structures_end_exit_portal.mts" modpath.."/schematics/mcl_structures_end_exit_portal.mts"
}, },
}) })
mcl_structures.register_structure("end_gateway_portal",{
filenames = {
modpath.."/schematics/mcl_structures_end_gateway_portal.mts"
},
})
local function get_tower(p,h,tbl) local function get_tower(p,h,tbl)
for i = 1,h do for i = 1,h do

View File

@ -81,18 +81,11 @@ function mcl_structures.call_struct(pos, struct_style, rotation, pr)
if not rotation then if not rotation then
rotation = "random" rotation = "random"
end end
if struct_style == "end_gateway_portal" then if struct_style == "end_portal_shrine" then
return mcl_structures.generate_end_gateway_portal(pos, rotation)
elseif struct_style == "end_portal_shrine" then
return mcl_structures.generate_end_portal_shrine(pos, rotation, pr) return mcl_structures.generate_end_portal_shrine(pos, rotation, pr)
end end
end end
function mcl_structures.generate_end_gateway_portal(pos, rot)
local path = modpath.."/schematics/mcl_structures_end_gateway_portal.mts"
return mcl_structures.place_schematic(pos, path, rot or "0", nil, true)
end
local function shrine_placement_callback(p1, p2, size, rotation, pr) local function shrine_placement_callback(p1, p2, size, rotation, pr)
-- Find and setup spawner with silverfish -- Find and setup spawner with silverfish
local spawners = minetest.find_nodes_in_area(p1, p2, "mcl_mobspawners:spawner") local spawners = minetest.find_nodes_in_area(p1, p2, "mcl_mobspawners:spawner")
@ -297,7 +290,7 @@ mcl_structures.register_structure("ice_spike_large",{
-- Debug command -- Debug command
minetest.register_chatcommand("spawnstruct", { minetest.register_chatcommand("spawnstruct", {
params = "end_gateway_portal | end_portal_shrine | nether_portal | dungeon", params = "end_portal_shrine | dungeon",
description = S("Generate a pre-defined structure near your position."), description = S("Generate a pre-defined structure near your position."),
privs = {debug = true}, privs = {debug = true},
func = function(name, param) func = function(name, param)
@ -311,14 +304,10 @@ minetest.register_chatcommand("spawnstruct", {
local pr = PseudoRandom(pos.x+pos.y+pos.z) local pr = PseudoRandom(pos.x+pos.y+pos.z)
local errord = false local errord = false
local message = S("Structure placed.") local message = S("Structure placed.")
if param == "end_gateway_portal" then if param == "end_portal_shrine" then
mcl_structures.generate_end_gateway_portal(pos, rot, pr)
elseif param == "end_portal_shrine" then
mcl_structures.generate_end_portal_shrine(pos, rot, pr) mcl_structures.generate_end_portal_shrine(pos, rot, pr)
elseif param == "dungeon" and mcl_dungeons and mcl_dungeons.spawn_dungeon then elseif param == "dungeon" and mcl_dungeons and mcl_dungeons.spawn_dungeon then
mcl_dungeons.spawn_dungeon(pos, rot, pr) 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 == "" then elseif param == "" then
message = S("Error: No structure type given. Please use “/spawnstruct <type>”.") message = S("Error: No structure type given. Please use “/spawnstruct <type>”.")
errord = true errord = true