From 6da1491f14c354e2f3914dd71609b1078c9e91da Mon Sep 17 00:00:00 2001 From: cora Date: Thu, 8 Sep 2022 13:16:26 +0200 Subject: [PATCH] make xp.throw_xp return the orb objects --- mods/HUD/mcl_experience/init.lua | 4 +++- mods/ITEMS/mcl_sculk/init.lua | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/mods/HUD/mcl_experience/init.lua b/mods/HUD/mcl_experience/init.lua index 37250ee2f..e32bd11dd 100644 --- a/mods/HUD/mcl_experience/init.lua +++ b/mods/HUD/mcl_experience/init.lua @@ -136,7 +136,7 @@ end function mcl_experience.throw_xp(pos, total_xp) local i, j = 0, 0 - + local obs = {} while i < total_xp and j < 100 do local xp = math.min(math.random(1, math.min(32767, total_xp - math.floor(i / 2))), total_xp - i) local obj = minetest.add_entity(pos, "mcl_experience:orb", tostring(xp)) @@ -153,7 +153,9 @@ function mcl_experience.throw_xp(pos, total_xp) i = i + xp j = j + 1 + table.insert(obs,obj) end + return obs end function mcl_experience.remove_hud(player) diff --git a/mods/ITEMS/mcl_sculk/init.lua b/mods/ITEMS/mcl_sculk/init.lua index d0ff33b3e..b347ac41c 100644 --- a/mods/ITEMS/mcl_sculk/init.lua +++ b/mods/ITEMS/mcl_sculk/init.lua @@ -126,7 +126,7 @@ minetest.registered_entities["mcl_experience:orb"].on_step = function(self,dtime if n.name == "mcl_sculk:sculk" and not self._sculkdrop then local c = minetest.find_node_near(p,range,{"mcl_sculk:catalyst"}) if c then - local nnn = minetest.find_nodes_in_area(vector.offset(p,-range,-2,-range),vector.offset(p,range,2,range),spread_to) + local nnn = minetest.find_nodes_in_area(vector.offset(p,-range,-range,-range),vector.offset(p,range,range,range),spread_to) local nn={} for _,v in pairs(nnn) do if has_air(v) then