Add compatibility machine with listring
Clear syntax. Add listring click + shift for take item in invetory or machine.
This commit is contained in:
parent
17a6f6d8d5
commit
d7a7a7e1a6
@ -176,18 +176,25 @@ local function update_meta(meta, enabled)
|
||||
--local state = enabled and "on" or "off"
|
||||
--meta:set_int("enabled", enabled and 1 or 0)
|
||||
meta:set_string("formspec",
|
||||
"size[8,11]"..
|
||||
"list[context;recipe;0,0;3,3;]"..
|
||||
"image[3,1;1,1;gui_hb_bg.png^[colorize:#141318:255]"..
|
||||
"list[context;output;3,1;1,1;]"..
|
||||
--"image_button[3,2;1,1;pipeworks_button_" .. state .. ".png;" .. state .. ";;;false;pipeworks_button_interm.png]" .. -- rnd disable button
|
||||
"list[context;src;0,3.5;8,3;]"..
|
||||
"list[context;dst;4,0;4,3;]"..
|
||||
default.gui_bg..
|
||||
default.gui_bg_img..
|
||||
default.gui_slots..
|
||||
default.get_hotbar_bg(0,7) ..
|
||||
"list[current_player;main;0,7;8,4;]")
|
||||
"size[8,11]"..
|
||||
"list[context;recipe;0,0;3,3;]"..
|
||||
"image[3,1;1,1;gui_hb_bg.png^[colorize:#141318:255]"..
|
||||
"list[context;output;3,1;1,1;]"..
|
||||
--"image_button[3,2;1,1;pipeworks_button_" .. state .. ".png;" .. state .. ";;;false;pipeworks_button_interm.png]" .. -- rnd disable button
|
||||
"list[context;src;0,3.5;8,3;]"..
|
||||
"list[context;dst;4,0;4,3;]"..
|
||||
default.gui_bg..
|
||||
default.gui_bg_img..
|
||||
default.gui_slots..
|
||||
default.get_hotbar_bg(0,7)..
|
||||
"list[current_player;main;0,7;8,4;]"..
|
||||
"listring[context;dst]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[context;src]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[context;recipe]"..
|
||||
"listring[current_player;main]"
|
||||
)
|
||||
|
||||
-- toggling the button doesn't quite call for running a recipe change check
|
||||
-- so instead we run a minimal version for infotext setting only
|
||||
|
35
enviro.lua
35
enviro.lua
@ -16,8 +16,7 @@ local space_start = 1100;
|
||||
local enviro_update_form = function (pos)
|
||||
|
||||
local meta = minetest.get_meta(pos);
|
||||
|
||||
|
||||
|
||||
local x0,y0,z0;
|
||||
x0=meta:get_int("x0");y0=meta:get_int("y0");z0=meta:get_int("z0");
|
||||
|
||||
@ -37,21 +36,23 @@ local enviro_update_form = function (pos)
|
||||
local list_name = "nodemeta:"..pos.x..','..pos.y..','..pos.z;
|
||||
|
||||
local form =
|
||||
"size[8,8.5]" .. -- width, height
|
||||
"field[0.25,0.5;1,1;x0;target;"..x0.."] field[1.25,0.5;1,1;y0;;"..y0.."] field[2.25,0.5;1,1;z0;;"..z0.."]"..
|
||||
"field[3.25,0.5;1,1;r;radius;"..r.."]"..
|
||||
--speed, jump, gravity,sneak
|
||||
"field[0.25,1.5;1,1;speed;speed;"..speed.."]"..
|
||||
"field[1.25,1.5;1,1;jump;jump;".. jump.."]"..
|
||||
"field[2.25,1.5;1,1;g;gravity;"..g.."]"..
|
||||
"field[3.25,1.5;1,1;sneak;sneak;"..sneak.."]"..
|
||||
"label[0.,3.0;Skybox selection]"..
|
||||
"dropdown[0.,3.35;3,1;skybox;"..skylist..";".. sky_ind .."]"..
|
||||
"button_exit[3.25,3.25;1,1;OK;OK]"..
|
||||
"list["..list_name..";fuel;3.25,2.25;1,1;]"..
|
||||
"list[current_player;main;0,4.5;8,4;]";
|
||||
meta:set_string("formspec",form);
|
||||
|
||||
"size[8,8.5]".. -- width, height
|
||||
"field[0.25,0.5;1,1;x0;target;"..x0.."] field[1.25,0.5;1,1;y0;;"..y0.."] field[2.25,0.5;1,1;z0;;"..z0.."]"..
|
||||
"field[3.25,0.5;1,1;r;radius;"..r.."]"..
|
||||
--speed, jump, gravity,sneak
|
||||
"field[0.25,1.5;1,1;speed;speed;"..speed.."]"..
|
||||
"field[1.25,1.5;1,1;jump;jump;"..jump.."]"..
|
||||
"field[2.25,1.5;1,1;g;gravity;"..g.."]"..
|
||||
"field[3.25,1.5;1,1;sneak;sneak;"..sneak.."]"..
|
||||
"label[0.,3.0;Skybox selection]"..
|
||||
"dropdown[0.,3.35;3,1;skybox;"..skylist..";"..sky_ind.."]"..
|
||||
"button_exit[3.25,3.25;1,1;OK;OK]"..
|
||||
"list["..list_name..";fuel;3.25,2.25;1,1;]"..
|
||||
"list[current_player;main;0,4.5;8,4;]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring["..list_name..";fuel]"..
|
||||
"listring[current_player;main]"
|
||||
meta:set_string("formspec",form)
|
||||
end
|
||||
|
||||
-- enviroment changer
|
||||
|
22
grinder.lua
22
grinder.lua
@ -124,12 +124,11 @@ end
|
||||
|
||||
|
||||
local grinder_update_meta = function(pos)
|
||||
local meta = minetest.get_meta(pos);
|
||||
local list_name = "nodemeta:"..pos.x..','..pos.y..','..pos.z
|
||||
local inv_name = "nodemeta:" .. pos.x ..","..pos.y..","..pos.z ;
|
||||
local form =
|
||||
"size[8,8]" .. -- width, height
|
||||
--"size[6,10]" .. -- width, height
|
||||
local meta = minetest.get_meta(pos);
|
||||
local list_name = "nodemeta:"..pos.x..','..pos.y..','..pos.z
|
||||
local form =
|
||||
"size[8,8]".. -- width, height
|
||||
--"size[6,10]".. -- width, height
|
||||
"label[0,0;IN] label[1,0;OUT] label[0,2;FUEL] "..
|
||||
"list["..list_name..";src;0.,0.5;1,1;]"..
|
||||
"list["..list_name..";dst;1.,0.5;3,3;]"..
|
||||
@ -137,12 +136,13 @@ local grinder_update_meta = function(pos)
|
||||
"list[current_player;main;0,4;8,4;]"..
|
||||
"button[6.5,0.5;1,1;OK;OK]"..
|
||||
"button[6.5,1.5;1,1;help;help]"..
|
||||
"listring[" .. inv_name .. ";dst]"..
|
||||
"listring["..list_name..";dst]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[" .. inv_name .. ";src]";
|
||||
|
||||
|
||||
meta:set_string("formspec", form);
|
||||
"listring["..list_name..";src]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring["..list_name..";fuel]"..
|
||||
"listring[current_player;main]"
|
||||
meta:set_string("formspec", form)
|
||||
end
|
||||
|
||||
minetest.register_node("basic_machines:grinder", {
|
||||
|
36
mover.lua
36
mover.lua
@ -163,7 +163,11 @@ local get_mover_form = function(pos,player)
|
||||
"dropdown[0.,3.35;3,1;mode;normal,dig,drop,object,inventory,transport;".. mode .."]"..
|
||||
"list[nodemeta:"..pos.x..','..pos.y..','..pos.z ..";filter;3,4.4;1,1;]"..
|
||||
"list[nodemeta:"..pos.x..','..pos.y..','..pos.z ..";upgrade;4,4.4;1,1;]".."label[4,4;upgrade .. ".. upgrade .."]" ..
|
||||
"field[3.25,1.5;1.,1;reverse;reverse;"..mreverse.."]" .. "list[current_player;main;0,5.5;8,4;]";
|
||||
"field[3.25,1.5;1.,1;reverse;reverse;"..mreverse.."]" .. "list[current_player;main;0,5.5;8,4;]"..
|
||||
"listring[nodemeta:"..pos.x..','..pos.y..','..pos.z ..";upgrade]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[nodemeta:"..pos.x..','..pos.y..','..pos.z ..";filter]"..
|
||||
"listring[current_player;main]"
|
||||
return form
|
||||
end
|
||||
|
||||
@ -1968,18 +1972,24 @@ minetest.register_on_player_receive_fields(function(player,formname,fields)
|
||||
|
||||
|
||||
local form = "size[8,9.5]" .. -- width, height
|
||||
--"size[6,10]" .. -- width, height
|
||||
"field[0.25,0.5;1,1;x0;source1;"..x0.."] field[1.25,0.5;1,1;y0;;"..y0.."] field[2.25,0.5;1,1;z0;;"..z0.."]"..
|
||||
"field[3.25,0.5;1.5,1;inv1;inv1;" .. inv1 .."]"..
|
||||
"field[0.25,1.5;1,1;x1;source2;"..x1.."] field[1.25,1.5;1,1;y1;;"..y1.."] field[2.25,1.5;1,1;z1;;"..z1.."]"..
|
||||
"field[0.25,2.5;1,1;x2;Target;"..x2.."] field[1.25,2.5;1,1;y2;;"..y2.."] field[2.25,2.5;1,1;z2;;"..z2.."]"..
|
||||
"field[3.25,2.5;1.5,1;inv2;inv2;" .. inv2 .."]"..
|
||||
"button_exit[4,3.25;1,1;OK;OK] field[0.25,4.5;3,1;prefer;filter;"..prefer.."]"..
|
||||
"button[3,3.25;1,1;help;help]"..
|
||||
"field[0.25,3.6;3,1;mode;mode;".. mode .."]"..
|
||||
"list[nodemeta:"..pos.x..','..pos.y..','..pos.z ..";filter;3,4.4;1,1;]"..
|
||||
"list[nodemeta:"..pos.x..','..pos.y..','..pos.z ..";upgrade;4,4.4;1,1;]".."label[4,4;upgrade .. ".. upgrade .."]" ..
|
||||
"field[3.25,1.5;1.,1;reverse;reverse;"..mreverse.."]" .. "list[current_player;main;0,5.5;8,4;]";
|
||||
--"size[6,10]" .. -- width, height
|
||||
"field[0.25,0.5;1,1;x0;source1;"..x0.."] field[1.25,0.5;1,1;y0;;"..y0.."] field[2.25,0.5;1,1;z0;;"..z0.."]"..
|
||||
"field[3.25,0.5;1.5,1;inv1;inv1;" .. inv1 .."]"..
|
||||
"field[0.25,1.5;1,1;x1;source2;"..x1.."] field[1.25,1.5;1,1;y1;;"..y1.."] field[2.25,1.5;1,1;z1;;"..z1.."]"..
|
||||
"field[0.25,2.5;1,1;x2;Target;"..x2.."] field[1.25,2.5;1,1;y2;;"..y2.."] field[2.25,2.5;1,1;z2;;"..z2.."]"..
|
||||
"field[3.25,2.5;1.5,1;inv2;inv2;" .. inv2 .."]"..
|
||||
"button_exit[4,3.25;1,1;OK;OK] field[0.25,4.5;3,1;prefer;filter;"..prefer.."]"..
|
||||
"button[3,3.25;1,1;help;help]"..
|
||||
"field[0.25,3.6;3,1;mode;mode;".. mode .."]"..
|
||||
"list[nodemeta:"..pos.x..','..pos.y..','..pos.z ..";filter;3,4.4;1,1;]"..
|
||||
"list[nodemeta:"..pos.x..','..pos.y..','..pos.z ..";upgrade;4,4.4;1,1;]".."label[4,4;upgrade .. ".. upgrade .."]"..
|
||||
"field[3.25,1.5;1.,1;reverse;reverse;"..mreverse.."]"..
|
||||
"list[current_player;main;0,5.5;8,4;]"..
|
||||
"listring[nodemeta:"..pos.x..','..pos.y..','..pos.z ..";upgrade]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[nodemeta:"..pos.x..','..pos.y..','..pos.z ..";filter]"..
|
||||
"listring[current_player;main]"
|
||||
|
||||
-- minetest.after(1,
|
||||
-- function()
|
||||
minetest.show_formspec(player:get_player_name(), "basic_machines:mover_"..minetest.pos_to_string(pos), form)
|
||||
|
29
recycler.lua
29
recycler.lua
@ -139,21 +139,26 @@ end
|
||||
|
||||
|
||||
local recycler_update_meta = function(pos)
|
||||
local meta = minetest.get_meta(pos);
|
||||
local list_name = "nodemeta:"..pos.x..','..pos.y..','..pos.z
|
||||
local form =
|
||||
"size[8,8]" .. -- width, height
|
||||
--"size[6,10]" .. -- width, height
|
||||
local meta = minetest.get_meta(pos)
|
||||
local list_name = "nodemeta:"..pos.x..','..pos.y..','..pos.z
|
||||
local form =
|
||||
"size[8,8]".. -- width, height
|
||||
--"size[6,10]".. -- width, height
|
||||
"label[0,0;IN] label[1,0;OUT] label[0,2;FUEL] "..
|
||||
"list["..list_name..";src;0.,0.5;1,1;]"..
|
||||
"list["..list_name..";src;0.,0.5;1,1;]"..
|
||||
"list["..list_name..";dst;1.,0.5;3,3;]"..
|
||||
"list["..list_name..";fuel;0.,2.5;1,1;]"..
|
||||
"list["..list_name..";fuel;0.,2.5;1,1;]"..
|
||||
"list[current_player;main;0,4;8,4;]"..
|
||||
"field[4.5,0.75;2,1;recipe;select recipe: ;" .. (meta:get_int("recipe")) .. "]"..
|
||||
"button[6.5,0.5;1,1;OK;OK]";
|
||||
|
||||
--"field[0.25,4.5;2,1;mode;mode;"..mode.."]";
|
||||
meta:set_string("formspec", form);
|
||||
"field[4.5,0.75;2,1;recipe;select recipe: ;"..(meta:get_int("recipe")).."]"..
|
||||
"button[6.5,0.5;1,1;OK;OK]"..
|
||||
"listring["..list_name..";dst]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring["..list_name..";src]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring["..list_name..";fuel]"..
|
||||
"listring[current_player;main]"
|
||||
--"field[0.25,4.5;2,1;mode;mode;"..mode.."]"
|
||||
meta:set_string("formspec", form)
|
||||
end
|
||||
|
||||
minetest.register_node("basic_machines:recycler", {
|
||||
|
@ -4,20 +4,24 @@ local machines_minstep = 1
|
||||
-- BATTERY
|
||||
|
||||
local battery_update_meta = function(pos)
|
||||
local meta = minetest.get_meta(pos);
|
||||
local list_name = "nodemeta:"..pos.x..','..pos.y..','..pos.z
|
||||
local capacity = meta:get_float("capacity");
|
||||
local maxpower = meta:get_float("maxpower");
|
||||
local energy = math.ceil(10*meta:get_float("energy"))/10;
|
||||
local form =
|
||||
"size[8,6.5]" .. -- width, height
|
||||
local meta = minetest.get_meta(pos)
|
||||
local list_name = "nodemeta:"..pos.x..','..pos.y..','..pos.z
|
||||
local capacity = meta:get_float("capacity")
|
||||
local maxpower = meta:get_float("maxpower")
|
||||
local energy = math.ceil(10*meta:get_float("energy"))/10
|
||||
local form =
|
||||
"size[8,6.5]".. -- width, height
|
||||
"label[0,0;FUEL] ".."label[6,0;UPGRADE] "..
|
||||
"label[1,0;ENERGY ".. energy .."/ ".. capacity..", maximum power output ".. maxpower .."]"..
|
||||
"label[1,1;UPGRADE LEVEL ".. meta:get_int("upgrade") .. " (mese and diamond block)]"..
|
||||
"list["..list_name..";fuel;0.,0.5;1,1;]".. "list["..list_name..";upgrade;6.,0.5;2,1;]" ..
|
||||
"list[current_player;main;0,2.5;8,4;]"..
|
||||
"button[4.5,0.35;1.5,1;OK;REFRESH]";
|
||||
meta:set_string("formspec", form);
|
||||
"button[4.5,0.35;1.5,1;OK;REFRESH]"..
|
||||
"listring["..list_name..";upgrade]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring["..list_name..";fuel]"..
|
||||
"listring[current_player;main]"
|
||||
meta:set_string("formspec", form)
|
||||
end
|
||||
|
||||
--[power crystal name] = energy provided
|
||||
@ -260,13 +264,19 @@ local generator_update_meta = function(pos)
|
||||
local list_name = "nodemeta:"..pos.x..','..pos.y..','..pos.z
|
||||
|
||||
local form =
|
||||
"size[8,6.5]" .. -- width, height
|
||||
"label[0,0;POWER CRYSTALS] ".."label[6,0;UPGRADE] "..
|
||||
"label[1,1;UPGRADE LEVEL ".. meta:get_int("upgrade") .. " (gold and diamond block)]"..
|
||||
"list["..list_name..";fuel;0.,0.5;1,1;]".. "list["..list_name..";upgrade;6.,0.5;2,1;]" ..
|
||||
"list[current_player;main;0,2.5;8,4;]"..
|
||||
"button[4.5,1.5;1.5,1;OK;REFRESH]" .. "button[6,1.5;1.5,1;help;help]";
|
||||
meta:set_string("formspec", form);
|
||||
"size[8,6.5]" .. -- width, height
|
||||
"label[0,0;POWER CRYSTALS] ".."label[6,0;UPGRADE] "..
|
||||
"label[1,1;UPGRADE LEVEL ".. meta:get_int("upgrade").." (gold and diamond block)]"..
|
||||
"list["..list_name..";fuel;0.,0.5;1,1;]"..
|
||||
"list["..list_name..";upgrade;6.,0.5;2,1;]"..
|
||||
"list[current_player;main;0,2.5;8,4;]"..
|
||||
"button[4.5,1.5;1.5,1;OK;REFRESH]"..
|
||||
"button[6,1.5;1.5,1;help;help]"..
|
||||
"listring["..list_name..";fuel]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring["..list_name..";upgrade]"..
|
||||
"listring[current_player;main]"
|
||||
meta:set_string("formspec", form)
|
||||
end
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user