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:
commit
503ae01f50
5
init.lua
5
init.lua
@ -31,12 +31,17 @@ local function update_player_light(pl)
|
|||||||
local has_light = false
|
local has_light = false
|
||||||
local rm = {}
|
local rm = {}
|
||||||
for h,v in pairs(placed_lights[pl] or {}) do
|
for h,v in pairs(placed_lights[pl] or {}) do
|
||||||
|
if minetest.get_item_group(minetest.get_node(v).name, "wieldlight") ~= 0 then
|
||||||
if light < 2 or ph ~= h then
|
if light < 2 or ph ~= h then
|
||||||
table.insert(rm,v)
|
table.insert(rm,v)
|
||||||
placed_lights[pl][h] = nil
|
placed_lights[pl][h] = nil
|
||||||
else
|
else
|
||||||
has_light = true
|
has_light = true
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
-- light has been replaced by something else
|
||||||
|
placed_lights[pl][h] = nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if light >= 2 and not has_light and n.name == "air" then
|
if light >= 2 and not has_light and n.name == "air" then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user