From 47eca3f7747b13231c85a5e50d2f9c42b4a30ac3 Mon Sep 17 00:00:00 2001 From: cora Date: Fri, 24 Jun 2022 03:08:52 +0200 Subject: [PATCH] fix callbacks --- mods/MAPGEN/mcl_structures/desert_temple.lua | 12 +++++------- mods/MAPGEN/mcl_structures/jungle_temple.lua | 12 +++++------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/mods/MAPGEN/mcl_structures/desert_temple.lua b/mods/MAPGEN/mcl_structures/desert_temple.lua index 9398e6062..fed97f047 100644 --- a/mods/MAPGEN/mcl_structures/desert_temple.lua +++ b/mods/MAPGEN/mcl_structures/desert_temple.lua @@ -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 }) diff --git a/mods/MAPGEN/mcl_structures/jungle_temple.lua b/mods/MAPGEN/mcl_structures/jungle_temple.lua index 1dc89b787..a8d93ca5d 100644 --- a/mods/MAPGEN/mcl_structures/jungle_temple.lua +++ b/mods/MAPGEN/mcl_structures/jungle_temple.lua @@ -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 })