fix frames to reset after /clearobjects
This commit is contained in:
parent
b2660e8c63
commit
10a3a022b6
|
@ -598,16 +598,21 @@ function mcl_itemframes.create_base_definitions()
|
||||||
local inv = minetest.get_meta(pos):get_inventory()
|
local inv = minetest.get_meta(pos):get_inventory()
|
||||||
local stack = inv:get_stack("main", 1)
|
local stack = inv:get_stack("main", 1)
|
||||||
local itemname = stack:get_name()
|
local itemname = stack:get_name()
|
||||||
|
local node = {}
|
||||||
if minetest.get_item_group(itemname, "clock") > 0 then
|
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)
|
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
|
if itemname ~= new_name then
|
||||||
stack:set_name(new_name)
|
stack:set_name(new_name)
|
||||||
inv:set_stack("main", 1, stack)
|
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)
|
mcl_itemframes.update_item_entity(pos, node, node.param2)
|
||||||
|
|
||||||
end
|
end
|
||||||
minetest.get_node_timer(pos):start(1.0)
|
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
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
@ -660,6 +665,8 @@ function mcl_itemframes.create_base_definitions()
|
||||||
end
|
end
|
||||||
if minetest.get_item_group(itemname, "clock") > 0 then
|
if minetest.get_item_group(itemname, "clock") > 0 then
|
||||||
minetest.get_node_timer(pos):start(1.0)
|
minetest.get_node_timer(pos):start(1.0)
|
||||||
|
else
|
||||||
|
minetest.get_node_timer(pos):start(40.0)
|
||||||
end
|
end
|
||||||
|
|
||||||
inv:set_stack("main", 1, put_itemstack)
|
inv:set_stack("main", 1, put_itemstack)
|
||||||
|
|
Loading…
Reference in New Issue