fix frames to reset after /clearobjects

This commit is contained in:
Michieal 2022-11-07 17:14:16 +00:00 committed by cora
parent b2660e8c63
commit 10a3a022b6
1 changed files with 9 additions and 2 deletions

View File

@ -598,16 +598,21 @@ function mcl_itemframes.create_base_definitions()
local inv = minetest.get_meta(pos):get_inventory()
local stack = inv:get_stack("main", 1)
local itemname = stack:get_name()
local node = {}
if minetest.get_item_group(itemname, "clock") > 0 then
local new_name = "mcl_clock:clock_" .. (mcl_worlds.clock_works(pos) and mcl_clock.old_time or mcl_clock.random_frame)
if itemname ~= new_name then
stack:set_name(new_name)
inv:set_stack("main", 1, stack)
local node = minetest.get_node(pos)
node = minetest.get_node(pos)
mcl_itemframes.update_item_entity(pos, node, node.param2)
end
minetest.get_node_timer(pos):start(1.0)
else
-- fix for /ClearObjects
node = minetest.get_node(pos)
mcl_itemframes.update_item_entity(pos, node, node.param2)
minetest.get_node_timer(pos):start(40.0)
end
end,
@ -660,6 +665,8 @@ function mcl_itemframes.create_base_definitions()
end
if minetest.get_item_group(itemname, "clock") > 0 then
minetest.get_node_timer(pos):start(1.0)
else
minetest.get_node_timer(pos):start(40.0)
end
inv:set_stack("main", 1, put_itemstack)