Make non-node items in tubes look more solid

Use the "wielditem" visual type for non-node items, with a fixed 45
degree yaw.  This matches the recent change of dropped-item entities from
"sprite" visual to "wielditem".
This commit is contained in:
Zefram 2014-07-03 02:22:55 +01:00 committed by Vanessa Ezekowitz
parent f8bbe908cd
commit 65baf218be

View File

@ -356,8 +356,8 @@ minetest.register_entity("pipeworks:tubed_item", {
physical = false, physical = false,
-- collisionbox = {0,0,0,0,0,0}, -- collisionbox = {0,0,0,0,0,0},
collisionbox = {0.1, 0.1, 0.1, 0.1, 0.1, 0.1}, collisionbox = {0.1, 0.1, 0.1, 0.1, 0.1, 0.1},
visual = "sprite", visual = "wielditem",
visual_size = {x = 0.5, y = 0.5}, visual_size = {x = 0.15, y = 0.15},
textures = {""}, textures = {""},
spritediv = {x = 1, y = 1}, spritediv = {x = 1, y = 1},
initial_sprite_basepos = {x = 0, y = 0}, initial_sprite_basepos = {x = 0, y = 0},
@ -373,32 +373,12 @@ minetest.register_entity("pipeworks:tubed_item", {
set_item = function(self, itemstring) set_item = function(self, itemstring)
self.itemstring = itemstring self.itemstring = itemstring
local stack = ItemStack(itemstring) local stack = ItemStack(itemstring)
local itemtable = stack:to_table() self.object:set_properties({
local itemname = nil
if itemtable then
itemname = stack:to_table().name
end
local item_texture = nil
local item_type = ""
if minetest.registered_items[itemname] then
item_texture = minetest.registered_items[itemname].inventory_image
item_type = minetest.registered_items[itemname].type
end
prop = {
is_visible = true, is_visible = true,
visual = "sprite", textures = { stack:get_name() },
textures = {"unknown_item.png"} })
} local def = stack:get_definition()
if item_texture and item_texture ~= "" then self.object:setyaw((def and def.type == "node") and 0 or math.pi * 0.25)
prop.visual = "sprite"
prop.textures = {item_texture}
prop.visual_size = {x = 0.3, y = 0.3}
else
prop.visual = "wielditem"
prop.textures = {itemname}
prop.visual_size = {x = 0.15, y = 0.15}
end
self.object:set_properties(prop)
end, end,
get_staticdata = function(self) get_staticdata = function(self)