summaryrefslogtreecommitdiff
path: root/sfinv_page.lua
blob: e90dd38d67ef3acbaeebaa338322d6d353792556 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
local S = skins.S

-- generate the current formspec
local function get_formspec(player, context)
	local skin = skins.get_player_skin(player)
	local formspec = skins.get_skin_info_formspec(skin)
	formspec = formspec..skins.get_skin_selection_formspec(context, 4)
	return formspec
end

sfinv.register_page("skins:overview", {
	title = "Skins",
	get = function(self, player, context)
		-- collect skins data
		context = skins.rebuild_formspec_context(player, context)
		return sfinv.make_formspec(player, context, get_formspec(player, context))
	end,
	on_player_receive_fields = function(self, player, context, fields)
		skins.on_skin_selection_receive_fields(player, context, fields)
		sfinv.set_player_inventory_formspec(player)
	end
})