Some space and newline optimizations

This commit is contained in:
Thomas--S 2017-03-29 15:58:54 +02:00
parent 09798d13b9
commit 7851a45f88
18 changed files with 203 additions and 205 deletions

View File

@ -42,8 +42,7 @@ local function update_forcefield(pos, meta, active, first)
local shape = meta:get_int("shape") local shape = meta:get_int("shape")
local range = meta:get_int("range") local range = meta:get_int("range")
local vm = VoxelManip() local vm = VoxelManip()
local MinEdge, MaxEdge = vm:read_from_map(vector.subtract(pos, range), local MinEdge, MaxEdge = vm:read_from_map(vector.subtract(pos, range), vector.add(pos, range))
vector.add(pos, range))
local area = VoxelArea:new({ MinEdge = MinEdge, MaxEdge = MaxEdge }) local area = VoxelArea:new({ MinEdge = MinEdge, MaxEdge = MaxEdge })
local data = vm:get_data() local data = vm:get_data()
@ -90,7 +89,7 @@ local function update_forcefield(pos, meta, active, first)
end end
local function set_forcefield_formspec(meta) local function set_forcefield_formspec(meta)
local formspec = "size[5,2.25]" .. local formspec = "size[5,2.25]"..
"field[0.3,0.5;2,1;range;"..S("Range")..";"..meta:get_int("range").."]" "field[0.3,0.5;2,1;range;"..S("Range")..";"..meta:get_int("range").."]"
-- The names for these toggle buttons are explicit about which -- The names for these toggle buttons are explicit about which
-- state they'll switch to, so that multiple presses (arising -- state they'll switch to, so that multiple presses (arising

View File

@ -28,11 +28,10 @@ minetest.register_craft({
} }
}) })
local reactor_formspec = local reactor_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[]" "listring[]"
-- "Boxy sphere" -- "Boxy sphere"

View File

@ -16,10 +16,10 @@ local quarry_eject_dir = vector.new(0, 1, 0)
local function set_quarry_formspec(meta) local function set_quarry_formspec(meta)
local radius = meta:get_int("size") local radius = meta:get_int("size")
local formspec = "size[6,4.3]" .. local formspec = "size[6,4.3]"..
"list[context;cache;0,1;4,3;]" .. "list[context;cache;0,1;4,3;]"..
"item_image[4.8,0;1,1;technic:quarry]" .. "item_image[4.8,0;1,1;technic:quarry]"..
"label[0,0.2;"..S("%s Quarry"):format("HV").."]" .. "label[0,0.2;"..S("%s Quarry"):format("HV").."]"..
"field[4.3,3.5;2,1;size;"..S("Radius:")..";"..radius.."]" "field[4.3,3.5;2,1;size;"..S("Radius:")..";"..radius.."]"
if meta:get_int("enabled") == 0 then if meta:get_int("enabled") == 0 then
formspec = formspec.."button[4,1;2,1;enable;"..S("Disabled").."]" formspec = formspec.."button[4,1;2,1;enable;"..S("Disabled").."]"
@ -197,7 +197,7 @@ end
local function send_move_error(player) local function send_move_error(player)
minetest.chat_send_player(player:get_player_name(), minetest.chat_send_player(player:get_player_name(),
S("Manually taking/removing from cache by hand is not possible. " .. S("Manually taking/removing from cache by hand is not possible. "..
"If you can't wait, restart or disable the quarry to start automatic purge.")) "If you can't wait, restart or disable the quarry to start automatic purge."))
return 0 return 0
end end

View File

@ -48,46 +48,46 @@ local twosize_products = {
} }
local cnc_formspec = local cnc_formspec =
"invsize[9,11;]" .. "invsize[9,11;]"..
"label[1,0;"..S("Choose Milling Program:").."]" .. "label[1,0;"..S("Choose Milling Program:").."]"..
"image_button[1,0.5;1,1;technic_cnc_slope.png;slope; ]" .. "image_button[1,0.5;1,1;technic_cnc_slope.png;slope; ]"..
"image_button[2,0.5;1,1;technic_cnc_slope_edge.png;slope_edge; ]" .. "image_button[2,0.5;1,1;technic_cnc_slope_edge.png;slope_edge; ]"..
"image_button[3,0.5;1,1;technic_cnc_slope_inner_edge.png;slope_inner_edge; ]" .. "image_button[3,0.5;1,1;technic_cnc_slope_inner_edge.png;slope_inner_edge; ]"..
"image_button[4,0.5;1,1;technic_cnc_pyramid.png;pyramid; ]" .. "image_button[4,0.5;1,1;technic_cnc_pyramid.png;pyramid; ]"..
"image_button[5,0.5;1,1;technic_cnc_spike.png;spike; ]" .. "image_button[5,0.5;1,1;technic_cnc_spike.png;spike; ]"..
"image_button[6,0.5;1,1;technic_cnc_cylinder.png;cylinder; ]" .. "image_button[6,0.5;1,1;technic_cnc_cylinder.png;cylinder; ]"..
"image_button[7,0.5;1,1;technic_cnc_oblate_spheroid.png;oblate_spheroid; ]" .. "image_button[7,0.5;1,1;technic_cnc_oblate_spheroid.png;oblate_spheroid; ]"..
"image_button[8,0.5;1,1;technic_cnc_stick.png;stick; ]" .. "image_button[8,0.5;1,1;technic_cnc_stick.png;stick; ]"..
"image_button[1,1.5;1,1;technic_cnc_slope_upsdwn.png;slope_upsdown; ]" .. "image_button[1,1.5;1,1;technic_cnc_slope_upsdwn.png;slope_upsdown; ]"..
"image_button[2,1.5;1,1;technic_cnc_slope_edge_upsdwn.png;slope_edge_upsdown; ]" .. "image_button[2,1.5;1,1;technic_cnc_slope_edge_upsdwn.png;slope_edge_upsdown; ]"..
"image_button[3,1.5;1,1;technic_cnc_slope_inner_edge_upsdwn.png;slope_inner_edge_upsdown; ]" .. "image_button[3,1.5;1,1;technic_cnc_slope_inner_edge_upsdwn.png;slope_inner_edge_upsdown; ]"..
"image_button[4,1.5;1,1;technic_cnc_cylinder_horizontal.png;cylinder_horizontal; ]" .. "image_button[4,1.5;1,1;technic_cnc_cylinder_horizontal.png;cylinder_horizontal; ]"..
"image_button[5,1.5;1,1;technic_cnc_sphere.png;sphere; ]" .. "image_button[5,1.5;1,1;technic_cnc_sphere.png;sphere; ]"..
"image_button[1,2.5;1,1;technic_cnc_slope_lying.png;slope_lying; ]" .. "image_button[1,2.5;1,1;technic_cnc_slope_lying.png;slope_lying; ]"..
"image_button[2,2.5;1,1;technic_cnc_onecurvededge.png;onecurvededge; ]" .. "image_button[2,2.5;1,1;technic_cnc_onecurvededge.png;onecurvededge; ]"..
"image_button[3,2.5;1,1;technic_cnc_twocurvededge.png;twocurvededge; ]" .. "image_button[3,2.5;1,1;technic_cnc_twocurvededge.png;twocurvededge; ]"..
"label[1,3.5;"..S("Slim Elements half / normal height:").."]" .. "label[1,3.5;"..S("Slim Elements half / normal height:").."]"..
"image_button[1,4;1,0.5;technic_cnc_full.png;full; ]" .. "image_button[1,4;1,0.5;technic_cnc_full.png;full; ]"..
"image_button[1,4.5;1,0.5;technic_cnc_half.png;half; ]" .. "image_button[1,4.5;1,0.5;technic_cnc_half.png;half; ]"..
"image_button[2,4;1,1;technic_cnc_element_straight.png;element_straight; ]" .. "image_button[2,4;1,1;technic_cnc_element_straight.png;element_straight; ]"..
"image_button[3,4;1,1;technic_cnc_element_end.png;element_end; ]" .. "image_button[3,4;1,1;technic_cnc_element_end.png;element_end; ]"..
"image_button[4,4;1,1;technic_cnc_element_cross.png;element_cross; ]" .. "image_button[4,4;1,1;technic_cnc_element_cross.png;element_cross; ]"..
"image_button[5,4;1,1;technic_cnc_element_t.png;element_t; ]" .. "image_button[5,4;1,1;technic_cnc_element_t.png;element_t; ]"..
"image_button[6,4;1,1;technic_cnc_element_edge.png;element_edge; ]" .. "image_button[6,4;1,1;technic_cnc_element_edge.png;element_edge; ]"..
"label[0, 5.5;"..S("In:").."]" .. "label[0, 5.5;"..S("In:").."]"..
"list[current_name;src;0.5,5.5;1,1;]" .. "list[current_name;src;0.5,5.5;1,1;]"..
"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;]" .. "list[current_player;main;0,7;8,4;]"..
"listring[current_name;dst]" .. "listring[current_name;dst]"..
"listring[current_player;main]" .. "listring[current_player;main]"..
"listring[current_name;src]" .. "listring[current_name;src]"..
"listring[current_player;main]" "listring[current_player;main]"
local size = 1; local size = 1;

View File

@ -71,19 +71,19 @@ end
local function set_display(meta) local function set_display(meta)
meta:set_string("formspec", meta:set_string("formspec",
"size[4,4.5]" .. "size[4,4.5]"..
"item_image[0,0;1,1;technic:music_player]" .. "item_image[0,0;1,1;technic:music_player]"..
"label[1,0;"..S("%s Music Player"):format("LV").."]" .. "label[1,0;"..S("%s Music Player"):format("LV").."]"..
"button[0,1;1,1;track1;1]" .. "button[0,1;1,1;track1;1]"..
"button[1,1;1,1;track2;2]" .. "button[1,1;1,1;track2;2]"..
"button[2,1;1,1;track3;3]" .. "button[2,1;1,1;track3;3]"..
"button[0,2;1,1;track4;4]" .. "button[0,2;1,1;track4;4]"..
"button[1,2;1,1;track5;5]" .. "button[1,2;1,1;track5;5]"..
"button[2,2;1,1;track6;6]" .. "button[2,2;1,1;track6;6]"..
"button[0,3;1,1;track7;7]" .. "button[0,3;1,1;track7;7]"..
"button[1,3;1,1;track8;8]" .. "button[1,3;1,1;track8;8]"..
"button[2,3;1,1;track9;9]" .. "button[2,3;1,1;track9;9]"..
"button[3,1;1,1;stop;Stop]" .. "button[3,1;1,1;stop;Stop]"..
"label[0,4;"..minetest.formspec_escape(meta:get_int("active") == 0 and "label[0,4;"..minetest.formspec_escape(meta:get_int("active") == 0 and
S("Stopped") or S("Stopped") or
S("Current track %s"):format(meta:get_int("current_track"))).."]") S("Current track %s"):format(meta:get_int("current_track"))).."]")

View File

@ -17,19 +17,19 @@ minetest.register_craft({
local workshop_demand = { 5000, 3500, 2000 } local workshop_demand = { 5000, 3500, 2000 }
local workshop_formspec = local workshop_formspec =
"invsize[8,9;]" .. "invsize[8,9;]"..
"list[current_name;src;3,1;1,1;]" .. "list[current_name;src;3,1;1,1;]"..
"label[0,0;"..S("%s Tool Workshop"):format("MV").."]" .. "label[0,0;"..S("%s Tool Workshop"):format("MV").."]"..
"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_player;main]"..
"listring[current_name;src]" .. "listring[current_name;src]"..
"listring[current_player;main]" .. "listring[current_player;main]"..
"listring[current_name;upgrade1]" .. "listring[current_name;upgrade1]"..
"listring[current_player;main]" .. "listring[current_player;main]"..
"listring[current_name;upgrade2]" .. "listring[current_name;upgrade2]"..
"listring[current_player;main]" "listring[current_player;main]"
local run = function(pos, node) local run = function(pos, node)

View File

@ -50,17 +50,17 @@ end
local function set_display(pos, meta) local function set_display(pos, meta)
meta:set_string("infotext", S(meta:get_int("enabled") ~= 0 and "%s Enabled" or "%s Disabled"):format(desc)) meta:set_string("infotext", S(meta:get_int("enabled") ~= 0 and "%s Enabled" or "%s Disabled"):format(desc))
meta:set_string("formspec", meta:set_string("formspec",
"size[5,3.5]" .. "size[5,3.5]"..
"item_image[0,0;1,1;technic:admin_anchor]" .. "item_image[0,0;1,1;technic:admin_anchor]"..
"label[1,0;"..minetest.formspec_escape(desc).."]" .. "label[1,0;"..minetest.formspec_escape(desc).."]"..
"label[0,1;"..minetest.formspec_escape(S("Owner:").." "..meta:get_string("owner")).."]" .. "label[0,1;"..minetest.formspec_escape(S("Owner:").." "..meta:get_string("owner")).."]"..
(meta:get_int("locked") == 0 and (meta:get_int("locked") == 0 and
"button[3,1;2,1;lock;"..minetest.formspec_escape(S("Unlocked")).."]" or "button[3,1;2,1;lock;"..minetest.formspec_escape(S("Unlocked")).."]" or
"button[3,1;2,1;unlock;"..minetest.formspec_escape(S("Locked")).."]") .. "button[3,1;2,1;unlock;"..minetest.formspec_escape(S("Locked")).."]")..
"field[0.25,2.3;1,1;radius;"..minetest.formspec_escape(S("Radius:"))..";"..meta:get_int("radius").."]" .. "field[0.25,2.3;1,1;radius;"..minetest.formspec_escape(S("Radius:"))..";"..meta:get_int("radius").."]"..
(meta:get_int("enabled") == 0 and (meta:get_int("enabled") == 0 and
"button[3,2;2,1;enable;"..minetest.formspec_escape(S("Disabled")).."]" or "button[3,2;2,1;enable;"..minetest.formspec_escape(S("Disabled")).."]" or
"button[3,2;2,1;disable;"..minetest.formspec_escape(S("Enabled")).."]") .. "button[3,2;2,1;disable;"..minetest.formspec_escape(S("Enabled")).."]")..
"label[0,3;"..minetest.formspec_escape(S("Keeping %d/%d map blocks loaded"):format(#currently_forceloaded_positions(meta), #compute_forceload_positions(pos, meta))).."]") "label[0,3;"..minetest.formspec_escape(S("Keeping %d/%d map blocks loaded"):format(#currently_forceloaded_positions(meta), #compute_forceload_positions(pos, meta))).."]")
end end

View File

@ -13,18 +13,18 @@ minetest.register_craft({
local machine_name = S("Fuel-Fired Alloy Furnace") local machine_name = S("Fuel-Fired Alloy Furnace")
local formspec = local formspec =
"size[8,9]" .. "size[8,9]"..
"label[0,0;"..machine_name.."]" .. "label[0,0;"..machine_name.."]"..
"image[2,2;1,1;default_furnace_fire_bg.png]" .. "image[2,2;1,1;default_furnace_fire_bg.png]"..
"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_name;dst]"..
"listring[current_player;main]" .. "listring[current_player;main]"..
"listring[current_name;src]" .. "listring[current_name;src]"..
"listring[current_player;main]" .. "listring[current_player;main]"..
"listring[current_name;fuel]" .. "listring[current_name;fuel]"..
"listring[current_player;main]" "listring[current_player;main]"
minetest.register_node("technic:coal_alloy_furnace", { minetest.register_node("technic:coal_alloy_furnace", {
@ -128,19 +128,19 @@ minetest.register_abm({
meta:set_string("infotext", S("%s Active"):format(machine_name).." ("..percent.."%)") meta:set_string("infotext", S("%s Active"):format(machine_name).." ("..percent.."%)")
technic.swap_node(pos, "technic:coal_alloy_furnace_active") technic.swap_node(pos, "technic:coal_alloy_furnace_active")
meta:set_string("formspec", meta:set_string("formspec",
"size[8,9]" .. "size[8,9]"..
"label[0,0;"..machine_name.."]" .. "label[0,0;"..machine_name.."]"..
"image[2,2;1,1;default_furnace_fire_bg.png^[lowpart:" .. "image[2,2;1,1;default_furnace_fire_bg.png^[lowpart:"..
(100 - percent)..":default_furnace_fire_fg.png]" .. (100 - percent)..":default_furnace_fire_fg.png]"..
"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_name;dst]"..
"listring[current_player;main]" .. "listring[current_player;main]"..
"listring[current_name;src]" .. "listring[current_name;src]"..
"listring[current_player;main]" .. "listring[current_player;main]"..
"listring[current_name;fuel]" .. "listring[current_name;fuel]"..
"listring[current_player;main]") "listring[current_player;main]")
return return
end end

View File

@ -131,8 +131,8 @@ local function make_constructor(mark, length)
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local formspec = "size[8,9;]" .. local formspec = "size[8,9;]"..
"label[0,0;"..S("Constructor Mk%d"):format(mark).."]" .. "label[0,0;"..S("Constructor Mk%d"):format(mark).."]"..
"list[current_player;main;0,5;8,4;]" "list[current_player;main;0,5;8,4;]"
for i = 1, length do for i = 1, length do
formspec = formspec formspec = formspec

View File

@ -49,14 +49,14 @@ minetest.register_craft({
local function set_injector_formspec(meta) local function set_injector_formspec(meta)
local is_stack = meta:get_string("mode") == "whole stacks" local is_stack = meta:get_string("mode") == "whole stacks"
meta:set_string("formspec", meta:set_string("formspec",
"invsize[8,9;]" .. "invsize[8,9;]"..
"item_image[0,0;1,1;technic:injector]" .. "item_image[0,0;1,1;technic:injector]"..
"label[1,0;"..S("Self-Contained Injector").."]" .. "label[1,0;"..S("Self-Contained Injector").."]"..
(is_stack and (is_stack and
"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[]") "listring[]")
end end

View File

@ -61,29 +61,29 @@ function technic.register_battery_box(data)
local ltier = string.lower(tier) local ltier = string.lower(tier)
local formspec = local formspec =
"invsize[8,9;]" .. "invsize[8,9;]"..
"image[1,1;1,2;technic_power_meter_bg.png]" .. "image[1,1;1,2;technic_power_meter_bg.png]"..
"list[current_name;src;3,1;1,1;]" .. "list[current_name;src;3,1;1,1;]"..
"image[4,1;1,1;technic_battery_reload.png]" .. "image[4,1;1,1;technic_battery_reload.png]"..
"list[current_name;dst;5,1;1,1;]" .. "list[current_name;dst;5,1;1,1;]"..
"label[0,0;"..S("%s Battery Box"):format(tier).."]" .. "label[0,0;"..S("%s Battery Box"):format(tier).."]"..
"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_name;dst]"..
"listring[current_player;main]" .. "listring[current_player;main]"..
"listring[current_name;src]" .. "listring[current_name;src]"..
"listring[current_player;main]" "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_name;upgrade1]"..
"listring[current_player;main]" .. "listring[current_player;main]"..
"listring[current_name;upgrade2]" .. "listring[current_name;upgrade2]"..
"listring[current_player;main]" "listring[current_player;main]"
end end
@ -144,7 +144,7 @@ function technic.register_battery_box(data)
local charge_percent = math.floor(current_charge / max_charge * 100) local charge_percent = math.floor(current_charge / max_charge * 100)
meta:set_string("formspec", meta:set_string("formspec",
formspec .. formspec..
"image[1,1;1,2;technic_power_meter_bg.png" "image[1,1;1,2;technic_power_meter_bg.png"
.. "^[lowpart:"..charge_percent .. "^[lowpart:"..charge_percent
.. ":technic_power_meter_fg.png]") .. ":technic_power_meter_fg.png]")

View File

@ -33,11 +33,11 @@ function technic.register_generator(data)
for k, v in pairs(groups) do active_groups[k] = v end for k, v in pairs(groups) do active_groups[k] = v end
local generator_formspec = local generator_formspec =
"invsize[8,9;]" .. "invsize[8,9;]"..
"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[]" "listring[]"
local desc = S("Fuel-Fired %s Generator"):format(tier) local desc = S("Fuel-Fired %s Generator"):format(tier)
@ -84,12 +84,12 @@ function technic.register_generator(data)
local percent = math.floor((burn_time / burn_totaltime) * 100) local percent = math.floor((burn_time / burn_totaltime) * 100)
meta:set_string("infotext", desc.." ("..percent.."%)") meta:set_string("infotext", desc.." ("..percent.."%)")
meta:set_string("formspec", meta:set_string("formspec",
"size[8, 9]" .. "size[8, 9]"..
"label[0, 0;"..minetest.formspec_escape(desc).."]" .. "label[0, 0;"..minetest.formspec_escape(desc).."]"..
"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[]") "listring[]")
end end
@ -169,12 +169,12 @@ function technic.register_generator(data)
meta:set_int("burn_time", burn_time) meta:set_int("burn_time", burn_time)
local percent = math.floor(burn_time / burn_totaltime * 100) local percent = math.floor(burn_time / burn_totaltime * 100)
meta:set_string("formspec", meta:set_string("formspec",
"size[8, 9]" .. "size[8, 9]"..
"label[0, 0;"..minetest.formspec_escape(desc).."]" .. "label[0, 0;"..minetest.formspec_escape(desc).."]"..
"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[]") "listring[]")
return true return true
end, end,

View File

@ -37,23 +37,23 @@ function technic.register_base_machine(data)
for k, v in pairs(groups) do active_groups[k] = v end for k, v in pairs(groups) do active_groups[k] = v end
local formspec = local formspec =
"invsize[8,9;]" .. "invsize[8,9;]"..
"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_name;dst]"..
"listring[current_player;main]" .. "listring[current_player;main]"..
"listring[current_name;src]" .. "listring[current_name;src]"..
"listring[current_player;main]" "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_name;upgrade1]"..
"listring[current_player;main]" .. "listring[current_player;main]"..
"listring[current_name;upgrade2]" .. "listring[current_name;upgrade2]"..
"listring[current_player;main]" "listring[current_player;main]"
end end

View File

@ -10,7 +10,7 @@
local S = technic.getter local S = technic.getter
local function set_supply_converter_formspec(meta) local function set_supply_converter_formspec(meta)
local formspec = "size[5,2.25]" .. local formspec = "size[5,2.25]"..
"field[0.3,0.5;2,1;power;"..S("Input Power")..";"..meta:get_int("power").."]" "field[0.3,0.5;2,1;power;"..S("Input Power")..";"..meta:get_int("power").."]"
-- The names for these toggle buttons are explicit about which -- The names for these toggle buttons are explicit about which
-- state they'll switch to, so that multiple presses (arising -- state they'll switch to, so that multiple presses (arising

View File

@ -64,33 +64,33 @@ minetest.register_tool("technic:prospector", {
end end
local look_diameter = toolmeta.look_radius * 2 + 1 local look_diameter = toolmeta.look_radius * 2 + 1
minetest.show_formspec(user:get_player_name(), "technic:prospector_control", minetest.show_formspec(user:get_player_name(), "technic:prospector_control",
"size[7,8.5]" .. "size[7,8.5]"..
"item_image[0,0;1,1;"..toolstack:get_name().."]" .. "item_image[0,0;1,1;"..toolstack:get_name().."]"..
"label[1,0;"..minetest.formspec_escape(toolstack:get_definition().description).."]" .. "label[1,0;"..minetest.formspec_escape(toolstack:get_definition().description).."]"..
(toolmeta.target ~= "" and (toolmeta.target ~= "" and
"label[0,1.5;Current target:]" .. "label[0,1.5;Current target:]"..
"label[0,2;"..minetest.formspec_escape(minetest.registered_nodes[toolmeta.target].description).."]" .. "label[0,2;"..minetest.formspec_escape(minetest.registered_nodes[toolmeta.target].description).."]"..
"item_image[0,2.5;1,1;"..toolmeta.target.."]" or "item_image[0,2.5;1,1;"..toolmeta.target.."]" or
"label[0,1.5;No target set]") .. "label[0,1.5;No target set]")..
(pointed and (pointed and
"label[3.5,1.5;May set new target:]" .. "label[3.5,1.5;May set new target:]"..
"label[3.5,2;"..minetest.formspec_escape(minetest.registered_nodes[pointed].description).."]" .. "label[3.5,2;"..minetest.formspec_escape(minetest.registered_nodes[pointed].description).."]"..
"item_image[3.5,2.5;1,1;"..pointed.."]" .. "item_image[3.5,2.5;1,1;"..pointed.."]"..
"button_exit[3.5,3.65;2,0.5;target_"..pointed..";Set target]" or "button_exit[3.5,3.65;2,0.5;target_"..pointed..";Set target]" or
"label[3.5,1.5;No new target available]") .. "label[3.5,1.5;No new target available]")..
"label[0,4.5;Region cross section:]" .. "label[0,4.5;Region cross section:]"..
"label[0,5;"..look_diameter.."x"..look_diameter.."]" .. "label[0,5;"..look_diameter.."x"..look_diameter.."]"..
"label[3.5,4.5;Set region cross section:]" .. "label[3.5,4.5;Set region cross section:]"..
"button_exit[3.5,5.15;1,0.5;look_radius_0;1x1]" .. "button_exit[3.5,5.15;1,0.5;look_radius_0;1x1]"..
"button_exit[4.5,5.15;1,0.5;look_radius_1;3x3]" .. "button_exit[4.5,5.15;1,0.5;look_radius_1;3x3]"..
"button_exit[5.5,5.15;1,0.5;look_radius_3;7x7]" .. "button_exit[5.5,5.15;1,0.5;look_radius_3;7x7]"..
"label[0,6;Region depth:]" .. "label[0,6;Region depth:]"..
"label[0,6.5;"..toolmeta.look_depth.."]" .. "label[0,6.5;"..toolmeta.look_depth.."]"..
"label[3.5,6;Set region depth:]" .. "label[3.5,6;Set region depth:]"..
"button_exit[3.5,6.65;1,0.5;look_depth_7;7]" .. "button_exit[3.5,6.65;1,0.5;look_depth_7;7]"..
"button_exit[4.5,6.65;1,0.5;look_depth_14;14]" .. "button_exit[4.5,6.65;1,0.5;look_depth_14;14]"..
"button_exit[5.5,6.65;1,0.5;look_depth_21;21]" .. "button_exit[5.5,6.65;1,0.5;look_depth_21;21]"..
"label[0,7.5;Accuracy:]" .. "label[0,7.5;Accuracy:]"..
"label[0,8;98%]") "label[0,8;98%]")
return return
end, end,

View File

@ -55,20 +55,20 @@ function technic.chests.inv_take(pos, listname, index, stack, player)
end end
function technic.chests.on_inv_move(pos, from_list, from_index, to_list, to_index, count, player) function technic.chests.on_inv_move(pos, from_list, from_index, to_list, to_index, count, player)
minetest.log("action", player:get_player_name() .. minetest.log("action", player:get_player_name()..
" moves stuff in chest at " " moves stuff in chest at "
.. minetest.pos_to_string(pos)) .. minetest.pos_to_string(pos))
end end
function technic.chests.on_inv_put(pos, listname, index, stack, player) function technic.chests.on_inv_put(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name() .. minetest.log("action", player:get_player_name()..
" moves "..stack:get_name() .. " moves "..stack:get_name()..
" to chest at "..minetest.pos_to_string(pos)) " to chest at "..minetest.pos_to_string(pos))
end end
function technic.chests.on_inv_take(pos, listname, index, stack, player) function technic.chests.on_inv_take(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name() .. minetest.log("action", player:get_player_name()..
" takes "..stack:get_name() .. " takes "..stack:get_name()..
" from chest at "..minetest.pos_to_string(pos)) " from chest at "..minetest.pos_to_string(pos))
end end

View File

@ -203,13 +203,13 @@ function technic.chests:definition(name, data)
local locked_after_place = nil local locked_after_place = nil
local front = { "technic_"..lname.."_chest_front.png" } local front = { "technic_"..lname.."_chest_front.png" }
data.base_formspec = "size["..data.ovwidth..","..data.ovheight.."]" .. data.base_formspec = "size["..data.ovwidth..","..data.ovheight.."]"..
"label[0,0;"..S("%s Chest"):format(name).."]" .. "label[0,0;"..S("%s Chest"):format(name).."]"..
"list[context;main;"..data.hileft..",1;"..data.width..","..data.height..";]" .. "list[context;main;"..data.hileft..",1;"..data.width..","..data.height..";]"..
"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[]" "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").."]"

View File

@ -118,9 +118,9 @@ minetest.register_tool("wrench:wrench", {
if def.owned then if def.owned then
local owner = meta:get_string("owner") local owner = meta:get_string("owner")
if owner and owner ~= placer:get_player_name() then if owner and owner ~= placer:get_player_name() then
minetest.log("action", placer:get_player_name() .. minetest.log("action", placer:get_player_name()..
" tried to pick up a owned node belonging to " .. " tried to pick up a owned node belonging to "..
owner.." at " .. owner.." at "..
minetest.pos_to_string(pos)) minetest.pos_to_string(pos))
return return
end end