Skip to content

Commit

Permalink
Forms: remove legacy default.{gui_bg[_img]|gui_slots}. Relates to l…
Browse files Browse the repository at this point in the history
  • Loading branch information
alek13 committed Oct 6, 2024
1 parent fb5fd91 commit f585c4f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 23 deletions.
2 changes: 0 additions & 2 deletions mods/_various/mobs/api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3122,8 +3122,6 @@ function mobs:feed_tame(self, clicker, feed_count, breed, tame)
local tag = self.nametag or ""

minetest.show_formspec(name, "mobs_nametag", "size[8,4]"
.. default.gui_bg
.. default.gui_bg_img
.. "field[0.5,1;7.5,0;name;" .. S("Enter name:") .. ";" .. tag .. "]"
.. "button_exit[2.5,3.5;3,1;mob_rename;" .. S("Rename") .. "]")

Expand Down
17 changes: 8 additions & 9 deletions mods/lord/Blocks/lord_homedecor/handlers/inventory.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,38 @@ local default_can_dig = function(pos,player)
return meta:get_inventory():is_empty("main")
end

local background = default.gui_bg .. default.gui_bg_img .. default.gui_slots
local default_inventory_formspecs = {
["4"]="size[8,6]".. background ..
["4"]="size[8,6]"..
"list[context;main;2,0;4,1;]"..
"list[current_player;main;0,2;8,4;]",

["6"]="size[8,6]".. background ..
["6"]="size[8,6]"..
"list[context;main;1,0;6,1;]"..
"list[current_player;main;0,2;8,4;]",

["8"]="size[8,6]".. background ..
["8"]="size[8,6]"..
"list[context;main;0,0;8,1;]"..
"list[current_player;main;0,2;8,4;]",

["12"]="size[8,7]".. background ..
["12"]="size[8,7]"..
"list[context;main;1,0;6,2;]"..
"list[current_player;main;0,3;8,4;]",

["16"]="size[8,7]".. background ..
["16"]="size[8,7]"..
"list[context;main;0,0;8,2;]"..
"list[current_player;main;0,3;8,4;]",

["24"]="size[8,8]".. background ..
["24"]="size[8,8]"..
"list[context;main;0,0;8,3;]"..
"list[current_player;main;0,4;8,4;]",

["32"]="size[8,9]".. background ..
["32"]="size[8,9]"..
"list[context;main;0,0.3;8,4;]"..
"list[current_player;main;0,4.85;8,1;]"..
"list[current_player;main;0,6.08;8,3;8]"..
default.get_hotbar_bg(0,4.85),

["50"]="size[10,10]".. background ..
["50"]="size[10,10]"..
"list[context;main;0,0;10,5;]"..
"list[current_player;main;1,6;8,4;]",
}
Expand Down
7 changes: 6 additions & 1 deletion mods/lord/Core/builtin/src/FormSpec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,14 @@ end
--- * Note: `fbgcolor`, leaving parameters empty and values for `fullscreen` that
--- are not bools are only available since formspec version 3.
---
--- @overload fun(bgcolor:string):string
--- @overload fun(bgcolor:string,fullscreen:string):string
--- @param bgcolor string is `ColorString`
--- @param fullscreen string one of `"true"`|`"false"`|`"both"`|`"neither"`
--- @param fbgcolor string is `ColorString`
--- @return string
function FormSpec.bgcolor(bgcolor,fullscreen,fbgcolor)
return 'bgcolor['..bgcolor..';'..fullscreen..';'..fbgcolor..']'
return 'bgcolor['..bgcolor..optional(fullscreen)..optional(fbgcolor)..']'
end

---
Expand Down
23 changes: 12 additions & 11 deletions mods/lord/Game/lord_forms/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,27 @@
minetest.mod(function(mod)
local spec = minetest.formspec

default.gui_bg = 'bgcolor[#080808BB;true]'
default.gui_bg_img = 'background9[5,5;1,1;gui_formbg.png;true;10]'
default.gui_slots = 'listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]'

local formspec_prepend =
default.gui_bg ..
default.gui_bg_img ..
default.gui_slots ..
spec.style_type('button', {
local formspec_prepend = ''
.. spec.bgcolor('#000c', 'true')
.. spec.background9(5, 5, 1, 1, 'gui_formbg.png', 'true', 10)
.. spec.listcolors('#0007', '#5a5a5a', '#141318', '#1238', '#fffc')
.. spec.style_type('button', {
bgimg = 'button_bg.png',
bgimg_middle = 4,
font = 'bold',
textcolor = '#fffc',
padding = '0',
})

-- as for now, this styles is not supported by MT
--.. spec.style_type({'field', 'field:focused', 'field:hovered', 'field:pressed'}, {
-- bgcolor = '#600',
-- bgcolor_hovered = '#000',
-- bgcolor_pressed = '#000',
-- padding = 0
--})

minetest.register_on_joinplayer(function(player)
player:set_formspec_prepend(formspec_prepend)
end)


end)

0 comments on commit f585c4f

Please sign in to comment.