From 1512784d81c1470ed945665cff5e22cac77b36a5 Mon Sep 17 00:00:00 2001 From: AFCMS <61794590+AFCMS@users.noreply.github.com> Date: Sun, 29 Aug 2021 18:06:18 +0200 Subject: [PATCH] MTG: Optionally use 9 sliced background (#924) --- mods/mtg/default/init.lua | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/mods/mtg/default/init.lua b/mods/mtg/default/init.lua index c4c020d..d7ee118 100644 --- a/mods/mtg/default/init.lua +++ b/mods/mtg/default/init.lua @@ -10,10 +10,22 @@ default.LIGHT_MAX = 14 -- GUI related stuff minetest.register_on_joinplayer(function(player) - player:set_formspec_prepend([[ - bgcolor[#080808BB;true] - background[5,5;1,1;gui_formbg.png;true] - listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF] ]]) + -- Set formspec prepend + local formspec = [[ + bgcolor[#080808BB;true] + listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF] + ]] + + local name = player:get_player_name() + local info = minetest.get_player_information(name) + + if info.formspec_version > 1 then + formspec = formspec .. "background9[5,5;1,1;gui_formbg.png;true;10]" + else + formspec = formspec .. "background[5,5;1,1;gui_formbg.png;true]" + end + + player:set_formspec_prepend(formspec) end) function default.get_hotbar_bg(x,y)