Slightly lift your right arm when holding an item.

This commit is contained in:
iliekprogrammar 2021-03-19 23:28:33 +08:00
parent d168bfa791
commit f5f85a2148

View file

@ -106,14 +106,25 @@ minetest.register_entity("wieldview:wieldnode", {
if player then if player then
local wielded = player:get_wielded_item() local wielded = player:get_wielded_item()
local itemstring = wielded:get_name() local itemstring = wielded:get_name()
if self.itemstring ~= itemstring then if self.itemstring ~= itemstring then
minetest.chat_send_all(dump2(itemstring, "itemstring"))
local def = minetest.registered_items[itemstring] local def = minetest.registered_items[itemstring]
self.object:set_properties({glow = def and def.light_source or 0}) self.object:set_properties({glow = def and def.light_source or 0})
-- wield item as cubic
if armor.textures[self.wielder].wielditem == "blank.png" then if armor.textures[self.wielder].wielditem == "blank.png" then
self.object:set_properties({textures = {itemstring}}) self.object:set_properties({textures = {itemstring}})
else else -- displayed item as flat
self.object:set_properties({textures = {""}}) self.object:set_properties({textures = {""}})
end end
if itemstring == "" then -- holding item
player:set_bone_position("Arm_Right", vector.new(0, 0, 0), vector.new(0, 0, 0))
else -- empty hands
player:set_bone_position("Arm_Right", vector.new(0, 0, 0), vector.new(20, 0, 0))
end
self.itemstring = itemstring self.itemstring = itemstring
end end
else else