awards: patch awards resizing formspec elements

master
Alexander Weber 2018-12-16 11:34:21 +01:00
parent 36c75ed649
commit 7479ded96b
1 changed files with 7 additions and 3 deletions

View File

@ -3,11 +3,15 @@ if not minetest.get_modpath("awards") then
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[]"
local formspec = awards.getFormspec(self.data.playername, self.data.playername, self.data.awards_idx or 1)
-- patch elememt sizes and positions
formspec = formspec:gsub('textarea%[0.25,3.75;3.9,4.2', 'textarea[-0.75,3.75;5.9,4.2')
formspec = formspec:gsub('box%[%-0.05,3.75;3.9,4.2', 'box[-1.05,3.75;5.9,4.2')
formspec = formspec:gsub('textlist%[4,0;3.8,8.6', 'textlist[6,0;6.8,8.6')
self.data.code = "container[3,0]".. formspec .."container_end[]"
end)
state:onInput(function(state, fields, player)