Add bgcolor fixer
This commit is contained in:
parent
314139bc56
commit
2be19dc6d2
|
@ -1,4 +1,4 @@
|
|||
# fs51
|
||||
# FS51
|
||||
|
||||
A compatibility layer that makes formspec_version 3 (and later) formspecs
|
||||
render more correctly in Minetest 5.1.0 and earlier.
|
||||
|
|
13
init.lua
13
init.lua
|
@ -134,6 +134,16 @@ function fixers.dropdown(elem)
|
|||
elem.index_event = nil
|
||||
end
|
||||
|
||||
-- Use a hack to make "neither" work properly. Not much can be done about
|
||||
-- "both" unfortunately.
|
||||
function fixers.bgcolor(elem)
|
||||
if elem.fullscreen == 'neither' then
|
||||
elem.bgcolor = '#0000'
|
||||
elem.fullscreen = false
|
||||
end
|
||||
elem.fbgcolor = nil
|
||||
end
|
||||
|
||||
--
|
||||
local pre_types = {size = true, position = true, anchor = true,
|
||||
no_prepend = true}
|
||||
|
@ -206,5 +216,6 @@ end
|
|||
-- Monkey patch Minetest's code
|
||||
if rawget(_G, 'minetest') and minetest.register_on_player_receive_fields and
|
||||
not minetest.settings:get_bool('fs51.disable_monkey_patching') then
|
||||
dofile(minetest.get_modpath('fs51') .. '/monkey_patching.lua')
|
||||
local fn = minetest.get_modpath('fs51') .. '/monkey_patching.lua'
|
||||
assert(loadfile(fn))(fixers)
|
||||
end
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
-- Copyright © 2021 by luk3yx.
|
||||
--
|
||||
|
||||
local get_player_information = minetest.get_player_information
|
||||
local type = type
|
||||
local fixers = ...
|
||||
local get_player_information, type = minetest.get_player_information, type
|
||||
local function backport_for(name, formspec)
|
||||
local info = get_player_information(name)
|
||||
local formspec_version = info and info.formspec_version or 1
|
||||
|
@ -58,6 +58,9 @@ local function backport_for(name, formspec)
|
|||
end
|
||||
elseif formspec_version == 1 and node_type == 'tabheader' then
|
||||
node.w, node.h = nil, nil
|
||||
elseif formspec_version == 2 and node_type == 'bgcolor' then
|
||||
modified = true
|
||||
fixers.bgcolor(node)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue