Fix misaligned generator formspec in MCL
This commit is contained in:
parent
d39fc81bb8
commit
c8d69e514b
@ -462,17 +462,6 @@ if industrialtest.mclAvailable then
|
||||
})
|
||||
end
|
||||
industrialtest.gameTexturePrefix="mcl"
|
||||
-- FIXME: Formspecs when used with MCL are misaligned, to fix that and also preserve compatibilty
|
||||
-- with MTG MCL has to stop using legacy formspec coordinates ~mrkubax10
|
||||
industrialtest.formspecVersion=function()
|
||||
return ""
|
||||
end
|
||||
industrialtest.formspecList=function(ctx,name,x,y,w,h)
|
||||
return "list["..ctx..";"..name..";"..x..","..y..";"..w..","..h.."]"..mcl_formspec.get_itemslot_bg(x,y,w,h)
|
||||
end
|
||||
industrialtest.formspecPlayerInv=function()
|
||||
return "list[current_player;main;0.5,5.5;9,3;9]"..mcl_formspec.get_itemslot_bg(0.5,5.5,9,3).."list[current_player;main;0.5,8.74;9,1]"..mcl_formspec.get_itemslot_bg(0.5,8.74,9,1)
|
||||
end
|
||||
-- assign element keys for elements that are required later
|
||||
industrialtest.elementKeys.stick="mcl_core:stick"
|
||||
industrialtest.elementKeys.ironIngot="mcl_core:iron_ingot"
|
||||
@ -624,15 +613,6 @@ elseif industrialtest.mtgAvailable then
|
||||
}
|
||||
})
|
||||
end
|
||||
industrialtest.formspecVersion=function()
|
||||
return "formspec_version[4]"
|
||||
end
|
||||
industrialtest.formspecList=function(ctx,name,x,y,w,h)
|
||||
return "list["..ctx..";"..name..";"..x..","..y..";"..w..","..h.."]"
|
||||
end
|
||||
industrialtest.formspecPlayerInv=function()
|
||||
return "list[current_player;main;0.5,6.25;8,1]list[current_player;main;0.5,7.5;8,3;8]"
|
||||
end
|
||||
industrialtest.gameTexturePrefix="mtg"
|
||||
industrialtest.elementKeys.tinIngot="default:tin_ingot"
|
||||
industrialtest.elementKeys.bronzeIngot="default:bronze_ingot"
|
||||
|
50
machines.lua
50
machines.lua
@ -18,20 +18,42 @@ local S=minetest.get_translator("industrialtest")
|
||||
|
||||
-- Generators
|
||||
local function generatorFormspec(fuelPercent,charged)
|
||||
local formspec={
|
||||
industrialtest.formspecVersion(),
|
||||
"size[10.8,12]",
|
||||
"label[0.5,0.5;"..S("Generator").."]",
|
||||
industrialtest.formspecList("context","charged",4.9,1.8,1,1),
|
||||
"listring[context;charged]",
|
||||
(fuelPercent>0 and "image[4.9,2.8;1,1;default_furnace_fire_bg.png^[lowpart:"..fuelPercent..":default_furnace_fire_fg.png]"
|
||||
or "image[4.9,2.8;1,1;default_furnace_fire_bg.png]"),
|
||||
industrialtest.formspecList("context","fuel",4.9,3.9,1,1),
|
||||
"listring[context;fuel]",
|
||||
"box[9,1;0.3,4.8;#202020]",
|
||||
(charged>0 and "box[9,"..(1+4.8-(charged*4.8))..";0.3,"..(charged*4.8)..";#FF1010]" or ""),
|
||||
industrialtest.formspecPlayerInv()
|
||||
}
|
||||
local formspec
|
||||
if industrialtest.mtgAvailable then
|
||||
formspec={
|
||||
"formspec_version[4]",
|
||||
"size[10.8,12]",
|
||||
"label[0.5,0.5;"..S("Generator").."]",
|
||||
"list[context;charged;4.9,1.8;1,1]",
|
||||
"listring[context;charged]",
|
||||
(fuelPercent>0 and "image[4.9,2.8;1,1;default_furnace_fire_bg.png^[lowpart:"..fuelPercent..":default_furnace_fire_fg.png]"
|
||||
or "image[4.9,2.8;1,1;default_furnace_fire_bg.png]"),
|
||||
"list[context;fuel;4.9,3.9;1,1]",
|
||||
"listring[context;fuel]",
|
||||
"box[9,1;0.3,4.8;#202020]",
|
||||
(charged>0 and "box[9,"..(1+4.8-(charged*4.8))..";0.3,"..(charged*4.8)..";#FF1010]" or ""),
|
||||
"list[current_player;main;0.5,6.25;8,1]list[current_player;main;0.5,7.5;8,3;8]"
|
||||
}
|
||||
elseif industrialtest.mclAvailable then
|
||||
formspec={
|
||||
"size[10.04,12]",
|
||||
"label[0.25,0.25;"..S("Generator").."]",
|
||||
"list[context;charged;4.7,1.8;1,1]",
|
||||
mcl_formspec.get_itemslot_bg(4.7,1.8,1,1),
|
||||
"listring[context;charged]",
|
||||
(fuelPercent>0 and "image[4.7,2.8;1,1;default_furnace_fire_bg.png^[lowpart:"..fuelPercent..":default_furnace_fire_fg.png]"
|
||||
or "image[4.7,2.8;1,1;default_furnace_fire_bg.png]"),
|
||||
"list[context;fuel;4.7,3.9;1,1]",
|
||||
mcl_formspec.get_itemslot_bg(4.7,3.9,1,1),
|
||||
"listring[context;fuel]",
|
||||
"box[9,1;0.3,4.8;#202020]",
|
||||
(charged>0 and "box[9,"..(1+4.8-(charged*4.8))..";0.3,"..(charged*4.8)..";#FF1010]" or ""),
|
||||
"list[current_player;main;0.5,7;9,3;9]",
|
||||
mcl_formspec.get_itemslot_bg(0.5,7,9,3),
|
||||
"list[current_player;main;0.5,10.24;9,1]",
|
||||
mcl_formspec.get_itemslot_bg(0.5,10.24,9,1)
|
||||
}
|
||||
end
|
||||
return table.concat(formspec,"")
|
||||
end
|
||||
local function generatorMclAfterDigNode(pos,oldnode,oldmeta,digger)
|
||||
|
Loading…
Reference in New Issue
Block a user