Add listring functionality

Add shift-click functionality
This commit is contained in:
est31 2015-06-18 04:09:27 +02:00
parent 7cd848a050
commit d732c8dfbd
9 changed files with 59 additions and 15 deletions

View File

@ -32,7 +32,8 @@ local generator_formspec =
"invsize[8,9;]".. "invsize[8,9;]"..
"label[0,0;"..S("Nuclear Reactor Rod Compartment").."]".. "label[0,0;"..S("Nuclear Reactor Rod Compartment").."]"..
"list[current_name;src;2,1;3,2;]".. "list[current_name;src;2,1;3,2;]"..
"list[current_player;main;0,5;8,4;]" "list[current_player;main;0,5;8,4;]"..
"listring[]"
-- "Boxy sphere" -- "Boxy sphere"
local nodebox = { local nodebox = {

View File

@ -73,7 +73,10 @@ local cnc_formspec =
"label[4, 5.5;"..S("Out:").."]".. "label[4, 5.5;"..S("Out:").."]"..
"list[current_name;dst;5,5.5;4,1;]".. "list[current_name;dst;5,5.5;4,1;]"..
"list[current_player;main;0,7;8,4;]" "listring[current_name;dst]"..
"listring[current_player;main]"..
"listring[current_name;src]"..
"listring[current_player;main]"
local size = 1; local size = 1;

View File

@ -20,7 +20,13 @@ local formspec =
"list[current_name;fuel;2,3;1,1;]".. "list[current_name;fuel;2,3;1,1;]"..
"list[current_name;src;2,1;2,1;]".. "list[current_name;src;2,1;2,1;]"..
"list[current_name;dst;5,1;2,2;]".. "list[current_name;dst;5,1;2,2;]"..
"list[current_player;main;0,5;8,4;]" "list[current_player;main;0,5;8,4;]"..
"listring[current_name;dst]"..
"listring[current_player;main]"..
"listring[current_name;src]"..
"listring[current_player;main]"..
"listring[current_name;fuel]"..
"listring[current_player;main]"
minetest.register_node("technic:coal_alloy_furnace", { minetest.register_node("technic:coal_alloy_furnace", {
description = machine_name, description = machine_name,
@ -125,7 +131,13 @@ minetest.register_abm({
"list[current_name;fuel;2,3;1,1;]".. "list[current_name;fuel;2,3;1,1;]"..
"list[current_name;src;2,1;2,1;]".. "list[current_name;src;2,1;2,1;]"..
"list[current_name;dst;5,1;2,2;]".. "list[current_name;dst;5,1;2,2;]"..
"list[current_player;main;0,5;8,4;]") "list[current_player;main;0,5;8,4;]"..
"listring[current_name;dst]"..
"listring[current_player;main]"..
"listring[current_name;src]"..
"listring[current_player;main]"..
"listring[current_name;fuel]"..
"listring[current_player;main]")
return return
end end

View File

@ -23,7 +23,14 @@ local workshop_formspec =
"list[current_name;upgrade1;1,3;1,1;]".. "list[current_name;upgrade1;1,3;1,1;]"..
"list[current_name;upgrade2;2,3;1,1;]".. "list[current_name;upgrade2;2,3;1,1;]"..
"label[1,4;"..S("Upgrade Slots").."]".. "label[1,4;"..S("Upgrade Slots").."]"..
"list[current_player;main;0,5;8,4;]" "list[current_player;main;0,5;8,4;]"..
"listring[current_player;main]"..
"listring[current_name;src]"..
"listring[current_player;main]"..
"listring[current_name;upgrade1]"..
"listring[current_player;main]"..
"listring[current_name;upgrade2]"..
"listring[current_player;main]"
local run = function(pos, node) local run = function(pos, node)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)

View File

@ -58,7 +58,8 @@ local function set_injector_formspec(meta)
"button[0,1;2,1;mode_item;"..S("Stackwise").."]" or "button[0,1;2,1;mode_item;"..S("Stackwise").."]" or
"button[0,1;2,1;mode_stack;"..S("Itemwise").."]").. "button[0,1;2,1;mode_stack;"..S("Itemwise").."]")..
"list[current_name;main;0,2;8,2;]".. "list[current_name;main;0,2;8,2;]"..
"list[current_player;main;0,5;8,4;]") "list[current_player;main;0,5;8,4;]"..
"listring[]")
end end
minetest.register_node("technic:injector", { minetest.register_node("technic:injector", {

View File

@ -71,13 +71,21 @@ function technic.register_battery_box(data)
"label[3,0;"..S("Charge").."]".. "label[3,0;"..S("Charge").."]"..
"label[5,0;"..S("Discharge").."]".. "label[5,0;"..S("Discharge").."]"..
"label[1,3;"..S("Power level").."]".. "label[1,3;"..S("Power level").."]"..
"list[current_player;main;0,5;8,4;]" "list[current_player;main;0,5;8,4;]"..
"listring[current_name;dst]"..
"listring[current_player;main]"..
"listring[current_name;src]"..
"listring[current_player;main]"
if data.upgrade then if data.upgrade then
formspec = formspec.. formspec = formspec..
"list[current_name;upgrade1;3.5,3;1,1;]".. "list[current_name;upgrade1;3.5,3;1,1;]"..
"list[current_name;upgrade2;4.5,3;1,1;]".. "list[current_name;upgrade2;4.5,3;1,1;]"..
"label[3.5,4;"..S("Upgrade Slots").."]" "label[3.5,4;"..S("Upgrade Slots").."]"..
"listring[current_name;upgrade1]"..
"listring[current_player;main]"..
"listring[current_name;upgrade2]"..
"listring[current_player;main]"
end end
local run = function(pos, node) local run = function(pos, node)

View File

@ -32,7 +32,8 @@ function technic.register_generator(data)
"label[0,0;"..S("Fuel-Fired %s Generator"):format(tier).."]".. "label[0,0;"..S("Fuel-Fired %s Generator"):format(tier).."]"..
"list[current_name;src;3,1;1,1;]".. "list[current_name;src;3,1;1,1;]"..
"image[4,1;1,1;default_furnace_fire_bg.png]".. "image[4,1;1,1;default_furnace_fire_bg.png]"..
"list[current_player;main;0,5;8,4;]" "list[current_player;main;0,5;8,4;]"..
"listring[]"
local desc = S("Fuel-Fired %s Generator"):format(tier) local desc = S("Fuel-Fired %s Generator"):format(tier)
@ -81,7 +82,8 @@ function technic.register_generator(data)
"list[current_name;src;3, 1;1, 1;]".. "list[current_name;src;3, 1;1, 1;]"..
"image[4, 1;1, 1;default_furnace_fire_bg.png^[lowpart:".. "image[4, 1;1, 1;default_furnace_fire_bg.png^[lowpart:"..
(percent)..":default_furnace_fire_fg.png]".. (percent)..":default_furnace_fire_fg.png]"..
"list[current_player;main;0, 5;8, 4;]") "list[current_player;main;0, 5;8, 4;]"..
"listring[]")
end end
minetest.register_node("technic:"..ltier.."_generator", { minetest.register_node("technic:"..ltier.."_generator", {
@ -159,7 +161,8 @@ function technic.register_generator(data)
"list[current_name;src;3, 1;1, 1;]".. "list[current_name;src;3, 1;1, 1;]"..
"image[4, 1;1, 1;default_furnace_fire_bg.png^[lowpart:".. "image[4, 1;1, 1;default_furnace_fire_bg.png^[lowpart:"..
(percent)..":default_furnace_fire_fg.png]".. (percent)..":default_furnace_fire_fg.png]"..
"list[current_player;main;0, 5;8, 4;]") "list[current_player;main;0, 5;8, 4;]"..
"listring[]")
return true return true
end, end,
}) })

View File

@ -42,12 +42,20 @@ function technic.register_base_machine(data)
"list[current_name;src;"..(4-input_size)..",1;"..input_size..",1;]".. "list[current_name;src;"..(4-input_size)..",1;"..input_size..",1;]"..
"list[current_name;dst;5,1;2,2;]".. "list[current_name;dst;5,1;2,2;]"..
"list[current_player;main;0,5;8,4;]".. "list[current_player;main;0,5;8,4;]"..
"label[0,0;"..machine_desc:format(tier).."]" "label[0,0;"..machine_desc:format(tier).."]"..
"listring[current_name;dst]"..
"listring[current_player;main]"..
"listring[current_name;src]"..
"listring[current_player;main]"
if data.upgrade then if data.upgrade then
formspec = formspec.. formspec = formspec..
"list[current_name;upgrade1;1,3;1,1;]".. "list[current_name;upgrade1;1,3;1,1;]"..
"list[current_name;upgrade2;2,3;1,1;]".. "list[current_name;upgrade2;2,3;1,1;]"..
"label[1,4;"..S("Upgrade Slots").."]" "label[1,4;"..S("Upgrade Slots").."]"..
"listring[current_name;upgrade1]"..
"listring[current_player;main]"..
"listring[current_name;upgrade2]"..
"listring[current_player;main]"
end end
local run = function(pos, node) local run = function(pos, node)

View File

@ -209,7 +209,8 @@ function technic.chests:definition(name, data)
"list[current_player;main;"..data.loleft..","..data.lotop..";8,4;]".. "list[current_player;main;"..data.loleft..","..data.lotop..";8,4;]"..
"background[-0.19,-0.25;"..(data.ovwidth+0.4)..","..(data.ovheight+0.75)..";technic_chest_form_bg.png]".. "background[-0.19,-0.25;"..(data.ovwidth+0.4)..","..(data.ovheight+0.75)..";technic_chest_form_bg.png]"..
"background["..data.hileft..",1;"..data.width..","..data.height..";technic_"..lname.."_chest_inventory.png]".. "background["..data.hileft..",1;"..data.width..","..data.height..";technic_"..lname.."_chest_inventory.png]"..
"background["..data.loleft..","..data.lotop..";8,4;technic_main_inventory.png]" "background["..data.loleft..","..data.lotop..";8,4;technic_main_inventory.png]"..
"listring[]"
if data.sort then if data.sort then
data.base_formspec = data.base_formspec.."button["..data.hileft..","..(data.height+1.1)..";1,0.8;sort;"..S("Sort").."]" data.base_formspec = data.base_formspec.."button["..data.hileft..","..(data.height+1.1)..";1,0.8;sort;"..S("Sort").."]"
end end