Merge pull request 'Fix light removal' (#2) from j-r/mcl_wieldlight:fix_light_removal into main

Reviewed-on: https://codeberg.org/mineclonia/mcl_wieldlight/pulls/2
Reviewed-by: cora <cora@noreply.codeberg.org>
This commit is contained in:
cora 2024-11-09 14:51:08 +00:00
commit 503ae01f50

View File

@ -31,11 +31,16 @@ local function update_player_light(pl)
local has_light = false
local rm = {}
for h,v in pairs(placed_lights[pl] or {}) do
if light < 2 or ph ~= h then
table.insert(rm,v)
placed_lights[pl][h] = nil
if minetest.get_item_group(minetest.get_node(v).name, "wieldlight") ~= 0 then
if light < 2 or ph ~= h then
table.insert(rm,v)
placed_lights[pl][h] = nil
else
has_light = true
end
else
has_light = true
-- light has been replaced by something else
placed_lights[pl][h] = nil
end
end