From 18d30c05fcce0a1c255aef6ff94807e1080be0c2 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 4 May 2022 12:57:07 +0200 Subject: [PATCH] Refactor builtin item code a bit --- mods/rp_builtin_item/init.lua | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/mods/rp_builtin_item/init.lua b/mods/rp_builtin_item/init.lua index e04e7b6..d593a8b 100644 --- a/mods/rp_builtin_item/init.lua +++ b/mods/rp_builtin_item/init.lua @@ -23,8 +23,9 @@ minetest.register_entity( collisionbox = {-0.125, -0.125, -0.125, 0.125, 0.125, 0.125}, collide_with_objects = false, pointable = false, - visual = "sprite", + visual = "wielditem", visual_size = {x=0.15, y=0.15}, + automatic_rotate = math.pi*0.5, textures = {""}, spritediv = {x=1, y=1}, initial_sprite_basepos = {x=0, y=0}, @@ -59,19 +60,8 @@ minetest.register_entity( end local prop = { is_visible = true, - visual = "sprite", - textures = {"unknown_item.png"} + textures = {itemname}, } - if item_texture and item_texture ~= "" then - prop.visual = "wielditem" - prop.textures = {itemname} - prop.visual_size = {x=0.15, y=0.15} - else - prop.visual = "wielditem" - prop.textures = {itemname} - prop.visual_size = {x=0.15, y=0.15} - end - prop.automatic_rotate = math.pi * 0.5 local ndef = minetest.registered_nodes[itemname] if ndef then prop.glow = ndef.light_source