mirror of
https://github.com/minetest-mods/3d_armor.git
synced 2024-09-11 23:36:46 +02:00
Add texture transform support
This commit is contained in:
parent
59048743ab
commit
5e52758216
@ -12,4 +12,6 @@ default settings: [minetest.conf]
|
|||||||
# Set number of seconds between visible wielded item updates.
|
# Set number of seconds between visible wielded item updates.
|
||||||
wieldview_update_time = 2
|
wieldview_update_time = 2
|
||||||
|
|
||||||
|
# Show nodes as tiles, disabled by default
|
||||||
|
wieldview_node_tiles = false
|
||||||
|
|
||||||
|
@ -4,23 +4,33 @@ if not update_time then
|
|||||||
update_time = 2
|
update_time = 2
|
||||||
minetest.setting_set("wieldview_update_time", tostring(update_time))
|
minetest.setting_set("wieldview_update_time", tostring(update_time))
|
||||||
end
|
end
|
||||||
|
local node_tiles = minetest.setting_getbool("wieldview_node_tiles")
|
||||||
|
if not node_tiles then
|
||||||
|
node_tiles = false
|
||||||
|
minetest.setting_set("wieldview_node_tiles", "false")
|
||||||
|
end
|
||||||
|
|
||||||
|
dofile(minetest.get_modpath(minetest.get_current_modname()).."/transform.lua")
|
||||||
|
|
||||||
wieldview = {
|
wieldview = {
|
||||||
wielded_item = {},
|
wielded_item = {},
|
||||||
}
|
}
|
||||||
|
|
||||||
wieldview.get_item_texture = function(self, item)
|
wieldview.get_item_texture = function(self, item)
|
||||||
|
local texture = uniskins.default_texture
|
||||||
if item ~= "" then
|
if item ~= "" then
|
||||||
if minetest.registered_items[item] then
|
if minetest.registered_items[item] then
|
||||||
if minetest.registered_items[item].inventory_image ~= "" then
|
if minetest.registered_items[item].inventory_image ~= "" then
|
||||||
return minetest.registered_items[item].inventory_image
|
texture = minetest.registered_items[item].inventory_image
|
||||||
end
|
elseif node_tiles == true and minetest.registered_items[item].tiles then
|
||||||
if minetest.registered_items[item].tiles then
|
texture = minetest.registered_items[item].tiles[1]
|
||||||
return minetest.registered_items[item].tiles[1]
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if wieldview_transform[item] then
|
||||||
|
texture = texture.."^[transform"..wieldview_transform[item]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return uniskins.default_texture
|
return texture
|
||||||
end
|
end
|
||||||
|
|
||||||
wieldview.update_wielded_item = function(self, player)
|
wieldview.update_wielded_item = function(self, player)
|
||||||
|
24
wieldview/transform.lua
Normal file
24
wieldview/transform.lua
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
-- Wielded Item Transformations - http://dev.minetest.net/texture
|
||||||
|
|
||||||
|
wieldview_transform = {
|
||||||
|
["default:torch"]="R270",
|
||||||
|
["default:sapling"]="R270",
|
||||||
|
["flowers:dandelion_white"]="R270",
|
||||||
|
["flowers:dandelion_yellow"]="R270",
|
||||||
|
["flowers:geranium"]="R270",
|
||||||
|
["flowers:rose"]="R270",
|
||||||
|
["flowers:tulip"]="R270",
|
||||||
|
["flowers:viola"]="R270",
|
||||||
|
["bucket:bucket_empty"]="R270",
|
||||||
|
["bucket:bucket_water"]="R270",
|
||||||
|
["bucket:bucket_lava"]="R270",
|
||||||
|
["screwdriver:screwdriver"]="R270",
|
||||||
|
["screwdriver:screwdriver1"]="R270",
|
||||||
|
["screwdriver:screwdriver2"]="R270",
|
||||||
|
["screwdriver:screwdriver3"]="R270",
|
||||||
|
["screwdriver:screwdriver4"]="R270",
|
||||||
|
["vessels:glass_bottle"]="R270",
|
||||||
|
["vessels:drinking_glass"]="R270",
|
||||||
|
["vessels:steel_bottle"]="R270",
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user