awards support: page added
This commit is contained in:
parent
c66763f734
commit
a041b235b9
1
init.lua
1
init.lua
@ -21,3 +21,4 @@ dofile(modpath.."/pages/crafting.lua")
|
||||
dofile(modpath.."/pages/creative.lua")
|
||||
dofile(modpath.."/pages/player.lua")
|
||||
dofile(modpath.."/pages/doc.lua")
|
||||
dofile(modpath.."/pages/awards.lua")
|
||||
|
29
pages/awards.lua
Normal file
29
pages/awards.lua
Normal file
@ -0,0 +1,29 @@
|
||||
if not minetest.get_modpath("awards") then
|
||||
return
|
||||
end
|
||||
|
||||
local function awards_callback(state)
|
||||
state:label(3, 1, "lbl_header", "Awards")
|
||||
|
||||
local codebox = state:element("code", { name = "code", code = "", playername = state.location.rootState.location.player })
|
||||
codebox:onBuild(function(self)
|
||||
self.data.code = "container[3,2]".. awards.getFormspec(self.data.playername, self.data.playername, self.data.awards_idx or 1).."container_end[]"
|
||||
end)
|
||||
|
||||
state:onInput(function(state, fields, player)
|
||||
if fields.awards then
|
||||
local event = minetest.explode_textlist_event(fields.awards)
|
||||
if event.type == "CHG" then
|
||||
state:get("code").data.awards_idx = event.index
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
smart_inventory.register_page({
|
||||
name = "awards",
|
||||
icon = "awards_ui_icon.png",
|
||||
tooltip = "Awards",
|
||||
smartfs_callback = awards_callback,
|
||||
sequence = 25,
|
||||
})
|
Loading…
x
Reference in New Issue
Block a user