1
0
mirror of https://github.com/mt-mods/pipeworks.git synced 2024-12-08 10:00:23 +01:00

MineClone formspec compat (#82)

* MineClone list backgrounds compat

* mineclone get inv func
This commit is contained in:
Github is a non-free platform owned by Microsoft. Reasonable alternatives exist, such as Gitea, Sourcehut. We need a federated, mastodon-like forge based on ForgeFed. See: https://forgefed.org 2023-08-25 02:50:49 +02:00 committed by GitHub
parent ebe2331619
commit 7f93e8aa0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 30 additions and 5 deletions

View File

@ -190,7 +190,7 @@ local function update_meta(meta, enabled)
local state = enabled and "on" or "off"
meta:set_int("enabled", enabled and 1 or 0)
local list_backgrounds = ""
if minetest.get_modpath("i3") then
if minetest.get_modpath("i3") or minetest.get_modpath("mcl_formspec") then
list_backgrounds = "style_type[box;colors=#666]"
for i=0, 2 do
for j=0, 2 do

View File

@ -168,6 +168,31 @@ function fs_helpers.get_inv(y)
end
end
table.insert(fs, "style_type[list;size="..size..";spacing="..spacing.."]")
table.insert(fs, "list[current_player;main;"..inv_x..","..(inv_y + 1.15)..";"..hotbar_len..","..(inv_size / hotbar_len)..";"..hotbar_len.."]")
elseif minetest.get_modpath("mcl_formspec") then
local inv_x = 0.22
local inv_y = (y + 0.4) or 6.9
local size, spacing = 1, 0.1
local hotbar_len = 9
local inv_size = hotbar_len * 4
table.insert(fs, "style_type[box;colors=#77777710,#77777710,#777,#777]")
for i = 0, hotbar_len - 1 do
table.insert(fs, "box["..(i * size + inv_x + (i * spacing))..","..inv_y..";"..size..","..size..";]")
end
table.insert(fs, "style_type[list;size="..size..";spacing="..spacing.."]")
table.insert(fs, "list[current_player;main;"..inv_x..","..inv_y..";"..hotbar_len..",1;]")
table.insert(fs, "style_type[box;colors=#666]")
for i=0, 2 do
for j=0, hotbar_len - 1 do
table.insert(fs, "box["..0.2+(j*0.1)+(j*size)..","..(inv_y+size+spacing+0.05)+(i*0.1)+(i*size)..";"..size..","..size..";]")
end
end
table.insert(fs, "style_type[list;size="..size..";spacing="..spacing.."]")
table.insert(fs, "list[current_player;main;"..inv_x..","..(inv_y + 1.15)..";"..hotbar_len..","..(inv_size / hotbar_len)..";"..hotbar_len.."]")
else

View File

@ -38,7 +38,7 @@ local function set_filter_formspec(data, meta)
end
local size = "10.2,11"
local list_backgrounds = ""
if minetest.get_modpath("i3") then
if minetest.get_modpath("i3") or minetest.get_modpath("mcl_formspec") then
list_backgrounds = "style_type[box;colors=#666]"
for i=0, 7 do
for j=0, 1 do

View File

@ -24,7 +24,7 @@ if pipeworks.enable_mese_tube then
)
end
local list_backgrounds = ""
if minetest.get_modpath("i3") then
if minetest.get_modpath("i3") or minetest.get_modpath("mcl_formspec") then
list_backgrounds = "style_type[box;colors=#666]"
for i=0, 5 do
for j=0, 5 do

View File

@ -23,7 +23,7 @@ minetest.register_node("pipeworks:trashcan", {
local meta = minetest.get_meta(pos)
local size = "10.2,9"
local list_background = ""
if minetest.get_modpath("i3") then
if minetest.get_modpath("i3") or minetest.get_modpath("mcl_formspec") then
list_background = "style_type[box;colors=#666]box[4.5,2;1,1;]"
end
meta:set_string("formspec",

View File

@ -8,7 +8,7 @@ end
local function set_wielder_formspec(data, meta)
local size = "10.2,"..(7+data.wield_inv_height)
local list_background = ""
if minetest.get_modpath("i3") then
if minetest.get_modpath("i3") or minetest.get_modpath("mcl_formspec") then
list_background = "style_type[box;colors=#666]"
for i=0, data.wield_inv_height-1 do
for j=0, data.wield_inv_width-1 do