1
0
Fork 0

fix callbacks

This commit is contained in:
cora 2022-06-24 03:08:52 +02:00
parent b396a3c6ee
commit 47eca3f774
2 changed files with 10 additions and 14 deletions

View File

@ -2,7 +2,10 @@ local modname = minetest.get_current_modname()
local S = minetest.get_translator(modname)
local modpath = minetest.get_modpath(modname)
local function temple_placement_callback(p1, p2, pr)
local function temple_placement_callback(pos,def, pr)
local hl = def.sidelen / 2
local p1 = vector.offset(pos,-hl,-hl,-hl)
local p2 = vector.offset(pos,hl,hl,hl)
-- Delete cacti leftovers:
local cactus_nodes = minetest.find_nodes_in_area_under_air(p1, p2, "mcl_core:cactus")
if cactus_nodes and #cactus_nodes > 0 then
@ -97,11 +100,6 @@ mcl_structures.register_structure("desert_temple",{
y_max = mcl_vars.mg_overworld_max,
y_min = 1,
biomes = { "Desert" },
after_place = function(pos,def,pr)
local hl = def.sidelen / 2
local p1 = vector.offset(pos,-hl,-hl,-hl)
local p2 = vector.offset(pos,hl,hl,hl)
temple_placement_callback(p1, p2, pr)
end,
filenames = { modpath.."/schematics/mcl_structures_desert_temple.mts" },
after_place = temple_placement_callback
})

View File

@ -2,7 +2,10 @@ local modname = minetest.get_current_modname()
local S = minetest.get_translator(modname)
local modpath = minetest.get_modpath(modname)
local function temple_placement_callback(p1, p2, pr)
local function temple_placement_callback(pos,def, pr)
local hl = def.sidelen / 2
local p1 = vector.offset(pos,-hl,-hl,-hl)
local p2 = vector.offset(pos,hl,hl,hl)
--dont remove foliage - looks kind of nice for a jt
local chests = minetest.find_nodes_in_area(p1, p2, "mcl_chests:trapped_chest_small")
-- Add jungle temple loot into chests
@ -61,10 +64,5 @@ mcl_structures.register_structure("jungle_temple",{
modpath.."/schematics/mcl_structures_jungle_temple.mts",
modpath.."/schematics/mcl_structures_jungle_temple_nice.mts",
},
after_place = function(pos,def,pr)
local hl = def.sidelen / 2
local p1 = vector.offset(pos,-hl,-hl,-hl)
local p2 = vector.offset(pos,hl,hl,hl)
temple_placement_callback(p1, p2, pr)
end,
after_place = temple_placement_callback
})