Add controller formspec for MineClone2-derived games

This commit is contained in:
cora 2021-08-26 04:24:05 +02:00 committed by Nils Dagsson Moskopp
parent 5383de2c16
commit 84f98b788c
Signed by: erlehmann
GPG Key ID: A3BC671C35191080
2 changed files with 23 additions and 9 deletions

View File

@ -1,5 +1,6 @@
default?
mcl_colorblocks?
mcl_core?
mcl_formspec?
wordedit?
intllib?

View File

@ -13,7 +13,8 @@ end
local has_default = mod_loaded("default")
local has_mcl = mod_loaded("mcl_core") and
mod_loaded("mcl_colorblocks")
mod_loaded("mcl_colorblocks") and
mod_loaded("mcl_formspec")
if not (has_default or has_mcl) then
error(
@ -100,14 +101,26 @@ local function show_meshnode_formspec(pos, player)
local id = minetest.pos_to_string(pos)
local entity = meshnode.get_luaentity(id)
local spos = pos.x..","..pos.y..","..pos.z
local formspec = "size[8,8]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
default.get_hotbar_bg(0,4)..
"list[current_player;main;0,4;8,1;]"..
"list[current_player;main;0,5.25;8,3;8]"..
"list[nodemeta:"..spos..";tool;0.5,1.5;1,1;]"
local formspec = ""
if has_default then
formspec = "size[8,8]" ..
default.gui_bg ..
default.gui_bg_img ..
default.gui_slots ..
default.get_hotbar_bg(0,4) ..
"list[current_player;main;0,4;8,1;]" ..
"list[current_player;main;0,5.25;8,3;8]" ..
"list[nodemeta:"..spos..";tool;0.5,1.5;1,1;]"
end
if has_mcl then
formspec = "size[9,8.75]" ..
mcl_formspec.get_itemslot_bg(0.5,1.5,1,1) ..
"list[current_player;main;0,4.5;9,3;9]" ..
mcl_formspec.get_itemslot_bg(0,4.5,9,3) ..
"list[current_player;main;0,7.74;9,1;]" ..
mcl_formspec.get_itemslot_bg(0,7.74,9,1) ..
"list[nodemeta:" .. spos .. ";tool;0.5,1.5;1,1;]"
end
local buttons = {}
if entity and #entity.nodes > 0 then
if inv:contains_item("tool", "meshnode:glue") then