Skip to content

Commit

Permalink
fixed listrings
Browse files Browse the repository at this point in the history
  • Loading branch information
nonfreegithub committed Dec 17, 2023
1 parent 06af175 commit d10b453
Show file tree
Hide file tree
Showing 9 changed files with 90 additions and 56 deletions.
3 changes: 2 additions & 1 deletion technic/machines/HV/nuclear_reactor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ local function make_reactor_formspec(meta)
local f = size..
"label[0,0;"..S("Nuclear Reactor Rod Compartment").."]"..
"list[context;src;2,1;3,2;]"..
"listring[context;src]"..
"button[5.5,1.5;2,1;start;"..S("Start").."]"..
"checkbox[5.5,2.5;autostart;"..S("Automatic Start")..";"..meta:get_string("autostart").."]"
if has_mcl then
Expand All @@ -51,7 +52,7 @@ local function make_reactor_formspec(meta)
else
f = f..
"list[current_player;main;0,5;8,4;]"..
"listring[]"
"listring[current_player;main]"
end
if not has_digilines then
return f
Expand Down
3 changes: 2 additions & 1 deletion technic/machines/HV/quarry.lua
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ local size = minetest.get_modpath("mcl_formspec") and "size[9,10]" or "size[8,9]
local base_formspec = size..
"label[0,0;"..S("@1 Quarry", S("HV")).."]"..
"list[context;cache;0,0.7;4,3;]"..
"listring[context;cache]"..
"button[6,0.6;2,1;restart;"..S("Restart").."]"..
"field[4.3,2.1;2,1;size;"..S("Radius")..";${size}]"..
"field[6.3,2.1;2,1;max_depth;"..S("Max Depth")..";${max_depth}]"..
Expand All @@ -287,7 +288,7 @@ if has_mcl then
else
base_formspec = base_formspec..
"list[current_player;main;0,5;8,4;]"..
"listring[]"
"listring[current_player;main]"
end

local function update_formspec(meta)
Expand Down
24 changes: 13 additions & 11 deletions technic/machines/MV/tool_workshop.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,7 @@ local workshop_formspec =
"label[0,0;"..S("@1 Tool Workshop", S("MV")).."]"..
"list[context;upgrade1;1,3;1,1;]"..
"list[context;upgrade2;2,3;1,1;]"..
"label[1,4;"..S("Upgrade Slots").."]"..
"listring[context;src]"..
"listring[current_player;main]"..
"listring[context;upgrade1]"..
"listring[current_player;main]"..
"listring[context;upgrade2]"..
"listring[current_player;main]"
"label[1,4;"..S("Upgrade Slots").."]"

if minetest.get_modpath("mcl_formspec") then
workshop_formspec = workshop_formspec..
Expand All @@ -43,14 +37,22 @@ if minetest.get_modpath("mcl_formspec") then
"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)..
"listring[current_player;main]"
mcl_formspec.get_itemslot_bg(0,7.74,9,1)
else
workshop_formspec = workshop_formspec..
"list[current_player;main;0,5;8,4;]"..
"listring[current_player;main]"
"list[current_player;main;0,5;8,4;]"
end

-- listrings
workshop_formspec = workshop_formspec..
"listring[current_player;main]"..
"listring[context;src]"..
"listring[current_player;main]"..
"listring[context;upgrade1]"..
"listring[current_player;main]"..
"listring[context;upgrade2]"..
"listring[current_player;main]"

local run = function(pos, node)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
Expand Down
36 changes: 25 additions & 11 deletions technic/machines/other/coal_alloy_furnace.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,7 @@ local formspec =
"image[2,2;1,1;default_furnace_fire_bg.png]"..
"list[context;fuel;2,3;1,1;]"..
"list[context;src;2,1;2,1;]"..
"list[context;dst;5,1;2,2;]"..
"listring[context;dst]"..
"listring[context;src]"..
"listring[current_player;main]"..
"listring[context;fuel]"..
"listring[current_player;main]"
"list[context;dst;5,1;2,2;]"

if minetest.get_modpath("mcl_formspec") then
formspec = formspec..
Expand All @@ -37,14 +32,21 @@ if minetest.get_modpath("mcl_formspec") then
"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)..
"listring[current_player;main]"
mcl_formspec.get_itemslot_bg(0,7.74,9,1)
else
formspec = formspec..
"list[current_player;main;0,5;8,4;]"..
"listring[current_player;main]"
"list[current_player;main;0,5;8,4;]"
end

-- listrings
formspec = formspec..
"listring[context;dst]"..
"listring[current_player;main]"..
"listring[context;src]"..
"listring[current_player;main]"..
"listring[context;fuel]"..
"listring[current_player;main]"

minetest.register_node("technic:coal_alloy_furnace", {
description = machine_name,
tiles = {"technic_coal_alloy_furnace_top.png", "technic_coal_alloy_furnace_bottom.png",
Expand Down Expand Up @@ -151,7 +153,19 @@ minetest.register_abm({
"list[context;fuel;2,3;1,1;]"..
"list[context;src;2,1;2,1;]"..
"list[context;dst;5,1;2,2;]"..
"list[current_player;main;0,5;8,4;]"..

(minetest.get_modpath("mcl_formspec") and
mcl_formspec.get_itemslot_bg(2,3,1,1)..
mcl_formspec.get_itemslot_bg(2,1,2,1)..
mcl_formspec.get_itemslot_bg(5,1,2,2)..
-- player inventory
"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)
or "list[current_player;main;0,5;8,4;]")..

-- listrings
"listring[context;dst]"..
"listring[current_player;main]"..
"listring[context;src]"..
Expand Down
16 changes: 10 additions & 6 deletions technic/machines/other/constructor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,7 @@ local function make_constructor(mark, length)
for i = 1, length do
formspec = formspec..
"label[5,"..(i - 1)..";"..S("Slot @1", i).."]"..
"list[context;slot"..i..";6,"..(i - 1)..";1,1;]"..
"listring[context;slot"..i.."]"
"list[context;slot"..i..";6,"..(i - 1)..";1,1;]"
end
if minetest.get_modpath("mcl_formspec") then
for i = 1, length do
Expand All @@ -168,13 +167,18 @@ local function make_constructor(mark, length)
"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)..
"listring[current_player;main]"
mcl_formspec.get_itemslot_bg(0,7.74,9,1)
else
formspec = formspec..
"list[current_player;main;0,5;8,4;]"..
"listring[current_player;main]"
"list[current_player;main;0,5;8,4;]"
end
-- listrings
for i = 1, length do
formspec = formspec..
"listring[current_player;main]"..
"listring[context;slot"..i.."]"
end

meta:set_string("formspec", formspec)
meta:set_string("infotext", S("Constructor Mk@1", mark))
local inv = meta:get_inventory()
Expand Down
5 changes: 3 additions & 2 deletions technic/machines/other/injector.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ local param2_to_under = {
local size = minetest.get_modpath("mcl_formspec") and "size[9,10]" or "size[8,9]"
local base_formspec = size..
"label[0,0;"..S("Self-Contained Injector").."]"..
"list[context;main;0,2;8,2;]"
"list[context;main;0,2;8,2;]"..
"listring[context;main]"

if minetest.get_modpath("mcl_formspec") then
base_formspec = base_formspec..
Expand All @@ -30,7 +31,7 @@ if minetest.get_modpath("mcl_formspec") then
else
base_formspec = base_formspec..
"list[current_player;main;0,5;8,4;]"..
"listring[]"
"listring[current_player;main]"
end

local function set_injector_formspec(pos)
Expand Down
25 changes: 15 additions & 10 deletions technic/machines/register/battery_box.lua
Original file line number Diff line number Diff line change
Expand Up @@ -125,18 +125,10 @@ function technic.register_battery_box(nodename, data)
"label[3,0;"..S("Charge").."]"..
"label[5,0;"..S("Discharge").."]"..
"label[1,3;"..S("Power level").."]"..
"listring[context;dst]"..
"listring[current_player;main]"..
"listring[context;src]"..
"listring[current_player;main]"..
(def.upgrade and
"list[context;upgrade1;3.5,3;1,1;]"..
"list[context;upgrade2;4.5,3;1,1;]"..
"label[3.5,4;"..S("Upgrade Slots").."]"..
"listring[context;upgrade1]"..
"listring[current_player;main]"..
"listring[context;upgrade2]"..
"listring[current_player;main]"
"label[3.5,4;"..S("Upgrade Slots").."]"
or "")

if minetest.get_modpath("mcl_formspec") then
Expand All @@ -148,7 +140,6 @@ function technic.register_battery_box(nodename, data)
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)..
"listring[current_player;main]"..
-- upgrade
(def.upgrade and
mcl_formspec.get_itemslot_bg(3.5,3,1,1)..
Expand All @@ -159,6 +150,20 @@ function technic.register_battery_box(nodename, data)
"list[current_player;main;0,5;8,4;]"
end

-- listrings
formspec = formspec..
"listring[context;dst]"..
"listring[current_player;main]"..
"listring[context;src]"..
"listring[current_player;main]"..
(def.upgrade and
"listring[context;upgrade1]"..
"listring[current_player;main]"..
"listring[context;upgrade2]"..
"listring[current_player;main]"
or "")



--
-- Generate formspec with power meter
Expand Down
2 changes: 2 additions & 0 deletions technic/machines/register/generator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ local function update_generator_formspec(meta, desc, percent, form_buttons)
local generator_formspec = size..
"label[0, 0;"..desc.."]"..
"list[context;src;3,1;1,1;]"..
"listring[context;src]"..
"image[4,1;1,1;default_furnace_fire_bg.png^[lowpart:"..
(percent)..":default_furnace_fire_fg.png]"..
form_buttons
Expand Down Expand Up @@ -65,6 +66,7 @@ function technic.register_generator(data)
size..
"label[0,0;"..S("Fuel-Fired @1 Generator", S(tier)).."]"..
"list[context;src;3,1;1,1;]"..
"listring[context;src]"..
"image[4,1;1,1;default_furnace_fire_bg.png]"

if minetest.get_modpath("mcl_formspec") then
Expand Down
32 changes: 18 additions & 14 deletions technic/machines/register/machine_base.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,12 @@ function technic.register_base_machine(nodename, data)
size..
"list[context;src;"..(4-input_size)..",1;"..input_size..",1;]"..
"list[context;dst;5,1;2,2;]"..
"label[0,0;"..def.description.."]"..
"listring[context;dst]"..
"listring[current_player;main]"..
"listring[context;src]"..
"listring[current_player;main]"
"label[0,0;"..def.description.."]"
if def.upgrade then
formspec = formspec..
"list[context;upgrade1;1,3;1,1;]"..
"list[context;upgrade2;2,3;1,1;]"..
"label[1,4;"..S("Upgrade Slots").."]"..
"listring[context;upgrade1]"..
"listring[current_player;main]"..
"listring[context;upgrade2]"..
"listring[current_player;main]"
"label[1,4;"..S("Upgrade Slots").."]"
end

if minetest.get_modpath("mcl_formspec") then
Expand All @@ -81,17 +73,29 @@ function technic.register_base_machine(nodename, data)
"list[current_player;main;0,5.5;9,3;9]"..
mcl_formspec.get_itemslot_bg(0,5.5,9,3)..
"list[current_player;main;0,8.74;9,1;]"..
mcl_formspec.get_itemslot_bg(0,8.74,9,1)..
"listring[current_player;main]"
mcl_formspec.get_itemslot_bg(0,8.74,9,1)
if def.upgrade then
formspec = formspec..
mcl_formspec.get_itemslot_bg(1,3,1,1)..
mcl_formspec.get_itemslot_bg(2,3,1,1)
end
else
formspec = formspec..
"list[current_player;main;0,5;8,4;]"..
"listring[current_player;main]"
"list[current_player;main;0,5;8,4;]"
end

-- listrings
formspec = formspec..
"listring[context;dst]"..
"listring[current_player;main]"..
"listring[context;src]"..
"listring[current_player;main]"
if def.upgrade then
formspec = formspec..
"listring[context;upgrade1]"..
"listring[current_player;main]"..
"listring[context;upgrade2]"..
"listring[current_player;main]"
end

local tube = technic.new_default_tube()
Expand Down

0 comments on commit d10b453

Please sign in to comment.