1
0
Fork 0

Make clocks work when dropped

This commit is contained in:
Lizzy Fleckenstein 2021-05-04 09:16:42 +02:00
parent 7513bc600a
commit 3b3d67a99c
1 changed files with 10 additions and 3 deletions

View File

@ -428,6 +428,7 @@ minetest.register_entity(":__builtin:item", {
description = def.description description = def.description
glow = def.light_source glow = def.light_source
end end
self.is_clock = minetest.get_item_group(itemname, "clock") > 0
local s = 0.2 + 0.1 * (count / max_count) 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 wield_scale = (def and def.wield_scale and def.wield_scale.x) or 1
local c = s local c = s
@ -593,6 +594,12 @@ minetest.register_entity(":__builtin:item", {
local node = minetest.get_node_or_nil(p) local node = minetest.get_node_or_nil(p)
local in_unloaded = (node == nil) 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 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 if self._magnet_active and (self._collector_timer == nil or (self._collector_timer > item_drop_settings.magnet_time)) then
self._magnet_active = false self._magnet_active = false