Change " .. " to ".."

This commit is contained in:
Thomas--S 2017-03-29 15:19:50 +02:00
parent 73d8bdff4b
commit 51b328a247
56 changed files with 476 additions and 476 deletions

View File

@ -8,11 +8,11 @@ technic.concrete_posts = {}
local S = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end local S = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end
for i = 0, 31 do for i = 0, 31 do
minetest.register_alias("technic:concrete_post" .. i, minetest.register_alias("technic:concrete_post"..i,
"technic:concrete_post") "technic:concrete_post")
end end
for i = 32, 63 do for i = 32, 63 do
minetest.register_alias("technic:concrete_post" .. i, minetest.register_alias("technic:concrete_post"..i,
"technic:concrete_post_with_platform") "technic:concrete_post_with_platform")
end end
@ -131,7 +131,7 @@ for platform = 0, 1 do
end end
end end
minetest.register_node(":technic:concrete_post" .. (platform == 1 and "_with_platform" or ""), { minetest.register_node(":technic:concrete_post"..(platform == 1 and "_with_platform" or ""), {
description = S("Concrete Post"), description = S("Concrete Post"),
tiles = { "technic_concrete_block.png" }, tiles = { "technic_concrete_block.png" },
groups = { cracky = 1, level = 2, concrete_post = 1, not_in_creative_inventory = platform }, groups = { cracky = 1, level = 2, concrete_post = 1, not_in_creative_inventory = platform },

View File

@ -64,35 +64,35 @@ if minetest.get_modpath("moreblocks") then
}) })
function register_technic_stairs_alias(modname, origname, newmod, newname) function register_technic_stairs_alias(modname, origname, newmod, newname)
minetest.register_alias(modname .. ":slab_" .. origname, newmod .. ":slab_" .. newname) minetest.register_alias(modname..":slab_"..origname, newmod..":slab_"..newname)
minetest.register_alias(modname .. ":slab_" .. origname .. "_inverted", newmod .. ":slab_" .. newname .. "_inverted") minetest.register_alias(modname..":slab_"..origname.."_inverted", newmod..":slab_"..newname.."_inverted")
minetest.register_alias(modname .. ":slab_" .. origname .. "_wall", newmod .. ":slab_" .. newname .. "_wall") minetest.register_alias(modname..":slab_"..origname.."_wall", newmod..":slab_"..newname.."_wall")
minetest.register_alias(modname .. ":slab_" .. origname .. "_quarter", newmod .. ":slab_" .. newname .. "_quarter") minetest.register_alias(modname..":slab_"..origname.."_quarter", newmod..":slab_"..newname.."_quarter")
minetest.register_alias(modname .. ":slab_" .. origname .. "_quarter_inverted", newmod .. ":slab_" .. newname .. "_quarter_inverted") minetest.register_alias(modname..":slab_"..origname.."_quarter_inverted", newmod..":slab_"..newname.."_quarter_inverted")
minetest.register_alias(modname .. ":slab_" .. origname .. "_quarter_wall", newmod .. ":slab_" .. newname .. "_quarter_wall") minetest.register_alias(modname..":slab_"..origname.."_quarter_wall", newmod..":slab_"..newname.."_quarter_wall")
minetest.register_alias(modname .. ":slab_" .. origname .. "_three_quarter", newmod .. ":slab_" .. newname .. "_three_quarter") minetest.register_alias(modname..":slab_"..origname.."_three_quarter", newmod..":slab_"..newname.."_three_quarter")
minetest.register_alias(modname .. ":slab_" .. origname .. "_three_quarter_inverted", newmod .. ":slab_" .. newname .. "_three_quarter_inverted") minetest.register_alias(modname..":slab_"..origname.."_three_quarter_inverted", newmod..":slab_"..newname.."_three_quarter_inverted")
minetest.register_alias(modname .. ":slab_" .. origname .. "_three_quarter_wall", newmod .. ":slab_" .. newname .. "_three_quarter_wall") minetest.register_alias(modname..":slab_"..origname.."_three_quarter_wall", newmod..":slab_"..newname.."_three_quarter_wall")
minetest.register_alias(modname .. ":stair_" .. origname, newmod .. ":stair_" .. newname) minetest.register_alias(modname..":stair_"..origname, newmod..":stair_"..newname)
minetest.register_alias(modname .. ":stair_" .. origname .. "_inverted", newmod .. ":stair_" .. newname .. "_inverted") minetest.register_alias(modname..":stair_"..origname.."_inverted", newmod..":stair_"..newname.."_inverted")
minetest.register_alias(modname .. ":stair_" .. origname .. "_wall", newmod .. ":stair_" .. newname .. "_wall") minetest.register_alias(modname..":stair_"..origname.."_wall", newmod..":stair_"..newname.."_wall")
minetest.register_alias(modname .. ":stair_" .. origname .. "_wall_half", newmod .. ":stair_" .. newname .. "_wall_half") minetest.register_alias(modname..":stair_"..origname.."_wall_half", newmod..":stair_"..newname.."_wall_half")
minetest.register_alias(modname .. ":stair_" .. origname .. "_wall_half_inverted", newmod .. ":stair_" .. newname .. "_wall_half_inverted") minetest.register_alias(modname..":stair_"..origname.."_wall_half_inverted", newmod..":stair_"..newname.."_wall_half_inverted")
minetest.register_alias(modname .. ":stair_" .. origname .. "_half", newmod .. ":stair_" .. newname .. "_half") minetest.register_alias(modname..":stair_"..origname.."_half", newmod..":stair_"..newname.."_half")
minetest.register_alias(modname .. ":stair_" .. origname .. "_half_inverted", newmod .. ":stair_" .. newname .. "_half_inverted") minetest.register_alias(modname..":stair_"..origname.."_half_inverted", newmod..":stair_"..newname.."_half_inverted")
minetest.register_alias(modname .. ":stair_" .. origname .. "_right_half", newmod .. ":stair_" .. newname .. "_right_half") minetest.register_alias(modname..":stair_"..origname.."_right_half", newmod..":stair_"..newname.."_right_half")
minetest.register_alias(modname .. ":stair_" .. origname .. "_right_half_inverted", newmod .. ":stair_" .. newname .. "_right_half_inverted") minetest.register_alias(modname..":stair_"..origname.."_right_half_inverted", newmod..":stair_"..newname.."_right_half_inverted")
minetest.register_alias(modname .. ":stair_" .. origname .. "_wall_half", newmod .. ":stair_" .. newname .. "_wall_half") minetest.register_alias(modname..":stair_"..origname.."_wall_half", newmod..":stair_"..newname.."_wall_half")
minetest.register_alias(modname .. ":stair_" .. origname .. "_wall_half_inverted", newmod .. ":stair_" .. newname .. "_wall_half_inverted") minetest.register_alias(modname..":stair_"..origname.."_wall_half_inverted", newmod..":stair_"..newname.."_wall_half_inverted")
minetest.register_alias(modname .. ":stair_" .. origname .. "_inner", newmod .. ":stair_" .. newname .. "_inner") minetest.register_alias(modname..":stair_"..origname.."_inner", newmod..":stair_"..newname.."_inner")
minetest.register_alias(modname .. ":stair_" .. origname .. "_inner_inverted", newmod .. ":stair_" .. newname .. "_inner_inverted") minetest.register_alias(modname..":stair_"..origname.."_inner_inverted", newmod..":stair_"..newname.."_inner_inverted")
minetest.register_alias(modname .. ":stair_" .. origname .. "_outer", newmod .. ":stair_" .. newname .. "_outer") minetest.register_alias(modname..":stair_"..origname.."_outer", newmod..":stair_"..newname.."_outer")
minetest.register_alias(modname .. ":stair_" .. origname .. "_outer_inverted", newmod .. ":stair_" .. newname .. "_outer_inverted") minetest.register_alias(modname..":stair_"..origname.."_outer_inverted", newmod..":stair_"..newname.."_outer_inverted")
minetest.register_alias(modname .. ":panel_" .. origname .. "_bottom", newmod .. ":panel_" .. newname .. "_bottom") minetest.register_alias(modname..":panel_"..origname.."_bottom", newmod..":panel_"..newname.."_bottom")
minetest.register_alias(modname .. ":panel_" .. origname .. "_top", newmod .. ":panel_" .. newname .. "_top") minetest.register_alias(modname..":panel_"..origname.."_top", newmod..":panel_"..newname.."_top")
minetest.register_alias(modname .. ":panel_" .. origname .. "_vertical", newmod .. ":panel_" .. newname .. "_vertical") minetest.register_alias(modname..":panel_"..origname.."_vertical", newmod..":panel_"..newname.."_vertical")
minetest.register_alias(modname .. ":micro_" .. origname .. "_bottom", newmod .. ":micro_" .. newname .. "_bottom") minetest.register_alias(modname..":micro_"..origname.."_bottom", newmod..":micro_"..newname.."_bottom")
minetest.register_alias(modname .. ":micro_" .. origname .. "_top", newmod .. ":micro_" .. newname .. "_top") minetest.register_alias(modname..":micro_"..origname.."_top", newmod..":micro_"..newname.."_top")
end end
register_technic_stairs_alias("stairsplus", "concrete", "technic", "concrete") register_technic_stairs_alias("stairsplus", "concrete", "technic", "concrete")

View File

@ -1,4 +1,4 @@
technic.config = technic.config or Settings(minetest.get_worldpath() .. "/technic.conf") technic.config = technic.config or Settings(minetest.get_worldpath().."/technic.conf")
local conf_table = technic.config:to_table() local conf_table = technic.config:to_table()

View File

@ -5,7 +5,7 @@ do
-- Escape for gsub -- Escape for gsub
for magic in ("().%+-*?[^$"):gmatch(".") do for magic in ("().%+-*?[^$"):gmatch(".") do
if sep == magic then if sep == magic then
sep = "%" .. sep sep = "%"..sep
end end
end end
digit_sep_esc = sep digit_sep_esc = sep
@ -15,7 +15,7 @@ end
function technic.pretty_num(num) function technic.pretty_num(num)
local str, k = tostring(num), nil local str, k = tostring(num), nil
repeat repeat
str, k = str:gsub("^(-?%d+)(%d%d%d)", "%1" .. digit_sep_esc .. "%2") str, k = str:gsub("^(-?%d+)(%d%d%d)", "%1"..digit_sep_esc.."%2")
until k == 0 until k == 0
return str return str
end end

View File

@ -16,36 +16,36 @@ technic.modpath = modpath
if rawget(_G, "intllib") then if rawget(_G, "intllib") then
technic.getter = intllib.Getter() technic.getter = intllib.Getter()
else else
technic.getter = function(s, a, ...) if a == nil then return s end a = { a, ... } return s:gsub("(@?)@(%(?)(%d+)(%)?)", function(e, o, n, c) if e == "" then return a[tonumber(n)] .. (o == "" and c or "") else return "@" .. o .. n .. c end end) end technic.getter = function(s, a, ...) if a == nil then return s end a = { a, ... } return s:gsub("(@?)@(%(?)(%d+)(%)?)", function(e, o, n, c) if e == "" then return a[tonumber(n)]..(o == "" and c or "") else return "@"..o..n..c end end) end
end end
local S = technic.getter local S = technic.getter
-- Read configuration file -- Read configuration file
dofile(modpath .. "/config.lua") dofile(modpath.."/config.lua")
-- Helper functions -- Helper functions
dofile(modpath .. "/helpers.lua") dofile(modpath.."/helpers.lua")
-- Items -- Items
dofile(modpath .. "/items.lua") dofile(modpath.."/items.lua")
-- Craft recipes for items -- Craft recipes for items
dofile(modpath .. "/crafts.lua") dofile(modpath.."/crafts.lua")
-- Register functions -- Register functions
dofile(modpath .. "/register.lua") dofile(modpath.."/register.lua")
-- Radiation -- Radiation
dofile(modpath .. "/radiation.lua") dofile(modpath.."/radiation.lua")
-- Machines -- Machines
dofile(modpath .. "/machines/init.lua") dofile(modpath.."/machines/init.lua")
-- Tools -- Tools
dofile(modpath .. "/tools/init.lua") dofile(modpath.."/tools/init.lua")
-- Aliases for legacy node/item names -- Aliases for legacy node/item names
dofile(modpath .. "/legacy.lua") dofile(modpath.."/legacy.lua")
if minetest.setting_getbool("log_mods") then if minetest.setting_getbool("log_mods") then
print(S("[Technic] Loaded in %f seconds"):format(os.clock() - load_start)) print(S("[Technic] Loaded in %f seconds"):format(os.clock() - load_start))

View File

@ -154,8 +154,8 @@ minetest.register_node("technic:machine_casing", {
for p = 0, 35 do for p = 0, 35 do
local nici = (p ~= 0 and p ~= 7 and p ~= 35) and 1 or nil local nici = (p ~= 0 and p ~= 7 and p ~= 35) and 1 or nil
local psuffix = p == 7 and "" or p local psuffix = p == 7 and "" or p
local ingot = "technic:uranium" .. psuffix .. "_ingot" local ingot = "technic:uranium"..psuffix.."_ingot"
local block = "technic:uranium" .. psuffix .. "_block" local block = "technic:uranium"..psuffix.."_block"
local ov = p == 7 and minetest.override_item or nil; local ov = p == 7 and minetest.override_item or nil;
(ov or minetest.register_craftitem)(ingot, { (ov or minetest.register_craftitem)(ingot, {
description = string.format(S("%.1f%%-Fissile Uranium Ingot"), p / 10), description = string.format(S("%.1f%%-Fissile Uranium Ingot"), p / 10),
@ -217,7 +217,7 @@ for p = 0, 35 do
}, },
}) })
minetest.register_craft({ minetest.register_craft({
output = ingot .. " 9", output = ingot.." 9",
recipe = { { block } }, recipe = { { block } },
}) })
end end

View File

@ -33,8 +33,8 @@ for old, new in pairs(technic.legacy_nodenames) do
end end
for i = 0, 64 do for i = 0, 64 do
minetest.register_alias("technic:hv_cable" .. i, "technic:hv_cable") minetest.register_alias("technic:hv_cable"..i, "technic:hv_cable")
minetest.register_alias("technic:mv_cable" .. i, "technic:mv_cable") minetest.register_alias("technic:mv_cable"..i, "technic:mv_cable")
minetest.register_alias("technic:lv_cable" .. i, "technic:lv_cable") minetest.register_alias("technic:lv_cable"..i, "technic:lv_cable")
end end

View File

@ -91,25 +91,25 @@ 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
-- from the ambiguity between lag and a missed press) only make -- from the ambiguity between lag and a missed press) only make
-- the single change that the user expects. -- the single change that the user expects.
if meta:get_int("shape") == 0 then if meta:get_int("shape") == 0 then
formspec = formspec .. "button[3,0.2;2,1;shape1;" .. S("Sphere") .. "]" formspec = formspec.."button[3,0.2;2,1;shape1;"..S("Sphere").."]"
else else
formspec = formspec .. "button[3,0.2;2,1;shape0;" .. S("Cube") .. "]" formspec = formspec.."button[3,0.2;2,1;shape0;"..S("Cube").."]"
end end
if meta:get_int("mesecon_mode") == 0 then if meta:get_int("mesecon_mode") == 0 then
formspec = formspec .. "button[0,1;5,1;mesecon_mode_1;" .. S("Ignoring Mesecon Signal") .. "]" formspec = formspec.."button[0,1;5,1;mesecon_mode_1;"..S("Ignoring Mesecon Signal").."]"
else else
formspec = formspec .. "button[0,1;5,1;mesecon_mode_0;" .. S("Controlled by Mesecon Signal") .. "]" formspec = formspec.."button[0,1;5,1;mesecon_mode_0;"..S("Controlled by Mesecon Signal").."]"
end end
if meta:get_int("enabled") == 0 then if meta:get_int("enabled") == 0 then
formspec = formspec .. "button[0,1.75;5,1;enable;" .. S("%s Disabled"):format(S("%s Forcefield Emitter"):format("HV")) .. "]" formspec = formspec.."button[0,1.75;5,1;enable;"..S("%s Disabled"):format(S("%s Forcefield Emitter"):format("HV")).."]"
else else
formspec = formspec .. "button[0,1.75;5,1;disable;" .. S("%s Enabled"):format(S("%s Forcefield Emitter"):format("HV")) .. "]" formspec = formspec.."button[0,1.75;5,1;disable;"..S("%s Enabled"):format(S("%s Forcefield Emitter"):format("HV")).."]"
end end
meta:set_string("formspec", formspec) meta:set_string("formspec", formspec)
end end

View File

@ -1,17 +1,17 @@
technic.register_tier("HV", "High Voltage") technic.register_tier("HV", "High Voltage")
local path = technic.modpath .. "/machines/HV" local path = technic.modpath.."/machines/HV"
-- Wiring stuff -- Wiring stuff
dofile(path .. "/cables.lua") dofile(path.."/cables.lua")
dofile(path .. "/battery_box.lua") dofile(path.."/battery_box.lua")
-- Generators -- Generators
dofile(path .. "/solar_array.lua") dofile(path.."/solar_array.lua")
dofile(path .. "/nuclear_reactor.lua") dofile(path.."/nuclear_reactor.lua")
dofile(path .. "/generator.lua") dofile(path.."/generator.lua")
-- Machines -- Machines
dofile(path .. "/quarry.lua") dofile(path.."/quarry.lua")
dofile(path .. "/forcefield.lua") dofile(path.."/forcefield.lua")

View File

@ -30,7 +30,7 @@ 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[]"
@ -215,7 +215,7 @@ end
local function melt_down_reactor(pos) local function melt_down_reactor(pos)
minetest.log("action", "A reactor melted down at " .. minetest.pos_to_string(pos)) minetest.log("action", "A reactor melted down at "..minetest.pos_to_string(pos))
minetest.set_node(pos, { name = "technic:corium_source" }) minetest.set_node(pos, { name = "technic:corium_source" })
end end
@ -282,7 +282,7 @@ local function run(pos, node)
burn_time = burn_time + 1 burn_time = burn_time + 1
meta:set_int("burn_time", burn_time) meta:set_int("burn_time", burn_time)
local percent = math.floor(burn_time / burn_ticks * 100) local percent = math.floor(burn_time / burn_ticks * 100)
meta:set_string("infotext", reactor_desc .. " (" .. percent .. "%)") meta:set_string("infotext", reactor_desc.." ("..percent.."%)")
meta:set_int("HV_EU_supply", power_supply) meta:set_int("HV_EU_supply", power_supply)
end end
end end

View File

@ -19,21 +19,21 @@ local function set_quarry_formspec(meta)
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").."]"
else else
formspec = formspec .. "button[4,1;2,1;disable;" .. S("Enabled") .. "]" formspec = formspec.."button[4,1;2,1;disable;"..S("Enabled").."]"
end end
local diameter = radius * 2 + 1 local diameter = radius * 2 + 1
local nd = meta:get_int("dug") local nd = meta:get_int("dug")
local rel_y = quarry_dig_above_nodes - math.floor(nd / (diameter * diameter)) local rel_y = quarry_dig_above_nodes - math.floor(nd / (diameter * diameter))
formspec = formspec .. "label[0,4;" .. minetest.formspec_escape(nd == 0 and S("Digging not started") or formspec = formspec.."label[0,4;"..minetest.formspec_escape(nd == 0 and S("Digging not started") or
(rel_y < -quarry_max_depth and S("Digging finished") or (rel_y < -quarry_max_depth and S("Digging finished") or
(meta:get_int("purge_on") == 1 and S("Purging cache") or (meta:get_int("purge_on") == 1 and S("Purging cache") or
S("Digging %d m " .. (rel_y > 0 and "above" or "below") .. " machine"):format(math.abs(rel_y))))) .. "]" S("Digging %d m "..(rel_y > 0 and "above" or "below").." machine"):format(math.abs(rel_y))))).."]"
formspec = formspec .. "button[4,2;2,1;restart;" .. S("Restart") .. "]" formspec = formspec.."button[4,2;2,1;restart;"..S("Restart").."]"
meta:set_string("formspec", formspec) meta:set_string("formspec", formspec)
end end

View File

@ -49,7 +49,7 @@ 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; ]" ..
@ -69,7 +69,7 @@ local cnc_formspec =
"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; ]" ..
@ -79,9 +79,9 @@ local cnc_formspec =
"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;]" ..
@ -128,14 +128,14 @@ local function form_handler(pos, formname, fields, sender)
end end
if onesize_products[k] ~= nil or (twosize_products[k] ~= nil and size == 2) then if onesize_products[k] ~= nil or (twosize_products[k] ~= nil and size == 2) then
meta:set_string("cnc_product", inputname .. "_technic_cnc_" .. k) meta:set_string("cnc_product", inputname.."_technic_cnc_"..k)
--print(inputname .. "_technic_cnc_" .. k) --print(inputname.."_technic_cnc_"..k)
break break
end end
if twosize_products[k] ~= nil and size == 1 then if twosize_products[k] ~= nil and size == 1 then
meta:set_string("cnc_product", inputname .. "_technic_cnc_" .. k .. "_double") meta:set_string("cnc_product", inputname.."_technic_cnc_"..k.."_double")
--print(inputname .. "_technic_cnc_" .. k .. "_double") --print(inputname.."_technic_cnc_"..k.."_double")
break break
end end
end end
@ -166,7 +166,7 @@ local run = function(pos, node)
technic.swap_node(pos, machine_node) technic.swap_node(pos, machine_node)
meta:set_string("infotext", S("%s Unpowered"):format(machine_name)) meta:set_string("infotext", S("%s Unpowered"):format(machine_name))
elseif eu_input >= demand then elseif eu_input >= demand then
technic.swap_node(pos, machine_node .. "_active") technic.swap_node(pos, machine_node.."_active")
meta:set_string("infotext", S("%s Active"):format(machine_name)) meta:set_string("infotext", S("%s Active"):format(machine_name))
meta:set_int("src_time", meta:get_int("src_time") + 1) meta:set_int("src_time", meta:get_int("src_time") + 1)
if meta:get_int("src_time") >= 3 then -- 3 ticks per output if meta:get_int("src_time") >= 3 then -- 3 ticks per output
@ -174,7 +174,7 @@ local run = function(pos, node)
srcstack = inv:get_stack("src", 1) srcstack = inv:get_stack("src", 1)
srcstack:take_item() srcstack:take_item()
inv:set_stack("src", 1, srcstack) inv:set_stack("src", 1, srcstack)
inv:add_item("dst", result .. " " .. meta:get_int("cnc_multiplier")) inv:add_item("dst", result.." "..meta:get_int("cnc_multiplier"))
end end
end end
meta:set_int("LV_EU_demand", demand) meta:set_int("LV_EU_demand", demand)

View File

@ -325,7 +325,7 @@ function technic.cnc.register_program(recipeitem, suffix, model, groups, images,
if cbox and not sbox then sbox = cbox end if cbox and not sbox then sbox = cbox end
minetest.register_node(":" .. recipeitem .. "_" .. suffix, { minetest.register_node(":"..recipeitem.."_"..suffix, {
description = description, description = description,
drawtype = dtype, drawtype = dtype,
node_box = nodeboxdef, node_box = nodeboxdef,
@ -355,7 +355,7 @@ function technic.cnc.register_all(recipeitem, groups, images, description)
-- Create the node if it passes the test -- Create the node if it passes the test
if do_register then if do_register then
technic.cnc.register_program(recipeitem, data.suffix, data.model, technic.cnc.register_program(recipeitem, data.suffix, data.model,
groups, images, description .. " " .. data.desc, data.cbox, data.sbox) groups, images, description.." "..data.desc, data.cbox, data.sbox)
end end
end end
end end

View File

@ -66,7 +66,7 @@ local run = function(pos, node)
end end
meta:set_string("infotext", meta:set_string("infotext",
S("Geothermal %s Generator"):format("LV") .. " (" .. production_level .. "%)") S("Geothermal %s Generator"):format("LV").." ("..production_level.."%)")
if production_level > 0 and minetest.get_node(pos).name == "technic:geothermal" then if production_level > 0 and minetest.get_node(pos).name == "technic:geothermal" then
technic.swap_node(pos, "technic:geothermal_active") technic.swap_node(pos, "technic:geothermal_active")

View File

@ -1,28 +1,28 @@
technic.register_tier("LV", "Low Voltage") technic.register_tier("LV", "Low Voltage")
local path = technic.modpath .. "/machines/LV" local path = technic.modpath.."/machines/LV"
-- Wiring stuff -- Wiring stuff
dofile(path .. "/cables.lua") dofile(path.."/cables.lua")
dofile(path .. "/battery_box.lua") dofile(path.."/battery_box.lua")
-- Generators -- Generators
dofile(path .. "/solar_panel.lua") dofile(path.."/solar_panel.lua")
dofile(path .. "/solar_array.lua") dofile(path.."/solar_array.lua")
dofile(path .. "/geothermal.lua") dofile(path.."/geothermal.lua")
dofile(path .. "/water_mill.lua") dofile(path.."/water_mill.lua")
dofile(path .. "/generator.lua") dofile(path.."/generator.lua")
-- Machines -- Machines
dofile(path .. "/alloy_furnace.lua") dofile(path.."/alloy_furnace.lua")
dofile(path .. "/electric_furnace.lua") dofile(path.."/electric_furnace.lua")
dofile(path .. "/grinder.lua") dofile(path.."/grinder.lua")
dofile(path .. "/extractor.lua") dofile(path.."/extractor.lua")
dofile(path .. "/compressor.lua") dofile(path.."/compressor.lua")
dofile(path .. "/music_player.lua") dofile(path.."/music_player.lua")
dofile(path .. "/cnc.lua") dofile(path.."/cnc.lua")
dofile(path .. "/cnc_api.lua") dofile(path.."/cnc_api.lua")
dofile(path .. "/cnc_nodes.lua") dofile(path.."/cnc_nodes.lua")

View File

@ -16,7 +16,7 @@ minetest.register_craft({
local music_handles = {} local music_handles = {}
local function play_track(pos, track) local function play_track(pos, track)
return minetest.sound_play("technic_track" .. tostring(track), return minetest.sound_play("technic_track"..tostring(track),
{ pos = pos, gain = 1.0, loop = true, max_hear_distance = 72, }) { pos = pos, gain = 1.0, loop = true, max_hear_distance = 72, })
end end
@ -73,7 +73,7 @@ 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]" ..
@ -84,9 +84,9 @@ local function set_display(meta)
"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"))).."]")
end end
minetest.register_node("technic:music_player", { minetest.register_node("technic:music_player", {

View File

@ -55,7 +55,7 @@ local run = function(pos, node)
end end
meta:set_string("infotext", meta:set_string("infotext",
S("Hydro %s Generator"):format("LV") .. " (" .. production_level .. "%)") S("Hydro %s Generator"):format("LV").." ("..production_level.."%)")
if production_level > 0 and if production_level > 0 and
minetest.get_node(pos).name == "technic:water_mill" then minetest.get_node(pos).name == "technic:water_mill" then

View File

@ -1,27 +1,27 @@
technic.register_tier("MV", "Medium Voltage") technic.register_tier("MV", "Medium Voltage")
local path = technic.modpath .. "/machines/MV" local path = technic.modpath.."/machines/MV"
-- Wiring stuff -- Wiring stuff
dofile(path .. "/cables.lua") dofile(path.."/cables.lua")
dofile(path .. "/battery_box.lua") dofile(path.."/battery_box.lua")
-- Generators -- Generators
if technic.config:get_bool("enable_wind_mill") then if technic.config:get_bool("enable_wind_mill") then
dofile(path .. "/wind_mill.lua") dofile(path.."/wind_mill.lua")
end end
dofile(path .. "/generator.lua") dofile(path.."/generator.lua")
dofile(path .. "/solar_array.lua") dofile(path.."/solar_array.lua")
-- Machines -- Machines
dofile(path .. "/alloy_furnace.lua") dofile(path.."/alloy_furnace.lua")
dofile(path .. "/electric_furnace.lua") dofile(path.."/electric_furnace.lua")
dofile(path .. "/grinder.lua") dofile(path.."/grinder.lua")
dofile(path .. "/extractor.lua") dofile(path.."/extractor.lua")
dofile(path .. "/compressor.lua") dofile(path.."/compressor.lua")
dofile(path .. "/centrifuge.lua") dofile(path.."/centrifuge.lua")
dofile(path .. "/tool_workshop.lua") dofile(path.."/tool_workshop.lua")
-- The power radiator supplies appliances with inductive coupled power: -- The power radiator supplies appliances with inductive coupled power:
-- Lighting and associated textures is taken directly from VanessaE's homedecor and made electric. -- Lighting and associated textures is taken directly from VanessaE's homedecor and made electric.

View File

@ -6,7 +6,7 @@
-- Boilerplate to support localized strings if intllib mod is installed. -- Boilerplate to support localized strings if intllib mod is installed.
local S local S
if (minetest.get_modpath("intllib")) then if (minetest.get_modpath("intllib")) then
dofile(minetest.get_modpath("intllib") .. "/intllib.lua") dofile(minetest.get_modpath("intllib").."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname()) S = intllib.Getter(minetest.get_current_modname())
else else
S = function(s) return s end S = function(s) return s end

View File

@ -32,7 +32,7 @@ minetest.register_craft({
technic.inductive_nodes = {} technic.inductive_nodes = {}
technic.register_inductive_machine = function(name) technic.register_inductive_machine = function(name)
table.insert(technic.inductive_nodes, name) table.insert(technic.inductive_nodes, name)
table.insert(technic.inductive_nodes, name .. "_active") table.insert(technic.inductive_nodes, name.."_active")
end end
-- Appliances: -- Appliances:
@ -87,7 +87,7 @@ local shutdown_inductive_appliances = function(pos)
for _, pos1 in pairs(positions) do for _, pos1 in pairs(positions) do
local meta1 = minetest.get_meta(pos1) local meta1 = minetest.get_meta(pos1)
-- If the appliance is belonging to this node -- If the appliance is belonging to this node
if meta1:get_string("has_supply") == pos.x .. pos.y .. pos.z then if meta1:get_string("has_supply") == pos.x..pos.y..pos.z then
local nodename = minetest.get_node(pos1).name local nodename = minetest.get_node(pos1).name
-- Swap the node and make sure it is off and unpowered -- Swap the node and make sure it is off and unpowered
if string.sub(nodename, -7) == "_active" then if string.sub(nodename, -7) == "_active" then
@ -109,7 +109,7 @@ local toggle_on_off_inductive_appliances = function(pos, node, puncher)
technic.inductive_nodes) technic.inductive_nodes)
for _, pos1 in pairs(positions) do for _, pos1 in pairs(positions) do
local meta1 = minetest.get_meta(pos1) local meta1 = minetest.get_meta(pos1)
if meta1:get_string("has_supply") == pos.x .. pos.y .. pos.z then if meta1:get_string("has_supply") == pos.x..pos.y..pos.z then
minetest.punch_node(pos1) minetest.punch_node(pos1)
end end
end end
@ -194,10 +194,10 @@ minetest.register_abm({
-- We can power the appliance. Register, and spend power if it is on. -- We can power the appliance. Register, and spend power if it is on.
connected_EU_demand = connected_EU_demand + app_eu_demand connected_EU_demand = connected_EU_demand + app_eu_demand
meta1:set_string("has_supply", pos.x .. pos.y .. pos.z) meta1:set_string("has_supply", pos.x..pos.y..pos.z)
--Always 0: used_charge = math.floor(used_charge + meta1:get_int("EU_charge") / eff_factor) --Always 0: used_charge = math.floor(used_charge + meta1:get_int("EU_charge") / eff_factor)
end end
elseif meta1:get_string("has_supply") == pos.x .. pos.y .. pos.z then elseif meta1:get_string("has_supply") == pos.x..pos.y..pos.z then
-- The appliance has power from this node. Spend power if it is on. -- The appliance has power from this node. Spend power if it is on.
used_charge = used_charge + math.floor(meta1:get_int("EU_charge") / eff_factor) used_charge = used_charge + math.floor(meta1:get_int("EU_charge") / eff_factor)
end end

View File

@ -19,10 +19,10 @@ 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]" ..

View File

@ -1,15 +1,15 @@
local path = technic.modpath .. "/machines" local path = technic.modpath.."/machines"
dofile(path .. "/register/init.lua") dofile(path.."/register/init.lua")
-- Tiers -- Tiers
dofile(path .. "/LV/init.lua") dofile(path.."/LV/init.lua")
dofile(path .. "/MV/init.lua") dofile(path.."/MV/init.lua")
dofile(path .. "/HV/init.lua") dofile(path.."/HV/init.lua")
dofile(path .. "/switching_station.lua") dofile(path.."/switching_station.lua")
dofile(path .. "/power_monitor.lua") dofile(path.."/power_monitor.lua")
dofile(path .. "/supply_converter.lua") dofile(path.."/supply_converter.lua")
dofile(path .. "/other/init.lua") dofile(path.."/other/init.lua")

View File

@ -52,16 +52,16 @@ local function set_display(pos, meta)
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
minetest.register_node("technic:admin_anchor", { minetest.register_node("technic:admin_anchor", {

View File

@ -14,7 +14,7 @@ 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;]" ..
@ -125,13 +125,13 @@ minetest.register_abm({
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
local percent = math.floor(meta:get_float("fuel_time") / local percent = math.floor(meta:get_float("fuel_time") /
meta:get_float("fuel_totaltime") * 100) meta:get_float("fuel_totaltime") * 100)
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;]" ..

View File

@ -92,13 +92,13 @@ local function make_on(mark, length)
local place_pos = vector.new(pos) local place_pos = vector.new(pos)
if node.name == "technic:constructor_mk" .. mark .. "_off" then if node.name == "technic:constructor_mk"..mark.."_off" then
technic.swap_node(pos, "technic:constructor_mk" .. mark .. "_on") technic.swap_node(pos, "technic:constructor_mk"..mark.."_on")
nodeupdate(pos) nodeupdate(pos)
for i = 1, length do for i = 1, length do
place_pos = vector.add(place_pos, dir) place_pos = vector.add(place_pos, dir)
local place_node = minetest.get_node(place_pos) local place_node = minetest.get_node(place_pos)
deploy_node(inv, "slot" .. i, place_pos, place_node, node) deploy_node(inv, "slot"..i, place_pos, place_node, node)
end end
end end
end end
@ -106,8 +106,8 @@ end
local function make_off(mark) local function make_off(mark)
return function(pos, node) return function(pos, node)
if node.name == "technic:constructor_mk" .. mark .. "_on" then if node.name == "technic:constructor_mk"..mark.."_on" then
technic.swap_node(pos, "technic:constructor_mk" .. mark .. "_off") technic.swap_node(pos, "technic:constructor_mk"..mark.."_off")
nodeupdate(pos) nodeupdate(pos)
end end
end end
@ -115,13 +115,13 @@ end
local function make_constructor(mark, length) local function make_constructor(mark, length)
minetest.register_node("technic:constructor_mk" .. mark .. "_off", { minetest.register_node("technic:constructor_mk"..mark.."_off", {
description = S("Constructor Mk%d"):format(mark), description = S("Constructor Mk%d"):format(mark),
tiles = { tiles = {
"technic_constructor_mk" .. mark .. "_top_off.png", "technic_constructor_mk"..mark.."_top_off.png",
"technic_constructor_mk" .. mark .. "_bottom_off.png", "technic_constructor_mk"..mark.."_bottom_off.png",
"technic_constructor_mk" .. mark .. "_side2_off.png", "technic_constructor_mk"..mark.."_side2_off.png",
"technic_constructor_mk" .. mark .. "_side1_off.png", "technic_constructor_mk"..mark.."_side1_off.png",
"technic_constructor_back.png", "technic_constructor_back.png",
"technic_constructor_front_off.png" "technic_constructor_front_off.png"
}, },
@ -132,26 +132,26 @@ local function make_constructor(mark, length)
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
.. "label[5," .. (i - 1) .. ";" .. S("Slot %d"):format(i) .. "]" .. "label[5,"..(i - 1)..";"..S("Slot %d"):format(i).."]"
.. "list[current_name;slot" .. i .. "list[current_name;slot"..i
.. ";6," .. (i - 1) .. ";1,1;]" .. ";6,"..(i - 1)..";1,1;]"
end end
meta:set_string("formspec", formspec) meta:set_string("formspec", formspec)
meta:set_string("infotext", S("Constructor Mk%d"):format(mark)) meta:set_string("infotext", S("Constructor Mk%d"):format(mark))
local inv = meta:get_inventory() local inv = meta:get_inventory()
for i = 1, length do for i = 1, length do
inv:set_size("slot" .. i, 1) inv:set_size("slot"..i, 1)
end end
end, end,
can_dig = function(pos, player) can_dig = function(pos, player)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
for i = 1, length do for i = 1, length do
if not inv:is_empty("slot" .. i) then if not inv:is_empty("slot"..i) then
return false return false
end end
end end
@ -162,17 +162,17 @@ local function make_constructor(mark, length)
allow_metadata_inventory_move = technic.machine_inventory_move, allow_metadata_inventory_move = technic.machine_inventory_move,
}) })
minetest.register_node("technic:constructor_mk" .. mark .. "_on", { minetest.register_node("technic:constructor_mk"..mark.."_on", {
tiles = { tiles = {
"technic_constructor_mk" .. mark .. "_top_on.png", "technic_constructor_mk"..mark.."_top_on.png",
"technic_constructor_mk" .. mark .. "_bottom_on.png", "technic_constructor_mk"..mark.."_bottom_on.png",
"technic_constructor_mk" .. mark .. "_side2_on.png", "technic_constructor_mk"..mark.."_side2_on.png",
"technic_constructor_mk" .. mark .. "_side1_on.png", "technic_constructor_mk"..mark.."_side1_on.png",
"technic_constructor_back.png", "technic_constructor_back.png",
"technic_constructor_front_on.png" "technic_constructor_front_on.png"
}, },
paramtype2 = "facedir", paramtype2 = "facedir",
drop = "technic:constructor_mk" .. mark .. "_off", drop = "technic:constructor_mk"..mark.."_off",
groups = { groups = {
snappy = 2, snappy = 2,
choppy = 2, choppy = 2,

View File

@ -58,7 +58,7 @@ local function pos_to_string(pos)
if pos.x == 0 then pos.x = 0 end -- Fix for signed 0 if pos.x == 0 then pos.x = 0 end -- Fix for signed 0
if pos.y == 0 then pos.y = 0 end -- Fix for signed 0 if pos.y == 0 then pos.y = 0 end -- Fix for signed 0
if pos.z == 0 then pos.z = 0 end -- Fix for signed 0 if pos.z == 0 then pos.z = 0 end -- Fix for signed 0
return tostring(pos.x) .. "\n" .. tostring(pos.y) .. "\n" .. tostring(pos.z) return tostring(pos.x).."\n"..tostring(pos.y).."\n"..tostring(pos.z)
end end
local function pos_from_string(str) local function pos_from_string(str)
@ -201,12 +201,12 @@ for xm = 0, 1 do
table.insert(nodeboxes, { -b, -b, -a, b, b, -b }) table.insert(nodeboxes, { -b, -b, -a, b, b, -b })
end end
local nameext = tostring(xm) .. tostring(xp) .. tostring(ym) .. tostring(yp) .. tostring(zm) .. tostring(zp) local nameext = tostring(xm)..tostring(xp)..tostring(ym)..tostring(yp)..tostring(zm)..tostring(zp)
local groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2 } local groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2 }
if nameext ~= "111111" then groups.not_in_creative_inventory = 1 end if nameext ~= "111111" then groups.not_in_creative_inventory = 1 end
minetest.register_node("technic:frame_" .. nameext, { minetest.register_node("technic:frame_"..nameext, {
description = S("Frame"), description = S("Frame"),
tiles = { "technic_frame.png" }, tiles = { "technic_frame.png" },
groups = groups, groups = groups,
@ -241,9 +241,9 @@ for xm = 0, 1 do
local nodename = node.name local nodename = node.name
local newstate = tostring(1 - tonumber(string.sub(nodename, -7 + pface, -7 + pface))) local newstate = tostring(1 - tonumber(string.sub(nodename, -7 + pface, -7 + pface)))
if pface <= 5 then if pface <= 5 then
nodename = string.sub(nodename, 1, -7 + pface - 1) .. newstate .. string.sub(nodename, -7 + pface + 1) nodename = string.sub(nodename, 1, -7 + pface - 1)..newstate..string.sub(nodename, -7 + pface + 1)
else else
nodename = string.sub(nodename, 1, -2) .. newstate nodename = string.sub(nodename, 1, -2)..newstate
end end
node.name = nodename node.name = nodename
minetest.set_node(pos, node) minetest.set_node(pos, node)
@ -252,7 +252,7 @@ for xm = 0, 1 do
local pos = pointed_thing.above local pos = pointed_thing.above
if minetest.is_protected(pos, placer:get_player_name()) then if minetest.is_protected(pos, placer:get_player_name()) then
minetest.log("action", placer:get_player_name() minetest.log("action", placer:get_player_name()
.. " tried to place " .. itemstack:get_name() .. " tried to place "..itemstack:get_name()
.. " at protected position " .. " at protected position "
.. minetest.pos_to_string(pos)) .. minetest.pos_to_string(pos))
minetest.record_protection_violation(pos, placer:get_player_name()) minetest.record_protection_violation(pos, placer:get_player_name())
@ -277,7 +277,7 @@ for xm = 0, 1 do
if is_supported_node(itemstack:get_name()) then if is_supported_node(itemstack:get_name()) then
if minetest.is_protected(pos, placer:get_player_name()) then if minetest.is_protected(pos, placer:get_player_name()) then
minetest.log("action", placer:get_player_name() minetest.log("action", placer:get_player_name()
.. " tried to place " .. itemstack:get_name() .. " tried to place "..itemstack:get_name()
.. " at protected position " .. " at protected position "
.. minetest.pos_to_string(pos)) .. minetest.pos_to_string(pos))
minetest.record_protection_violation(pos, placer:get_player_name()) minetest.record_protection_violation(pos, placer:get_player_name())
@ -397,9 +397,9 @@ minetest.register_entity("technic:frame_entity", {
local nodename = self.node.name local nodename = self.node.name
local newstate = tostring(1 - tonumber(string.sub(nodename, -7 + pface, -7 + pface))) local newstate = tostring(1 - tonumber(string.sub(nodename, -7 + pface, -7 + pface)))
if pface <= 5 then if pface <= 5 then
nodename = string.sub(nodename, 1, -7 + pface - 1) .. newstate .. string.sub(nodename, -7 + pface + 1) nodename = string.sub(nodename, 1, -7 + pface - 1)..newstate..string.sub(nodename, -7 + pface + 1)
else else
nodename = string.sub(nodename, 1, -2) .. newstate nodename = string.sub(nodename, 1, -2)..newstate
end end
self.node.name = nodename self.node.name = nodename
self:set_node(self.node) self:set_node(self.node)
@ -451,7 +451,7 @@ minetest.register_entity("technic:damage_entity", {
self.frame_object.damage_object = nil self.frame_object.damage_object = nil
self.frame_object:dig() self.frame_object:dig()
end end
local ct = "crack_anylength.png^[verticalframe:5:" .. self.texture_index local ct = "crack_anylength.png^[verticalframe:5:"..self.texture_index
self.object:set_properties({ textures = { ct, ct, ct, ct, ct, ct } }) self.object:set_properties({ textures = { ct, ct, ct, ct, ct, ct } })
end end
end, end,
@ -719,10 +719,10 @@ local function template_drops(pos, node, oldmeta, digger)
local num = #(minetest.deserialize(c)) local num = #(minetest.deserialize(c))
drops = {} drops = {}
while num > stack_max do while num > stack_max do
drops[#drops + 1] = "technic:template " .. stack_max drops[#drops + 1] = "technic:template "..stack_max
num = num - stack_max num = num - stack_max
end end
drops[#drops + 1] = "technic:template " .. num drops[#drops + 1] = "technic:template "..num
end end
end end
end end

View File

@ -1,15 +1,15 @@
local path = technic.modpath .. "/machines/other" local path = technic.modpath.."/machines/other"
-- mesecons and tubes related -- mesecons and tubes related
dofile(path .. "/injector.lua") dofile(path.."/injector.lua")
dofile(path .. "/constructor.lua") dofile(path.."/constructor.lua")
if technic.config:get_bool("enable_frames") and minetest.get_modpath("mesecons_mvps") ~= nil then if technic.config:get_bool("enable_frames") and minetest.get_modpath("mesecons_mvps") ~= nil then
dofile(path .. "/frames.lua") dofile(path.."/frames.lua")
end end
-- Coal-powered machines -- Coal-powered machines
dofile(path .. "/coal_alloy_furnace.lua") dofile(path.."/coal_alloy_furnace.lua")
dofile(path .. "/coal_furnace.lua") dofile(path.."/coal_furnace.lua")
dofile(path .. "/anchor.lua") dofile(path.."/anchor.lua")

View File

@ -51,10 +51,10 @@ local function set_injector_formspec(meta)
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[]")

View File

@ -45,7 +45,7 @@ minetest.register_abm({
local sw_pos = network and { x = network.x, y = network.y + 1, z = network.z } local sw_pos = network and { x = network.x, y = network.y + 1, z = network.z }
local timeout = 0 local timeout = 0
for tier in pairs(technic.machines) do for tier in pairs(technic.machines) do
timeout = math.max(meta:get_int(tier .. "_EU_timeout"), timeout) timeout = math.max(meta:get_int(tier.."_EU_timeout"), timeout)
end end
if timeout > 0 and sw_pos and minetest.get_node(sw_pos).name == "technic:switching_station" then if timeout > 0 and sw_pos and minetest.get_node(sw_pos).name == "technic:switching_station" then
local sw_meta = minetest.get_meta(sw_pos) local sw_meta = minetest.get_meta(sw_pos)

View File

@ -66,10 +66,10 @@ function technic.register_battery_box(data)
"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]" ..
@ -80,7 +80,7 @@ function technic.register_battery_box(data)
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]" ..
@ -89,7 +89,7 @@ function technic.register_battery_box(data)
local run = function(pos, node) local run = function(pos, node)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local eu_input = meta:get_int(tier .. "_EU_input") local eu_input = meta:get_int(tier.."_EU_input")
local current_charge = meta:get_int("internal_EU_charge") local current_charge = meta:get_int("internal_EU_charge")
local EU_upgrade, tube_upgrade = 0, 0 local EU_upgrade, tube_upgrade = 0, 0
@ -126,9 +126,9 @@ function technic.register_battery_box(data)
end end
-- We allow batteries to charge on less than the demand -- We allow batteries to charge on less than the demand
meta:set_int(tier .. "_EU_demand", meta:set_int(tier.."_EU_demand",
math.min(data.charge_rate, max_charge - current_charge)) math.min(data.charge_rate, max_charge - current_charge))
meta:set_int(tier .. "_EU_supply", meta:set_int(tier.."_EU_supply",
math.min(data.discharge_rate, current_charge)) math.min(data.discharge_rate, current_charge))
meta:set_int("internal_EU_charge", current_charge) meta:set_int("internal_EU_charge", current_charge)
@ -138,7 +138,7 @@ function technic.register_battery_box(data)
charge_count = math.max(charge_count, 0) charge_count = math.max(charge_count, 0)
local last_count = meta:get_float("last_side_shown") local last_count = meta:get_float("last_side_shown")
if charge_count ~= last_count then if charge_count ~= last_count then
technic.swap_node(pos, "technic:" .. ltier .. "_battery_box" .. charge_count) technic.swap_node(pos, "technic:"..ltier.."_battery_box"..charge_count)
meta:set_float("last_side_shown", charge_count) meta:set_float("last_side_shown", charge_count)
end end
@ -146,7 +146,7 @@ function technic.register_battery_box(data)
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]")
local infotext = S("@1 Battery Box: @2/@3", tier, local infotext = S("@1 Battery Box: @2/@3", tier,
@ -163,7 +163,7 @@ function technic.register_battery_box(data)
choppy = 2, choppy = 2,
oddly_breakable_by_hand = 2, oddly_breakable_by_hand = 2,
technic_machine = 1, technic_machine = 1,
["technic_" .. ltier] = 1 ["technic_"..ltier] = 1
} }
if i ~= 0 then if i ~= 0 then
groups.not_in_creative_inventory = 1 groups.not_in_creative_inventory = 1
@ -174,22 +174,22 @@ function technic.register_battery_box(data)
groups.tubedevice_receiver = 1 groups.tubedevice_receiver = 1
end end
minetest.register_node("technic:" .. ltier .. "_battery_box" .. i, { minetest.register_node("technic:"..ltier.."_battery_box"..i, {
description = S("%s Battery Box"):format(tier), description = S("%s Battery Box"):format(tier),
tiles = { tiles = {
"technic_" .. ltier .. "_battery_box_top.png", "technic_"..ltier.."_battery_box_top.png",
"technic_" .. ltier .. "_battery_box_bottom.png", "technic_"..ltier.."_battery_box_bottom.png",
"technic_" .. ltier .. "_battery_box_side.png^technic_power_meter" .. i .. ".png", "technic_"..ltier.."_battery_box_side.png^technic_power_meter"..i..".png",
"technic_" .. ltier .. "_battery_box_side.png^technic_power_meter" .. i .. ".png", "technic_"..ltier.."_battery_box_side.png^technic_power_meter"..i..".png",
"technic_" .. ltier .. "_battery_box_side.png^technic_power_meter" .. i .. ".png", "technic_"..ltier.."_battery_box_side.png^technic_power_meter"..i..".png",
"technic_" .. ltier .. "_battery_box_side.png^technic_power_meter" .. i .. ".png" "technic_"..ltier.."_battery_box_side.png^technic_power_meter"..i..".png"
}, },
groups = groups, groups = groups,
connect_sides = { "bottom" }, connect_sides = { "bottom" },
tube = data.tube and tube or nil, tube = data.tube and tube or nil,
paramtype2 = "facedir", paramtype2 = "facedir",
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
drop = "technic:" .. ltier .. "_battery_box0", drop = "technic:"..ltier.."_battery_box0",
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
@ -197,9 +197,9 @@ function technic.register_battery_box(data)
meta:set_string("infotext", S("%s Battery Box"):format(tier)) meta:set_string("infotext", S("%s Battery Box"):format(tier))
meta:set_string("formspec", formspec) meta:set_string("formspec", formspec)
meta:set_int(tier .. "_EU_demand", 0) meta:set_int(tier.."_EU_demand", 0)
meta:set_int(tier .. "_EU_supply", 0) meta:set_int(tier.."_EU_supply", 0)
meta:set_int(tier .. "_EU_input", 0) meta:set_int(tier.."_EU_input", 0)
meta:set_float("internal_EU_charge", 0) meta:set_float("internal_EU_charge", 0)
inv:set_size("src", 1) inv:set_size("src", 1)
inv:set_size("dst", 1) inv:set_size("dst", 1)
@ -219,7 +219,7 @@ function technic.register_battery_box(data)
-- Register as a battery type -- Register as a battery type
-- Battery type machines function as power reservoirs and can both receive and give back power -- Battery type machines function as power reservoirs and can both receive and give back power
for i = 0, 8 do for i = 0, 8 do
technic.register_machine(tier, "technic:" .. ltier .. "_battery_box" .. i, technic.battery) technic.register_machine(tier, "technic:"..ltier.."_battery_box"..i, technic.battery)
end end
end end

View File

@ -66,7 +66,7 @@ local function clear_networks(pos)
if technic.is_tier_cable(name, tier) then if technic.is_tier_cable(name, tier) then
table.insert(network.all_nodes, pos) table.insert(network.all_nodes, pos)
elseif technic.machines[tier][node.name] then elseif technic.machines[tier][node.name] then
meta:set_string(tier .. "_network", minetest.pos_to_string(sw_pos)) meta:set_string(tier.."_network", minetest.pos_to_string(sw_pos))
if technic.machines[tier][node.name] == technic.producer then if technic.machines[tier][node.name] == technic.producer then
table.insert(network.PR_nodes, pos) table.insert(network.PR_nodes, pos)
elseif technic.machines[tier][node.name] == technic.receiver then elseif technic.machines[tier][node.name] == technic.receiver then
@ -119,7 +119,7 @@ end
function technic.register_cable(tier, size) function technic.register_cable(tier, size)
local ltier = string.lower(tier) local ltier = string.lower(tier)
cable_tier["technic:" .. ltier .. "_cable"] = tier cable_tier["technic:"..ltier.."_cable"] = tier
local groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2 } local groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2 }
@ -134,21 +134,21 @@ function technic.register_cable(tier, size)
connect_right = { -size, -size, -size, 0.5, size, size }, -- x+ connect_right = { -size, -size, -size, 0.5, size, size }, -- x+
} }
minetest.register_node("technic:" .. ltier .. "_cable", { minetest.register_node("technic:"..ltier.."_cable", {
description = S("%s Cable"):format(tier), description = S("%s Cable"):format(tier),
tiles = { "technic_" .. ltier .. "_cable.png" }, tiles = { "technic_"..ltier.."_cable.png" },
inventory_image = "technic_" .. ltier .. "_cable_wield.png", inventory_image = "technic_"..ltier.."_cable_wield.png",
wield_image = "technic_" .. ltier .. "_cable_wield.png", wield_image = "technic_"..ltier.."_cable_wield.png",
groups = groups, groups = groups,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
drop = "technic:" .. ltier .. "_cable", drop = "technic:"..ltier.."_cable",
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
drawtype = "nodebox", drawtype = "nodebox",
node_box = node_box, node_box = node_box,
connects_to = { connects_to = {
"technic:" .. ltier .. "_cable", "technic:"..ltier.."_cable",
"group:technic_" .. ltier, "group:technic_all_tiers" "group:technic_"..ltier, "group:technic_all_tiers"
}, },
on_construct = clear_networks, on_construct = clear_networks,
on_destruct = clear_networks, on_destruct = clear_networks,

View File

@ -19,16 +19,16 @@ local recipes = {
} }
local function uranium_dust(p) local function uranium_dust(p)
return "technic:uranium" .. (p == 7 and "" or p) .. "_dust" return "technic:uranium"..(p == 7 and "" or p).."_dust"
end end
for p = 1, 34 do for p = 1, 34 do
table.insert(recipes, { uranium_dust(p) .. " 2", uranium_dust(p - 1), uranium_dust(p + 1) }) table.insert(recipes, { uranium_dust(p).." 2", uranium_dust(p - 1), uranium_dust(p + 1) })
end end
if minetest.get_modpath("bushes_classic") then if minetest.get_modpath("bushes_classic") then
for _, berry in ipairs({ "blackberry", "blueberry", "gooseberry", "raspberry", "strawberry" }) do for _, berry in ipairs({ "blackberry", "blueberry", "gooseberry", "raspberry", "strawberry" }) do
table.insert(recipes, { "bushes:" .. berry .. "_bush", "default:stick 20", "bushes:" .. berry .. " 4" }) table.insert(recipes, { "bushes:"..berry.."_bush", "default:stick 20", "bushes:"..berry.." 4" })
end end
end end

View File

@ -37,8 +37,8 @@ if minetest.get_modpath("dye") then
for _, color in ipairs(dyes) do for _, color in ipairs(dyes) do
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = "dye:" .. color .. " 1", output = "dye:"..color.." 1",
recipe = { "group:flower,color_" .. color }, recipe = { "group:flower,color_"..color },
}) })
end end
minetest.register_craft({ minetest.register_craft({

View File

@ -23,7 +23,7 @@ function technic.register_generator(data)
choppy = 2, choppy = 2,
oddly_breakable_by_hand = 2, oddly_breakable_by_hand = 2,
technic_machine = 1, technic_machine = 1,
["technic_" .. ltier] = 1 ["technic_"..ltier] = 1
} }
if data.tube then if data.tube then
groups.tubedevice = 1 groups.tubedevice = 1
@ -34,7 +34,7 @@ function technic.register_generator(data)
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;]" ..
@ -48,7 +48,7 @@ function technic.register_generator(data)
local burn_totaltime = meta:get_int("burn_totaltime") local burn_totaltime = meta:get_int("burn_totaltime")
-- If more to burn and the energy produced was used: produce some more -- If more to burn and the energy produced was used: produce some more
if burn_time > 0 then if burn_time > 0 then
meta:set_int(tier .. "_EU_supply", data.supply) meta:set_int(tier.."_EU_supply", data.supply)
burn_time = burn_time - 1 burn_time = burn_time - 1
meta:set_int("burn_time", burn_time) meta:set_int("burn_time", burn_time)
end end
@ -66,39 +66,39 @@ function technic.register_generator(data)
}) })
if not fuel or fuel.time == 0 then if not fuel or fuel.time == 0 then
meta:set_string("infotext", S("%s Out Of Fuel"):format(desc)) meta:set_string("infotext", S("%s Out Of Fuel"):format(desc))
technic.swap_node(pos, "technic:" .. ltier .. "_generator") technic.swap_node(pos, "technic:"..ltier.."_generator")
meta:set_int(tier .. "_EU_supply", 0) meta:set_int(tier.."_EU_supply", 0)
return return
end end
meta:set_int("burn_time", fuel.time) meta:set_int("burn_time", fuel.time)
meta:set_int("burn_totaltime", fuel.time) meta:set_int("burn_totaltime", fuel.time)
inv:set_stack("src", 1, afterfuel.items[1]) inv:set_stack("src", 1, afterfuel.items[1])
technic.swap_node(pos, "technic:" .. ltier .. "_generator_active") technic.swap_node(pos, "technic:"..ltier.."_generator_active")
meta:set_int(tier .. "_EU_supply", data.supply) meta:set_int(tier.."_EU_supply", data.supply)
else else
technic.swap_node(pos, "technic:" .. ltier .. "_generator") technic.swap_node(pos, "technic:"..ltier.."_generator")
meta:set_int(tier .. "_EU_supply", 0) meta:set_int(tier.."_EU_supply", 0)
end end
end end
if burn_totaltime == 0 then burn_totaltime = 1 end if burn_totaltime == 0 then burn_totaltime = 1 end
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
minetest.register_node("technic:" .. ltier .. "_generator", { minetest.register_node("technic:"..ltier.."_generator", {
description = desc, description = desc,
tiles = { tiles = {
"technic_" .. ltier .. "_generator_top.png", "technic_machine_bottom.png", "technic_"..ltier.."_generator_top.png", "technic_machine_bottom.png",
"technic_" .. ltier .. "_generator_side.png", "technic_" .. ltier .. "_generator_side.png", "technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_side.png",
"technic_" .. ltier .. "_generator_side.png", "technic_" .. ltier .. "_generator_front.png" "technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_front.png"
}, },
paramtype2 = "facedir", paramtype2 = "facedir",
groups = groups, groups = groups,
@ -109,7 +109,7 @@ function technic.register_generator(data)
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("infotext", desc) meta:set_string("infotext", desc)
meta:set_int(data.tier .. "_EU_supply", 0) meta:set_int(data.tier.."_EU_supply", 0)
meta:set_int("burn_time", 0) meta:set_int("burn_time", 0)
meta:set_int("tube_time", 0) meta:set_int("tube_time", 0)
meta:set_string("formspec", generator_formspec) meta:set_string("formspec", generator_formspec)
@ -125,12 +125,12 @@ function technic.register_generator(data)
after_dig_node = technic.machine_after_dig_node after_dig_node = technic.machine_after_dig_node
}) })
minetest.register_node("technic:" .. ltier .. "_generator_active", { minetest.register_node("technic:"..ltier.."_generator_active", {
description = desc, description = desc,
tiles = { tiles = {
"technic_" .. ltier .. "_generator_top.png", "technic_machine_bottom.png", "technic_"..ltier.."_generator_top.png", "technic_machine_bottom.png",
"technic_" .. ltier .. "_generator_side.png", "technic_" .. ltier .. "_generator_side.png", "technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_side.png",
"technic_" .. ltier .. "_generator_side.png", "technic_" .. ltier .. "_generator_front_active.png" "technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_front_active.png"
}, },
paramtype2 = "facedir", paramtype2 = "facedir",
groups = active_groups, groups = active_groups,
@ -138,7 +138,7 @@ function technic.register_generator(data)
legacy_facedir_simple = true, legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
tube = data.tube and tube or nil, tube = data.tube and tube or nil,
drop = "technic:" .. ltier .. "_generator", drop = "technic:"..ltier.."_generator",
can_dig = technic.machine_can_dig, can_dig = technic.machine_can_dig,
allow_metadata_inventory_put = technic.machine_inventory_put, allow_metadata_inventory_put = technic.machine_inventory_put,
allow_metadata_inventory_take = technic.machine_inventory_take, allow_metadata_inventory_take = technic.machine_inventory_take,
@ -152,14 +152,14 @@ function technic.register_generator(data)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
-- Connected back? -- Connected back?
if meta:get_int(tier .. "_EU_timeout") > 0 then return false end if meta:get_int(tier.."_EU_timeout") > 0 then return false end
local burn_time = meta:get_int("burn_time") or 0 local burn_time = meta:get_int("burn_time") or 0
if burn_time <= 0 then if burn_time <= 0 then
meta:set_int(tier .. "_EU_supply", 0) meta:set_int(tier.."_EU_supply", 0)
meta:set_int("burn_time", 0) meta:set_int("burn_time", 0)
technic.swap_node(pos, "technic:" .. ltier .. "_generator") technic.swap_node(pos, "technic:"..ltier.."_generator")
return false return false
end end
@ -170,17 +170,17 @@ 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("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,
}) })
technic.register_machine(tier, "technic:" .. ltier .. "_generator", technic.producer) technic.register_machine(tier, "technic:"..ltier.."_generator", technic.producer)
technic.register_machine(tier, "technic:" .. ltier .. "_generator_active", technic.producer) technic.register_machine(tier, "technic:"..ltier.."_generator_active", technic.producer)
end end

View File

@ -72,17 +72,17 @@ end
local function register_dust(name, ingot) local function register_dust(name, ingot)
local lname = string.lower(name) local lname = string.lower(name)
lname = string.gsub(lname, ' ', '_') lname = string.gsub(lname, ' ', '_')
minetest.register_craftitem("technic:" .. lname .. "_dust", { minetest.register_craftitem("technic:"..lname.."_dust", {
description = S("%s Dust"):format(S(name)), description = S("%s Dust"):format(S(name)),
inventory_image = "technic_" .. lname .. "_dust.png", inventory_image = "technic_"..lname.."_dust.png",
}) })
if ingot then if ingot then
minetest.register_craft({ minetest.register_craft({
type = "cooking", type = "cooking",
recipe = "technic:" .. lname .. "_dust", recipe = "technic:"..lname.."_dust",
output = ingot, output = ingot,
}) })
technic.register_grinder_recipe({ input = { ingot }, output = "technic:" .. lname .. "_dust 1" }) technic.register_grinder_recipe({ input = { ingot }, output = "technic:"..lname.."_dust 1" })
end end
end end
@ -116,8 +116,8 @@ end
for p = 0, 35 do for p = 0, 35 do
local nici = (p ~= 0 and p ~= 7 and p ~= 35) and 1 or nil local nici = (p ~= 0 and p ~= 7 and p ~= 35) and 1 or nil
local psuffix = p == 7 and "" or p local psuffix = p == 7 and "" or p
local ingot = "technic:uranium" .. psuffix .. "_ingot" local ingot = "technic:uranium"..psuffix.."_ingot"
local dust = "technic:uranium" .. psuffix .. "_dust" local dust = "technic:uranium"..psuffix.."_dust"
minetest.register_craftitem(dust, { minetest.register_craftitem(dust, {
description = S("%s Dust"):format(string.format(S("%.1f%%-Fissile Uranium"), p / 10)), description = S("%s Dust"):format(string.format(S("%.1f%%-Fissile Uranium"), p / 10)),
inventory_image = "technic_uranium_dust.png", inventory_image = "technic_uranium_dust.png",
@ -133,7 +133,7 @@ for p = 0, 35 do
end end
local function uranium_dust(p) local function uranium_dust(p)
return "technic:uranium" .. (p == 7 and "" or p) .. "_dust" return "technic:uranium"..(p == 7 and "" or p).."_dust"
end end
for pa = 0, 34 do for pa = 0, 34 do
@ -143,7 +143,7 @@ for pa = 0, 34 do
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
recipe = { uranium_dust(pa), uranium_dust(pb) }, recipe = { uranium_dust(pa), uranium_dust(pb) },
output = uranium_dust(pc) .. " 2", output = uranium_dust(pc).." 2",
}) })
end end
end end

View File

@ -10,16 +10,16 @@ minetest.register_craftitem(sawdust, {
inventory_image = "technic_sawdust.png", inventory_image = "technic_sawdust.png",
}) })
minetest.register_craft({ type = "fuel", recipe = sawdust, burntime = 6 }) minetest.register_craft({ type = "fuel", recipe = sawdust, burntime = 6 })
technic.register_compressor_recipe({ input = { sawdust .. " 4" }, output = "default:wood" }) technic.register_compressor_recipe({ input = { sawdust.." 4" }, output = "default:wood" })
-- tree/wood grindings -- tree/wood grindings
local function register_tree_grinding(name, tree, wood, extract, grinding_color) local function register_tree_grinding(name, tree, wood, extract, grinding_color)
local lname = string.lower(name) local lname = string.lower(name)
lname = string.gsub(lname, ' ', '_') lname = string.gsub(lname, ' ', '_')
local grindings_name = "technic:" .. lname .. "_grindings" local grindings_name = "technic:"..lname.."_grindings"
local inventory_image = "technic_" .. lname .. "_grindings.png" local inventory_image = "technic_"..lname.."_grindings.png"
if grinding_color then if grinding_color then
inventory_image = inventory_image .. "^[colorize:" .. grinding_color inventory_image = inventory_image.."^[colorize:"..grinding_color
end end
minetest.register_craftitem(grindings_name, { minetest.register_craftitem(grindings_name, {
description = S("%s Grinding"):format(S(name)), description = S("%s Grinding"):format(S(name)),
@ -30,16 +30,16 @@ local function register_tree_grinding(name, tree, wood, extract, grinding_color)
recipe = grindings_name, recipe = grindings_name,
burntime = 8, burntime = 8,
}) })
technic.register_grinder_recipe({ input = { tree }, output = grindings_name .. " 4" }) technic.register_grinder_recipe({ input = { tree }, output = grindings_name.." 4" })
technic.register_grinder_recipe({ input = { grindings_name }, output = sawdust .. " 4" }) technic.register_grinder_recipe({ input = { grindings_name }, output = sawdust.." 4" })
if wood then if wood then
technic.register_grinder_recipe({ input = { wood }, output = grindings_name }) technic.register_grinder_recipe({ input = { wood }, output = grindings_name })
end end
if extract then if extract then
technic.register_extractor_recipe({ input = { grindings_name .. " 4" }, output = extract }) technic.register_extractor_recipe({ input = { grindings_name.." 4" }, output = extract })
technic.register_separating_recipe({ technic.register_separating_recipe({
input = { grindings_name .. " 4" }, input = { grindings_name.." 4" },
output = { sawdust .. " 4", extract } output = { sawdust.." 4", extract }
}) })
end end
end end

View File

@ -1,33 +1,33 @@
local path = technic.modpath .. "/machines/register" local path = technic.modpath.."/machines/register"
dofile(path .. "/common.lua") dofile(path.."/common.lua")
-- Wiring stuff -- Wiring stuff
dofile(path .. "/cables.lua") dofile(path.."/cables.lua")
dofile(path .. "/battery_box.lua") dofile(path.."/battery_box.lua")
-- Generators -- Generators
dofile(path .. "/solar_array.lua") dofile(path.."/solar_array.lua")
dofile(path .. "/generator.lua") dofile(path.."/generator.lua")
-- API for machines -- API for machines
dofile(path .. "/recipes.lua") dofile(path.."/recipes.lua")
dofile(path .. "/machine_base.lua") dofile(path.."/machine_base.lua")
-- Recipes -- Recipes
dofile(path .. "/alloy_recipes.lua") dofile(path.."/alloy_recipes.lua")
dofile(path .. "/grinder_recipes.lua") dofile(path.."/grinder_recipes.lua")
dofile(path .. "/extractor_recipes.lua") dofile(path.."/extractor_recipes.lua")
dofile(path .. "/compressor_recipes.lua") dofile(path.."/compressor_recipes.lua")
dofile(path .. "/centrifuge_recipes.lua") dofile(path.."/centrifuge_recipes.lua")
-- Multi-Machine Recipes -- Multi-Machine Recipes
dofile(path .. "/grindings.lua") dofile(path.."/grindings.lua")
-- Machines -- Machines
dofile(path .. "/alloy_furnace.lua") dofile(path.."/alloy_furnace.lua")
dofile(path .. "/electric_furnace.lua") dofile(path.."/electric_furnace.lua")
dofile(path .. "/grinder.lua") dofile(path.."/grinder.lua")
dofile(path .. "/extractor.lua") dofile(path.."/extractor.lua")
dofile(path .. "/compressor.lua") dofile(path.."/compressor.lua")
dofile(path .. "/centrifuge.lua") dofile(path.."/centrifuge.lua")

View File

@ -28,7 +28,7 @@ function technic.register_base_machine(data)
local tier = data.tier local tier = data.tier
local ltier = string.lower(tier) local ltier = string.lower(tier)
local groups = { cracky = 2, technic_machine = 1, ["technic_" .. ltier] = 1 } local groups = { cracky = 2, technic_machine = 1, ["technic_"..ltier] = 1 }
if data.tube then if data.tube then
groups.tubedevice = 1 groups.tubedevice = 1
groups.tubedevice_receiver = 1 groups.tubedevice_receiver = 1
@ -38,10 +38,10 @@ function technic.register_base_machine(data)
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]" ..
@ -50,7 +50,7 @@ function technic.register_base_machine(data)
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]" ..
@ -60,16 +60,16 @@ function technic.register_base_machine(data)
local run = function(pos, node) local run = function(pos, node)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
local eu_input = meta:get_int(tier .. "_EU_input") local eu_input = meta:get_int(tier.."_EU_input")
local machine_desc_tier = machine_desc:format(tier) local machine_desc_tier = machine_desc:format(tier)
local machine_node = "technic:" .. ltier .. "_" .. machine_name local machine_node = "technic:"..ltier.."_"..machine_name
local machine_demand = data.demand local machine_demand = data.demand
-- Setup meta data if it does not exist. -- Setup meta data if it does not exist.
if not eu_input then if not eu_input then
meta:set_int(tier .. "_EU_demand", machine_demand[1]) meta:set_int(tier.."_EU_demand", machine_demand[1])
meta:set_int(tier .. "_EU_input", 0) meta:set_int(tier.."_EU_input", 0)
return return
end end
@ -90,12 +90,12 @@ function technic.register_base_machine(data)
if not result then if not result then
technic.swap_node(pos, machine_node) technic.swap_node(pos, machine_node)
meta:set_string("infotext", S("%s Idle"):format(machine_desc_tier)) meta:set_string("infotext", S("%s Idle"):format(machine_desc_tier))
meta:set_int(tier .. "_EU_demand", 0) meta:set_int(tier.."_EU_demand", 0)
meta:set_int("src_time", 0) meta:set_int("src_time", 0)
return return
end end
meta:set_int(tier .. "_EU_demand", machine_demand[EU_upgrade + 1]) meta:set_int(tier.."_EU_demand", machine_demand[EU_upgrade + 1])
technic.swap_node(pos, machine_node .. "_active") technic.swap_node(pos, machine_node.."_active")
meta:set_string("infotext", S("%s Active"):format(machine_desc_tier)) meta:set_string("infotext", S("%s Active"):format(machine_desc_tier))
if meta:get_int("src_time") < round(result.time * 10) then if meta:get_int("src_time") < round(result.time * 10) then
if not powered then if not powered then
@ -123,7 +123,7 @@ function technic.register_base_machine(data)
if not room_for_output then if not room_for_output then
technic.swap_node(pos, machine_node) technic.swap_node(pos, machine_node)
meta:set_string("infotext", S("%s Idle"):format(machine_desc_tier)) meta:set_string("infotext", S("%s Idle"):format(machine_desc_tier))
meta:set_int(tier .. "_EU_demand", 0) meta:set_int(tier.."_EU_demand", 0)
meta:set_int("src_time", round(result.time * 10)) meta:set_int("src_time", round(result.time * 10))
return return
end end
@ -133,15 +133,15 @@ function technic.register_base_machine(data)
end end
end end
minetest.register_node("technic:" .. ltier .. "_" .. machine_name, { minetest.register_node("technic:"..ltier.."_"..machine_name, {
description = machine_desc:format(tier), description = machine_desc:format(tier),
tiles = { tiles = {
"technic_" .. ltier .. "_" .. machine_name .. "_top.png", "technic_"..ltier.."_"..machine_name.."_top.png",
"technic_" .. ltier .. "_" .. machine_name .. "_bottom.png", "technic_"..ltier.."_"..machine_name.."_bottom.png",
"technic_" .. ltier .. "_" .. machine_name .. "_side.png", "technic_"..ltier.."_"..machine_name.."_side.png",
"technic_" .. ltier .. "_" .. machine_name .. "_side.png", "technic_"..ltier.."_"..machine_name.."_side.png",
"technic_" .. ltier .. "_" .. machine_name .. "_side.png", "technic_"..ltier.."_"..machine_name.."_side.png",
"technic_" .. ltier .. "_" .. machine_name .. "_front.png" "technic_"..ltier.."_"..machine_name.."_front.png"
}, },
paramtype2 = "facedir", paramtype2 = "facedir",
groups = groups, groups = groups,
@ -170,18 +170,18 @@ function technic.register_base_machine(data)
after_dig_node = technic.machine_after_dig_node after_dig_node = technic.machine_after_dig_node
}) })
minetest.register_node("technic:" .. ltier .. "_" .. machine_name .. "_active", { minetest.register_node("technic:"..ltier.."_"..machine_name.."_active", {
description = machine_desc:format(tier), description = machine_desc:format(tier),
tiles = { tiles = {
"technic_" .. ltier .. "_" .. machine_name .. "_top.png", "technic_"..ltier.."_"..machine_name.."_top.png",
"technic_" .. ltier .. "_" .. machine_name .. "_bottom.png", "technic_"..ltier.."_"..machine_name.."_bottom.png",
"technic_" .. ltier .. "_" .. machine_name .. "_side.png", "technic_"..ltier.."_"..machine_name.."_side.png",
"technic_" .. ltier .. "_" .. machine_name .. "_side.png", "technic_"..ltier.."_"..machine_name.."_side.png",
"technic_" .. ltier .. "_" .. machine_name .. "_side.png", "technic_"..ltier.."_"..machine_name.."_side.png",
"technic_" .. ltier .. "_" .. machine_name .. "_front_active.png" "technic_"..ltier.."_"..machine_name.."_front_active.png"
}, },
paramtype2 = "facedir", paramtype2 = "facedir",
drop = "technic:" .. ltier .. "_" .. machine_name, drop = "technic:"..ltier.."_"..machine_name,
groups = active_groups, groups = active_groups,
connect_sides = data.connect_sides or connect_default, connect_sides = data.connect_sides or connect_default,
legacy_facedir_simple = true, legacy_facedir_simple = true,
@ -192,11 +192,11 @@ function technic.register_base_machine(data)
allow_metadata_inventory_take = technic.machine_inventory_take, allow_metadata_inventory_take = technic.machine_inventory_take,
allow_metadata_inventory_move = technic.machine_inventory_move, allow_metadata_inventory_move = technic.machine_inventory_move,
technic_run = run, technic_run = run,
technic_disabled_machine_name = "technic:" .. ltier .. "_" .. machine_name, technic_disabled_machine_name = "technic:"..ltier.."_"..machine_name,
}) })
technic.register_machine(tier, "technic:" .. ltier .. "_" .. machine_name, technic.receiver) technic.register_machine(tier, "technic:"..ltier.."_"..machine_name, technic.receiver)
technic.register_machine(tier, "technic:" .. ltier .. "_" .. machine_name .. "_active", technic.receiver) technic.register_machine(tier, "technic:"..ltier.."_"..machine_name.."_active", technic.receiver)
end end
-- End registration -- End registration

View File

@ -30,20 +30,20 @@ function technic.register_solar_array(data)
charge_to_give = math.max(charge_to_give, 0) charge_to_give = math.max(charge_to_give, 0)
charge_to_give = math.min(charge_to_give, data.power * 50) charge_to_give = math.min(charge_to_give, data.power * 50)
meta:set_string("infotext", S("@1 Active (@2 EU)", machine_name, technic.pretty_num(charge_to_give))) meta:set_string("infotext", S("@1 Active (@2 EU)", machine_name, technic.pretty_num(charge_to_give)))
meta:set_int(tier .. "_EU_supply", charge_to_give) meta:set_int(tier.."_EU_supply", charge_to_give)
else else
meta:set_string("infotext", S("%s Idle"):format(machine_name)) meta:set_string("infotext", S("%s Idle"):format(machine_name))
meta:set_int(tier .. "_EU_supply", 0) meta:set_int(tier.."_EU_supply", 0)
end end
end end
minetest.register_node("technic:solar_array_" .. ltier, { minetest.register_node("technic:solar_array_"..ltier, {
tiles = { tiles = {
"technic_" .. ltier .. "_solar_array_top.png", "technic_" .. ltier .. "_solar_array_bottom.png", "technic_"..ltier.."_solar_array_top.png", "technic_"..ltier.."_solar_array_bottom.png",
"technic_" .. ltier .. "_solar_array_side.png", "technic_" .. ltier .. "_solar_array_side.png", "technic_"..ltier.."_solar_array_side.png", "technic_"..ltier.."_solar_array_side.png",
"technic_" .. ltier .. "_solar_array_side.png", "technic_" .. ltier .. "_solar_array_side.png" "technic_"..ltier.."_solar_array_side.png", "technic_"..ltier.."_solar_array_side.png"
}, },
groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, technic_machine = 1, ["technic_" .. ltier] = 1 }, groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, technic_machine = 1, ["technic_"..ltier] = 1 },
connect_sides = { "bottom" }, connect_sides = { "bottom" },
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
description = S("Arrayed Solar %s Generator"):format(tier), description = S("Arrayed Solar %s Generator"):format(tier),
@ -57,11 +57,11 @@ function technic.register_solar_array(data)
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local name = minetest.get_node(pos).name local name = minetest.get_node(pos).name
meta:set_int(tier .. "_EU_supply", 0) meta:set_int(tier.."_EU_supply", 0)
end, end,
technic_run = run, technic_run = run,
}) })
technic.register_machine(tier, "technic:solar_array_" .. ltier, technic.producer) technic.register_machine(tier, "technic:solar_array_"..ltier, technic.producer)
end end

View File

@ -11,20 +11,20 @@ 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
-- from the ambiguity between lag and a missed press) only make -- from the ambiguity between lag and a missed press) only make
-- the single change that the user expects. -- the single change that the user expects.
if meta:get_int("mesecon_mode") == 0 then if meta:get_int("mesecon_mode") == 0 then
formspec = formspec .. "button[0,1;5,1;mesecon_mode_1;" .. S("Ignoring Mesecon Signal") .. "]" formspec = formspec.."button[0,1;5,1;mesecon_mode_1;"..S("Ignoring Mesecon Signal").."]"
else else
formspec = formspec .. "button[0,1;5,1;mesecon_mode_0;" .. S("Controlled by Mesecon Signal") .. "]" formspec = formspec.."button[0,1;5,1;mesecon_mode_0;"..S("Controlled by Mesecon Signal").."]"
end end
if meta:get_int("enabled") == 0 then if meta:get_int("enabled") == 0 then
formspec = formspec .. "button[0,1.75;5,1;enable;" .. S("%s Disabled"):format(S("Supply Converter")) .. "]" formspec = formspec.."button[0,1.75;5,1;enable;"..S("%s Disabled"):format(S("Supply Converter")).."]"
else else
formspec = formspec .. "button[0,1.75;5,1;disable;" .. S("%s Enabled"):format(S("Supply Converter")) .. "]" formspec = formspec.."button[0,1.75;5,1;disable;"..S("%s Enabled"):format(S("Supply Converter")).."]"
end end
meta:set_string("formspec", formspec) meta:set_string("formspec", formspec)
end end
@ -88,19 +88,19 @@ local run = function(pos, node, run_stage)
local to = technic.get_cable_tier(name_down) local to = technic.get_cable_tier(name_down)
if from and to then if from and to then
local input = meta:get_int(from .. "_EU_input") local input = meta:get_int(from.."_EU_input")
meta:set_int(from .. "_EU_demand", demand) meta:set_int(from.."_EU_demand", demand)
meta:set_int(from .. "_EU_supply", 0) meta:set_int(from.."_EU_supply", 0)
meta:set_int(to .. "_EU_demand", 0) meta:set_int(to.."_EU_demand", 0)
meta:set_int(to .. "_EU_supply", input * remain) meta:set_int(to.."_EU_supply", input * remain)
meta:set_string("infotext", S("@1 (@2 @3 -> @4 @5)", machine_name, technic.pretty_num(input), from, technic.pretty_num(input * remain), to)) meta:set_string("infotext", S("@1 (@2 @3 -> @4 @5)", machine_name, technic.pretty_num(input), from, technic.pretty_num(input * remain), to))
else else
meta:set_string("infotext", S("%s Has Bad Cabling"):format(machine_name)) meta:set_string("infotext", S("%s Has Bad Cabling"):format(machine_name))
if to then if to then
meta:set_int(to .. "_EU_supply", 0) meta:set_int(to.."_EU_supply", 0)
end end
if from then if from then
meta:set_int(from .. "_EU_demand", 0) meta:set_int(from.."_EU_demand", 0)
end end
return return
end end

View File

@ -62,7 +62,7 @@ minetest.register_node("technic:switching_station", {
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("infotext", S("Switching Station")) meta:set_string("infotext", S("Switching Station"))
meta:set_string("active", 1) meta:set_string("active", 1)
meta:set_string("channel", "switching_station" .. minetest.pos_to_string(pos)) meta:set_string("channel", "switching_station"..minetest.pos_to_string(pos))
meta:set_string("formspec", "field[channel;Channel;${channel}]") meta:set_string("formspec", "field[channel;Channel;${channel}]")
end, end,
after_dig_node = function(pos) after_dig_node = function(pos)
@ -136,7 +136,7 @@ local check_node_subp = function(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_nod
add_new_cable_node(all_nodes, pos, network_id) add_new_cable_node(all_nodes, pos, network_id)
elseif machines[name] then elseif machines[name] then
--dprint(name.." is a "..machines[name]) --dprint(name.." is a "..machines[name])
meta:set_string(tier .. "_network", minetest.pos_to_string(sw_pos)) meta:set_string(tier.."_network", minetest.pos_to_string(sw_pos))
if machines[name] == technic.producer then if machines[name] == technic.producer then
add_new_cable_node(PR_nodes, pos, network_id) add_new_cable_node(PR_nodes, pos, network_id)
elseif machines[name] == technic.receiver then elseif machines[name] == technic.receiver then
@ -154,7 +154,7 @@ local check_node_subp = function(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_nod
add_new_cable_node(BA_nodes, pos, network_id) add_new_cable_node(BA_nodes, pos, network_id)
end end
meta:set_int(tier .. "_EU_timeout", 2) -- Touch node meta:set_int(tier.."_EU_timeout", 2) -- Touch node
end end
end end
@ -178,7 +178,7 @@ end
local touch_nodes = function(list, tier) local touch_nodes = function(list, tier)
for _, pos in ipairs(list) do for _, pos in ipairs(list) do
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_int(tier .. "_EU_timeout", 2) -- Touch node meta:set_int(tier.."_EU_timeout", 2) -- Touch node
end end
end end
@ -286,9 +286,9 @@ minetest.register_abm({
run_nodes(BA_nodes, technic.battery) run_nodes(BA_nodes, technic.battery)
-- Strings for the meta data -- Strings for the meta data
local eu_demand_str = tier .. "_EU_demand" local eu_demand_str = tier.."_EU_demand"
local eu_input_str = tier .. "_EU_input" local eu_input_str = tier.."_EU_input"
local eu_supply_str = tier .. "_EU_supply" local eu_supply_str = tier.."_EU_supply"
-- Distribute charge equally across multiple batteries. -- Distribute charge equally across multiple batteries.
local charge_total = 0 local charge_total = 0
@ -436,12 +436,12 @@ minetest.register_abm({
-- A node must be touched by the station continuously in order to function -- A node must be touched by the station continuously in order to function
local function switching_station_timeout_count(pos, tier) local function switching_station_timeout_count(pos, tier)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local timeout = meta:get_int(tier .. "_EU_timeout") local timeout = meta:get_int(tier.."_EU_timeout")
if timeout <= 0 then if timeout <= 0 then
meta:set_int(tier .. "_EU_input", 0) -- Not needed anymore <-- actually, it is for supply converter meta:set_int(tier.."_EU_input", 0) -- Not needed anymore <-- actually, it is for supply converter
return true return true
else else
meta:set_int(tier .. "_EU_timeout", timeout - 1) meta:set_int(tier.."_EU_timeout", timeout - 1)
return false return false
end end
end end

View File

@ -380,12 +380,12 @@ end
local griefing = technic.config:get_bool("enable_corium_griefing") local griefing = technic.config:get_bool("enable_corium_griefing")
for _, state in pairs({ "flowing", "source" }) do for _, state in pairs({ "flowing", "source" }) do
minetest.register_node("technic:corium_" .. state, { minetest.register_node("technic:corium_"..state, {
description = S(state == "source" and "Corium Source" or "Flowing Corium"), description = S(state == "source" and "Corium Source" or "Flowing Corium"),
drawtype = (state == "source" and "liquid" or "flowingliquid"), drawtype = (state == "source" and "liquid" or "flowingliquid"),
[state == "source" and "tiles" or "special_tiles"] = { [state == "source" and "tiles" or "special_tiles"] = {
{ {
name = "technic_corium_" .. state .. "_animated.png", name = "technic_corium_"..state.."_animated.png",
animation = { animation = {
type = "vertical_frames", type = "vertical_frames",
aspect_w = 16, aspect_w = 16,

View File

@ -36,7 +36,7 @@ function technic.register_can(d)
local charge = get_can_level(itemstack) local charge = get_can_level(itemstack)
if charge == data.can_capacity then return end if charge == data.can_capacity then return end
if minetest.is_protected(pointed_thing.under, user:get_player_name()) then if minetest.is_protected(pointed_thing.under, user:get_player_name()) then
minetest.log("action", user:get_player_name() .. " tried to take " .. node.name .. " at protected position " .. minetest.pos_to_string(pointed_thing.under) .. " with a " .. data.can_name) minetest.log("action", user:get_player_name().." tried to take "..node.name.." at protected position "..minetest.pos_to_string(pointed_thing.under).." with a "..data.can_name)
return return
end end
minetest.remove_node(pointed_thing.under) minetest.remove_node(pointed_thing.under)
@ -60,7 +60,7 @@ function technic.register_can(d)
local charge = get_can_level(itemstack) local charge = get_can_level(itemstack)
if charge == 0 then return end if charge == 0 then return end
if minetest.is_protected(pos, user:get_player_name()) then if minetest.is_protected(pos, user:get_player_name()) then
minetest.log("action", user:get_player_name() .. " tried to place " .. data.liquid_source_name .. " at protected position " .. minetest.pos_to_string(pos) .. " with a " .. data.can_name) minetest.log("action", user:get_player_name().." tried to place "..data.liquid_source_name.." at protected position "..minetest.pos_to_string(pos).." with a "..data.can_name)
return return
end end
minetest.set_node(pos, { name = data.liquid_source_name }) minetest.set_node(pos, { name = data.liquid_source_name })

View File

@ -1,20 +1,20 @@
local path = technic.modpath .. "/tools" local path = technic.modpath.."/tools"
if technic.config:get_bool("enable_mining_drill") then if technic.config:get_bool("enable_mining_drill") then
dofile(path .. "/mining_drill.lua") dofile(path.."/mining_drill.lua")
end end
if technic.config:get_bool("enable_mining_laser") then if technic.config:get_bool("enable_mining_laser") then
dofile(path .. "/mining_lasers.lua") dofile(path.."/mining_lasers.lua")
end end
if technic.config:get_bool("enable_flashlight") then if technic.config:get_bool("enable_flashlight") then
dofile(path .. "/flashlight.lua") dofile(path.."/flashlight.lua")
end end
dofile(path .. "/cans.lua") dofile(path.."/cans.lua")
dofile(path .. "/chainsaw.lua") dofile(path.."/chainsaw.lua")
dofile(path .. "/tree_tap.lua") dofile(path.."/tree_tap.lua")
dofile(path .. "/sonic_screwdriver.lua") dofile(path.."/sonic_screwdriver.lua")
dofile(path .. "/prospector.lua") dofile(path.."/prospector.lua")
dofile(path .. "/vacuum.lua") dofile(path.."/vacuum.lua")
if minetest.get_modpath("screwdriver") then if minetest.get_modpath("screwdriver") then
-- compatibility alias -- compatibility alias

View File

@ -32,7 +32,7 @@ for i = 1, 4 do
output = 'technic:mining_drill_mk3', output = 'technic:mining_drill_mk3',
recipe = { recipe = {
{ 'technic:diamond_drill_head', 'technic:diamond_drill_head', 'technic:diamond_drill_head' }, { 'technic:diamond_drill_head', 'technic:diamond_drill_head', 'technic:diamond_drill_head' },
{ 'technic:stainless_steel_ingot', 'technic:mining_drill_mk2_' .. i, 'technic:stainless_steel_ingot' }, { 'technic:stainless_steel_ingot', 'technic:mining_drill_mk2_'..i, 'technic:stainless_steel_ingot' },
{ '', 'technic:blue_energy_crystal', '' }, { '', 'technic:blue_energy_crystal', '' },
} }
}) })
@ -253,8 +253,8 @@ local function mining_drill_mk2_setmode(user, itemstack)
mode = (meta["mode"]) mode = (meta["mode"])
mode = mode + 1 mode = mode + 1
if mode >= 5 then mode = 1 end if mode >= 5 then mode = 1 end
minetest.chat_send_player(player_name, S("Mining Drill Mk%d Mode %d"):format(2, mode) .. ": " .. mining_drill_mode_text[mode][1]) minetest.chat_send_player(player_name, S("Mining Drill Mk%d Mode %d"):format(2, mode)..": "..mining_drill_mode_text[mode][1])
itemstack:set_name("technic:mining_drill_mk2_" .. mode); itemstack:set_name("technic:mining_drill_mk2_"..mode);
meta["mode"] = mode meta["mode"] = mode
itemstack:set_metadata(minetest.serialize(meta)) itemstack:set_metadata(minetest.serialize(meta))
return itemstack return itemstack
@ -276,8 +276,8 @@ local function mining_drill_mk3_setmode(user, itemstack)
mode = (meta["mode"]) mode = (meta["mode"])
mode = mode + 1 mode = mode + 1
if mode >= 6 then mode = 1 end if mode >= 6 then mode = 1 end
minetest.chat_send_player(player_name, S("Mining Drill Mk%d Mode %d"):format(3, mode) .. ": " .. mining_drill_mode_text[mode][1]) minetest.chat_send_player(player_name, S("Mining Drill Mk%d Mode %d"):format(3, mode)..": "..mining_drill_mode_text[mode][1])
itemstack:set_name("technic:mining_drill_mk3_" .. mode); itemstack:set_name("technic:mining_drill_mk3_"..mode);
meta["mode"] = mode meta["mode"] = mode
itemstack:set_metadata(minetest.serialize(meta)) itemstack:set_metadata(minetest.serialize(meta))
return itemstack return itemstack
@ -374,10 +374,10 @@ minetest.register_tool("technic:mining_drill_mk2", {
technic.register_power_tool("technic:mining_drill_mk2", max_charge[2]) technic.register_power_tool("technic:mining_drill_mk2", max_charge[2])
for i = 1, 4 do for i = 1, 4 do
technic.register_power_tool("technic:mining_drill_mk2_" .. i, max_charge[2]) technic.register_power_tool("technic:mining_drill_mk2_"..i, max_charge[2])
minetest.register_tool("technic:mining_drill_mk2_" .. i, { minetest.register_tool("technic:mining_drill_mk2_"..i, {
description = S("Mining Drill Mk%d Mode %d"):format(2, i), description = S("Mining Drill Mk%d Mode %d"):format(2, i),
inventory_image = "technic_mining_drill_mk2.png^technic_tool_mode" .. i .. ".png", inventory_image = "technic_mining_drill_mk2.png^technic_tool_mode"..i..".png",
wield_image = "technic_mining_drill_mk2.png", wield_image = "technic_mining_drill_mk2.png",
wear_represents = "technic_RE_charge", wear_represents = "technic_RE_charge",
on_refill = technic.refill_RE_charge, on_refill = technic.refill_RE_charge,
@ -403,10 +403,10 @@ minetest.register_tool("technic:mining_drill_mk3", {
technic.register_power_tool("technic:mining_drill_mk3", max_charge[3]) technic.register_power_tool("technic:mining_drill_mk3", max_charge[3])
for i = 1, 5, 1 do for i = 1, 5, 1 do
technic.register_power_tool("technic:mining_drill_mk3_" .. i, max_charge[3]) technic.register_power_tool("technic:mining_drill_mk3_"..i, max_charge[3])
minetest.register_tool("technic:mining_drill_mk3_" .. i, { minetest.register_tool("technic:mining_drill_mk3_"..i, {
description = S("Mining Drill Mk%d Mode %d"):format(3, i), description = S("Mining Drill Mk%d Mode %d"):format(3, i),
inventory_image = "technic_mining_drill_mk3.png^technic_tool_mode" .. i .. ".png", inventory_image = "technic_mining_drill_mk3.png^technic_tool_mode"..i..".png",
wield_image = "technic_mining_drill_mk3.png", wield_image = "technic_mining_drill_mk3.png",
wear_represents = "technic_RE_charge", wear_represents = "technic_RE_charge",
on_refill = technic.refill_RE_charge, on_refill = technic.refill_RE_charge,

View File

@ -42,7 +42,7 @@ local function laser_node(pos, node, player)
acceleration = { x = 0, y = -1, z = 0 }, acceleration = { x = 0, y = -1, z = 0 },
expirationtime = 1.5, expirationtime = 1.5,
size = 6 + math.random() * 2, size = 6 + math.random() * 2,
texture = "smoke_puff.png^[transform" .. math.random(0, 7), texture = "smoke_puff.png^[transform"..math.random(0, 7),
}) })
return return
end end
@ -68,7 +68,7 @@ local function laser_shoot(player, range, particle_texture, sound)
acceleration = vector.multiply(dir, 50), acceleration = vector.multiply(dir, 50),
expirationtime = range / 11, expirationtime = range / 11,
size = 1, size = 1,
texture = particle_texture .. "^[transform" .. math.random(0, 7), texture = particle_texture.."^[transform"..math.random(0, 7),
}) })
minetest.sound_play(sound, { pos = player_pos, max_hear_distance = range }) minetest.sound_play(sound, { pos = player_pos, max_hear_distance = range })
for pos in technic.trace_node_ray_fat(start_pos, dir, range) do for pos in technic.trace_node_ray_fat(start_pos, dir, range) do
@ -88,10 +88,10 @@ end
for _, m in pairs(mining_lasers_list) do for _, m in pairs(mining_lasers_list) do
technic.register_power_tool("technic:laser_mk" .. m[1], m[3]) technic.register_power_tool("technic:laser_mk"..m[1], m[3])
minetest.register_tool("technic:laser_mk" .. m[1], { minetest.register_tool("technic:laser_mk"..m[1], {
description = S("Mining Laser Mk%d"):format(m[1]), description = S("Mining Laser Mk%d"):format(m[1]),
inventory_image = "technic_mining_laser_mk" .. m[1] .. ".png", inventory_image = "technic_mining_laser_mk"..m[1]..".png",
stack_max = 1, stack_max = 1,
wear_represents = "technic_RE_charge", wear_represents = "technic_RE_charge",
on_refill = technic.refill_RE_charge, on_refill = technic.refill_RE_charge,
@ -103,7 +103,7 @@ for _, m in pairs(mining_lasers_list) do
-- If there's enough charge left, fire the laser -- If there's enough charge left, fire the laser
if meta.charge >= m[4] then if meta.charge >= m[4] then
laser_shoot(user, m[2], "technic_laser_beam_mk" .. m[1] .. ".png", "technic_laser_mk" .. m[1]) laser_shoot(user, m[2], "technic_laser_beam_mk"..m[1]..".png", "technic_laser_mk"..m[1])
if not technic.creative_mode then if not technic.creative_mode then
meta.charge = meta.charge - m[4] meta.charge = meta.charge - m[4]
technic.set_RE_wear(itemstack, meta.charge, m[3]) technic.set_RE_wear(itemstack, meta.charge, m[3])

View File

@ -47,8 +47,8 @@ minetest.register_tool("technic:prospector", {
end end
end end
if math.random() < 0.02 then found = not found end if math.random() < 0.02 then found = not found end
minetest.chat_send_player(user:get_player_name(), minetest.registered_nodes[toolmeta.target].description .. " is " .. (found and "present" or "absent") .. " in " .. look_diameter .. "x" .. look_diameter .. "x" .. toolmeta.look_depth .. " region") minetest.chat_send_player(user:get_player_name(), minetest.registered_nodes[toolmeta.target].description.." is "..(found and "present" or "absent").." in "..look_diameter.."x"..look_diameter.."x"..toolmeta.look_depth.." region")
minetest.sound_play("technic_prospector_" .. (found and "hit" or "miss"), { pos = vector.add(user:getpos(), { x = 0, y = 1, z = 0 }), gain = 1.0, max_hear_distance = 10 }) minetest.sound_play("technic_prospector_"..(found and "hit" or "miss"), { pos = vector.add(user:getpos(), { x = 0, y = 1, z = 0 }), gain = 1.0, max_hear_distance = 10 })
return toolstack return toolstack
end, end,
on_place = function(toolstack, user, pointed_thing) on_place = function(toolstack, user, pointed_thing)
@ -65,27 +65,27 @@ minetest.register_tool("technic:prospector", {
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]" ..

View File

@ -62,13 +62,13 @@ 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

@ -11,7 +11,7 @@ for _, material in ipairs(material_list) do
output = 'technic:gold_chest', output = 'technic:gold_chest',
recipe = { recipe = {
{ 'default:gold_ingot', 'default:gold_ingot', 'default:gold_ingot' }, { 'default:gold_ingot', 'default:gold_ingot', 'default:gold_ingot' },
{ 'default:gold_ingot', "technic:" .. material .. "_chest", 'default:gold_ingot' }, { 'default:gold_ingot', "technic:"..material.."_chest", 'default:gold_ingot' },
{ 'default:gold_ingot', 'default:gold_ingot', 'default:gold_ingot' }, { 'default:gold_ingot', 'default:gold_ingot', 'default:gold_ingot' },
} }
}) })
@ -20,7 +20,7 @@ for _, material in ipairs(material_list) do
output = 'technic:gold_locked_chest', output = 'technic:gold_locked_chest',
recipe = { recipe = {
{ 'default:gold_ingot', 'default:gold_ingot', 'default:gold_ingot' }, { 'default:gold_ingot', 'default:gold_ingot', 'default:gold_ingot' },
{ 'default:gold_ingot', "technic:" .. material .. "_locked_chest", 'default:gold_ingot' }, { 'default:gold_ingot', "technic:"..material.."_locked_chest", 'default:gold_ingot' },
{ 'default:gold_ingot', 'default:gold_ingot', 'default:gold_ingot' }, { 'default:gold_ingot', 'default:gold_ingot', 'default:gold_ingot' },
} }
}) })

View File

@ -7,12 +7,12 @@ local modpath = minetest.get_modpath("technic_chests")
technic = rawget(_G, "technic") or {} technic = rawget(_G, "technic") or {}
technic.chests = {} technic.chests = {}
dofile(modpath .. "/common.lua") dofile(modpath.."/common.lua")
dofile(modpath .. "/register.lua") dofile(modpath.."/register.lua")
dofile(modpath .. "/wooden_chest.lua") dofile(modpath.."/wooden_chest.lua")
dofile(modpath .. "/iron_chest.lua") dofile(modpath.."/iron_chest.lua")
dofile(modpath .. "/copper_chest.lua") dofile(modpath.."/copper_chest.lua")
dofile(modpath .. "/silver_chest.lua") dofile(modpath.."/silver_chest.lua")
dofile(modpath .. "/gold_chest.lua") dofile(modpath.."/gold_chest.lua")
dofile(modpath .. "/mithril_chest.lua") dofile(modpath.."/mithril_chest.lua")

View File

@ -9,7 +9,7 @@ if not minetest.get_modpath("pipeworks") then
local dummy = function() local dummy = function()
end end
pipeworks_meta.__index = function(table, key) pipeworks_meta.__index = function(table, key)
print("[technic_chests] WARNING: variable or method '" .. key .. "' not present in dummy pipeworks table - assuming it is a method...") print("[technic_chests] WARNING: variable or method '"..key.."' not present in dummy pipeworks table - assuming it is a method...")
pipeworks[key] = dummy pipeworks[key] = dummy
return dummy return dummy
end end
@ -37,7 +37,7 @@ local chest_mark_colors = {
local function colorid_to_postfix(id) local function colorid_to_postfix(id)
return chest_mark_colors[id] and "_" .. chest_mark_colors[id][1] or "" return chest_mark_colors[id] and "_"..chest_mark_colors[id][1] or ""
end end
@ -45,11 +45,11 @@ local function get_color_buttons(coleft, lotop)
local buttons_string = "" local buttons_string = ""
for y = 0, 3 do for y = 0, 3 do
for x = 0, 3 do for x = 0, 3 do
local file_name = "technic_colorbutton" .. (y * 4 + x) .. ".png" local file_name = "technic_colorbutton"..(y * 4 + x)..".png"
buttons_string = buttons_string .. "image_button[" buttons_string = buttons_string.."image_button["
.. (coleft + 0.1 + x * 0.7) .. "," .. (lotop + 0.1 + y * 0.7) .. (coleft + 0.1 + x * 0.7)..","..(lotop + 0.1 + y * 0.7)
.. ";0.8,0.8;" .. file_name .. ";color_button" .. ";0.8,0.8;"..file_name..";color_button"
.. (y * 4 + x + 1) .. ";]" .. (y * 4 + x + 1)..";]"
end end
end end
return buttons_string return buttons_string
@ -58,9 +58,9 @@ end
local function check_color_buttons(pos, meta, chest_name, fields) local function check_color_buttons(pos, meta, chest_name, fields)
for i = 1, 16 do for i = 1, 16 do
if fields["color_button" .. i] then if fields["color_button"..i] then
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
node.name = chest_name .. colorid_to_postfix(i) node.name = chest_name..colorid_to_postfix(i)
minetest.swap_node(pos, node) minetest.swap_node(pos, node)
meta:set_string("color", i) meta:set_string("color", i)
return return
@ -74,20 +74,20 @@ local function set_formspec(pos, data, page)
local formspec = data.base_formspec local formspec = data.base_formspec
if data.autosort then if data.autosort then
local status = meta:get_int("autosort") local status = meta:get_int("autosort")
formspec = formspec .. "button[" .. (data.hileft + 2) .. "," .. (data.height + 1.1) .. ";3,0.8;autosort_to_" .. (1 - status) .. ";" .. S("Auto-sort is %s"):format(status == 1 and S("On") or S("Off")) .. "]" formspec = formspec.."button["..(data.hileft + 2)..","..(data.height + 1.1)..";3,0.8;autosort_to_"..(1 - status)..";"..S("Auto-sort is %s"):format(status == 1 and S("On") or S("Off")).."]"
end end
if data.infotext then if data.infotext then
local formspec_infotext = minetest.formspec_escape(meta:get_string("infotext")) local formspec_infotext = minetest.formspec_escape(meta:get_string("infotext"))
if page == "main" then if page == "main" then
formspec = formspec .. "image_button[" .. (data.hileft + 2.1) .. ",0.1;0.8,0.8;" formspec = formspec.."image_button["..(data.hileft + 2.1)..",0.1;0.8,0.8;"
.. "technic_pencil_icon.png;edit_infotext;]" .. "technic_pencil_icon.png;edit_infotext;]"
.. "label[" .. (data.hileft + 3) .. ",0;" .. formspec_infotext .. "]" .. "label["..(data.hileft + 3)..",0;"..formspec_infotext.."]"
elseif page == "edit_infotext" then elseif page == "edit_infotext" then
formspec = formspec .. "image_button[" .. (data.hileft + 2.1) .. ",0.1;0.8,0.8;" formspec = formspec.."image_button["..(data.hileft + 2.1)..",0.1;0.8,0.8;"
.. "technic_checkmark_icon.png;save_infotext;]" .. "technic_checkmark_icon.png;save_infotext;]"
.. "field[" .. (data.hileft + 3.3) .. ",0.2;4.8,1;" .. "field["..(data.hileft + 3.3)..",0.2;4.8,1;"
.. "infotext_box;" .. S("Edit chest description:") .. ";" .. "infotext_box;"..S("Edit chest description:")..";"
.. formspec_infotext .. "]" .. formspec_infotext.."]"
end end
end end
if data.color then if data.color then
@ -98,7 +98,7 @@ local function set_formspec(pos, data, page)
else else
colorName = S("None") colorName = S("None")
end end
formspec = formspec .. "label[" .. (data.coleft + 0.2) .. "," .. (data.lotop + 3) .. ";" .. S("Color Filter: %s"):format(colorName) .. "]" formspec = formspec.."label["..(data.coleft + 0.2)..","..(data.lotop + 3)..";"..S("Color Filter: %s"):format(colorName).."]"
end end
meta:set_string("formspec", formspec) meta:set_string("formspec", formspec)
end end
@ -166,7 +166,7 @@ local function get_receive_fields(name, data)
end end
if data.color then if data.color then
-- This sets the node -- This sets the node
local nn = "technic:" .. lname .. (data.locked and "_locked" or "") .. "_chest" local nn = "technic:"..lname..(data.locked and "_locked" or "").."_chest"
check_color_buttons(pos, meta, nn, fields) check_color_buttons(pos, meta, nn, fields)
end end
meta:get_inventory():set_size("main", data.width * data.height) meta:get_inventory():set_size("main", data.width * data.height)
@ -202,20 +202,20 @@ function technic.chests:definition(name, data)
data.ovheight = data.lotop + 4 data.ovheight = data.lotop + 4
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").."]"
end end
if data.color then if data.color then
data.base_formspec = data.base_formspec .. get_color_buttons(data.coleft, data.lotop) data.base_formspec = data.base_formspec..get_color_buttons(data.coleft, data.lotop)
end end
if data.locked then if data.locked then
@ -226,7 +226,7 @@ function technic.chests:definition(name, data)
S("%s Locked Chest (owned by %s)"):format(name, meta:get_string("owner"))) S("%s Locked Chest (owned by %s)"):format(name, meta:get_string("owner")))
pipeworks.after_place(pos) pipeworks.after_place(pos)
end end
table.insert(front, "technic_" .. lname .. "_chest_lock_overlay.png") table.insert(front, "technic_"..lname.."_chest_lock_overlay.png")
else else
locked_after_place = pipeworks.after_place locked_after_place = pipeworks.after_place
end end
@ -241,9 +241,9 @@ function technic.chests:definition(name, data)
local def = { local def = {
description = desc, description = desc,
tiles = { tiles = {
"technic_" .. lname .. "_chest_top.png", "technic_" .. lname .. "_chest_top.png", "technic_"..lname.."_chest_top.png", "technic_"..lname.."_chest_top.png",
"technic_" .. lname .. "_chest_side.png", "technic_" .. lname .. "_chest_side.png", "technic_"..lname.."_chest_side.png", "technic_"..lname.."_chest_side.png",
"technic_" .. lname .. "_chest_side.png", table.concat(front, "^") "technic_"..lname.."_chest_side.png", table.concat(front, "^")
}, },
paramtype2 = "facedir", paramtype2 = "facedir",
groups = self.groups, groups = self.groups,
@ -267,7 +267,7 @@ function technic.chests:definition(name, data)
on_blast = function(pos) on_blast = function(pos)
local drops = {} local drops = {}
default.get_inventory_drops(pos, "main", drops) default.get_inventory_drops(pos, "main", drops)
drops[#drops + 1] = "technic:" .. name:lower() .. (data.locked and "_locked" or "") .. "_chest" drops[#drops + 1] = "technic:"..name:lower()..(data.locked and "_locked" or "").."_chest"
minetest.remove_node(pos) minetest.remove_node(pos)
return drops return drops
end, end,
@ -309,15 +309,15 @@ end
function technic.chests:register(name, data) function technic.chests:register(name, data)
local def = technic.chests:definition(name, data) local def = technic.chests:definition(name, data)
local nn = "technic:" .. name:lower() .. (data.locked and "_locked" or "") .. "_chest" local nn = "technic:"..name:lower()..(data.locked and "_locked" or "").."_chest"
minetest.register_node(":" .. nn, def) minetest.register_node(":"..nn, def)
if data.color then if data.color then
local mk_front local mk_front
if string.find(def.tiles[6], "%^") then if string.find(def.tiles[6], "%^") then
mk_front = function(overlay) return def.tiles[6]:gsub("%^", "^" .. overlay .. "^") end mk_front = function(overlay) return def.tiles[6]:gsub("%^", "^"..overlay.."^") end
else else
mk_front = function(overlay) return def.tiles[6] .. "^" .. overlay end mk_front = function(overlay) return def.tiles[6].."^"..overlay end
end end
for i = 1, 15 do for i = 1, 15 do
local postfix = colorid_to_postfix(i) local postfix = colorid_to_postfix(i)
@ -327,8 +327,8 @@ function technic.chests:register(name, data)
end end
colordef.drop = nn colordef.drop = nn
colordef.groups = self.groups_noinv colordef.groups = self.groups_noinv
colordef.tiles = { def.tiles[1], def.tiles[2], def.tiles[3], def.tiles[4], def.tiles[5], mk_front("technic_chest_overlay" .. postfix .. ".png") } colordef.tiles = { def.tiles[1], def.tiles[2], def.tiles[3], def.tiles[4], def.tiles[5], mk_front("technic_chest_overlay"..postfix..".png") }
minetest.register_node(":" .. nn .. postfix, colordef) minetest.register_node(":"..nn..postfix, colordef)
end end
end end
end end

View File

@ -1,4 +1,4 @@
technic.config = technic.config or Settings(minetest.get_worldpath() .. "/technic.conf") technic.config = technic.config or Settings(minetest.get_worldpath().."/technic.conf")
local conf_table = technic.config:to_table() local conf_table = technic.config:to_table()

View File

@ -85,7 +85,7 @@ local function register_block(block, ingot)
}) })
minetest.register_craft({ minetest.register_craft({
output = ingot .. " 9", output = ingot.." 9",
recipe = { recipe = {
{ block } { block }
} }

View File

@ -5,14 +5,14 @@ technic.worldgen = {
gettext = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end, gettext = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end,
} }
dofile(modpath .. "/config.lua") dofile(modpath.."/config.lua")
dofile(modpath .. "/nodes.lua") dofile(modpath.."/nodes.lua")
dofile(modpath .. "/oregen.lua") dofile(modpath.."/oregen.lua")
dofile(modpath .. "/crafts.lua") dofile(modpath.."/crafts.lua")
-- Rubber trees, moretrees also supplies these -- Rubber trees, moretrees also supplies these
if not minetest.get_modpath("moretrees") then if not minetest.get_modpath("moretrees") then
dofile(modpath .. "/rubber.lua") dofile(modpath.."/rubber.lua")
else else
-- older versions of technic provided rubber trees regardless -- older versions of technic provided rubber trees regardless
minetest.register_alias("technic:rubber_sapling", "moretrees:rubber_tree_sapling") minetest.register_alias("technic:rubber_sapling", "moretrees:rubber_tree_sapling")
@ -21,6 +21,6 @@ end
-- mg suppport -- mg suppport
if minetest.get_modpath("mg") then if minetest.get_modpath("mg") then
dofile(modpath .. "/mg.lua") dofile(modpath.."/mg.lua")
end end

View File

@ -16,8 +16,8 @@ local LATEST_SERIALIZATION_VERSION = 1
wrench = {} wrench = {}
local modpath = minetest.get_modpath(minetest.get_current_modname()) local modpath = minetest.get_modpath(minetest.get_current_modname())
dofile(modpath .. "/support.lua") dofile(modpath.."/support.lua")
dofile(modpath .. "/technic.lua") dofile(modpath.."/technic.lua")
-- Boilerplate to support localized strings if intllib mod is installed. -- Boilerplate to support localized strings if intllib mod is installed.
local S = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end local S = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end
@ -31,7 +31,7 @@ local function get_meta_type(name, metaname)
end end
local function get_pickup_name(name) local function get_pickup_name(name)
return "wrench:picked_up_" .. (name:gsub(":", "_")) return "wrench:picked_up_"..(name:gsub(":", "_"))
end end
local function restore(pos, placer, itemstack) local function restore(pos, placer, itemstack)
@ -73,7 +73,7 @@ for name, info in pairs(wrench.registered_nodes) do
newdef.on_construct = nil newdef.on_construct = nil
newdef.on_destruct = nil newdef.on_destruct = nil
newdef.after_place_node = restore newdef.after_place_node = restore
minetest.register_node(":" .. get_pickup_name(name), newdef) minetest.register_node(":"..get_pickup_name(name), newdef)
end end
end end
@ -120,7 +120,7 @@ minetest.register_tool("wrench:wrench", {
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

View File

@ -381,11 +381,11 @@ local chest_mark_colors = {
} }
for i = 1, 15 do for i = 1, 15 do
wrench:register_node("technic:gold_chest" .. chest_mark_colors[i], { wrench:register_node("technic:gold_chest"..chest_mark_colors[i], {
lists = { "main" }, lists = { "main" },
metas = { infotext = STRING, formspec = STRING }, metas = { infotext = STRING, formspec = STRING },
}) })
wrench:register_node("technic:gold_locked_chest" .. chest_mark_colors[i], { wrench:register_node("technic:gold_locked_chest"..chest_mark_colors[i], {
lists = { "main" }, lists = { "main" },
metas = { infotext = STRING, owner = STRING, formspec = STRING }, metas = { infotext = STRING, owner = STRING, formspec = STRING },
owned = true, owned = true,
@ -396,14 +396,14 @@ if minetest.get_modpath("technic") then
for tier, _ in pairs(technic.machines) do for tier, _ in pairs(technic.machines) do
local ltier = tier:lower() local ltier = tier:lower()
for i = 0, 8 do for i = 0, 8 do
wrench:register_node("technic:" .. ltier .. "_battery_box" .. i, { wrench:register_node("technic:"..ltier.."_battery_box"..i, {
lists = { "src", "dst" }, lists = { "src", "dst" },
metas = { metas = {
infotext = STRING, infotext = STRING,
formspec = STRING, formspec = STRING,
[tier .. "_EU_demand"] = INT, [tier.."_EU_demand"] = INT,
[tier .. "_EU_supply"] = INT, [tier.."_EU_supply"] = INT,
[tier .. "_EU_input"] = INT, [tier.."_EU_input"] = INT,
internal_EU_charge = INT, internal_EU_charge = INT,
last_side_shown = INT last_side_shown = INT
}, },