get the new api working with sfinv and 3d_armor

This commit is contained in:
Alexander Weber 2017-06-16 23:16:22 +02:00
parent 28d28390ce
commit 8d991881aa
4 changed files with 8 additions and 6 deletions

View File

@ -9,7 +9,7 @@ skins = {}
skins.modpath = minetest.get_modpath(minetest.get_current_modname())
skins.default = "character_1"
dofile(skins.modpath.."skin_meta_api.lua")
dofile(skins.modpath.."/skin_meta_api.lua")
dofile(skins.modpath.."/api.lua")
dofile(skins.modpath.."/skinlist.lua")
@ -30,6 +30,6 @@ if minetest.global_exists("armor") then
end
armor.get_preview = function(self, name)
local skin = skins.get_player_skin(minetest.get_player_by_name(name))
return skin:get_meta("preview")
return skin:get_preview()
end
end

View File

@ -11,7 +11,8 @@ local dropdown_values = {}
-- collect skins data
local total_pages = 1
for i, skin in ipairs(skins.list) do
skin:set_meta("inv_page", math.floor((i-1) / 16)+1)
local page = math.floor((i-1) / 16)+1
skin:set_meta("inv_page", page)
skin:set_meta("inv_page_index", (i-1)%16+1)
total_pages = page
end

View File

@ -12,9 +12,9 @@ function skins.new(key, object)
setmetatable(self, skin_class)
self.__index = skin_class
self._key, key)
self._key = key
self._sort_id = 0
skins.meta[key]
skins.meta[key] = self
return self
end

View File

@ -7,7 +7,7 @@ for _, fn in pairs(skins_dir_list) do
nameparts = string.gsub(fn, "[.]", "_"):split("_")
local id = nameparts[2]
local name = "character_"..id
local skin_obj = skins.get(name) or skins.new(new)
local skin_obj = skins.get(name) or skins.new(name)
if nameparts[3] == "preview" then
skin_obj:set_preview(fn)
else
@ -21,6 +21,7 @@ for _, fn in pairs(skins_dir_list) do
skin_obj:set_meta("author", data[2])
skin_obj:set_meta("license", data[3])
end
table.insert(unsorted_skinslist, skin_obj)
end
end
end