diff --git a/rules.lua b/rules.lua index 0a3891e..c958695 100644 --- a/rules.lua +++ b/rules.lua @@ -190,15 +190,27 @@ function lc_liberties.handle_placement(pos) end if captured then + local removed_items = {} -- key = name, value = count for i,v in pairs(captureses) do if v.capture then local proximal = {} for i2, v2 in pairs(v.stones) do + local old = minetest.get_node(v2).name + removed_items[old] = (removed_items[old] or 0) + 1 + nodecore.set_loud(v2, {name = "nc_fire:fire"}) end - - -- todo: spawn itemstack of captured stones somehow + end + end + for k, v in pairs(removed_items) do + local max = minetest.registered_items[k].stack_max + while v > max do + nodecore.item_eject(pos, k .. " " .. max) + v = v - max + end + if v > 0 then + nodecore.item_eject(pos, k .. " " .. v) end end else