From 6a09746b903d63302d9dd339877bf450adb3a52c Mon Sep 17 00:00:00 2001 From: Alexander Weber Date: Sun, 7 Jan 2018 20:30:27 +0100 Subject: [PATCH] Support for in_inventory_list attribute to hide usable skins in inventory API-documentation update --- API.md | 4 +++- skinlist.lua | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/API.md b/API.md index f94213b..193f824 100644 --- a/API.md +++ b/API.md @@ -70,12 +70,14 @@ Add a meta information to the skin object Note: the information is not stored, therefore should be filled each time during skins registration ## skin:get_meta(key) -The next metadata keys are usually filled +The next metadata keys are filled or/and used interally in skinsdb framework - name - A name for the skin - author - The skin author - license - THe skin texture license - assignment - (obsolete) is "player:playername" in case the skin is assigned to be privat for a player - playername - Player assignment for private skin. Set false for skins not usable by all players (like NPC-Skins), true or nothing for all player skins + - in_inventory_list - If set to false the skin is not visible in inventory skins selection but can be still applied to the player + - _sort_id - Thi skins lists are sorted by this field for output (internal key) ## skin:get_meta_string(key) Same as get_meta() but does return "" instead of nil if the meta key does not exists diff --git a/skinlist.lua b/skinlist.lua index 0a06f5d..5ed5e12 100644 --- a/skinlist.lua +++ b/skinlist.lua @@ -75,7 +75,7 @@ end function skins.get_skinlist_for_player(playername) local skinslist = {} for _, skin in pairs(skins.meta) do - if skin:is_applicable_for_player(playername) then + if skin:is_applicable_for_player(playername) and skin:get_meta("in_inventory_list") ~= false then table.insert(skinslist, skin) end end