2018-02-13 22:31:44 +01:00
|
|
|
local S = skins.S
|
2017-06-15 17:18:51 +02:00
|
|
|
|
|
|
|
-- generate the current formspec
|
|
|
|
local function get_formspec(player, context)
|
|
|
|
local skin = skins.get_player_skin(player)
|
2018-02-13 22:31:44 +01:00
|
|
|
local formspec = skins.get_skin_info_formspec(skin)
|
2018-02-14 00:28:09 +01:00
|
|
|
formspec = formspec..skins.get_skin_selection_formspec(context, 4)
|
2017-06-15 17:18:51 +02:00
|
|
|
return formspec
|
|
|
|
end
|
|
|
|
|
|
|
|
sfinv.register_page("skins:overview", {
|
|
|
|
title = "Skins",
|
|
|
|
get = function(self, player, context)
|
2017-06-17 00:23:39 +02:00
|
|
|
-- collect skins data
|
2018-02-14 00:28:09 +01:00
|
|
|
context = skins.rebuild_formspec_context(player, context)
|
2017-06-15 17:18:51 +02:00
|
|
|
return sfinv.make_formspec(player, context, get_formspec(player, context))
|
2017-06-15 18:06:40 +02:00
|
|
|
end,
|
|
|
|
on_player_receive_fields = function(self, player, context, fields)
|
2018-02-14 00:28:09 +01:00
|
|
|
skins.on_skin_selection_receive_fields(player, context, fields)
|
|
|
|
sfinv.set_player_inventory_formspec(player)
|
2017-06-15 17:18:51 +02:00
|
|
|
end
|
2017-06-15 18:06:40 +02:00
|
|
|
})
|