Make compasses point upwards when dropped as an item

This commit is contained in:
Elias Fleckenstein 2021-05-04 10:24:08 +02:00
parent cb2bc52cbb
commit 75d9450002

@ -406,6 +406,14 @@ minetest.register_entity(":__builtin:item", {
return return
end end
local stack = ItemStack(itemstring) local stack = ItemStack(itemstring)
if minetest.get_item_group(stack:get_name(), "compass") > 0 then
stack:set_name("mcl_compass:16")
itemstring = stack:to_string()
self.itemstring = itemstring
end
if minetest.get_item_group(stack:get_name(), "clock") > 0 then
self.is_clock = true
end
local count = stack:get_count() local count = stack:get_count()
local max_count = stack:get_stack_max() local max_count = stack:get_stack_max()
if count > max_count then if count > max_count then
@ -428,7 +436,6 @@ 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