diff --git a/mods/PLAYER/wieldview/LICENSE.txt b/mods/PLAYER/wieldview/LICENSE.txt index 4e8d524b81..e1552c0668 100644 --- a/mods/PLAYER/wieldview/LICENSE.txt +++ b/mods/PLAYER/wieldview/LICENSE.txt @@ -1,5 +1,18 @@ [mod] visible wielded items [wieldview] ======================================= -License Source Code: Copyright (C) 2013-2017 Stuart Jones - LGPL v2.1 +Copyright (C) 2012-2019 stujones11, Stuart Jones +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. diff --git a/mods/PLAYER/wieldview/README.txt b/mods/PLAYER/wieldview/README.txt index 66133c745a..183e8c6d5e 100644 --- a/mods/PLAYER/wieldview/README.txt +++ b/mods/PLAYER/wieldview/README.txt @@ -1,8 +1,6 @@ [mod] visible wielded items [wieldview] ======================================= -Depends on: mcl_armor - Makes hand wielded items visible to other players. default settings: [minetest.conf] @@ -13,3 +11,11 @@ wieldview_update_time = 2 # Show nodes as tiles, disabled by default wieldview_node_tiles = false + +Info for modders +################ + +Wield image transformation: To apply a simple transformation to the item in +hand, add the group “wieldview_transform” to the item definition. The group +rating equals one of the numbers used for the [transform texture modifier +of the Lua API. diff --git a/mods/PLAYER/wieldview/init.lua b/mods/PLAYER/wieldview/init.lua index 2824097d1f..ecbb2dc0b7 100644 --- a/mods/PLAYER/wieldview/init.lua +++ b/mods/PLAYER/wieldview/init.lua @@ -29,8 +29,15 @@ wieldview.get_item_texture = function(self, item) texture = minetest.inventorycube(minetest.registered_items[item].tiles[1]) end end - if wieldview.transform[item] then - texture = texture.."^[transform"..wieldview.transform[item] + -- Get item image transformation, first from group, then from transform.lua + local transform = minetest.get_item_group(item, "wieldview_transform") + if transform == 0 then + transform = wieldview.transform[item] + end + if transform then + -- This actually works with groups ratings because transform1, transform2, etc. + -- have meaning and transform0 is used for identidy, so it can be ignored + texture = texture.."^[transform"..tostring(transform) end end return texture