Make clocks work when dropped

This commit is contained in:
Elias Fleckenstein 2021-05-04 09:16:42 +02:00
parent 7513bc600a
commit 3b3d67a99c

@ -428,6 +428,7 @@ minetest.register_entity(":__builtin:item", {
description = def.description
glow = def.light_source
end
self.is_clock = minetest.get_item_group(itemname, "clock") > 0
local s = 0.2 + 0.1 * (count / max_count)
local wield_scale = (def and def.wield_scale and def.wield_scale.x) or 1
local c = s
@ -593,6 +594,12 @@ minetest.register_entity(":__builtin:item", {
local node = minetest.get_node_or_nil(p)
local in_unloaded = (node == nil)
if self.is_clock then
self.object:set_properties({
textures = {"mcl_clock:clock_" .. (mcl_worlds.clock_works(p) and mcl_clock.old_time or mcl_clock.random_frame)}
})
end
-- If no collector was found for a long enough time, declare the magnet as disabled
if self._magnet_active and (self._collector_timer == nil or (self._collector_timer > item_drop_settings.magnet_time)) then
self._magnet_active = false