diff --git a/techage/.test/sink.lua b/techage/.test/sink.lua index ec32e83..7d0c33a 100644 --- a/techage/.test/sink.lua +++ b/techage/.test/sink.lua @@ -7,7 +7,7 @@ GPL v3 See LICENSE.txt for more information - + Demo for a electrical power consuming node ]]-- @@ -62,7 +62,7 @@ end minetest.register_node("techage:sink", { description = "Sink", tiles = {'techage_electric_button.png^[colorize:#000000:50'}, - + on_timer = function(pos, elapsed) local consumed = power.consume_power(pos, Cable, nil, PWR_NEEDED) if consumed == PWR_NEEDED then @@ -76,7 +76,7 @@ minetest.register_node("techage:sink", { after_dig_node = after_dig_node, paramtype = "light", - light_source = 0, + light_source = 0, paramtype2 = "facedir", groups = {choppy = 2, cracky = 2, crumbly = 2}, is_ground_content = false, @@ -100,7 +100,7 @@ minetest.register_node("techage:sink_on", { after_dig_node = after_dig_node, paramtype = "light", - light_source = minetest.LIGHT_MAX, + light_source = minetest.LIGHT_MAX, paramtype2 = "facedir", diggable = false, drop = "", diff --git a/techage/basic_machines/autocrafter.lua b/techage/basic_machines/autocrafter.lua index 5a0e733..4212bc2 100644 --- a/techage/basic_machines/autocrafter.lua +++ b/techage/basic_machines/autocrafter.lua @@ -8,11 +8,11 @@ AGPL v3 See LICENSE.txt for more information - The autocrafter is derived from pipeworks: + The autocrafter is derived from pipeworks: Copyright (C) 2004 Sam Hocevar WTFPL - + TA2/TA3/TA4 Autocrafter - + ]]-- -- for lazy programmers @@ -69,7 +69,7 @@ local function count_index(invlist) end -- caches some recipe data -local autocrafterCache = {} +local autocrafterCache = {} local function get_craft(pos, inventory, hash) hash = hash or minetest.hash_node_position(pos) @@ -78,13 +78,13 @@ local function get_craft(pos, inventory, hash) local recipe = inventory:get_list("recipe") local output, decremented_input = minetest.get_craft_result( {method = "normal", width = 3, items = recipe}) - + -- check if registered item - if UncraftableItems[output.item:get_name()] then + if UncraftableItems[output.item:get_name()] then output.item = ItemStack() end - - craft = {recipe = recipe, consumption = count_index(recipe), + + craft = {recipe = recipe, consumption = count_index(recipe), output = output, decremented_input = decremented_input} autocrafterCache[hash] = craft end @@ -93,18 +93,18 @@ end local function autocraft(pos, crd, nvm, inv) local craft = get_craft(pos, inv) - if not craft then + if not craft then crd.State:idle(pos, nvm) return end local output_item = craft.output.item if output_item:get_name() == "" then crd.State:idle(pos, nvm) - return + return end - + -- check if we have enough room in dst - if not inv:room_for_item("dst", output_item) then + if not inv:room_for_item("dst", output_item) then crd.State:blocked(pos, nvm) return end @@ -112,9 +112,9 @@ local function autocraft(pos, crd, nvm, inv) local inv_index = count_index(inv:get_list("src")) -- check if we have enough material available for itemname, number in pairs(consumption) do - if (not inv_index[itemname]) or inv_index[itemname] < number then + if (not inv_index[itemname]) or inv_index[itemname] < number then crd.State:idle(pos, nvm) - return + return end end -- consume material @@ -129,7 +129,7 @@ local function autocraft(pos, crd, nvm, inv) for i = 1, 9 do inv:add_item("dst", craft.decremented_input.items[i]) end - + crd.State:keep_running(pos, nvm, COUNTDOWN_TICKS) end @@ -230,7 +230,7 @@ local function determine_recipe_items(pos, input) if num and idx then input = get_input_from_recipeblock(pos, num, idx) end - + if input then -- ",,..." input local items = string.split(input, ",", true, 8) @@ -452,7 +452,7 @@ local tubing = { end, } -local node_name_ta2, node_name_ta3, node_name_ta4 = +local node_name_ta2, node_name_ta3, node_name_ta4 = techage.register_consumer("autocrafter", S("Autocrafter"), tiles, { drawtype = "normal", cycle_time = CYCLE_TIME, diff --git a/techage/basic_machines/blackhole.lua b/techage/basic_machines/blackhole.lua index 3deb033..3f397c0 100644 --- a/techage/basic_machines/blackhole.lua +++ b/techage/basic_machines/blackhole.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information All items and liquids disappear. - + ]]-- local S = techage.S @@ -70,7 +70,7 @@ minetest.register_craft({ techage.register_node({"techage:blackhole"}, { on_pull_item = nil, -- not needed on_unpull_item = nil, -- not needed - + on_push_item = function(pos, in_dir, stack) local meta = minetest.get_meta(pos) if meta:get_int("push_dir") == in_dir then diff --git a/techage/basic_machines/chest.lua b/techage/basic_machines/chest.lua index 5d66ffa..b07f824 100644 --- a/techage/basic_machines/chest.lua +++ b/techage/basic_machines/chest.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - + TA2/TA3/TA4 Chest - + ]]-- -- for lazy programmers @@ -76,7 +76,7 @@ minetest.register_node("techage:chest_ta2", { local inv = meta:get_inventory() inv:set_size('main', 32) end, - + after_place_node = function(pos, placer) local meta = minetest.get_meta(pos) meta:set_string("owner", placer:get_player_name()) @@ -86,7 +86,7 @@ minetest.register_node("techage:chest_ta2", { techage_set_numbers = function(pos, numbers, player_name) return techage.logic.set_numbers(pos, numbers, player_name, S("TA2 Protected Chest")) end, - + can_dig = can_dig, after_dig_node = after_dig_node, allow_metadata_inventory_put = allow_metadata_inventory_put, @@ -126,7 +126,7 @@ minetest.register_node("techage:chest_ta3", { local inv = meta:get_inventory() inv:set_size('main', 40) end, - + after_place_node = function(pos, placer) local meta = minetest.get_meta(pos) local number = techage.add_node(pos, "techage:chest_ta3") @@ -139,7 +139,7 @@ minetest.register_node("techage:chest_ta3", { techage_set_numbers = function(pos, numbers, player_name) return techage.logic.set_numbers(pos, numbers, player_name, S("TA3 Protected Chest")) end, - + can_dig = can_dig, after_dig_node = after_dig_node, allow_metadata_inventory_put = allow_metadata_inventory_put, @@ -180,7 +180,7 @@ techage.register_node({"techage:chest_ta2", "techage:chest_ta3"}, { return "unsupported" end end, -}) +}) local function formspec4(pos) @@ -227,7 +227,7 @@ local function ta4_allow_metadata_inventory_put(pos, listname, index, stack, pla if not public and minetest.is_protected(pos, player:get_player_name()) then return 0 end - + if listname == "main" then return stack:get_count() else @@ -240,7 +240,7 @@ local function ta4_allow_metadata_inventory_take(pos, listname, index, stack, pl if not public and minetest.is_protected(pos, player:get_player_name()) then return 0 end - + if listname == "main" then return stack:get_count() else @@ -253,7 +253,7 @@ local function ta4_allow_metadata_inventory_move(pos, from_list, from_index, to_ if not public and minetest.is_protected(pos, player:get_player_name()) then return 0 end - + if from_list == "main" then return count else @@ -279,7 +279,7 @@ minetest.register_node("techage:chest_ta4", { inv:set_size('main', 50) inv:set_size('conf', 50) end, - + after_place_node = function(pos, placer) local meta = minetest.get_meta(pos) local number = techage.add_node(pos, "techage:chest_ta4") @@ -293,7 +293,7 @@ minetest.register_node("techage:chest_ta4", { if minetest.is_protected(pos, player:get_player_name()) then return end - + local meta = minetest.get_meta(pos) local mem = techage.get_mem(pos) if fields.tab == "1" then @@ -320,11 +320,11 @@ minetest.register_node("techage:chest_ta4", { meta:set_string("formspec", formspec4_cfg(pos)) end end, - + techage_set_numbers = function(pos, numbers, player_name) return techage.logic.set_numbers(pos, numbers, player_name, S("TA4 Protected Chest")) end, - + can_dig = can_dig, after_dig_node = after_dig_node, allow_metadata_inventory_put = ta4_allow_metadata_inventory_put, @@ -347,14 +347,14 @@ techage.register_node({"techage:chest_ta4"}, { local meta = minetest.get_meta(pos) local inv = meta:get_inventory() local mem = techage.get_mem(pos) - + mem.filter = mem.filter or mConf.item_filter(pos, TA4_INV_SIZE) mem.chest_configured = mem.chest_configured or not inv:is_empty("conf") - + if inv:is_empty("main") then return nil end - + if item_name then if mem.filter[item_name] or not mem.chest_configured then local taken = inv:remove_item("main", {name = item_name, count = num}) @@ -374,10 +374,10 @@ techage.register_node({"techage:chest_ta4"}, { local meta = minetest.get_meta(pos) local inv = meta:get_inventory() local mem = techage.get_mem(pos) - + mem.filter = mem.filter or mConf.item_filter(pos, TA4_INV_SIZE) mem.chest_configured = mem.chest_configured or not inv:is_empty("conf") - + if mem.chest_configured then local name = item:get_name() local stacks = mem.filter[name] or mem.filter["unconfigured"] @@ -390,10 +390,10 @@ techage.register_node({"techage:chest_ta4"}, { local meta = minetest.get_meta(pos) local inv = meta:get_inventory() local mem = techage.get_mem(pos) - + mem.filter = mem.filter or mConf.item_filter(pos, TA4_INV_SIZE) mem.chest_configured = mem.chest_configured or not inv:is_empty("conf") - + if mem.chest_configured then local name = item:get_name() local stacks = mem.filter[name] or mem.filter["unconfigured"] @@ -402,7 +402,7 @@ techage.register_node({"techage:chest_ta4"}, { return techage.put_items(inv, "main", item) end end, - + on_recv_message = function(pos, src, topic, payload) if topic == "state" then local meta = minetest.get_meta(pos) @@ -412,7 +412,7 @@ techage.register_node({"techage:chest_ta4"}, { return "unsupported" end end, -}) +}) minetest.register_craft({ type = "shapeless", diff --git a/techage/basic_machines/concentrator.lua b/techage/basic_machines/concentrator.lua index eed6f43..40e836d 100644 --- a/techage/basic_machines/concentrator.lua +++ b/techage/basic_machines/concentrator.lua @@ -65,7 +65,7 @@ techage.register_node(names, { return techage.safe_push_items(pos, push_dir, stack) end, is_pusher = true, -- is a pulling/pushing node -}) +}) names = networks.register_junction("techage:ta4_concentrator", 2/8, Boxes, Tube, { description = S("TA4 Tube Concentrator"), @@ -104,7 +104,7 @@ techage.register_node(names, { return techage.safe_push_items(pos, push_dir, stack) end, is_pusher = true, -- is a pulling/pushing node -}) +}) minetest.register_craft({ diff --git a/techage/basic_machines/consumer.lua b/techage/basic_machines/consumer.lua index f745a59..b75fd0d 100644 --- a/techage/basic_machines/consumer.lua +++ b/techage/basic_machines/consumer.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + Consumer node basis functionality. It handles: - up to 4 stages of nodes (TA2/TA3/TA4/TA5) @@ -54,7 +54,7 @@ end local function node_timer_pas(pos, elapsed) local crd = CRD(pos) local nvm = techage.get_nvm(pos) - + -- handle power consumption if crd.power_netw and techage.needs_power(nvm) then local consumed = power.consume_power(pos, crd.power_netw, nil, crd.power_consumption) @@ -62,7 +62,7 @@ local function node_timer_pas(pos, elapsed) crd.State:start(pos, nvm) end end - + -- call the node timer routine if techage.is_operational(nvm) then nvm.node_timer_call_cyle = (nvm.node_timer_call_cyle or 0) + 1 @@ -77,7 +77,7 @@ end local function node_timer_act(pos, elapsed) local crd = CRD(pos) local nvm = techage.get_nvm(pos) - + -- handle power consumption if crd.power_netw and techage.needs_power(nvm) then local consumed = power.consume_power(pos, crd.power_netw, nil, crd.power_consumption) @@ -85,7 +85,7 @@ local function node_timer_act(pos, elapsed) crd.State:nopower(pos, nvm) end end - + -- call the node timer routine if techage.is_operational(nvm) then nvm.node_timer_call_cyle = (nvm.node_timer_call_cyle or 0) + 1 @@ -111,7 +111,7 @@ local function prepare_tiles(tiles, stage, power_png) return tbl end --- 'validStates' is optional and can be used to e.g. enable +-- 'validStates' is optional and can be used to e.g. enable -- only one TA2 node {false, true, false, false} function techage.register_consumer(base_name, inv_name, tiles, tNode, validStates, node_name_prefix) local names = {} @@ -163,7 +163,7 @@ function techage.register_consumer(base_name, inv_name, tiles, tNode, validState State = tState, -- number of items to be processed per cycle num_items = tNode.num_items and tNode.num_items[stage], - power_consumption = power_used and + power_consumption = power_used and tNode.power_consumption[stage] or 0, node_timer = tNode.node_timer, cycle_time = tNode.cycle_time, @@ -204,7 +204,7 @@ function techage.register_consumer(base_name, inv_name, tiles, tNode, validState techage.remove_node(pos, oldnode, oldmetadata) techage.del_mem(pos) end - + tNode.groups.not_in_creative_inventory = 0 local def_pas = { @@ -285,14 +285,14 @@ function techage.register_consumer(base_name, inv_name, tiles, tNode, validState def_act[k] = v end end - + minetest.register_node(name_act, def_act) if power_used then power.register_nodes({name_pas, name_act}, power_network, "con", sides) end techage.register_node({name_pas, name_act}, tNode.tubing) - + if tNode.tube_sides then Tube:set_valid_sides(name_pas, get_keys(tNode.tube_sides)) Tube:set_valid_sides(name_act, get_keys(tNode.tube_sides)) diff --git a/techage/basic_machines/distributor.lua b/techage/basic_machines/distributor.lua index b5ac378..6df2639 100644 --- a/techage/basic_machines/distributor.lua +++ b/techage/basic_machines/distributor.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information TA2/TA3/TA4 Distributor - + ]]-- -- for lazy programmers @@ -34,7 +34,7 @@ local INFO = [[Turn port on/off or read its state: command = 'port', payload = r --local Side2Color = {B="red", L="green", F="blue", R="yellow"} local SlotColors = {"red", "green", "blue", "yellow"} -local Num2Ascii = {"B", "L", "F", "R"} +local Num2Ascii = {"B", "L", "F", "R"} local FilterCache = {} -- local cache for filter settings local function filter_settings(pos) @@ -72,9 +72,9 @@ local function filter_settings(pos) end end end - + FilterCache[minetest.hash_node_position(pos)] = { - ItemFilter = ItemFilter, + ItemFilter = ItemFilter, OpenPorts = OpenPorts, } end @@ -88,7 +88,7 @@ local function get_filter_settings(pos) -- } -- local OpenPorts = {3} -- return ItemFilter, OpenPorts - + local hash = minetest.hash_node_position(pos) if FilterCache[hash] == nil then filter_settings(pos) @@ -111,8 +111,8 @@ local function blocking_checkbox(pos, filter, is_hp) M(pos):set_int("blocking", 0) -- disable blocking end return "" -end - +end + local function formspec(self, pos, nvm) local filter = minetest.deserialize(M(pos):get_string("filter")) or {false,false,false,false} local is_hp = nvm.high_performance == true @@ -185,7 +185,7 @@ end local function allow_metadata_inventory_put(pos, listname, index, stack, player) local inv = M(pos):get_inventory() local list = inv:get_list(listname) - + if minetest.is_protected(pos, player:get_player_name()) then return 0 end @@ -247,7 +247,7 @@ local function tubelib2_on_update2(pos, outdir, tlib2, node) is_ta4_tube = is_ta4_tube and techage.TA4tubes[node.name] end end - + local nvm = techage.get_nvm(pos) local crd = CRD(pos) if CRD(pos).stage == 4 and not is_ta4_tube then @@ -295,10 +295,10 @@ local function distributing(pos, inv, crd, nvm) local sum_num_pushed = 0 local num_pushed = 0 local blocking_mode = M(pos):get_int("blocking") == 1 - + -- start searching after last position local offs = nvm.last_index or 1 - + for i = 1, SRC_INV_SIZE do local idx = ((i + offs - 1) % 8) + 1 local stack = inv:get_stack("src", idx) @@ -308,7 +308,7 @@ local function distributing(pos, inv, crd, nvm) local stack_to_push = stack:peek_item(num_to_push) local filter = item_filter[item_name] num_pushed = 0 - + if filter and #filter > 0 then -- Push items based on filter num_pushed = push_item(pos, filter, stack_to_push, num_to_push, nvm) @@ -320,16 +320,16 @@ local function distributing(pos, inv, crd, nvm) -- Push items based on open ports num_pushed = push_item(pos, open_ports, stack_to_push, num_to_push, nvm) end - + sum_num_pushed = sum_num_pushed + num_pushed stack:take_item(num_pushed) inv:set_stack("src", idx, stack) - if sum_num_pushed >= (nvm.num_items or crd.num_items) then + if sum_num_pushed >= (nvm.num_items or crd.num_items) then nvm.last_index = idx - break + break end end - + if sum_num_pushed == 0 then crd.State:blocked(pos, nvm) else @@ -370,9 +370,9 @@ local function on_receive_fields(pos, formname, fields, player) meta:set_int("blocking", fields.blocking == "true" and 1 or 0) end meta:set_string("filter", minetest.serialize(filter)) - + filter_settings(pos) - + local nvm = techage.get_nvm(pos) if fields.state_button ~= nil then crd.State:state_button_event(pos, nvm, fields) @@ -391,9 +391,9 @@ local function change_filter_settings(pos, slot, val) filter[num] = val == "on" end meta:set_string("filter", minetest.serialize(filter)) - + filter_settings(pos) - + local nvm = techage.get_nvm(pos) meta:set_string("formspec", formspec(CRD(pos).State, pos, nvm)) return true @@ -474,7 +474,7 @@ local tubing = { else return change_filter_settings(pos, slot, val) end - else + else return CRD(pos).State:on_receive_message(pos, topic, payload) end end, diff --git a/techage/basic_machines/electronic_fab.lua b/techage/basic_machines/electronic_fab.lua index 96a875b..6487412 100644 --- a/techage/basic_machines/electronic_fab.lua +++ b/techage/basic_machines/electronic_fab.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information TA2/TA3/TA4 Electronic Fab - + ]]-- -- for lazy programmers @@ -109,14 +109,14 @@ local function on_receive_fields(pos, formname, fields, player) if minetest.is_protected(pos, player:get_player_name()) then return end - + local nvm = techage.get_nvm(pos) local crd = CRD(pos) - - if not nvm.running then + + if not nvm.running then recipes.on_receive_fields(pos, formname, fields, player) end - + crd.State:state_button_event(pos, nvm, fields) M(pos):set_string("formspec", formspec(crd.State, pos, nvm)) end @@ -207,7 +207,7 @@ local tubing = { end, } -local node_name_ta2, node_name_ta3, node_name_ta4 = +local node_name_ta2, node_name_ta3, node_name_ta4 = techage.register_consumer("electronic_fab", S("Electronic Fab"), tiles, { drawtype = "normal", cycle_time = CYCLE_TIME, @@ -277,4 +277,3 @@ techage.recipes.register_craft_type("ta4_electronic_fab", { width = 2, height = 2, }) - diff --git a/techage/basic_machines/forceload.lua b/techage/basic_machines/forceload.lua index fdbde0c..121d8ab 100644 --- a/techage/basic_machines/forceload.lua +++ b/techage/basic_machines/forceload.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information Forceload block - + ]]-- -- for lazy programmers @@ -38,7 +38,7 @@ end local function remove_list_elem(list, x) local n = nil for idx, v in ipairs(list) do - if vector.equals(v, x) then + if vector.equals(v, x) then n = idx break end @@ -59,12 +59,12 @@ local function postload_area(pos) minetest.after(60, postload_area, pos) end end - + local function add_pos(pos, player) local meta = player:get_meta() local lPos = minetest.deserialize(meta:get_string("techage_forceload_blocks")) or {} if not in_list(lPos, pos) and (#lPos < techage.max_num_forceload_blocks or - creative and creative.is_enabled_for and + minetest.global_exists("creative") and creative.is_enabled_for and creative.is_enabled_for(player:get_player_name())) then lPos[#lPos+1] = pos local meta = player:get_meta() @@ -73,7 +73,7 @@ local function add_pos(pos, player) end return false end - + local function del_pos(pos, player) local meta = player:get_meta() local lPos = minetest.deserialize(meta:get_string("techage_forceload_blocks")) or {} @@ -116,7 +116,6 @@ local function formspec(name) local tRes = {} for idx,pos in ipairs(lPos) do local pos1, pos2 = calc_area(pos) - local ypos = 0.2 + idx * 0.4 tRes[#tRes+1] = idx tRes[#tRes+1] = minetest.formspec_escape(P2S(pos1)) tRes[#tRes+1] = "to" @@ -202,10 +201,10 @@ minetest.register_node("techage:forceload", { after_dig_node = after_dig_node, on_rightclick = on_rightclick, on_punch = on_punch, - + paramtype = "light", sunlight_propagates = true, - groups = {choppy=2, cracky=2, crumbly=2, + groups = {choppy=2, cracky=2, crumbly=2, digtron_protected = 1, not_in_creative_inventory = techage.max_num_forceload_blocks == 0 and 1 or 0}, is_ground_content = false, @@ -236,17 +235,17 @@ minetest.register_node("techage:forceloadtile", { {-4/16, -8/16, -4/16, 4/16, -15/32, 4/16}, }, }, - + on_place = on_place, after_place_node = after_place_node, after_dig_node = after_dig_node, on_rightclick = on_rightclick, on_punch = on_punch, - + paramtype = "light", paramtype2 = "facedir", sunlight_propagates = true, - groups = {choppy=2, cracky=2, crumbly=2, + groups = {choppy=2, cracky=2, crumbly=2, not_in_creative_inventory = techage.max_num_forceload_blocks == 0 and 1 or 0}, is_ground_content = false, sounds = default.node_sound_wood_defaults(), diff --git a/techage/basic_machines/foreign_nodes.lua b/techage/basic_machines/foreign_nodes.lua index b87ebf3..e9a3ebc 100644 --- a/techage/basic_machines/foreign_nodes.lua +++ b/techage/basic_machines/foreign_nodes.lua @@ -7,16 +7,16 @@ AGPL v3 See LICENSE.txt for more information - + Tube support for default chests and furnace - + ]]-- local OwnerCache = { } -- Check if the chest is in the protected area of the owner -local function is_owner(pos, meta) +local function is_owner(pos, meta) local owner = meta:get_string("owner") local key = minetest.hash_node_position(pos) -- If successfull, store info in cache @@ -27,7 +27,7 @@ local function is_owner(pos, meta) end return OwnerCache[key] == owner end - + techage.register_node({"default:chest", "default:chest_open"}, { on_inv_request = function(pos, in_dir, access_type) @@ -49,7 +49,7 @@ techage.register_node({"default:chest", "default:chest_open"}, { local inv = meta:get_inventory() return techage.put_items(inv, "main", stack) end, -}) +}) techage.register_node({"default:chest_locked", "default:chest_locked_open"}, { on_inv_request = function(pos, in_dir, access_type) @@ -75,7 +75,7 @@ techage.register_node({"default:chest_locked", "default:chest_locked_open"}, { local inv = meta:get_inventory() return techage.put_items(inv, "main", stack) end, -}) +}) techage.register_node({"shop:shop"}, { on_inv_request = function(pos, in_dir, access_type) @@ -101,7 +101,7 @@ techage.register_node({"shop:shop"}, { local inv = meta:get_inventory() return techage.put_items(inv, "register", stack) end, -}) +}) techage.register_node({"default:furnace", "default:furnace_active"}, { on_pull_item = function(pos, in_dir, num) @@ -124,7 +124,7 @@ techage.register_node({"default:furnace", "default:furnace_active"}, { local inv = meta:get_inventory() return techage.put_items(inv, "dst", stack) end, -}) +}) techage.register_node({"mobs:beehive"}, { on_pull_item = function(pos, in_dir, num) @@ -137,7 +137,7 @@ techage.register_node({"mobs:beehive"}, { local inv = meta:get_inventory() return techage.put_items(inv, "beehive", stack) end, -}) +}) techage.register_node({"xdecor:hive"}, { on_pull_item = function(pos, in_dir, num) @@ -150,4 +150,4 @@ techage.register_node({"xdecor:hive"}, { local inv = meta:get_inventory() return techage.put_items(inv, "honey", stack) end, -}) +}) diff --git a/techage/basic_machines/gravelrinser.lua b/techage/basic_machines/gravelrinser.lua index 3df776f..cff4611 100644 --- a/techage/basic_machines/gravelrinser.lua +++ b/techage/basic_machines/gravelrinser.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - + TA2 Gravel Rinser, washing sieved gravel to find more ores - + ]]-- -- for lazy programmers @@ -146,7 +146,7 @@ local function washing(pos, crd, nvm, inv) crd.State:keep_running(pos, nvm, COUNTDOWN_TICKS) return end - + local src = ItemStack("techage:sieved_gravel") local dst = ItemStack("default:sand") if inv:contains_item("src", src) then @@ -255,7 +255,7 @@ local tubing = { end, } -local node_name_ta2, node_name_ta3, node_name_ta4 = +local node_name_ta2, node_name_ta3, node_name_ta4 = techage.register_consumer("rinser", S("Gravel Rinser"), tiles, { drawtype = "nodebox", paramtype = "light", @@ -329,8 +329,7 @@ function techage.add_rinser_recipe(recipe) recipe.items = {recipe.input} recipe.type = "rinsing" techage.recipes.register_craft(recipe) -end +end techage.add_rinser_recipe({input="techage:sieved_gravel", output="techage:usmium_nuggets", probability=30}) techage.add_rinser_recipe({input="techage:sieved_gravel", output="default:copper_lump", probability=15}) - diff --git a/techage/basic_machines/gravelsieve.lua b/techage/basic_machines/gravelsieve.lua index 3152d3c..0d61593 100644 --- a/techage/basic_machines/gravelsieve.lua +++ b/techage/basic_machines/gravelsieve.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - + TA2/TA3/TA4 Gravel Sieve, sieving gravel to find ores - + ]]-- -- for lazy programmers @@ -179,7 +179,7 @@ local tubing = { end, } -local node_name_ta2, node_name_ta3, node_name_ta4 = +local node_name_ta2, node_name_ta3, node_name_ta4 = techage.register_consumer("gravelsieve", S("Gravel Sieve"), tiles, { drawtype = "nodebox", paramtype = "light", @@ -265,17 +265,17 @@ techage.recipes.register_craft_type("ta4_gravelsieve", { height = 1, }) techage.recipes.register_craft({ - output = "techage:sieved_basalt_gravel", + output = "techage:sieved_basalt_gravel", items = {"techage:basalt_gravel"}, type = "ta2_gravelsieve", }) techage.recipes.register_craft({ - output = "techage:sieved_basalt_gravel", + output = "techage:sieved_basalt_gravel", items = {"techage:basalt_gravel"}, type = "ta3_gravelsieve", }) techage.recipes.register_craft({ - output = "techage:sieved_basalt_gravel", + output = "techage:sieved_basalt_gravel", items = {"techage:basalt_gravel"}, type = "ta4_gravelsieve", }) diff --git a/techage/basic_machines/grinder.lua b/techage/basic_machines/grinder.lua index ec20d1a..48a9efc 100644 --- a/techage/basic_machines/grinder.lua +++ b/techage/basic_machines/grinder.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - + TA2/TA3/TA4 Grinder, grinding Cobble/Basalt to Gravel - + ]]-- -- for lazy programmers @@ -98,7 +98,7 @@ local function src_to_dst(src_stack, idx, src_name, num_items, inp_num, inv, dst end return false end - + local function grinding(pos, crd, nvm, inv) local blocked = false -- idle for idx,stack in ipairs(inv:get_list("src")) do @@ -211,7 +211,7 @@ local tubing = { end, } -local node_name_ta2, node_name_ta3, node_name_ta4 = +local node_name_ta2, node_name_ta3, node_name_ta4 = techage.register_consumer("grinder", S("Grinder"), tiles, { drawtype = "nodebox", paramtype = "light", @@ -313,7 +313,7 @@ techage.register_node({"techage:ta1_mill_base"}, { on_node_load = function(pos, node) minetest.get_node_timer(pos):start(4) end, -}) +}) minetest.register_craft({ output = "techage:ta1_mill_base", @@ -369,19 +369,19 @@ function techage.add_grinder_recipe(recipe, ta1_permitted) if minetest.registered_items[name] then if ta1_permitted then RecipesTa1[name] = {input = name,inp_num = tonumber(num) or 1, output = recipe.output} - + recipe.items = {recipe.input} recipe.type = "milling" techage.recipes.register_craft(table.copy(recipe)) end - + Recipes[name] = {input = name,inp_num = tonumber(num) or 1, output = recipe.output} - + recipe.items = {recipe.input} recipe.type = "grinding" techage.recipes.register_craft(recipe) end -end +end techage.add_grinder_recipe({input="default:cobble", output="default:gravel"}) diff --git a/techage/basic_machines/itemsource.lua b/techage/basic_machines/itemsource.lua index ac908d7..ae28a40 100644 --- a/techage/basic_machines/itemsource.lua +++ b/techage/basic_machines/itemsource.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + Item Source Block ]]-- @@ -16,7 +16,7 @@ local M = minetest.get_meta local S = techage.S local CYCLE_TIME = 30 - + local function formspec() return "size[8,7.2]".. default.gui_bg.. @@ -32,7 +32,7 @@ local function allow_metadata_inventory_put(pos, listname, index, stack, player) if minetest.is_protected(pos, player:get_player_name()) then return 0 end - + return stack:get_count() end @@ -40,7 +40,7 @@ local function allow_metadata_inventory_take(pos, listname, index, stack, player if minetest.is_protected(pos, player:get_player_name()) then return 0 end - + return stack:get_count() end @@ -81,7 +81,7 @@ minetest.register_node("techage:itemsource", { end return true end, - + allow_metadata_inventory_put = allow_metadata_inventory_put, allow_metadata_inventory_take = allow_metadata_inventory_take, @@ -97,4 +97,4 @@ techage.register_node({"techage:itemsource"}, { on_node_load = function(pos) minetest.get_node_timer(pos):start(CYCLE_TIME) end, -}) +}) diff --git a/techage/basic_machines/liquidsampler.lua b/techage/basic_machines/liquidsampler.lua index ab4d695..0a4ca84 100644 --- a/techage/basic_machines/liquidsampler.lua +++ b/techage/basic_machines/liquidsampler.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - + TA2/TA3 Bucket based Liquid Sampler - + ]]-- -- for lazy programmers @@ -96,7 +96,7 @@ end local function keep_running(pos, elapsed) --if tubelib.data_not_corrupted(pos) then local nvm = techage.get_nvm(pos) - local crd = CRD(pos) + local crd = CRD(pos) local inv = M(pos):get_inventory() sample_liquid(pos, crd, nvm, inv) end @@ -175,7 +175,7 @@ local tubing = { end, } -local node_name_ta2, node_name_ta3, _ = +local node_name_ta2, node_name_ta3, _ = techage.register_consumer("liquidsampler", S("Liquid Sampler"), tiles, { cycle_time = CYCLE_TIME, standby_ticks = STANDBY_TICKS, @@ -220,4 +220,3 @@ minetest.register_craft({ {"", "techage:vacuum_tube", ""}, }, }) - diff --git a/techage/basic_machines/mods_support.lua b/techage/basic_machines/mods_support.lua index bebf06b..1508479 100644 --- a/techage/basic_machines/mods_support.lua +++ b/techage/basic_machines/mods_support.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - + Tube support for digtron and protector chests - + ]]-- @@ -20,7 +20,7 @@ local CacheForFuelNodeNames = {} local function is_fuel(stack) local name = stack:get_name() - if CacheForFuelNodeNames[name] then + if CacheForFuelNodeNames[name] then return true end if minetest.get_craft_result({method="fuel", width=1, items={stack}}).time ~= 0 then @@ -53,7 +53,7 @@ techage.register_node({"digtron:inventory"}, { local inv = meta:get_inventory() return techage.put_items(inv, "main", stack) end, -}) +}) techage.register_node({"digtron:fuelstore"}, { on_inv_request = function(pos, in_dir, access_type) @@ -75,7 +75,7 @@ techage.register_node({"digtron:fuelstore"}, { local inv = meta:get_inventory() return techage.put_items(inv, "fuel", stack) end, -}) +}) techage.register_node({"digtron:combined_storage"}, { on_inv_request = function(pos, in_dir, access_type) @@ -102,7 +102,7 @@ techage.register_node({"digtron:combined_storage"}, { local inv = meta:get_inventory() return techage.put_items(inv, "main", stack) end, -}) +}) ------------------------------------------------------------------------------ -- protector @@ -128,6 +128,4 @@ techage.register_node({"protector:chest"}, { local inv = meta:get_inventory() return techage.put_items(inv, "main", stack) end, -}) - - +}) diff --git a/techage/basic_machines/pusher.lua b/techage/basic_machines/pusher.lua index 9da7d43..9568d8a 100644 --- a/techage/basic_machines/pusher.lua +++ b/techage/basic_machines/pusher.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA2/TA3/TA4 Pusher Nodes for push/pull operation of StackItems from chests or other inventory/server nodes to tubes or other inventory/server nodes. @@ -33,7 +33,7 @@ local Tube = techage.Tube local STANDBY_TICKS = 2 local COUNTDOWN_TICKS = 4 local CYCLE_TIME = 2 - + local function ta4_formspec(self, pos, nvm) if CRD(pos).stage == 4 then -- TA4 node? return "size[8,7.2]".. @@ -56,12 +56,12 @@ local function allow_metadata_inventory_put(pos, listname, index, stack, player) if minetest.is_protected(pos, player:get_player_name()) then return 0 end - + local nvm = techage.get_nvm(pos) if CRD(pos).State:get_state(nvm) ~= techage.STOPPED then return 0 end - + local inv = M(pos):get_inventory() local list = inv:get_list(listname) if list[index]:get_count() == 0 then @@ -76,12 +76,12 @@ local function allow_metadata_inventory_take(pos, listname, index, stack, player if minetest.is_protected(pos, player:get_player_name()) then return 0 end - + local nvm = techage.get_nvm(pos) if CRD(pos).State:get_state(nvm) ~= techage.STOPPED then return 0 end - + local inv = M(pos):get_inventory() inv:set_stack(listname, index, nil) return 0 @@ -118,7 +118,7 @@ local function keep_running(pos, elapsed) local crd = CRD(pos) pushing(pos, crd, M(pos), nvm) crd.State:is_active(nvm) -end +end local function on_rightclick(pos, node, clicker) if CRD(pos).stage ~= 4 then -- Not TA4 node? @@ -148,14 +148,14 @@ local function tubelib2_on_update2(pos, outdir, tlib2, node) local pull_dir = M(pos):get_int("pull_dir") local push_dir = M(pos):get_int("push_dir") local is_ta4_tube = true - + for i, pos, node in Tube:get_tube_line(pos, pull_dir) do is_ta4_tube = is_ta4_tube and techage.TA4tubes[node.name] end for i, pos, node in Tube:get_tube_line(pos, push_dir) do is_ta4_tube = is_ta4_tube and techage.TA4tubes[node.name] end - + local nvm = techage.get_nvm(pos) local crd = CRD(pos) if CRD(pos).stage == 4 and not is_ta4_tube then @@ -182,7 +182,7 @@ end local function config_item(pos, payload) local name, count = unpack(payload:split(" ")) - if name and (minetest.registered_nodes[name] or minetest.registered_items[name] + if name and (minetest.registered_nodes[name] or minetest.registered_items[name] or minetest.registered_craftitems[name]) then count = tonumber(count) or 1 local inv = M(pos):get_inventory() @@ -230,14 +230,14 @@ tiles.act = { }, }, } - + local tubing = { -- push item through the pusher in opposit direction on_push_item = function(pos, in_dir, stack) return in_dir == M(pos):get_int("pull_dir") and techage.safe_push_items(pos, in_dir, stack) end, is_pusher = true, -- is a pulling/pushing node - + on_recv_message = function(pos, src, topic, payload) if topic == "pull" then local nvm = techage.get_nvm(pos) @@ -257,8 +257,8 @@ local tubing = { end end, } - -local node_name_ta2, node_name_ta3, node_name_ta4 = + +local node_name_ta2, node_name_ta3, node_name_ta4 = techage.register_consumer("pusher", S("Pusher"), tiles, { cycle_time = CYCLE_TIME, standby_ticks = STANDBY_TICKS, @@ -285,7 +285,7 @@ local node_name_ta2, node_name_ta3, node_name_ta4 = node_timer = keep_running, on_rotate = screwdriver.disallow, tubelib2_on_update2 = tubelib2_on_update2, - + groups = {choppy=2, cracky=2, crumbly=2}, is_ground_content = false, sounds = default.node_sound_wood_defaults(), @@ -319,4 +319,3 @@ minetest.register_craft({ {"", "techage:ta4_wlanchip", ""}, }, }) - diff --git a/techage/basic_machines/quarry.lua b/techage/basic_machines/quarry.lua index d87200a..90aaf87 100644 --- a/techage/basic_machines/quarry.lua +++ b/techage/basic_machines/quarry.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - + Quarry machine to dig stones and other ground blocks. - + The Quarry digs a hole (default) 5x5 blocks large and up to 80 blocks deep. It starts at the given level (0 is same level as the quarry block, 1 is one level higher and so on)) and goes down to the given depth number. @@ -34,7 +34,7 @@ local Side2Facedir = {F=0, R=1, B=2, L=3, D=4, U=5} local Depth2Idx = {[1]=1 ,[2]=2, [3]=3, [5]=4, [10]=5, [15]=6, [20]=7, [25]=8, [40]=9, [60]=10, [80]=11} local Holesize2Idx = {["3x3"] = 1, ["5x5"] = 2, ["7x7"] = 3, ["9x9"] = 4, ["11x11"] = 5} local Holesize2Diameter = {["3x3"] = 3, ["5x5"] = 5, ["7x7"] = 7, ["9x9"] = 9, ["11x11"] = 11} -local Level2Idx = {[2]=1, [1]=2, [0]=3, [-1]=4, [-2]=5, [-3]=6, +local Level2Idx = {[2]=1, [1]=2, [0]=3, [-1]=4, [-2]=5, [-3]=6, [-5]=7, [-10]=8, [-15]=9, [-20]=10} local function formspec(self, pos, nvm) @@ -53,7 +53,7 @@ local function formspec(self, pos, nvm) elseif CRD(pos).stage == 2 then depth_list = "1,2,3,5,10,15,20" end - + return "size[8,8]".. default.gui_bg.. default.gui_bg_img.. @@ -61,11 +61,11 @@ local function formspec(self, pos, nvm) "box[0,-0.1;7.8,0.5;#c6e8ff]".. "label[3.5,-0.1;"..minetest.colorize( "#000000", S("Quarry")).."]".. techage.question_mark_help(8, tooltip).. - "dropdown[0,0.8;1.5;level;2,1,0,-1,-2,-3,-5,-10,-15,-20;"..level_idx.."]".. + "dropdown[0,0.8;1.5;level;2,1,0,-1,-2,-3,-5,-10,-15,-20;"..level_idx.."]".. "label[1.6,0.9;"..S("Start level").."]".. - "dropdown[0,1.8;1.5;depth;"..depth_list..";"..depth_idx.."]".. + "dropdown[0,1.8;1.5;depth;"..depth_list..";"..depth_idx.."]".. "label[1.6,1.9;"..S("Digging depth").." ("..level..")]".. - "dropdown[0,2.8;1.5;hole_size;"..hsize_list..";"..hsize_idx.."]".. + "dropdown[0,2.8;1.5;hole_size;"..hsize_list..";"..hsize_idx.."]".. "label[1.6,2.9;"..S("Hole size").."]".. "list[context;main;5,0.8;3,3;]".. "image[4,0.8;1,1;"..techage.get_power_image(pos, nvm).."]".. @@ -80,7 +80,7 @@ local function play_sound(pos) local mem = techage.get_mem(pos) if not mem.handle or mem.handle == -1 then mem.handle = minetest.sound_play("techage_quarry", { - pos = pos, + pos = pos, gain = 1.5, max_hear_distance = 15, loop = true}) @@ -114,7 +114,7 @@ local function get_pos(pos, facedir, side, steps) facedir = (facedir + Side2Facedir[side]) % 4 local dir = vector.multiply(minetest.facedir_to_dir(facedir), steps or 1) return vector.add(pos, dir) -end +end local function allow_metadata_inventory_put(pos, listname, index, stack, player) if minetest.is_protected(pos, player:get_player_name()) then @@ -147,7 +147,7 @@ local function get_corner_positions(pos, facedir, hole_diameter) return pos1, pos2 end -local function is_air_level(pos1, pos2, hole_diameter) +local function is_air_level(pos1, pos2, hole_diameter) return #minetest.find_nodes_in_area(pos1, pos2, {"air"}) == hole_diameter * hole_diameter end @@ -189,7 +189,7 @@ local function quarry_task(pos, crd, nvm) end return at_least_one_added end - + local pos1, pos2 = get_corner_positions(pos, facedir, nvm.hole_diameter) nvm.level = 1 for y_curr = y_first, y_last, -1 do @@ -197,16 +197,16 @@ local function quarry_task(pos, crd, nvm) pos2.y = y_curr nvm.level = y_first - y_curr - + if minetest.is_area_protected(pos1, pos2, owner, 5) then crd.State:fault(pos, nvm, S("area is protected")) return end - + if not is_air_level(pos1, pos2, nvm.hole_diameter) then mark_area(pos1, pos2, owner) coroutine.yield() - + for zoffs = 1, nvm.hole_diameter do for xoffs = 1, nvm.hole_diameter do local qpos = get_quarry_pos(pos1, xoffs, zoffs) @@ -226,20 +226,20 @@ local function quarry_task(pos, crd, nvm) end crd.State:stop(pos, nvm, S("finished")) end - + local function keep_running(pos, elapsed) local mem = techage.get_mem(pos) if not mem.co then mem.co = coroutine.create(quarry_task) end - + local nvm = techage.get_nvm(pos) local crd = CRD(pos) local _, err = coroutine.resume(mem.co, pos, crd, nvm) if err then minetest.log("error", "[TA4 Quarry Coroutine Error]" .. err) end - + if techage.is_activeformspec(pos) then M(pos):set_string("formspec", formspec(crd.State, pos, nvm)) end @@ -268,7 +268,7 @@ local function on_receive_fields(pos, formname, fields, player) end local nvm = techage.get_nvm(pos) local mem = techage.get_mem(pos) - + if fields.depth then if tonumber(fields.depth) ~= nvm.quarry_depth then nvm.quarry_depth = tonumber(fields.depth) @@ -281,7 +281,7 @@ local function on_receive_fields(pos, formname, fields, player) CRD(pos).State:stop(pos, nvm) end end - + if fields.level then if tonumber(fields.level) ~= nvm.start_level then nvm.start_level = tonumber(fields.level) @@ -373,7 +373,7 @@ local tubing = { end, } -local node_name_ta2, node_name_ta3, node_name_ta4 = +local node_name_ta2, node_name_ta3, node_name_ta4 = techage.register_consumer("quarry", S("Quarry"), tiles, { drawtype = "normal", cycle_time = CYCLE_TIME, diff --git a/techage/basic_machines/recipeblock.lua b/techage/basic_machines/recipeblock.lua index 3e34cc5..37f39b4 100644 --- a/techage/basic_machines/recipeblock.lua +++ b/techage/basic_machines/recipeblock.lua @@ -91,7 +91,7 @@ local function get_recipe(inv) local input = table.concat(items, ",", 1, last_idx) local stack = inv:get_stack("output", 1) return { - input = input, + input = input, output = stack:get_name() .. " " .. stack:get_count() } end @@ -129,7 +129,7 @@ local function allow_metadata_inventory_put(pos, listname, index, stack, player) if minetest.is_protected(pos, player:get_player_name()) then return 0 end - + local inv = M(pos):get_inventory() local list = inv:get_list(listname) stack:set_count(1) @@ -142,7 +142,7 @@ local function allow_metadata_inventory_take(pos, listname, index, stack, player if minetest.is_protected(pos, player:get_player_name()) then return 0 end - + local inv = M(pos):get_inventory() inv:set_stack(listname, index, nil) after_recipe_change(pos, inv, listname) @@ -153,7 +153,7 @@ local function allow_metadata_inventory_move(pos, from_list, from_index, to_list if minetest.is_protected(pos, player:get_player_name()) then return 0 end - + local inv = M(pos):get_inventory() if from_list == to_list then minetest.after(0.1, after_recipe_change, pos, inv, from_list) @@ -176,7 +176,7 @@ minetest.register_node("techage:ta4_recipeblock", { inv:set_size('input', 9) inv:set_size('output', 1) end, - + after_place_node = function(pos, placer, itemstack) local nvm = techage.get_nvm(pos) local number = techage.add_node(pos, "techage:ta4_chest") @@ -190,7 +190,7 @@ minetest.register_node("techage:ta4_recipeblock", { if minetest.is_protected(pos, player:get_player_name()) then return end - + local nvm = techage.get_nvm(pos) nvm.recipe_idx = nvm.recipe_idx or 1 if fields.next == ">>" then @@ -202,7 +202,7 @@ minetest.register_node("techage:ta4_recipeblock", { update_inventor(pos, inv, nvm.recipe_idx or 1) M(pos):set_string("formspec", formspec(pos, nvm)) end, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) techage.remove_node(pos, oldnode, oldmetadata) techage.del_mem(pos) @@ -211,7 +211,7 @@ minetest.register_node("techage:ta4_recipeblock", { allow_metadata_inventory_put = allow_metadata_inventory_put, allow_metadata_inventory_take = allow_metadata_inventory_take, allow_metadata_inventory_move = allow_metadata_inventory_move, - + paramtype2 = "facedir", groups = {choppy=2, cracky=2, crumbly=2}, is_ground_content = false, @@ -241,4 +241,3 @@ minetest.register_craft({ {"default:steel_ingot", "techage:ta4_wlanchip", "default:steel_ingot"}, }, }) - diff --git a/techage/basic_machines/recycler.lua b/techage/basic_machines/recycler.lua index f2adfc2..e2442a2 100644 --- a/techage/basic_machines/recycler.lua +++ b/techage/basic_machines/recycler.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - + TA4 Recycler, recycling techage machines - + ]]-- -- for lazy programmers @@ -112,9 +112,9 @@ local function allow_metadata_inventory_take(pos, listname, index, stack, player return stack:get_count() end -local function cook_reverse(stack, inv, idx, recipe) +local function cook_reverse(stack, inv, idx, recipe) -- check space - for _,item in ipairs(recipe.items) do + for _,item in ipairs(recipe.items) do if not inv:room_for_item("dst", stack) then return false end @@ -122,7 +122,7 @@ local function cook_reverse(stack, inv, idx, recipe) -- take item inv:remove_item("src", ItemStack(recipe.output)) -- add items - for _,item in ipairs(recipe.items) do + for _,item in ipairs(recipe.items) do inv:add_item("dst", item) end return true @@ -240,7 +240,7 @@ local tubing = { end, } -local _, _, node_name_ta4 = +local _, _, node_name_ta4 = techage.register_consumer("recycler", S("Recycler"), tiles, { drawtype = "nodebox", paramtype = "light", @@ -292,13 +292,13 @@ minetest.register_craft({ ------------------------------------------------------------------------------- -- Prepare recipes ------------------------------------------------------------------------------- --- Nodes from mods that can be recycled +-- Nodes from mods that can be recycled local ModNames = { - techage = true, + techage = true, hyperloop = true, } -local function get_item_list(inputs) +local function get_item_list(inputs) local lst = {} for _,input in pairs(inputs or {}) do if SpecialItems[input] then @@ -317,7 +317,7 @@ local function get_special_recipe(name) if SpecialItems[name] then return { output = name, - items = {SpecialItems[name]} + items = {SpecialItems[name]} } end end @@ -325,22 +325,22 @@ end local function collect_recipes() local add = function(name, ndef) local _, _, mod, _ = string.find(name, "([%w_]+):([%w_]+)") - local recipe = get_special_recipe(name) or - techage.recipes.get_recipe(name) or + local recipe = get_special_recipe(name) or + techage.recipes.get_recipe(name) or minetest.get_craft_recipe(name) local items = get_item_list(recipe.items) - - if ModNames[mod] - and ndef.groups.not_in_creative_inventory ~= 1 + + if ModNames[mod] + and ndef.groups.not_in_creative_inventory ~= 1 and not ndef.tool_capabilities - and recipe.output + and recipe.output and next(items) then local s = table.concat(items, ", ") --print(string.format("%-36s {%s}", recipe.output, s)) Recipes[name] = {output = recipe.output, items = items} end end - + for name, ndef in pairs(minetest.registered_nodes) do add(name, ndef) end diff --git a/techage/basic_machines/source.lua b/techage/basic_machines/source.lua index 14eefa2..0c12fb8 100644 --- a/techage/basic_machines/source.lua +++ b/techage/basic_machines/source.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information TA2/TA3 Power Test Source - + ]]-- -- for lazy programmers @@ -55,7 +55,7 @@ local function stop_node2(pos, nvm, state) end local function start_node3(pos, nvm, state) - local meta = M(pos) + local meta = M(pos) nvm.running = true nvm.provided = 0 techage.evaluate_charge_termination(nvm, meta) @@ -241,7 +241,7 @@ techage.register_node({"techage:t4_source"}, { return State3:on_receive_message(pos, topic, payload) end end, -}) +}) control.register_nodes({"techage:t4_source"}, { on_receive = function(pos, tlib2, topic, payload) @@ -256,11 +256,10 @@ control.register_nodes({"techage:t4_source"}, { running = nvm.running or false, available = PWR_PERF, provided = nvm.provided or 0, - termpoint = meta:get_string("termpoint"), + termpoint = meta:get_string("termpoint"), } end return false end, } ) - diff --git a/techage/basic_machines/ta4_chest.lua b/techage/basic_machines/ta4_chest.lua index 62b0551..096eaef 100644 --- a/techage/basic_machines/ta4_chest.lua +++ b/techage/basic_machines/ta4_chest.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - + TA4 8x2000 Chest - + ]]-- -- for lazy programmers @@ -36,7 +36,7 @@ local function repair_inv(nvm) nvm.inventory = nvm.inventory or {} for i = 1,8 do local item = nvm.inventory[i] - if not item or type(item) ~= "table" + if not item or type(item) ~= "table" or not item.name or type(item.name) ~= "string" or item.name == "" or not item.count or type(item.count) ~= "number" or item.count < 1 then @@ -102,8 +102,8 @@ end local function get_stacksize(pos) local size = M(pos):get_int("stacksize") - if size == 0 then - return STACK_SIZE + if size == 0 then + return STACK_SIZE end return size end @@ -362,15 +362,15 @@ local function get_front_chest_pos(pos) if nvm.front_chest_pos then return nvm.front_chest_pos end - + local node = techage.get_node_lvm(pos) if search_chest_in_front(pos, node) then return nvm.front_chest_pos end - + return pos end - + local function convert_to_chest_again(pos, node, player) local dir = techage.side_to_outdir("B", node.param2) local pos1 = tubelib2.get_pos(pos, dir) @@ -389,8 +389,8 @@ local function convert_to_chest_again(pos, node, player) M(pos1):set_string("formspec", formspec(pos1)) M(pos1):set_string("infotext", DESCRIPTION.." "..number) end -end - +end + local function unlock_chests(pos, player) local nvm = techage.get_nvm(pos) for idx = 1,8 do @@ -450,7 +450,7 @@ local function on_receive_fields(pos, formname, fields, player) if minetest.is_protected(pos, player:get_player_name()) then return end - + for i = 1,8 do if fields["get"..i] ~= nil then inv_take_from_chest(pos, i) @@ -469,7 +469,7 @@ local function on_receive_fields(pos, formname, fields, player) if fields.priority then M(pos):set_int("priority", fields.priority == "true" and 1 or 0) end - + M(pos):set_string("formspec", formspec(pos)) end @@ -511,7 +511,7 @@ minetest.register_node("techage:ta4_chest", { local inv = M(pos):get_inventory() inv:set_size('main', 8) end, - + after_place_node = function(pos, placer) local node = minetest.get_node(pos) if search_chest_in_front(pos, node) then @@ -530,7 +530,7 @@ minetest.register_node("techage:ta4_chest", { techage_set_numbers = function(pos, numbers, player_name) return techage.logic.set_numbers(pos, numbers, player_name, DESCRIPTION) end, - + on_rotate = on_rotate, on_rightclick = on_rightclick, on_receive_fields = on_receive_fields, @@ -538,7 +538,7 @@ minetest.register_node("techage:ta4_chest", { after_dig_node = after_dig_node, allow_metadata_inventory_put = allow_metadata_inventory_put, allow_metadata_inventory_take = allow_metadata_inventory_take, - + on_metadata_inventory_put = on_metadata_inventory_put, on_metadata_inventory_move = on_metadata_inventory_move, on_metadata_inventory_take = on_metadata_inventory_take, @@ -593,7 +593,7 @@ techage.register_node({"techage:ta4_chest"}, { end return res end, - + on_recv_message = function(pos, src, topic, payload) if topic == "count" then local nvm = techage.get_nvm(pos) @@ -608,7 +608,7 @@ techage.register_node({"techage:ta4_chest"}, { return "unsupported" end end, -}) +}) techage.register_node({"techage:ta4_chest_dummy"}, { on_pull_item = function(pos, in_dir, num, item_name) @@ -635,7 +635,7 @@ techage.register_node({"techage:ta4_chest_dummy"}, { end return res end -}) +}) minetest.register_craft({ type = "shapeless", diff --git a/techage/basic_machines/ta4_injector.lua b/techage/basic_machines/ta4_injector.lua index 15e6a02..4332e17 100644 --- a/techage/basic_machines/ta4_injector.lua +++ b/techage/basic_machines/ta4_injector.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA4 Injector ]]-- @@ -47,12 +47,12 @@ local function allow_metadata_inventory_put(pos, listname, index, stack, player) if minetest.is_protected(pos, player:get_player_name()) then return 0 end - + local nvm = techage.get_nvm(pos) if CRD(pos).State:get_state(nvm) ~= techage.STOPPED then return 0 end - + local inv = M(pos):get_inventory() local list = inv:get_list(listname) local cdr = CRD(pos) @@ -69,12 +69,12 @@ local function allow_metadata_inventory_take(pos, listname, index, stack, player if minetest.is_protected(pos, player:get_player_name()) then return 0 end - + local nvm = techage.get_nvm(pos) if CRD(pos).State:get_state(nvm) ~= techage.STOPPED then return 0 end - + local inv = M(pos):get_inventory() inv:set_stack(listname, index, nil) return 0 @@ -148,7 +148,7 @@ local function pushing(pos, crd, meta, nvm) local filter = inv:get_list("filter") local pushed = false local pulled = false - + for idx, item in ipairs(filter) do local name = item:get_name() local num = math.min(item:get_count(), crd.num_items) @@ -165,7 +165,7 @@ local function pushing(pos, crd, meta, nvm) end end end - + if not pulled then crd.State:idle(pos, nvm) elseif not pushed then @@ -179,7 +179,7 @@ local function node_timer(pos, elapsed) local nvm = techage.get_nvm(pos) local crd = CRD(pos) pushing(pos, crd, M(pos), nvm) -end +end local function on_receive_fields(pos, formname, fields, player) if minetest.is_protected(pos, player:get_player_name()) then @@ -188,7 +188,7 @@ local function on_receive_fields(pos, formname, fields, player) local nvm = techage.get_nvm(pos) if fields.pull_mode then nvm.pull_mode = fields.pull_mode == "true" - end + end CRD(pos).State:state_button_event(pos, nvm, fields) M(pos):set_string("formspec", formspec(CRD(pos).State, pos, nvm)) end @@ -231,14 +231,14 @@ tiles.act = { }, }, } - + local tubing = { -- push item through the injector in opposit direction on_push_item = function(pos, in_dir, stack) return in_dir == M(pos):get_int("pull_dir") and techage.safe_push_items(pos, in_dir, stack) end, is_pusher = true, -- is a pulling/pushing node - + on_recv_message = function(pos, src, topic, payload) return CRD(pos).State:on_receive_message(pos, topic, payload) end, @@ -246,8 +246,8 @@ local tubing = { CRD(pos).State:on_node_load(pos) end, } - -local _, node_name_ta3, node_name_ta4 = + +local _, node_name_ta3, node_name_ta4 = techage.register_consumer("injector", S("Injector"), tiles, { cycle_time = CYCLE_TIME, standby_ticks = STANDBY_TICKS, @@ -271,7 +271,7 @@ local _, node_name_ta3, node_name_ta4 = on_receive_fields = on_receive_fields, node_timer = node_timer, on_rotate = screwdriver.disallow, - + groups = {choppy=2, cracky=2, crumbly=2}, is_ground_content = false, sounds = default.node_sound_wood_defaults(), diff --git a/techage/basic_machines/ta5_chest.lua b/techage/basic_machines/ta5_chest.lua index 222525d..1d56064 100644 --- a/techage/basic_machines/ta5_chest.lua +++ b/techage/basic_machines/ta5_chest.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - + TA5 Hyperloop Chest - + ]]-- -- for lazy programmers @@ -33,7 +33,7 @@ local function formspec(pos) local title = ndef.description .. " " .. status return "size[8,9]".. "box[0,-0.1;7.8,0.5;#c6e8ff]" .. - "label[0.2,-0.1;" .. minetest.colorize( "#000000", title) .. "]" .. + "label[0.2,-0.1;" .. minetest.colorize( "#000000", title) .. "]" .. "list[context;main;0,1;8,4;]".. "list[current_player;main;0,5.3;8,4;]".. "listring[context;main]".. @@ -175,7 +175,7 @@ techage.register_node({"techage:ta5_hl_chest"}, { return "unsupported" end end, -}) +}) minetest.register_craft({ diff --git a/techage/basis/assemble.lua b/techage/basis/assemble.lua index b176495..c4d81d9 100644 --- a/techage/basis/assemble.lua +++ b/techage/basis/assemble.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information Assemble routines - + ]]-- -- for lazy programmers @@ -28,7 +28,7 @@ local Face2Dir = {[0]= {x=0, y=1, z=0} } --- Determine the destination position based on the base position, +-- Determine the destination position based on the base position, -- param2, and a route table like : {0,3} -- 0 = forward, 1 = right, 2 = backward, 3 = left local function dest_pos(pos, param2, route, y_offs) @@ -54,8 +54,8 @@ local function build(pos, param2, AssemblyPlan, idx) local nvm = techage.get_nvm(pos) nvm.assemble_locked = false end -end - +end + -- timer based function local function remove(pos, param2, AssemblyPlan, idx) local item = AssemblyPlan[idx] @@ -68,7 +68,7 @@ local function remove(pos, param2, AssemblyPlan, idx) local nvm = techage.get_nvm(pos) nvm.assemble_locked = false end -end +end local function check_space(pos, param2, AssemblyPlan, player_name) for _,item in ipairs(AssemblyPlan) do @@ -78,7 +78,7 @@ local function check_space(pos, param2, AssemblyPlan, player_name) minetest.chat_send_player(player_name, S("[TA] Area is protected!")) return false end - + local node = techage.get_node_lvm(pos1) local ndef = minetest.registered_nodes[node.name] if not ndef or not ndef.buildable_to and node.name ~= node_name then @@ -97,7 +97,7 @@ function techage.assemble.build(pos, AssemblyPlan, player_name) -- check protection if minetest.is_protected(pos, player_name) then return - end + end local nvm = techage.get_nvm(pos) if nvm.assemble_locked then return @@ -114,7 +114,7 @@ function techage.assemble.remove(pos, AssemblyPlan, player_name) -- check protection if minetest.is_protected(pos, player_name) then return - end + end local nvm = techage.get_nvm(pos) if nvm.assemble_locked then return @@ -130,7 +130,7 @@ end -------------------------------------------------------------------------------- local function play_sound(pos, sound) minetest.sound_play(sound, { - pos = pos, + pos = pos, gain = 1, max_hear_distance = 10, }) @@ -232,7 +232,7 @@ function techage.assemble.count_items(AssemblyPlan) end end return t -end +end -- Determine the destination position based on the given route -- param2, and a route table like : {0,3} diff --git a/techage/basis/boiler_lib.lua b/techage/basis/boiler_lib.lua index 0b805aa..bd7c566 100644 --- a/techage/basis/boiler_lib.lua +++ b/techage/basis/boiler_lib.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + Boiler common functions ]]-- @@ -74,7 +74,7 @@ function techage.boiler.water_temperature(pos, nvm) nvm.temperature = math.max(nvm.temperature - HEAT_STEP, 20) end nvm.fire_trigger = false - + if nvm.water_level == 0 then if nvm.num_water > 0 then nvm.num_water = nvm.num_water - 1 @@ -119,7 +119,7 @@ function techage.boiler.on_punch(pos, node, puncher, pointed_thing) if mem.blocking_time > techage.SystemTime then return end - + nvm.num_water = nvm.num_water or 0 local wielded_item = puncher:get_wielded_item():get_name() local item_count = puncher:get_wielded_item():get_count() @@ -146,4 +146,3 @@ function techage.boiler.on_punch(pos, node, puncher, pointed_thing) M(pos):set_string("formspec", techage.boiler.formspec(pos, nvm)) end end - diff --git a/techage/basis/command.lua b/techage/basis/command.lua index 1cd93fb..a32f218 100644 --- a/techage/basis/command.lua +++ b/techage/basis/command.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + Basis functions for inter-node communication ]]-- @@ -59,7 +59,7 @@ local function delete_nodeinfo_entry(number) return number end --- Keep the cache size small by deleting entries randomly +-- Keep the cache size small by deleting entries randomly local function keep_small(number) number = delete_nodeinfo_entry(number) minetest.after(10, keep_small, number) @@ -82,13 +82,13 @@ end -- Determine position related node number for addressing purposes local function get_number(pos, new) local meta = minetest.get_meta(pos) - if meta:contains("node_number") then - return meta:get_string("node_number") + if meta:contains("node_number") then + return meta:get_string("node_number") end -- generate new number if new then local num = backend.add_nodepos(pos) - meta:set_string("node_number", num) + meta:set_string("node_number", num) return num end end @@ -141,15 +141,15 @@ end local function get_next_node(pos, out_dir) local res, npos, node = Tube:compatible_node(pos, out_dir) local in_dir = tubelib2.Turn180Deg[out_dir] - return res, npos, in_dir, node.name + return res, npos, in_dir, node.name end local function get_dest_node(pos, out_dir) local spos, in_dir = Tube:get_connected_node_pos(pos, out_dir) local _,node = Tube:get_node(spos) - return spos, in_dir, node.name + return spos, in_dir, node.name end - + local function item_handling_node(name) local node_def = name and NodeDef[name] if node_def then @@ -181,17 +181,17 @@ end) ------------------------------------------------------------------- -- API helper functions ------------------------------------------------------------------- - + -- Function returns { pos, name } for the node referenced by number function techage.get_node_info(dest_num) return NodeInfoCache[dest_num] or update_nodeinfo(dest_num) -end +end -- Function returns the node number from the given position or -- nil, if no node number for this position is assigned. function techage.get_node_number(pos) return get_number(pos) -end +end function techage.get_pos(pos, side) local node = techage.get_node_lvm(pos) @@ -200,11 +200,11 @@ function techage.get_pos(pos, side) dir = side_to_dir(side, node.param2) end return tubelib2.get_pos(pos, dir) -end +end -- Function is used for available nodes with lost numbers, only. function techage.get_new_number(pos, name) - -- store position + -- store position return get_number(pos, true) end @@ -217,7 +217,7 @@ end ------------------------------------------------------------------- -- Node construction/destruction functions ------------------------------------------------------------------- - + -- Add node to the techage lists. -- Function determines and returns the node position number, -- needed for message communication. @@ -227,7 +227,7 @@ function techage.add_node(pos, name, is_ta2) if item_handling_node(name) then Tube:after_place_node(pos) end - if is_ta2 then + if is_ta2 then return "-" end local key = minetest.hash_node_position(pos) @@ -307,10 +307,10 @@ function techage.register_node(names, node_definition) for _,n in ipairs(names) do NodeDef[n] = node_definition end - if node_definition.on_pull_item or node_definition.on_push_item or + if node_definition.on_pull_item or node_definition.on_push_item or node_definition.is_pusher then Tube:add_secondary_node_names(names) - + for _,n in ipairs(names) do techage.KnownNodes[n] = true end @@ -346,7 +346,7 @@ function techage.check_numbers(numbers, placer_name) return true end return false -end +end function techage.send_multi(src, numbers, topic, payload) --print("send_multi", src, numbers, topic) @@ -360,7 +360,7 @@ function techage.send_multi(src, numbers, topic, payload) end end end -end +end function techage.send_single(src, number, topic, payload) --print("send_single", src, number, topic) @@ -373,7 +373,7 @@ function techage.send_single(src, number, topic, payload) end end return false -end +end -- The destination node location is either: -- A) a destination position, specified by pos @@ -407,7 +407,7 @@ function techage.transfer(pos, outdir, topic, payload, network, nodenames) return ndef.on_transfer(dpos, indir, topic, payload) end return false -end +end ------------------------------------------------------------------- -- Client side Push/Pull item functions @@ -430,10 +430,10 @@ end function techage.push_items(pos, out_dir, stack, idx) local npos, in_dir, name = get_dest_node(pos, out_dir) if npos and NodeDef[name] and NodeDef[name].on_push_item then - return NodeDef[name].on_push_item(npos, in_dir, stack, idx) + return NodeDef[name].on_push_item(npos, in_dir, stack, idx) elseif is_air_like(name) or is_cart_available(npos) then minetest.add_item(npos, stack) - return true + return true end return false end @@ -470,9 +470,9 @@ function techage.unpull_items(pos, out_dir, stack) end return false end - + ------------------------------------------------------------------- --- Client side Push/Pull item functions for hopper like nodes +-- Client side Push/Pull item functions for hopper like nodes -- (nodes with no tube support) ------------------------------------------------------------------- @@ -486,10 +486,10 @@ end function techage.neighbour_push_items(pos, out_dir, stack) local res, npos, in_dir, name = get_next_node(pos, out_dir) if res and NodeDef[name] and NodeDef[name].on_push_item then - return NodeDef[name].on_push_item(npos, in_dir, stack) + return NodeDef[name].on_push_item(npos, in_dir, stack) elseif name == "air" then minetest.add_item(npos, stack) - return true + return true end return false end diff --git a/techage/basis/conf_inv.lua b/techage/basis/conf_inv.lua index 88aa4f3..f64aca6 100644 --- a/techage/basis/conf_inv.lua +++ b/techage/basis/conf_inv.lua @@ -7,10 +7,10 @@ AGPL v3 See LICENSE.txt for more information - + Configured inventory lib Assuming the inventory has the name "conf" - + ]]-- -- for lazy programmers @@ -38,7 +38,7 @@ function inv_lib.item_filter(pos, size) for idx = 1, size do local item_name = inv:get_stack("conf", idx):get_name() if item_name == "" then item_name = "unconfigured" end - if not filter[item_name] then + if not filter[item_name] then filter[item_name] = {} end table.insert(filter[item_name], idx) @@ -49,7 +49,7 @@ end function inv_lib.allow_conf_inv_put(pos, listname, index, stack, player) local inv = M(pos):get_inventory() local list = inv:get_list(listname) - + if list[index]:get_count() == 0 then stack:set_count(1) inv:set_stack(listname, index, stack) @@ -104,6 +104,6 @@ function inv_lib.take_item(pos, inv, listname, num, stacks) end end end - -return inv_lib \ No newline at end of file + +return inv_lib diff --git a/techage/basis/counting.lua b/techage/basis/counting.lua index 33db84d..dd00a5e 100644 --- a/techage/basis/counting.lua +++ b/techage/basis/counting.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information Count techage commands player related - + ]]-- local PlayerName @@ -43,10 +43,10 @@ local function output() if val > MAX_POINTS then local obj = minetest.get_player_by_name(name) if obj then - minetest.chat_send_player(name, + minetest.chat_send_player(name, S("[techage] The limit for 'number of commands per minute' has been exceeded.") .. " " .. string.format(MAX_POINTS .. " " .. S("is allowed. Current value is") .. " " .. val)); - minetest.log("action", "[techage] " .. name .. + minetest.log("action", "[techage] " .. name .. " exceeds the limit for commands per minute. value = " .. val) local factor = 100 / (obj:get_armor_groups().fleshy or 100) obj:punch(obj, 1.0, {full_punch_interval=1.0, damage_groups = {fleshy=factor * 5}}) @@ -65,8 +65,7 @@ minetest.register_chatcommand("ta_limit", { description = "Get your current techage command limit value", func = function(name) local num = LastPlayerPoints[name] or 0 - return true, S("Your current value is") .. " " .. num .. " " .. S("per minute") .. ". " .. + return true, S("Your current value is") .. " " .. num .. " " .. S("per minute") .. ". " .. MAX_POINTS .. " " .. S("is allowed") end }) - diff --git a/techage/basis/fake_player.lua b/techage/basis/fake_player.lua index 40c9371..3526762 100644 --- a/techage/basis/fake_player.lua +++ b/techage/basis/fake_player.lua @@ -10,7 +10,7 @@ See LICENSE.txt for more information Fake Player - + ]]-- -- Map method names to their return values @@ -115,4 +115,3 @@ for method_name, return_value in pairs(methods) do return return_value end end - diff --git a/techage/basis/firebox_lib.lua b/techage/basis/firebox_lib.lua index 28e6807..0767080 100644 --- a/techage/basis/firebox_lib.lua +++ b/techage/basis/firebox_lib.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + Firebox basic functions ]]-- @@ -43,7 +43,7 @@ local function determine_burntimes() local fuel,_ = minetest.get_craft_result({method = "fuel", width = 1, items = {k}}) techage.firebox.Burntime[k] = fuel.time end -end +end minetest.after(1, determine_burntimes) function techage.firebox.formspec(nvm) @@ -147,5 +147,4 @@ function techage.firebox.set_firehole(pos, on) minetest.swap_node(pos2, {name="air"}) end end -end - +end diff --git a/techage/basis/fly_lib.lua b/techage/basis/fly_lib.lua index 8cc8d19..b20a6ae 100644 --- a/techage/basis/fly_lib.lua +++ b/techage/basis/fly_lib.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information Block fly/move library - + ]]-- -- for lazy programmers @@ -22,7 +22,7 @@ local flylib = {} local function lvect_add_vec(lvect1, offs) if not lvect1 or not offs then return end - + local lvect2 = {} for _, v in ipairs(lvect1) do lvect2[#lvect2 + 1] = vector.add(v, offs) @@ -32,7 +32,7 @@ end local function lvect_add(lvect1, lvect2) if not lvect1 or not lvect2 then return end - + local lvect3 = {} for i, v in ipairs(lvect1) do lvect3[#lvect3 + 1] = vector.add(v, lvect2[i]) @@ -42,7 +42,7 @@ end local function lvect_subtract(lvect1, lvect2) if not lvect1 or not lvect2 then return end - + local lvect3 = {} for i, v in ipairs(lvect1) do lvect3[#lvect3 + 1] = vector.subtract(v, lvect2[i]) @@ -58,7 +58,7 @@ local function rotate(v, yaw) end ------------------------------------------------------------------------------- --- to_path function for the fly/move path +-- to_path function for the fly/move path ------------------------------------------------------------------------------- local function strsplit(text) @@ -79,9 +79,9 @@ function flylib.to_vector(s) local x,y,z = unpack(string.split(s, ",")) if x and y and z then return { - x=tonumber(x) or 0, - y=tonumber(y) or 0, - z=tonumber(z) or 0, + x=tonumber(x) or 0, + y=tonumber(y) or 0, + z=tonumber(z) or 0, } end end @@ -89,7 +89,7 @@ end function flylib.to_path(s, max_dist) local tPath local dist = 0 - + for _, line in ipairs(strsplit(s)) do line = trim(line) line = string.split(line, "--", true, 1)[1] or "" @@ -125,7 +125,7 @@ local function reverse_path(lpath) end return lres end - + local function dest_offset(lpath) local offs = {x=0, y=0, z=0} for i = 1,#lpath do @@ -133,9 +133,9 @@ local function dest_offset(lpath) end return offs end - + ------------------------------------------------------------------------------- --- Entity / Move / Attach / Detach +-- Entity / Move / Attach / Detach ------------------------------------------------------------------------------- local MIN_SPEED = 0.4 local MAX_SPEED = 8 @@ -167,7 +167,7 @@ end -- Check access conflicts with other mods local function lock_player(player) local meta = player:get_meta() - if meta:get_int("player_physics_locked") == 0 then + if meta:get_int("player_physics_locked") == 0 then meta:set_int("player_physics_locked", 1) meta:set_string("player_physics_locked_by", "ta_flylib") return true @@ -177,7 +177,7 @@ end local function unlock_player(player) local meta = player:get_meta() - if meta:get_int("player_physics_locked") == 1 then + if meta:get_int("player_physics_locked") == 1 then if meta:get_string("player_physics_locked_by") == "ta_flylib" then meta:set_int("player_physics_locked", 0) meta:set_string("player_physics_locked_by", "") @@ -294,7 +294,7 @@ local function entity_to_node(pos, obj) nvm.running = nil end obj:remove() - + local node = minetest.get_node(pos) local ndef1 = minetest.registered_nodes[name] local ndef2 = minetest.registered_nodes[node.name] @@ -321,7 +321,7 @@ end local function node_to_entity(start_pos) local meta = M(start_pos) local node, metadata - + if meta:contains("ta_move_block") then -- Move-block stored as metadata node = minetest.deserialize(meta:get_string("ta_move_block")) @@ -335,17 +335,17 @@ local function node_to_entity(start_pos) end local obj = minetest.add_entity(start_pos, "techage:move_item") if obj then - local self = obj:get_luaentity() + local self = obj:get_luaentity() local rot = techage.facedir_to_rotation(node.param2) obj:set_rotation(rot) obj:set_properties({wield_item=node.name}) obj:set_armor_groups({immortal=1}) - + -- To be able to revert to node self.item_name = node.name self.param2 = node.param2 self.metadata = metadata or {} - + -- Prepare for attachments self.players = {} self.entities = {} @@ -412,7 +412,7 @@ local function handover_to(obj, self, pos1) nvm.lpos1 = nvm.lpos1 or {} if self.move2to1 then nvm.lpos1[self.pos1_idx] = pos2 - + else nvm.lpos1[self.pos1_idx] = pos1 end @@ -435,7 +435,7 @@ minetest.register_entity("techage:move_item", { visual_size = {x=0.67, y=0.67, z=0.67}, selectionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, }, - + get_staticdata = function(self) return minetest.serialize({ item_name = self.item_name, @@ -454,7 +454,7 @@ minetest.register_entity("techage:move_item", { respawn = true, }) end, - + on_activate = function(self, staticdata) if staticdata then local tbl = minetest.deserialize(staticdata) or {} @@ -478,7 +478,7 @@ minetest.register_entity("techage:move_item", { end end end, - + on_step = function(self, dtime, moveresult) local stop_obj = function(obj, self) local dest_pos = self.dest_pos @@ -490,14 +490,14 @@ minetest.register_entity("techage:move_item", { self.ttl = 2 return dest_pos end - + if self.dest_pos then local obj = self.object local pos = obj:get_pos() local dist = vector.distance(pos, self.dest_pos) local speed = calc_speed(obj:get_velocity()) self.old_dist = self.old_dist or dist - + -- Landing if self.lpath and self.lpath[self.path_idx] then if dist < 1 or dist > self.old_dist then @@ -520,26 +520,26 @@ minetest.register_entity("techage:move_item", { return end end - + self.old_dist = dist - - -- Braking or limit max speed + + -- Braking or limit max speed if self.handover then if speed > (dist * 4) or speed > self.max_speed then - speed = math.min(speed, math.max(dist * 4, MIN_SPEED)) + speed = math.min(speed, math.max(dist * 4, MIN_SPEED)) local vel = vector.multiply(self.dir,speed) obj:set_velocity(vel) obj:set_acceleration({x=0, y=0, z=0}) end else if speed > (dist * 2) or speed > self.max_speed then - speed = math.min(speed, math.max(dist * 2, MIN_SPEED)) + speed = math.min(speed, math.max(dist * 2, MIN_SPEED)) local vel = vector.multiply(self.dir,speed) obj:set_velocity(vel) obj:set_acceleration({x=0, y=0, z=0}) end end - + elseif self.ttl then self.ttl = self.ttl - dtime if self.ttl < 0 then @@ -566,19 +566,19 @@ end local function is_simple_node(pos) -- special handling local name = minetest.get_node(pos).name - if SimpleNodes[name] ~= nil then - return SimpleNodes[name] + if SimpleNodes[name] ~= nil then + return SimpleNodes[name] end - + local ndef = minetest.registered_nodes[name] if not ndef or name == "air" or name == "ignore" then return false end -- don't remove nodes with some intelligence or undiggable nodes if ndef.drop == "" then return false end if ndef.diggable == false then return false end if ndef.after_dig_node then return false end - + return true -end +end local function move_node(pos, pos1_idx, start_pos, lpath, max_speed, height, move2to1, handover, cpos) local pos2 = next_path_pos(start_pos, lpath, 1) @@ -618,7 +618,7 @@ local function move_nodes(pos, meta, nvm, lpath, max_speed, height, move2to1, ha --print("move_nodes", dump(nvm), dump(lpath), max_speed, height, move2to1, handover) local owner = meta:get_string("owner") techage.counting_add(owner, #nvm.lpos1 * #lpath) - + for idx = 1, #nvm.lpos1 do local pos1 = nvm.lpos1[idx] local pos2 = nvm.lpos2[idx] @@ -650,27 +650,27 @@ local function move_nodes(pos, meta, nvm, lpath, max_speed, height, move2to1, ha return true end -function flylib.move_to_other_pos(pos, move2to1) +function flylib.move_to_other_pos(pos, move2to1) local meta = M(pos) local nvm = techage.get_nvm(pos) local lpath, err = flylib.to_path(meta:get_string("path")) or {} local max_speed = meta:contains("max_speed") and meta:get_int("max_speed") or MAX_SPEED local height = meta:contains("height") and meta:get_float("height") or 1 local handover - + if err then return false end - + height = techage.in_range(height, 0, 1) max_speed = techage.in_range(max_speed, MIN_SPEED, MAX_SPEED) nvm.lpos1 = nvm.lpos1 or {} - + local offs = dest_offset(lpath) if move2to1 then lpath = reverse_path(lpath) end -- calc destination positions nvm.lpos2 = lvect_add_vec(nvm.lpos1, offs) - + if move2to1 then handover = meta:contains("handoverA") and meta:get_string("handoverA") else @@ -688,9 +688,9 @@ function flylib.rotate_nodes(pos, posses1, rot) local posses2 = techage.rotate_around_center(posses1, rot, cpos) local param2 local nodes2 = {} - + techage.counting_add(owner, #posses1 * 2) - + for i, pos1 in ipairs(posses1) do local node = techage.get_node_lvm(pos1) if rot == "l" then diff --git a/techage/basis/formspec_update.lua b/techage/basis/formspec_update.lua index b42b173..9696c2f 100644 --- a/techage/basis/formspec_update.lua +++ b/techage/basis/formspec_update.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + Keep only one formspec active per player ]]-- diff --git a/techage/basis/fuel_lib.lua b/techage/basis/fuel_lib.lua index d7fb569..0a60d3b 100644 --- a/techage/basis/fuel_lib.lua +++ b/techage/basis/fuel_lib.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + Oil fuel burning lib ]]-- @@ -51,7 +51,7 @@ function techage.fuel.fuel_container(x, y, nvm) fuel_percent..":default_furnace_fire_fg.png]".. techage.item_image(0.1, 1.1, itemname).. "container_end[]" -end +end local function help(x, y) local tooltip = S("To add fuel punch\nthis block\nwith a fuel container") @@ -108,17 +108,17 @@ function techage.fuel.on_punch(pos, node, puncher, pointed_thing) if mem.blocking_time > techage.SystemTime then return end - + local wielded_item = puncher:get_wielded_item():get_name() local item_count = puncher:get_wielded_item():get_count() - local new_item = techage.liquid.fill_on_punch(nvm, wielded_item, item_count, puncher) + local new_item = techage.liquid.fill_on_punch(nvm, wielded_item, item_count, puncher) if new_item then puncher:set_wielded_item(new_item) M(pos):set_string("formspec", techage.fuel.formspec(pos, nvm)) mem.blocking_time = techage.SystemTime + BLOCKING_TIME return end - + local ldef = techage.liquid.get_liquid_def(wielded_item) if ldef and ValidOilFuels[ldef.inv_item] then local lqd = (minetest.registered_nodes[node.name] or {}).liquid @@ -139,7 +139,7 @@ function techage.fuel.get_fuel(nvm) nvm.liquid.amount = nvm.liquid.amount - 1 return nvm.liquid.name end - nvm.liquid.name = nil + nvm.liquid.name = nil end return nil end @@ -194,4 +194,4 @@ function techage.fuel.get_liquid_table(valid_fuel, capacity, start_firebox) return leftover end } -end \ No newline at end of file +end diff --git a/techage/basis/gravel_lib.lua b/techage/basis/gravel_lib.lua index 53b21f2..f3ced55 100644 --- a/techage/basis/gravel_lib.lua +++ b/techage/basis/gravel_lib.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - + Gravel Sieve basis functions - + ]]-- -- Increase the probability over the natural occurrence @@ -36,12 +36,12 @@ local function add_ores() and drop ~= "" and item.ore_type == "scatter" and item.wherein == "default:stone" - and item.clust_scarcity ~= nil and item.clust_scarcity > 0 - and item.clust_num_ores ~= nil and item.clust_num_ores > 0 + and item.clust_scarcity ~= nil and item.clust_scarcity > 0 + and item.clust_num_ores ~= nil and item.clust_num_ores > 0 and item.y_max ~= nil and item.y_min ~= nil then local factor = 0.5 - if item.y_max < -250 then - factor = -250 / item.y_max + if item.y_max < -250 then + factor = -250 / item.y_max end local probability = (techage.ore_rarity / PROBABILITY_FACTOR) * item.clust_scarcity / (item.clust_num_ores * factor) @@ -64,7 +64,7 @@ local function add_ores() overall_probability = overall_probability + 1.0/probability end minetest.log("info", string.format("[techage] Overall probability %g", overall_probability)) -end +end minetest.after(1, add_ores) diff --git a/techage/basis/hyperloop.lua b/techage/basis/hyperloop.lua index d5e1c64..a694e32 100644 --- a/techage/basis/hyperloop.lua +++ b/techage/basis/hyperloop.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + For chests and tanks with hyperloop support ]]-- @@ -85,7 +85,7 @@ end local function update_node_data(pos, state, conn_name, remote_name, rmt_pos) local meta = M(pos) local nvm = techage.get_nvm(pos) - + if state == "server_connected" then Stations:update(pos, {conn_name=conn_name, single="nil"}) meta:set_string("status", "server") @@ -138,7 +138,7 @@ techage.hyperloop.SUBMENU = { choices = "", on_dropdown = on_dropdown, name = "remote_name", - label = S("Remote name"), + label = S("Remote name"), tooltip = S("Connection name of the remote block"), }, } @@ -153,7 +153,7 @@ function techage.hyperloop.is_client(pos) end end end - + function techage.hyperloop.is_server(pos) if HYPERLOOP then if M(pos):get_string("status") == "server" then @@ -184,28 +184,28 @@ function techage.hyperloop.remote_pos(pos) end return pos end - + function techage.hyperloop.after_place_node(pos, placer, node_type) if HYPERLOOP then Stations:set(pos, node_type, {owner=placer:get_player_name()}) M(pos):set_string("node_type", node_type) Tube:after_place_node(pos) end -end +end function techage.hyperloop.after_dig_node(pos, oldnode, oldmetadata, digger) if HYPERLOOP then local conn_name = oldmetadata.fields.conn_name local remote_name = oldmetadata.fields.remote_name local loc_pos, rmt_pos = pos, techage.get_nvm(pos).rmt_pos - + -- Close connections if remote_name and rmt_pos then -- Connected client update_node_data(rmt_pos, "server_not_connected", remote_name, "") elseif conn_name and rmt_pos then -- Connected server update_node_data(rmt_pos, "client_not_connected", "", conn_name) end - + Tube:after_dig_node(pos) Stations:delete(pos) end @@ -218,7 +218,7 @@ function techage.hyperloop.after_formspec(pos, fields) local remote_name = meta:get_string("remote_name") local status = meta:contains("status") and meta:get_string("status") or "not connected" local loc_pos, rmt_pos = pos, techage.get_nvm(pos).rmt_pos - + if status == "not connected" then if fields.remote_name ~= "" then -- Client local rmt_pos = get_remote_pos(pos, fields.remote_name) @@ -232,4 +232,3 @@ function techage.hyperloop.after_formspec(pos, fields) end end end - diff --git a/techage/basis/legacy.lua b/techage/basis/legacy.lua index 1578262..18d25a1 100644 --- a/techage/basis/legacy.lua +++ b/techage/basis/legacy.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + For the transition from v0.26 to v1.0 ]]-- diff --git a/techage/basis/lib.lua b/techage/basis/lib.lua index 6b83c27..99deec8 100644 --- a/techage/basis/lib.lua +++ b/techage/basis/lib.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + Helper functions ]]-- @@ -69,8 +69,8 @@ local RotationViaYAxis = {} for _,row in ipairs(ROTATION) do for i = 1,4 do local val = row[i] - local left = row[i == 1 and 4 or i - 1] - local right = row[i == 4 and 1 or i + 1] + local left = row[i == 1 and 4 or i - 1] + local right = row[i == 4 and 1 or i + 1] RotationViaYAxis[val] = {left, right} end end @@ -250,8 +250,8 @@ end -- returns true, if node can be dug, otherwise false function techage.can_node_dig(node, ndef) - if RegisteredNodesToBeDug[node.name] then - return true + if RegisteredNodesToBeDug[node.name] then + return true end if not ndef then return false end if node.name == "ignore" then return false end @@ -329,7 +329,7 @@ function techage.dropped_node(node, ndef) return handle_drop(ndef.drop) end return ndef.drop or node.name -end +end -- needed for windmill plants local function determine_ocean_ids() @@ -375,7 +375,7 @@ function techage.item_image(x, y, itemname, count) end label = "label["..(x + offs)..","..(y + 0.45)..";"..tostring(size).."]" end - + return "box["..x..","..y..";0.85,0.9;#808080]".. "item_image["..x..","..y..";1,1;"..itemname.."]".. tooltip.. @@ -386,12 +386,12 @@ function techage.item_image_small(x, y, itemname, tooltip_prefix) local name = unpack(string.split(itemname, " ")) local tooltip = "" local ndef = minetest.registered_nodes[name] or minetest.registered_items[name] or minetest.registered_craftitems[name] - + if ndef and ndef.description then local text = minetest.formspec_escape(ndef.description) tooltip = "tooltip["..x..","..y..";0.8,0.8;"..tooltip_prefix..": "..text..";#0C3D32;#FFFFFF]" end - + return "box["..x..","..y..";0.65,0.7;#808080]".. "item_image["..x..","..y..";0.8,0.8;"..name.."]".. tooltip @@ -470,7 +470,7 @@ local BUFFER_DEPTH = 10 function techage.historybuffer_add(pos, s) local mem = techage.get_mem(pos) mem.hisbuf = mem.hisbuf or {} - + if #s > 2 then table.insert(mem.hisbuf, s) if #mem.hisbuf > BUFFER_DEPTH then @@ -484,7 +484,7 @@ function techage.historybuffer_priv(pos) local mem = techage.get_mem(pos) mem.hisbuf = mem.hisbuf or {} mem.hisbuf_idx = mem.hisbuf_idx or 1 - + mem.hisbuf_idx = math.max(1, mem.hisbuf_idx - 1) return mem.hisbuf[mem.hisbuf_idx] end @@ -493,7 +493,7 @@ function techage.historybuffer_next(pos) local mem = techage.get_mem(pos) mem.hisbuf = mem.hisbuf or {} mem.hisbuf_idx = mem.hisbuf_idx or 1 - + mem.hisbuf_idx = math.min(#mem.hisbuf, mem.hisbuf_idx + 1) return mem.hisbuf[mem.hisbuf_idx] end diff --git a/techage/basis/liquid_lib.lua b/techage/basis/liquid_lib.lua index 967f560..25acfd3 100644 --- a/techage/basis/liquid_lib.lua +++ b/techage/basis/liquid_lib.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + Liquid lib ]]-- @@ -55,7 +55,7 @@ function techage.liquid.formspec(pos, nvm, title) help(7.4, -0.1).. techage.item_image(3.5, 1, itemname) end -end +end function techage.liquid.is_empty(pos) local nvm = techage.get_nvm(pos) @@ -75,7 +75,7 @@ techage.liquid.recv_message = { return "unsupported" end end, -} +} -- like: register_liquid("techage:ta3_barrel_oil", "techage:ta3_barrel_empty", 10, "techage:oil") function techage.register_liquid(full_container, empty_container, container_size, inv_item) @@ -88,7 +88,7 @@ end local function get_liquid_def(full_container) return LiquidDef[full_container] end - + local function get_container_def(container_name) return ContainerDef[container_name] end @@ -109,7 +109,7 @@ local function fill_container(pos, inv, empty_container) local full_container = get_full_container(empty_container, nvm.liquid.name) if empty_container and full_container then local ldef = get_liquid_def(full_container) - if ldef and nvm.liquid.amount - ldef.size >= 0 then + if ldef and nvm.liquid.amount - ldef.size >= 0 then if inv:room_for_item("dst", {name = full_container}) then inv:add_item("dst", {name = full_container}) nvm.liquid.amount = nvm.liquid.amount - ldef.size @@ -134,7 +134,7 @@ local function empty_container(pos, inv, full_container) local tank_size = (ndef_lqd and ndef_lqd.capa) or 0 local ldef = get_liquid_def(full_container) if ldef and (not nvm.liquid.name or ldef.inv_item == nvm.liquid.name) then - if nvm.liquid.amount + ldef.size <= tank_size then + if nvm.liquid.amount + ldef.size <= tank_size then if inv:room_for_item("dst", {name = ldef.container}) then inv:add_item("dst", {name = ldef.container}) nvm.liquid.amount = nvm.liquid.amount + ldef.size @@ -157,22 +157,22 @@ local function fill_on_punch(nvm, empty_container, item_count, puncher) if empty_container and full_container then local item = {name = full_container} local ldef = get_liquid_def(full_container) - if ldef and nvm.liquid.amount - ldef.size >= 0 then + if ldef and nvm.liquid.amount - ldef.size >= 0 then if item_count > 1 then -- can't be simply replaced? -- check for extra free space local inv = puncher:get_inventory() if inv:room_for_item("main", {name = full_container}) then -- add full container and return -- the empty once - 1 - inv:add_item("main", {name = full_container}) + inv:add_item("main", {name = full_container}) item = {name = empty_container, count = item_count - 1} else return -- no free space end end nvm.liquid.amount = nvm.liquid.amount - ldef.size - if nvm.liquid.amount == 0 then - nvm.liquid.name = nil + if nvm.liquid.amount == 0 then + nvm.liquid.name = nil end return item -- to be added to the players inv. end @@ -181,8 +181,8 @@ local function fill_on_punch(nvm, empty_container, item_count, puncher) local count = math.max(nvm.liquid.amount, 99) local name = nvm.liquid.name nvm.liquid.amount = nvm.liquid.amount - count - if nvm.liquid.amount == 0 then - nvm.liquid.name = nil + if nvm.liquid.amount == 0 then + nvm.liquid.name = nil end return {name = name, count = count} end @@ -195,7 +195,7 @@ local function legacy_items(full_container, item_count) elseif full_container == "techage:oil_source" then return {container = "", size = item_count, inv_item = full_container} end -end +end -- check if the wielded full container can be emptied into the tank local function empty_on_punch(pos, nvm, full_container, item_count) @@ -203,10 +203,10 @@ local function empty_on_punch(pos, nvm, full_container, item_count) nvm.liquid.amount = nvm.liquid.amount or 0 local lqd_def = get_liquid_def(full_container) or legacy_items(full_container, item_count) local ndef_lqd = LQD(pos) - if lqd_def and ndef_lqd then + if lqd_def and ndef_lqd then local tank_size = ndef_lqd.capa or 0 if not nvm.liquid.name or lqd_def.inv_item == nvm.liquid.name then - if nvm.liquid.amount + lqd_def.size <= tank_size then + if nvm.liquid.amount + lqd_def.size <= tank_size then nvm.liquid.amount = nvm.liquid.amount + lqd_def.size nvm.liquid.name = lqd_def.inv_item return {name = lqd_def.container} @@ -227,10 +227,10 @@ function techage.liquid.on_punch(pos, node, puncher, pointed_thing) if mem.blocking_time > techage.SystemTime then return end - + local wielded_item = puncher:get_wielded_item():get_name() local item_count = puncher:get_wielded_item():get_count() - local new_item = fill_on_punch(nvm, wielded_item, item_count, puncher) + local new_item = fill_on_punch(nvm, wielded_item, item_count, puncher) or empty_on_punch(pos, nvm, wielded_item, item_count) if new_item then puncher:set_wielded_item(new_item) diff --git a/techage/basis/manual.lua b/techage/basis/manual.lua index c70e0a6..d8e599c 100644 --- a/techage/basis/manual.lua +++ b/techage/basis/manual.lua @@ -89,5 +89,3 @@ techage.manual_DE.aPlanTable = { "", "", } - - diff --git a/techage/basis/mark.lua b/techage/basis/mark.lua index 538bae7..8058b1f 100644 --- a/techage/basis/mark.lua +++ b/techage/basis/mark.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information mark.lua: - + ]]-- local marker_region = {} @@ -27,9 +27,9 @@ end function techage.mark_region(name, pos1, pos2, owner, secs) if not name or not pos1 or not pos2 then return end - + techage.unmark_region(name) - + local thickness = 0.2 local sizex, sizey, sizez = (1 + pos2.x - pos1.x) / 2, (1 + pos2.y - pos1.y) / 2, (1 + pos2.z - pos1.z) / 2 local markers = {} @@ -96,4 +96,3 @@ minetest.register_entity(":techage:region_cube", { techage.unmark_region(self.player_name) end, }) - diff --git a/techage/basis/mark2.lua b/techage/basis/mark2.lua index 7ea7e12..ab1124e 100644 --- a/techage/basis/mark2.lua +++ b/techage/basis/mark2.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information mark.lua: - + ]]-- local marker_region = {} @@ -44,7 +44,7 @@ function techage.mark_cube(name, pos1, pos2, nametag, color, time) local size_x = math.abs(pos1.x - pos2.x) + 1 local size_y = math.abs(pos1.y - pos2.y) + 1 local size_z = math.abs(pos1.z - pos2.z) + 1 - + local marker = minetest.add_entity( {x = new_x, y = new_y, z = new_z}, "techage:position_cube") if marker ~= nil then @@ -126,4 +126,3 @@ minetest.register_entity(":techage:position_side", { techage.unmark_position(self.player_name) end, }) - diff --git a/techage/basis/mark_lib.lua b/techage/basis/mark_lib.lua index 8cc52ce..835555a 100644 --- a/techage/basis/mark_lib.lua +++ b/techage/basis/mark_lib.lua @@ -9,12 +9,12 @@ See LICENSE.txt for more information Block marker lib for door/move/fly controller - + ]]-- local marker = {} -local MarkedNodes = {} -- t[player] = {{entity, pos},...} +local MarkedNodes = {} -- t[player] = {{entity, pos},...} local MaxNumber = {} local CurrentPos -- to mark punched entities @@ -67,11 +67,11 @@ end minetest.register_on_punchnode(function(pos, node, puncher, pointed_thing) if puncher and puncher:is_player() then local name = puncher:get_player_name() - + if not MarkedNodes[name] then return end - + mark_position(name, pointed_thing.under) end end) @@ -119,4 +119,4 @@ minetest.register_entity(":techage:block_marker", { end, }) -return marker \ No newline at end of file +return marker diff --git a/techage/basis/node_states.lua b/techage/basis/node_states.lua index ea4a29d..f866910 100644 --- a/techage/basis/node_states.lua +++ b/techage/basis/node_states.lua @@ -13,33 +13,33 @@ ]]-- ---[[ +--[[ Node states: +-----------------------------------+ +------------+ - | | | | - | V V | - | +---------+ | - | | | | - | +---------| STOPPED | | - | | | | | - | button | +---------+ | - | | ^ | - button | V | button | - | +---------+ | | button - | +--------->| |---------+ | - | | power | RUNNING | | - | | +------| |---------+ | - | | | +---------+ | | - | | | ^ | | | - | | | | | | | - | | V | V V | - | +---------+ +----------+ +---------+ | - | | | | | | | | - +---| NOPOWER | | STANDBY/ | | FAULT |----------+ - | | | BLOCKED | | | - +---------+ +----------+ +---------+ + | | | | + | V V | + | +---------+ | + | | | | + | +---------| STOPPED | | + | | | | | + | button | +---------+ | + | | ^ | + button | V | button | + | +---------+ | | button + | +--------->| |---------+ | + | | power | RUNNING | | + | | +------| |---------+ | + | | | +---------+ | | + | | | ^ | | | + | | | | | | | + | | V | V V | + | +---------+ +----------+ +---------+ | + | | | | | | | | + +---| NOPOWER | | STANDBY/ | | FAULT |----------+ + | | | BLOCKED | | | + +---------+ +----------+ +---------+ | cycle time operational needs power @@ -74,12 +74,12 @@ techage.FAULT = 5 -- any fault state (e.g. wrong source items), which can be f techage.STOPPED = 6 -- not operational/turned off techage.StatesImg = { - "techage_inv_button_on.png", + "techage_inv_button_on.png", "techage_inv_button_warning.png", - "techage_inv_button_standby.png", - "techage_inv_button_nopower.png", + "techage_inv_button_standby.png", + "techage_inv_button_nopower.png", "techage_inv_button_error.png", - "techage_inv_button_off.png", + "techage_inv_button_off.png", } local function error(pos, msg) @@ -176,7 +176,7 @@ function NodeStates:new(attr) -- optional countdown_ticks = attr.countdown_ticks or 1, node_name_passive = attr.node_name_passive, - node_name_active = attr.node_name_active, + node_name_active = attr.node_name_active, infotext_name = attr.infotext_name, has_power = attr.has_power or has_power, can_start = attr.can_start or can_start, @@ -274,7 +274,7 @@ function NodeStates:start(pos, nvm) self.on_state_change(pos, state, RUNNING) end start_timer_delayed(pos, self.cycle_time) - + if self.quick_start and state == STOPPED then self.quick_start(pos, 0) end @@ -305,7 +305,7 @@ function NodeStates:standby(pos, nvm, err_string) return true end return false -end +end -- special case of standby for pushing nodes function NodeStates:blocked(pos, nvm, err_string) @@ -330,7 +330,7 @@ function NodeStates:blocked(pos, nvm, err_string) return true end return false -end +end function NodeStates:nopower(pos, nvm, err_string) local state = nvm.techage_state or RUNNING @@ -354,7 +354,7 @@ function NodeStates:nopower(pos, nvm, err_string) return true end return false -end +end function NodeStates:fault(pos, nvm, err_string) local state = nvm.techage_state or STOPPED @@ -379,7 +379,7 @@ function NodeStates:fault(pos, nvm, err_string) return true end return false -end +end function NodeStates:get_state(nvm) return nvm.techage_state or techage.STOPPED @@ -431,7 +431,7 @@ function NodeStates:state_button_event(pos, nvm, fields) if state == STOPPED or state == STANDBY or state == BLOCKED then if not self:start(pos, nvm) and (state == STANDBY or state == BLOCKED) then self:stop(pos, nvm) - end + end elseif state == RUNNING or state == FAULT or state == NOPOWER then self:stop(pos, nvm) end @@ -478,7 +478,7 @@ function NodeStates:on_receive_message(pos, topic, payload) return "unsupported" end end - + -- restart timer function NodeStates:on_node_load(pos) local nvm = techage.get_nvm(pos) diff --git a/techage/basis/node_store.lua b/techage/basis/node_store.lua index 23c1438..cce2e55 100644 --- a/techage/basis/node_store.lua +++ b/techage/basis/node_store.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + Data storage system for node related volatile and non-volatile data. Non-volatile data is stored from time to time and at shutdown. Volatile data is lost at every shutdown. @@ -41,14 +41,14 @@ local function get_keys(pos) end local function pos_from_key(key1, key2) - + local x1 = (math.floor(key1 / (4096 * 4096)) - 2048) * 16 local y1 = ((math.floor(key1 / 4096) % 4096) - 2048) * 16 local z1 = ((key1 % 4096) - 2048) * 16 local x2 = math.floor(key2 / (16 * 16)) local y2 = math.floor(key2 / 16) % 16 local z2 = key2 % 16 - + return {x = x1 + x2, y = y1 + y2, z = z1 + z2} end @@ -66,8 +66,8 @@ local function debug(key1, item) end print("mapblock", string.format("%09X", key1), cnt.." nodes") end - - + + ------------------------------------------------------------------- -- Storage scheduler ------------------------------------------------------------------- @@ -137,12 +137,12 @@ end -- Returns non-volatile node data as table function techage.get_nvm(pos) local key1, key2 = get_keys(pos) - + if not NvmStore[key1] then NvmStore[key1] = backend.get_mapblock_data(key1) push(key1) end - + local block = NvmStore[key1] block.in_use = true if not block[key2] then @@ -161,7 +161,7 @@ end function techage.del_mem(pos) local hash = minetest.hash_node_position(pos) MemStore[hash] = nil - + local key1, key2 = get_keys(pos) NvmStore[key1] = NvmStore[key1] or backend.get_mapblock_data(key1) NvmStore[key1][key2] = nil diff --git a/techage/basis/nodedata_meta.lua b/techage/basis/nodedata_meta.lua index e179e7e..875ce6d 100644 --- a/techage/basis/nodedata_meta.lua +++ b/techage/basis/nodedata_meta.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + Storage backend for node related data as node metadata ]]-- @@ -35,7 +35,7 @@ if use_marshal then if not marshal then error("Please install marshal via 'luarocks install lua-marshal'") end - + serialize = marshal.encode deserialize = function(s) @@ -76,12 +76,12 @@ end function api.get_node_data(pos) local tbl = {} local s = M(pos):get_string("ta_data") - + if s ~= "" then tbl = deserialize(s) or {} end tbl._POS_ = table.copy(pos) - + return tbl end diff --git a/techage/basis/nodedata_sqlite.lua b/techage/basis/nodedata_sqlite.lua index f241c5b..e9e3f8c 100644 --- a/techage/basis/nodedata_sqlite.lua +++ b/techage/basis/nodedata_sqlite.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + Storage backend for node related data via sqlite database ]]-- @@ -44,7 +44,7 @@ if sqlite3 then sqlite3 = nil end db:exec[[ CREATE TABLE mapblocks(id INTEGER PRIMARY KEY, key INTEGER, data BLOB); - CREATE UNIQUE INDEX idx ON mapblocks(key); + CREATE UNIQUE INDEX idx ON mapblocks(key); ]] local set = db:prepare("INSERT or REPLACE INTO mapblocks VALUES(NULL, ?, ?);") @@ -54,7 +54,7 @@ local function set_block(key, data) set:reset() set:bind(1, key) set:bind_blob(2, data) - set:step() + set:step() return true end @@ -76,8 +76,8 @@ function api.store_mapblock_data(key, mapblock_data) --local s = marshal.encode(mapblock_data) local s = minetest.serialize(mapblock_data) return set_block(key, s) -end - +end + function api.get_mapblock_data(key) local s = get_block(key) if s then @@ -89,8 +89,8 @@ function api.get_mapblock_data(key) end api.store_mapblock_data(key, {}) return {} -end - +end + function api.get_node_data(pos) -- legacy data available? local s = M(pos):get_string("ta_data") diff --git a/techage/basis/numbers_sqlite.lua b/techage/basis/numbers_sqlite.lua index c4cf717..f2f8be8 100644 --- a/techage/basis/numbers_sqlite.lua +++ b/techage/basis/numbers_sqlite.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + Storage backend for node number mapping via sqlite database ]]-- @@ -46,7 +46,7 @@ if sqlite3 then sqlite3 = nil end db:exec[[ CREATE TABLE numbers(id INTEGER PRIMARY KEY, number INTEGER, x INTEGER, y INTEGER, z INTEGER); - CREATE UNIQUE INDEX idx ON numbers(number); + CREATE UNIQUE INDEX idx ON numbers(number); ]] local set = db:prepare("INSERT or REPLACE INTO numbers VALUES(NULL, ?, ?, ?, ?);") @@ -58,7 +58,7 @@ local function set_block(number, pos) set:bind(2, pos.x) set:bind(3, pos.y) set:bind(4, pos.z) - set:step() + set:step() return true end @@ -94,7 +94,7 @@ if Version == 3 then storage:set_string(number, "") end end -elseif Version == 4 then +elseif Version == 4 then NextNumber = storage:get_int("NextNumber") else error("[] Invalid version number for 'number to pos mapping' table!") @@ -108,28 +108,28 @@ local api = {} function api.get_nodepos(number) return get_block(number) -end - +end + function api.set_nodepos(number, pos) set_block(number, pos) -end - +end + function api.add_nodepos(pos) local num = tostring(NextNumber) NextNumber = NextNumber + 1 storage:set_int("NextNumber", NextNumber) set_block(num, pos) return num -end - +end + function api.del_nodepos(number) del_block(number) -end +end -- delete invalid entries function api.delete_invalid_entries(node_def) minetest.log("info", "[TechAge] Data maintenance started") - for id, num, x, y, z in db:urows('SELECT * FROM numbers') do + for id, num, x, y, z in db:urows('SELECT * FROM numbers') do local pos = {x = x, y = y, z = z} local name = techage.get_node_lvm(pos).name if not node_def[name] then @@ -137,6 +137,6 @@ function api.delete_invalid_entries(node_def) end end minetest.log("info", "[TechAge] Data maintenance finished") -end +end return api diff --git a/techage/basis/numbers_storage.lua b/techage/basis/numbers_storage.lua index 8e42d58..02219b1 100644 --- a/techage/basis/numbers_storage.lua +++ b/techage/basis/numbers_storage.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + Storage backend for node number mapping via mod storage ]]-- @@ -59,23 +59,23 @@ storage:set_int("Version", Version) ------------------------------------------------------------------- function backend.get_nodepos(number) return minetest.string_to_pos(storage:get_string(number)) -end - +end + function backend.set_nodepos(number, pos) storage:set_string(number, minetest.pos_to_string(pos)) -end - +end + function backend.add_nodepos(pos) local num = tostring(NextNumber) NextNumber = NextNumber + 1 storage:set_int("NextNumber", NextNumber) storage:set_string(num, minetest.pos_to_string(pos)) return num -end - +end + function backend.del_nodepos(number) storage:set_string(number, "") -end +end -- delete invalid entries function backend.delete_invalid_entries(node_def) @@ -88,11 +88,11 @@ function backend.delete_invalid_entries(node_def) if not node_def[name] then backend.del_nodepos(number) else - minetest.get_meta(pos):set_string("node_number", number) + minetest.get_meta(pos):set_string("node_number", number) end end end minetest.log("info", "[TechAge] Data maintenance finished") -end +end return backend diff --git a/techage/basis/recipe_lib.lua b/techage/basis/recipe_lib.lua index 76306d3..8ff64e7 100644 --- a/techage/basis/recipe_lib.lua +++ b/techage/basis/recipe_lib.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + Recipe lib for formspecs ]]-- @@ -38,7 +38,7 @@ local GROUP_ITEMS = { local RECIPE = { output = {name = "", num = 0}, waste = {name = "", num = 0}, - input = { + input = { {name = "", num =0}, {name = "", num =0}, {name = "", num =0}, @@ -52,7 +52,7 @@ local function filter_recipes_based_on_points(recipes, owner) local player = minetest.get_player_by_name(owner) ex_points = techage.get_expoints(player) or 0 end - + local tbl = {} for _,item in ipairs(recipes) do if ex_points >= (item.ex_points or 0) then @@ -78,7 +78,7 @@ function techage.recipes.get(nvm, rtype) local recipes = Recipes[rtype] or {} return recipes[nvm.recipe_idx or 1] end - + -- Add 4 input/output/waste recipe -- { -- output = " ", -- units = 1..n @@ -92,7 +92,7 @@ function techage.recipes.add(rtype, recipe) if not Recipes[rtype] then Recipes[rtype] = {} end - + local name, num, output local item = {input = {}} for idx = 1,4 do @@ -100,7 +100,7 @@ function techage.recipes.add(rtype, recipe) name, num = unpack(string.split(inp, " ")) item.input[idx] = {name = name or "", num = tonumber(num) or 0} end - if recipe.waste then + if recipe.waste then name, num = unpack(string.split(recipe.waste, " ")) else name, num = "", "0" @@ -114,12 +114,12 @@ function techage.recipes.add(rtype, recipe) output = name techage.recipes.register_craft({ - output = recipe.output, + output = recipe.output, items = recipe.input, type = rtype, }) NormalizedRecipes[output] = { - output = recipe.output, + output = recipe.output, items = recipe.input, } end @@ -151,9 +151,9 @@ function techage.recipes.on_receive_fields(pos, formname, fields, player) return end local nvm = techage.get_nvm(pos) - + nvm.recipe_idx = nvm.recipe_idx or 1 - if not nvm.running then + if not nvm.running then if fields.next == ">>" then nvm.recipe_idx = nvm.recipe_idx + 1 elseif fields.priv == "<<" then @@ -165,8 +165,8 @@ end function techage.recipes.get_recipe(name) return NormalizedRecipes[name] end - - + + function techage.recipes.get_default_group_item_name(item_name) if item_name and item_name:sub(1, 6) == "group:" then local default_name = GROUP_ITEMS[item_name:sub(7)] @@ -182,7 +182,7 @@ function techage.recipes.add_group_item(group, default_item_name) end ------------------------------------------------------------------------------- --- Borrowed from ghaydn +-- Borrowed from ghaydn ------------------------------------------------------------------------------- local has_i3 = minetest.get_modpath("i3") local has_ui = minetest.get_modpath("unified_inventory") diff --git a/techage/basis/shared_inv.lua b/techage/basis/shared_inv.lua index 3f375af..4169d3e 100644 --- a/techage/basis/shared_inv.lua +++ b/techage/basis/shared_inv.lua @@ -34,7 +34,7 @@ function techage.shared_inv.node_timer(pos, elapsed) if techage.is_activeformspec(pos) then copy_inventory_list(rmt_pos, pos, "main") return true - end + end return false end @@ -64,6 +64,5 @@ function techage.shared_inv.on_rightclick(pos, clicker, listname) copy_inventory_list(rmt_pos, pos, listname) techage.set_activeformspec(pos, clicker) minetest.get_node_timer(pos):start(2) - end + end end - diff --git a/techage/basis/shared_tank.lua b/techage/basis/shared_tank.lua index 5d0b1fe..1e2f067 100644 --- a/techage/basis/shared_tank.lua +++ b/techage/basis/shared_tank.lua @@ -21,6 +21,7 @@ techage.shared_tank = {} local liquid = networks.liquid local hyperloop = techage.hyperloop local remote_pos = techage.hyperloop.remote_pos +local is_paired = techage.hyperloop.is_paired local menu = techage.menu local function formspec(pos) @@ -36,10 +37,10 @@ local function formspec(pos) end function techage.shared_tank.node_timer(pos) - if techage.is_activeformspec(pos) then + if techage.is_activeformspec(pos) and is_paired(pos) then M(pos):set_string("formspec", formspec(pos)) return true - end + end return false end @@ -47,10 +48,10 @@ function techage.shared_tank.on_rightclick(pos, node, clicker) --if hyperloop.is_client(pos) then techage.set_activeformspec(pos, clicker) minetest.get_node_timer(pos):start(2) - --end + --end M(pos):set_string("formspec", formspec(pos)) end - + function techage.shared_tank.can_dig(pos, player) if minetest.is_protected(pos, player:get_player_name()) then return false @@ -60,26 +61,47 @@ function techage.shared_tank.can_dig(pos, player) end function techage.shared_tank.peek_liquid(pos, indir) - pos = remote_pos(pos) - local nvm = techage.get_nvm(pos) - return liquid.srv_peek(nvm) + if is_paired(pos) then + pos = remote_pos(pos) + local nvm = techage.get_nvm(pos) + return liquid.srv_peek(nvm) + end end function techage.shared_tank.take_liquid(pos, indir, name, amount) - pos = remote_pos(pos) - local nvm = techage.get_nvm(pos) - amount, name = liquid.srv_take(nvm, name, amount) - if techage.is_activeformspec(pos) then - M(pos):set_string("formspec", formspec(pos)) + if is_paired(pos) then + pos = remote_pos(pos) + local nvm = techage.get_nvm(pos) + amount, name = liquid.srv_take(nvm, name, amount) + if techage.is_activeformspec(pos) then + M(pos):set_string("formspec", formspec(pos)) + end + return amount, name end - return amount, name + return 0, name end - + function techage.shared_tank.put_liquid(pos, indir, name, amount) - pos = remote_pos(pos) - -- check if it is not powder - local ndef = minetest.registered_craftitems[name] or {} - if not ndef.groups or ndef.groups.powder ~= 1 then + if is_paired(pos) then + pos = remote_pos(pos) + -- check if it is not powder + local ndef = minetest.registered_craftitems[name] or {} + if not ndef.groups or ndef.groups.powder ~= 1 then + local nvm = techage.get_nvm(pos) + local ndef = NDEF(pos) + local leftover = liquid.srv_put(nvm, name, amount, ndef.liquid.capa) + if techage.is_activeformspec(pos) then + M(pos):set_string("formspec", formspec(pos)) + end + return leftover + end + end + return amount +end + +function techage.shared_tank.untake_liquid(pos, indir, name, amount) + if is_paired(pos) then + pos = remote_pos(pos) local nvm = techage.get_nvm(pos) local ndef = NDEF(pos) local leftover = liquid.srv_put(nvm, name, amount, ndef.liquid.capa) @@ -91,15 +113,4 @@ function techage.shared_tank.put_liquid(pos, indir, name, amount) return amount end -function techage.shared_tank.untake_liquid(pos, indir, name, amount) - pos = remote_pos(pos) - local nvm = techage.get_nvm(pos) - local ndef = NDEF(pos) - local leftover = liquid.srv_put(nvm, name, amount, ndef.liquid.capa) - if techage.is_activeformspec(pos) then - M(pos):set_string("formspec", formspec(pos)) - end - return leftover -end - -techage.shared_tank.formspec = formspec \ No newline at end of file +techage.shared_tank.formspec = formspec diff --git a/techage/basis/submenu.lua b/techage/basis/submenu.lua index f7011db..5ee9fb2 100644 --- a/techage/basis/submenu.lua +++ b/techage/basis/submenu.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + A formspec control to generate formspec strings for machine settings and monitoring ]]-- @@ -43,7 +43,7 @@ local function generate_formspec_substring(pos, meta, form_def, player_name) local player_inv_needed = false if meta and form_def then local nvm = techage.get_nvm(pos) - + for i,elem in ipairs(form_def) do local offs = (i - 1) * 0.9 - 0.2 tbl[#tbl+1] = "label[0," .. offs .. ";" .. minetest.formspec_escape(elem.label) .. ":]" @@ -133,7 +133,7 @@ local function generate_formspec_substring(pos, meta, form_def, player_name) tbl[#tbl+1] = "label[0," .. offs .. ";" .. S("Note: You can't change any values while the block is running!") .. "]" end end - + return player_inv_needed, table.concat(tbl, "") end @@ -143,23 +143,23 @@ local function value_check(elem, value) end return value ~= nil end - + local function evaluate_data(pos, meta, form_def, fields, player_name) local res = true - + if meta and form_def then local nvm = techage.get_nvm(pos) if nvm.running or techage.is_running(nvm) then return res end for idx,elem in ipairs(form_def) do - if elem.type == "number" then + if elem.type == "number" then if fields[elem.name] then - if fields[elem.name] == "" then + if fields[elem.name] == "" then meta:set_string(elem.name, "") elseif fields[elem.name]:find("^[%d ]+$") then local val = tonumber(fields[elem.name]) - if value_check(elem, val) then + if value_check(elem, val) then meta:set_int(elem.name, val) --print("set_int", elem.name, val) else @@ -169,11 +169,11 @@ local function evaluate_data(pos, meta, form_def, fields, player_name) res = false end end - elseif elem.type == "numbers" then + elseif elem.type == "numbers" then if fields[elem.name] then - if fields[elem.name] == "" then + if fields[elem.name] == "" then meta:set_string(elem.name, "") - elseif fields[elem.name]:find("^[%d ]+$") and value_check(elem, fields[elem.name]) then + elseif fields[elem.name]:find("^[%d ]+$") and value_check(elem, fields[elem.name]) then meta:set_string(elem.name, fields[elem.name]) else res = false @@ -184,13 +184,13 @@ local function evaluate_data(pos, meta, form_def, fields, player_name) meta:set_string(elem.name, "") elseif fields[elem.name] then local val = tonumber(fields[elem.name]) - if val and value_check(elem, val) then + if val and value_check(elem, val) then meta:set_string(elem.name, val) else res = false end end - elseif elem.type == "ascii" then + elseif elem.type == "ascii" then if fields[elem.name] == ""then meta:set_string(elem.name, "") elseif fields[elem.name] then @@ -200,11 +200,11 @@ local function evaluate_data(pos, meta, form_def, fields, player_name) res = false end end - elseif elem.type == "dropdown" then + elseif elem.type == "dropdown" then if fields[elem.name] ~= nil then meta:set_string(elem.name, fields[elem.name]) end - elseif elem.type == "items" and player_name then + elseif elem.type == "items" and player_name then local inv_name = minetest.formspec_escape(player_name) .. "_techage_wrench_menu" local dinv = minetest.get_inventory({type = "detached", name = inv_name}) local ninv = minetest.get_inventory({type = "node", pos = pos}) @@ -232,7 +232,7 @@ function techage.menu.generate_formspec(pos, ndef, form_def, player_name) allow_take = allow_take}) local dinv = minetest.get_inventory({type = "detached", name = inv_name}) local ninv = minetest.get_inventory({type = "node", pos = pos}) - if dinv and ninv then + if dinv and ninv then dinv:set_size('cfg', ninv:get_size("cfg")) for i = 1, ninv:get_size("cfg") do dinv:set_stack("cfg", i, ninv:get_stack("cfg", i)) @@ -243,7 +243,7 @@ function techage.menu.generate_formspec(pos, ndef, form_def, player_name) local title = ndef.description .. " (" .. number .. ")" local player_inv_needed, text = generate_formspec_substring(pos, meta, form_def, player_name) local buttons - + if player_inv_needed then buttons = "button[0.5,6.2;3,1;refresh;" .. S("Refresh") .. "]" .. "button_exit[3.5,6.2;3,1;cancel;" .. S("Cancel") .. "]" .. @@ -254,7 +254,7 @@ function techage.menu.generate_formspec(pos, ndef, form_def, player_name) "button_exit[3.5,8.4;3,1;cancel;" .. S("Cancel") .. "]" .. "button[6.5,8.4;3,1;save;" .. S("Save") .. "]" end - + if #form_def > 8 then local size = (#form_def * 10) - 60 return "size[10,9]" .. @@ -287,10 +287,10 @@ function techage.menu.generate_formspec(pos, ndef, form_def, player_name) return "" end -function techage.menu.eval_input(pos, form_def, fields, player_name) +function techage.menu.eval_input(pos, form_def, fields, player_name) if fields.save or fields.key_enter_field then local meta = minetest.get_meta(pos) evaluate_data(pos, meta, form_def, fields, player_name) end - return fields.refresh or fields.save or fields.key_enter_field + return fields.refresh or fields.save or fields.key_enter_field end diff --git a/techage/basis/teleport.lua b/techage/basis/teleport.lua index 4184c33..a9dd85b 100644 --- a/techage/basis/teleport.lua +++ b/techage/basis/teleport.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + For tupe/pipe blocks with teleport support ]]-- @@ -67,7 +67,7 @@ local TELE_MENU = { choices = "", on_dropdown = get_free_server_list, name = "remote_name", - label = S("Remote name"), + label = S("Remote name"), tooltip = S("Connection name of the remote block"), }, { @@ -83,7 +83,7 @@ function techage.teleport.formspec(pos) local ndef = NDEF(pos) return menu.generate_formspec(pos, ndef, TELE_MENU) end - + local function store_connection(pos, peer_pos) local meta = M(pos) local status = S("connected to") .. " " .. P2S(peer_pos) diff --git a/techage/basis/tube_wall_entry.lua b/techage/basis/tube_wall_entry.lua index 9c66b06..a2dab89 100644 --- a/techage/basis/tube_wall_entry.lua +++ b/techage/basis/tube_wall_entry.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + Tube wall entry ]]-- @@ -27,7 +27,7 @@ minetest.register_node("techage:tube_wall_entry", { "basic_materials_concrete_block.png^techage_tube_hole.png", "basic_materials_concrete_block.png^techage_tube_hole.png", }, - + after_place_node = function(pos, placer, itemstack, pointed_thing) if not Tube:after_place_tube(pos, placer, pointed_thing) then minetest.remove_node(pos) @@ -35,11 +35,11 @@ minetest.register_node("techage:tube_wall_entry", { end return false end, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) Tube:after_dig_tube(pos, oldnode, oldmetadata) end, - + paramtype2 = "facedir", -- important! on_rotate = screwdriver.disallow, -- important! groups = {crumbly = 2, cracky = 2, snappy = 2}, diff --git a/techage/basis/tubes.lua b/techage/basis/tubes.lua index 5f3d440..177cb5e 100644 --- a/techage/basis/tubes.lua +++ b/techage/basis/tubes.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + Tubes based on tubelib2 ]]-- @@ -27,13 +27,13 @@ techage.KnownNodes = { local Tube = tubelib2.Tube:new({ -- North, East, South, West, Down, Up dirs_to_check = {1,2,3,4,5,6}, - max_tube_length = 200, + max_tube_length = 200, show_infotext = false, primary_node_names = { - "techage:tubeS", "techage:tubeA", + "techage:tubeS", "techage:tubeA", "techage:ta4_tubeS", "techage:ta4_tubeA", "techage:tube_wall_entry", - }, + }, after_place_tube = function(pos, param2, tube_type, num_tubes, tbl) local name = minetest.get_node(pos).name if name == "techage:tubeS" or name == "techage:tubeA" then @@ -58,7 +58,7 @@ minetest.register_node("techage:tubeS", { "techage_tube_hole.png", "techage_tube_hole.png", }, - + after_place_node = function(pos, placer, itemstack, pointed_thing) if not Tube:after_place_tube(pos, placer, pointed_thing) then minetest.remove_node(pos) @@ -66,11 +66,11 @@ minetest.register_node("techage:tubeS", { end return false end, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) Tube:after_dig_tube(pos, oldnode, oldmetadata) end, - + paramtype2 = "facedir", drawtype = "nodebox", node_box = { @@ -106,11 +106,11 @@ minetest.register_node("techage:tubeA", { "techage_tube_knee2.png", "techage_tube_hole2.png", }, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) Tube:after_dig_tube(pos, oldnode, oldmetadata) end, - + paramtype2 = "facedir", drawtype = "nodebox", node_box = { diff --git a/techage/basis/tubes_ta4.lua b/techage/basis/tubes_ta4.lua index 0902a31..6c06af2 100644 --- a/techage/basis/tubes_ta4.lua +++ b/techage/basis/tubes_ta4.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + Tubes in TA4 design based on tubelib2 ]]-- @@ -25,7 +25,7 @@ minetest.register_node("techage:ta4_tubeS", { "techage_tube_hole.png", "techage_tube_hole.png", }, - + after_place_node = function(pos, placer, itemstack, pointed_thing) if not Tube:after_place_tube(pos, placer, pointed_thing) then minetest.remove_node(pos) @@ -33,11 +33,11 @@ minetest.register_node("techage:ta4_tubeS", { end return false end, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) Tube:after_dig_tube(pos, oldnode, oldmetadata) end, - + paramtype2 = "facedir", drawtype = "nodebox", node_box = { @@ -73,11 +73,11 @@ minetest.register_node("techage:ta4_tubeA", { "techage_tubeta4_knee2.png", "techage_tubeta4_hole2.png", }, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) Tube:after_dig_tube(pos, oldnode, oldmetadata) end, - + paramtype2 = "facedir", drawtype = "nodebox", node_box = { diff --git a/techage/basis/windturbine_lib.lua b/techage/basis/windturbine_lib.lua index 5299bd6..2aa9355 100644 --- a/techage/basis/windturbine_lib.lua +++ b/techage/basis/windturbine_lib.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + Wind turbine helper function ]]-- @@ -49,15 +49,15 @@ function techage.valid_place_for_windturbine(pos, player_name, num_turbines) num = #minetest.find_nodes_in_area(pos1, pos2, {"air", "ignore"}) if num < (41 * 41 * 21 * 0.9) then techage.mark_region(player_name, pos1, pos2, "") - return chat_message(player_name, + return chat_message(player_name, S("Here is not enough wind\n(A free air space of 41x41x21 m is necessary)!")) end -- Check for water surface (occean) pos1 = {x=pos.x-20, y=1, z=pos.z-20} pos2 = {x=pos.x+20, y=1, z=pos.z+20} - num = #minetest.find_nodes_in_area(pos1, pos2, + num = #minetest.find_nodes_in_area(pos1, pos2, {"default:water_source", "default:water_flowing", "ignore"}) - + if num < (41*41 * 0.8) then techage.mark_region(player_name, pos1, pos2, "") return chat_message(player_name, S("Here is not enough water (41x41 m)!")) @@ -71,7 +71,7 @@ function techage.valid_place_for_windturbine(pos, player_name, num_turbines) techage.mark_region(player_name, pos1, pos2, "") return chat_message(player_name, S("The next wind turbines is too close!")) end - + if num_turbines == 0 then chat_message(player_name, minetest.pos_to_string(pos).." ".. S("is a suitable place for a wind turbine!")) diff --git a/techage/carts/chest_cart.lua b/techage/carts/chest_cart.lua index 64361ce..e34e874 100644 --- a/techage/carts/chest_cart.lua +++ b/techage/carts/chest_cart.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information TA3 Chest Cart - + ]]-- -- for lazy programmers @@ -59,7 +59,7 @@ end minetest.register_node("techage:chest_cart", { description = S("TA Chest Cart"), tiles = { - -- up, down, right, left, back, front + -- up, down, right, left, back, front "techage_chest_cart_top.png", "techage_chest_cart_bottom.png", "techage_chest_cart_side.png", @@ -83,13 +83,13 @@ minetest.register_node("techage:chest_cart", { groups = {cracky = 2, crumbly = 2, choppy = 2}, node_placement_prediction = "", diggable = false, - + on_place = minecart.on_nodecart_place, on_punch = minecart.on_nodecart_punch, allow_metadata_inventory_put = allow_metadata_inventory_put, allow_metadata_inventory_take = allow_metadata_inventory_take, on_rightclick = on_rightclick, - + after_place_node = function(pos, placer) local inv = M(pos):get_inventory() inv:set_size('main', 4) @@ -99,14 +99,14 @@ minetest.register_node("techage:chest_cart", { M(pos):set_string("formspec", formspec()) end end, - + set_cargo = function(pos, data) local inv = M(pos):get_inventory() for idx, stack in ipairs(data) do inv:set_stack("main", idx, stack) end end, - + get_cargo = function(pos) local inv = M(pos):get_inventory() local data = {} @@ -159,7 +159,7 @@ techage.register_node({"techage:chest_cart"}, { return "unsupported" end end, -}) +}) Tube:set_valid_sides("techage:chest_cart", {"L", "R", "F", "B"}) diff --git a/techage/carts/tank_cart.lua b/techage/carts/tank_cart.lua index d3654ac..cbb1db1 100644 --- a/techage/carts/tank_cart.lua +++ b/techage/carts/tank_cart.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information TA3 Tank Cart - + ]]-- -- for lazy programmers @@ -20,7 +20,7 @@ local S2P = minetest.string_to_pos local Pipe = techage.LiquidPipe local MP = minetest.get_modpath("minecart") -local liquid = networks.liquid +local liquid = networks.liquid local CAPACITY = 100 local function on_rightclick(pos, node, clicker) @@ -41,7 +41,7 @@ local function node_timer(pos, elapsed) local nvm = techage.get_nvm(pos) M(pos):set_string("formspec", techage.liquid.formspec(pos, nvm)) return true - end + end return false end @@ -58,7 +58,7 @@ local function take_liquid(pos, indir, name, amount) end return amount, name end - + local function put_liquid(pos, indir, name, amount) -- check if it is not powder local ndef = minetest.registered_craftitems[name] or {} @@ -85,7 +85,7 @@ end minetest.register_node("techage:tank_cart", { description = S("TA Tank Cart"), tiles = { - -- up, down, right, left, back, front + -- up, down, right, left, back, front "techage_tank_cart_top.png", "techage_tank_cart_bottom.png", "techage_tank_cart_side.png", @@ -110,7 +110,7 @@ minetest.register_node("techage:tank_cart", { groups = {cracky = 2, crumbly = 2, choppy = 2}, node_placement_prediction = "", diggable = false, - + on_place = minecart.on_nodecart_place, on_punch = minecart.on_nodecart_punch, @@ -119,31 +119,31 @@ minetest.register_node("techage:tank_cart", { nvm.liquid = nvm.liquid or {} M(pos):set_string("formspec", techage.liquid.formspec(pos, nvm)) -- Delete the network between pump and cart - Pipe:after_dig_node(pos) + Pipe:after_dig_node(pos) Pipe:after_place_node(pos) end, - + set_cargo = function(pos, data) local nvm = techage.get_nvm(pos) nvm.liquid = data end, - + get_cargo = function(pos) local nvm = techage.get_nvm(pos) local data = nvm.liquid nvm.liquid = {} return data end, - + has_cargo = function(pos) return not techage.liquid.is_empty(pos) end, - + on_timer = node_timer, on_rightclick = on_rightclick, }) -techage.register_node({"techage:tank_cart"}, techage.liquid.recv_message) +techage.register_node({"techage:tank_cart"}, techage.liquid.recv_message) liquid.register_nodes({"techage:tank_cart"}, Pipe, "tank", {"U"}, { diff --git a/techage/chemistry/ta4_doser.lua b/techage/chemistry/ta4_doser.lua index 886e8b3..30abf1e 100644 --- a/techage/chemistry/ta4_doser.lua +++ b/techage/chemistry/ta4_doser.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA4 Doser ]]-- @@ -54,14 +54,14 @@ local function get_liquids(pos) Liquids[hash] = tbl return Liquids[hash] end - + local function del_liquids(pos) local hash = minetest.hash_node_position(pos) Liquids[hash] = nil end - + -- if liquids are missing, update the cached liquid table -local function reload_liquids(pos) +local function reload_liquids(pos) local hash = minetest.hash_node_position(pos) -- determine the available input liquids local tbl = {} @@ -73,11 +73,11 @@ local function reload_liquids(pos) end Liquids[hash] = tbl return Liquids[hash] -end +end local function reactor_cmnd(pos, cmnd, payload) return techage.transfer( - pos, + pos, 6, -- outdir cmnd, -- topic payload, -- payload @@ -136,7 +136,7 @@ local function untake(pos, taken) for _,item in pairs(taken) do liquid.untake(pos, Pipe, item.outdir, item.name, item.num) end -end +end local function dosing(pos, nvm, elapsed) -- trigger reactor (power) @@ -177,13 +177,13 @@ local function dosing(pos, nvm, elapsed) end end end - + -- check leftover local leftover local mem = techage.get_mem(pos) if mem.waste_leftover then leftover = reactor_cmnd(pos, "waste", { - name = mem.waste_leftover.name, + name = mem.waste_leftover.name, amount = mem.waste_leftover.num}) or mem.waste_leftover.num if leftover > 0 then mem.waste_leftover.num = leftover @@ -194,7 +194,7 @@ local function dosing(pos, nvm, elapsed) end if mem.output_leftover then leftover = reactor_cmnd(pos, "output", { - name = mem.output_leftover.name, + name = mem.output_leftover.name, amount = mem.output_leftover.num}) or mem.output_leftover.num if leftover > 0 then mem.output_leftover.num = leftover @@ -203,11 +203,11 @@ local function dosing(pos, nvm, elapsed) end mem.output_leftover = nil end - + -- inputs local taken = {} mem.dbg_cycles = (mem.dbg_cycles or 0) - 1 - + for _,item in pairs(recipe.input) do if item.name ~= "" then local outdir = liquids[item.name] or reload_liquids(pos)[item.name] @@ -231,7 +231,7 @@ local function dosing(pos, nvm, elapsed) -- waste if recipe.waste.name ~= "" then leftover = reactor_cmnd(pos, "waste", { - name = recipe.waste.name, + name = recipe.waste.name, amount = recipe.waste.num}) or recipe.waste.num if leftover > 0 then mem.waste_leftover = {name = recipe.waste.name, num = leftover} @@ -243,7 +243,7 @@ local function dosing(pos, nvm, elapsed) end -- output leftover = reactor_cmnd(pos, "output", { - name = recipe.output.name, + name = recipe.output.name, amount = recipe.output.num}) or recipe.output.num if leftover > 0 then mem.output_leftover = {name = recipe.output.name, num = leftover} @@ -252,13 +252,13 @@ local function dosing(pos, nvm, elapsed) return end State:keep_running(pos, nvm, COUNTDOWN_TICKS) -end +end local function node_timer(pos, elapsed) local nvm = techage.get_nvm(pos) dosing(pos, nvm, elapsed) return State:is_active(nvm) -end +end local function on_rightclick(pos) local nvm = techage.get_nvm(pos) @@ -269,9 +269,9 @@ local function on_receive_fields(pos, formname, fields, player) if minetest.is_protected(pos, player:get_player_name()) then return end - + local nvm = techage.get_nvm(pos) - if not nvm.running then + if not nvm.running then recipes.on_receive_fields(pos, formname, fields, player) end local mem = techage.get_mem(pos) @@ -345,7 +345,7 @@ minetest.register_node("techage:ta4_doser_on", { on_receive_fields = on_receive_fields, on_rightclick = on_rightclick, on_timer = node_timer, - + paramtype2 = "facedir", on_rotate = screwdriver.disallow, diggable = false, diff --git a/techage/chemistry/ta4_liquid_filter.lua b/techage/chemistry/ta4_liquid_filter.lua index de85e61..988a1d5 100644 --- a/techage/chemistry/ta4_liquid_filter.lua +++ b/techage/chemistry/ta4_liquid_filter.lua @@ -8,7 +8,7 @@ AGPL v3 See LICENSE.txt for more information - + TA4 Liquid Filter ]]-- diff --git a/techage/chemistry/ta4_reactor.lua b/techage/chemistry/ta4_reactor.lua index 3377aca..2736091 100644 --- a/techage/chemistry/ta4_reactor.lua +++ b/techage/chemistry/ta4_reactor.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA4 Reactor ]]-- @@ -51,10 +51,10 @@ minetest.register_node("techage:ta4_reactor_fillerpipe", { after_dig_node = function(pos, oldnode, oldmetadata, digger) Pipe:after_dig_node(pos) end, - + paramtype = "light", use_texture_alpha = techage.CLIP, - sunlight_propagates = true, + sunlight_propagates = true, paramtype2 = "facedir", on_rotate = screwdriver.disallow, groups = {cracky=2}, @@ -64,7 +64,7 @@ minetest.register_node("techage:ta4_reactor_fillerpipe", { local function stand_cmnd(pos, cmnd, payload) return techage.transfer( - {x = pos.x, y = pos.y-1, z = pos.z}, + {x = pos.x, y = pos.y-1, z = pos.z}, 5, -- outdir cmnd, -- topic payload, -- payload @@ -83,11 +83,11 @@ techage.register_node({"techage:ta4_reactor_fillerpipe"}, { on_transfer = function(pos, in_dir, topic, payload) if topic == "check" then local pos2,node = Pipe:get_node(pos, 5) - if not node or node.name ~= "techage:ta4_reactor" then + if not node or node.name ~= "techage:ta4_reactor" then return false end pos2,node = Pipe:get_node(pos2, 5) - if not node or node.name ~= "techage:ta4_reactor_stand" then + if not node or node.name ~= "techage:ta4_reactor_stand" then return false end return true @@ -95,7 +95,7 @@ techage.register_node({"techage:ta4_reactor_fillerpipe"}, { return base_waste(pos, payload or {}) elseif topic == "catalyst" then local pos2,node = Pipe:get_node(pos, 5) - if not node or node.name ~= "techage:ta4_reactor" then + if not node or node.name ~= "techage:ta4_reactor" then return end local inv = M(pos2):get_inventory() @@ -158,7 +158,7 @@ minetest.register_node("techage:ta4_reactor", { end, allow_metadata_inventory_put = allow_metadata_inventory_put, allow_metadata_inventory_take = allow_metadata_inventory_take, - + paramtype = "light", use_texture_alpha = techage.CLIP, paramtype2 = "facedir", @@ -191,7 +191,7 @@ minetest.register_lbm({ name = "techage:update_reactor", nodenames = { - "techage:ta4_reactor", + "techage:ta4_reactor", }, run_at_every_load = true, diff --git a/techage/chemistry/ta4_stand.lua b/techage/chemistry/ta4_stand.lua index 77db92f..efd429e 100644 --- a/techage/chemistry/ta4_stand.lua +++ b/techage/chemistry/ta4_stand.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA4 Reactor Stand and Base ]]-- @@ -26,7 +26,7 @@ local function play_sound(pos) local mem = techage.get_mem(pos) if not mem.handle or mem.handle == -1 then mem.handle = minetest.sound_play("techage_reactor", { - pos = pos, + pos = pos, gain = 0.5, max_hear_distance = 10, loop = true}) @@ -58,8 +58,8 @@ local function on_nopower(pos) nvm.running = false end -local function is_running(pos, nvm) - return nvm.running +local function is_running(pos, nvm) + return nvm.running end minetest.register_node("techage:ta4_reactor_stand", { @@ -76,14 +76,14 @@ minetest.register_node("techage:ta4_reactor_stand", { drawtype = "nodebox", node_box = { type = "fixed", - fixed = { + fixed = { { -8/16, 2/16, -8/16, 8/16, 4/16, 8/16 }, - + { -8/16, -8/16, -8/16, -6/16, 8/16, -6/16 }, { 6/16, -8/16, -8/16, 8/16, 8/16, -6/16 }, { -8/16, -8/16, 6/16, -6/16, 8/16, 8/16 }, { 6/16, -8/16, 6/16, 8/16, 8/16, 8/16 }, - + {-1/8, -4/8, -1/8, 1/8, 4/8, 1/8}, {-4/8, -1/8, -1/8, 4/8, 1/8, 1/8}, {-4/8, -1/8, -3/8, -3/8, 1/8, 3/8}, @@ -94,7 +94,7 @@ minetest.register_node("techage:ta4_reactor_stand", { type = "fixed", fixed = {-1/2, -1/2, -1/2, 1/2, 1/2, 1/2}, }, - + after_place_node = function(pos, placer) local nvm = techage.get_nvm(pos) M(pos):set_string("infotext", S("off")) @@ -117,7 +117,7 @@ minetest.register_node("techage:ta4_reactor_stand", { Cable:after_dig_node(pos) techage.del_mem(pos) end, - + paramtype = "light", use_texture_alpha = techage.CLIP, paramtype2 = "facedir", @@ -155,7 +155,7 @@ techage.register_node({"techage:ta4_reactor_stand"}, { local nvm = techage.get_nvm(pos) if nvm.has_power then play_sound(pos) - end + end end, }) @@ -170,7 +170,7 @@ minetest.register_node("techage:ta4_reactor_base", { "techage_concrete.png", "techage_concrete.png", }, - + after_place_node = function(pos, placer) M(pos):set_int("outdir", networks.side_to_outdir(pos, "R")) Pipe:after_place_node(pos) @@ -178,7 +178,7 @@ minetest.register_node("techage:ta4_reactor_base", { after_dig_node = function(pos, oldnode, oldmetadata, digger) Pipe:after_dig_node(pos) end, - + paramtype2 = "facedir", on_rotate = screwdriver.disallow, groups = {cracky=2}, diff --git a/techage/coal_power_station/boiler_base.lua b/techage/coal_power_station/boiler_base.lua index a2b39e5..73c37d5 100644 --- a/techage/coal_power_station/boiler_base.lua +++ b/techage/coal_power_station/boiler_base.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3 Coal Power Station Boiler Base ]]-- @@ -39,7 +39,7 @@ minetest.register_node("techage:coalboiler_base", { after_place_node = after_place_node, after_dig_node = after_dig_node, - + paramtype = "light", paramtype2 = "facedir", on_rotate = screwdriver.disallow, @@ -49,7 +49,7 @@ minetest.register_node("techage:coalboiler_base", { }) Pipe:add_secondary_node_names({"techage:coalboiler_base"}) - + -- for logical communication techage.register_node({"techage:coalboiler_base"}, { on_transfer = function(pos, in_dir, topic, payload) @@ -65,4 +65,3 @@ minetest.register_craft({ {"default:stone", "default:stone", "default:stone"}, }, }) - diff --git a/techage/coal_power_station/boiler_top.lua b/techage/coal_power_station/boiler_top.lua index 050b61a..9ec177f 100644 --- a/techage/coal_power_station/boiler_top.lua +++ b/techage/coal_power_station/boiler_top.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3 Coal Power Station Boiler Top ]]-- @@ -62,14 +62,14 @@ minetest.register_node("techage:coalboiler_top", { type = "fixed", fixed = {-13/32, -48/32, -13/32, 13/32, 16/32, 13/32}, }, - + can_dig = boiler.can_dig, on_timer = node_timer, on_rightclick = boiler.on_rightclick, after_place_node = after_place_node, after_dig_node = after_dig_node, on_punch = boiler.on_punch, - + paramtype = "light", paramtype2 = "facedir", groups = {cracky=1}, @@ -108,4 +108,3 @@ minetest.register_craft({ {"default:stone", "", "default:stone"}, }, }) - diff --git a/techage/coal_power_station/cooler.lua b/techage/coal_power_station/cooler.lua index 148cfb3..3cb2aae 100644 --- a/techage/coal_power_station/cooler.lua +++ b/techage/coal_power_station/cooler.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3 Cooler ]]-- @@ -19,7 +19,7 @@ local S = techage.S local Pipe = techage.SteamPipe local function transfer(pos, in_dir, topic, payload) - return techage.transfer(pos, in_dir, topic, payload, Pipe, + return techage.transfer(pos, in_dir, topic, payload, Pipe, {"techage:coalboiler_base"}) end @@ -61,10 +61,10 @@ minetest.register_node("techage:cooler", { "techage_filling_ta3.png^techage_frame_ta3.png^techage_cooler.png", "techage_filling_ta3.png^techage_frame_ta3.png^techage_cooler.png", }, - + after_place_node = after_place_node, after_dig_node = after_dig_node, - + paramtype2 = "facedir", groups = {cracky=2, crumbly=2, choppy=2}, on_rotate = screwdriver.disallow, @@ -102,10 +102,10 @@ minetest.register_node("techage:cooler_on", { "techage_filling_ta3.png^techage_frame_ta3.png^techage_cooler.png", "techage_filling_ta3.png^techage_frame_ta3.png^techage_cooler.png", }, - + after_place_node = after_place_node, after_dig_node = after_dig_node, - + paramtype2 = "facedir", drop = "techage:cooler", groups = {cracky=2, crumbly=2, choppy=2, not_in_creative_inventory=1}, @@ -131,4 +131,3 @@ minetest.register_craft({ {"basic_materials:steel_bar", "default:wood", "basic_materials:steel_bar"}, }, }) - diff --git a/techage/coal_power_station/firebox.lua b/techage/coal_power_station/firebox.lua index bdb7c4c..c8849dd 100644 --- a/techage/coal_power_station/firebox.lua +++ b/techage/coal_power_station/firebox.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3 Coal Power Station Firebox ]]-- @@ -25,7 +25,7 @@ local BURN_CYCLE_FACTOR = 0.5 local function node_timer(pos, elapsed) local nvm = techage.get_nvm(pos) local power = techage.transfer( - {x=pos.x, y=pos.y+2, z=pos.z}, + {x=pos.x, y=pos.y+2, z=pos.z}, nil, -- outdir "trigger", -- topic nil, -- payload @@ -34,7 +34,7 @@ local function node_timer(pos, elapsed) ) nvm.burn_cycles = (nvm.burn_cycles or 0) - math.max((power or 0.02), 0.02) if nvm.burn_cycles <= 0 then - local taken = firebox.get_fuel(pos) + local taken = firebox.get_fuel(pos) if taken then nvm.burn_cycles = (firebox.Burntime[taken:get_name()] or 1) / CYCLE_TIME * BURN_CYCLE_FACTOR nvm.burn_cycles_total = nvm.burn_cycles @@ -83,7 +83,7 @@ minetest.register_node("techage:coalfirebox", { allow_metadata_inventory_put = firebox.allow_metadata_inventory_put, allow_metadata_inventory_take = firebox.allow_metadata_inventory_take, on_rightclick = firebox.on_rightclick, - + after_place_node = function(pos, placer) if firebox.is_free_position(pos, placer:get_player_name()) then techage.add_node(pos, "techage:coalfirebox") diff --git a/techage/coal_power_station/generator.lua b/techage/coal_power_station/generator.lua index fc875ef..e744574 100644 --- a/techage/coal_power_station/generator.lua +++ b/techage/coal_power_station/generator.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3 Power Station Generator ]]-- @@ -30,7 +30,7 @@ local function formspec(self, pos, nvm) end local function transfer_turbine(pos, topic, payload) - return techage.transfer(pos, "L", topic, payload, nil, + return techage.transfer(pos, "L", topic, payload, nil, {"techage:turbine", "techage:turbine_on"}) end @@ -145,7 +145,7 @@ minetest.register_node("techage:generator", { "techage_filling_ta3.png^techage_frame_ta3.png^techage_appl_generator.png", "techage_filling_ta3.png^techage_frame_ta3.png^techage_appl_generator.png^[transformFX]", }, - + on_receive_fields = on_receive_fields, on_rightclick = on_rightclick, on_timer = node_timer, @@ -190,7 +190,7 @@ minetest.register_node("techage:generator_on", { }, }, }, - + on_receive_fields = on_receive_fields, on_rightclick = on_rightclick, on_timer = node_timer, @@ -247,7 +247,7 @@ control.register_nodes({"techage:generator", "techage:generator_on"}, { running = techage.is_running(nvm) or false, available = PWR_PERF, provided = nvm.provided or 0, - termpoint = meta:get_string("termpoint"), + termpoint = meta:get_string("termpoint"), } end return false diff --git a/techage/coal_power_station/oilfirebox.lua b/techage/coal_power_station/oilfirebox.lua index eff5593..960d581 100644 --- a/techage/coal_power_station/oilfirebox.lua +++ b/techage/coal_power_station/oilfirebox.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3 Coal Power Station Firebox ]]-- @@ -28,7 +28,7 @@ local BURN_CYCLE_FACTOR = 0.5 local function node_timer(pos, elapsed) local nvm = techage.get_nvm(pos) local power = techage.transfer( - {x=pos.x, y=pos.y+2, z=pos.z}, + {x=pos.x, y=pos.y+2, z=pos.z}, nil, -- outdir "trigger", -- topic nil, -- payload @@ -85,7 +85,7 @@ minetest.register_node("techage:oilfirebox", { can_dig = fuel.can_dig, on_rightclick = fuel.on_rightclick, on_receive_fields = fuel.on_receive_fields, - + after_place_node = function(pos, placer) if firebox.is_free_position(pos, placer:get_player_name()) then techage.add_node(pos, "techage:oilfirebox") @@ -103,7 +103,7 @@ minetest.register_node("techage:oilfirebox", { return true end end, - + on_destruct = function(pos) firebox.set_firehole(pos, nil) end, @@ -142,5 +142,3 @@ minetest.register_craft({ {'', '', ''}, }, }) - - diff --git a/techage/coal_power_station/turbine.lua b/techage/coal_power_station/turbine.lua index 479d489..5d825e4 100644 --- a/techage/coal_power_station/turbine.lua +++ b/techage/coal_power_station/turbine.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3 Power Station Turbine ]]-- @@ -19,12 +19,12 @@ local S = techage.S local Pipe = techage.SteamPipe local function transfer_cooler(pos, topic, payload) - return techage.transfer(pos, 6, topic, payload, Pipe, + return techage.transfer(pos, 6, topic, payload, Pipe, {"techage:cooler", "techage:cooler_on"}) end local function transfer_generator(pos, topic, payload) - return techage.transfer(pos, "R", topic, payload, nil, + return techage.transfer(pos, "R", topic, payload, nil, {"techage:generator", "techage:generator_on"}) end @@ -41,7 +41,7 @@ local function play_sound(pos) local mem = techage.get_mem(pos) if not mem.handle or mem.handle == -1 then mem.handle = minetest.sound_play("techage_turbine", { - pos = pos, + pos = pos, gain = 1, max_hear_distance = 15, loop = true}) @@ -69,7 +69,7 @@ local function after_dig_node(pos, oldnode) techage.del_mem(pos) end -local function tubelib2_on_update2(pos, outdir, tlib2, node) +local function tubelib2_on_update2(pos, outdir, tlib2, node) swap_node(pos, "techage:turbine") stop_sound(pos) end @@ -85,11 +85,11 @@ minetest.register_node("techage:turbine", { "techage_filling_ta3.png^techage_appl_turbine.png^techage_frame_ta3.png", "techage_filling_ta3.png^techage_appl_turbine.png^techage_frame_ta3.png", }, - + after_place_node = after_place_node, after_dig_node = after_dig_node, tubelib2_on_update2 = tubelib2_on_update2, - + paramtype2 = "facedir", groups = {cracky=2, crumbly=2, choppy=2}, on_rotate = screwdriver.disallow, @@ -125,9 +125,9 @@ minetest.register_node("techage:turbine_on", { }, }, }, - + tubelib2_on_update2 = tubelib2_on_update2, - + paramtype2 = "facedir", groups = {not_in_creative_inventory=1}, diggable = false, @@ -168,7 +168,7 @@ techage.register_node({"techage:turbine", "techage:turbine_on"}, { on_node_load = function(pos, node) if node.name == "techage:turbine_on" then play_sound(pos) - end + end end, }) @@ -180,4 +180,3 @@ minetest.register_craft({ {"default:wood", "techage:iron_ingot", "basic_materials:steel_bar"}, }, }) - diff --git a/techage/collider/cooler.lua b/techage/collider/cooler.lua index 4161b08..e5f1871 100644 --- a/techage/collider/cooler.lua +++ b/techage/collider/cooler.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA4 Cooler as part of the Collider ]]-- @@ -60,7 +60,7 @@ minetest.register_node("techage:ta4_collider_cooler", { after_place_node = function(pos, placer, itemstack) Pipe:after_place_node(pos) end, - + after_dig_node = function(pos, oldnode) Pipe:after_dig_node(pos) techage.del_mem(pos) @@ -78,7 +78,7 @@ techage.register_node({"techage:ta4_collider_cooler"}, { return false end end, -}) +}) minetest.register_craft({ output = "techage:ta4_collider_cooler", @@ -88,4 +88,3 @@ minetest.register_craft({ {'', 'techage:aluminum', ''}, }, }) - diff --git a/techage/collider/detector.lua b/techage/collider/detector.lua index 6a38a27..2a50207 100644 --- a/techage/collider/detector.lua +++ b/techage/collider/detector.lua @@ -43,7 +43,7 @@ local Schedule = {[0] = local function play_sound(pos) minetest.sound_play("techage_hum", { - pos = pos, + pos = pos, gain = 0.5, max_hear_distance = 10, }) @@ -52,12 +52,12 @@ end local function terminal_message(pos, msg) local term_num = M(pos):contains("term_num") and M(pos):get_string("term_num") local own_num = M(pos):get_string("node_number") - + if term_num and own_num then techage.send_single(own_num, term_num, "text", msg) end end - + local function experience_points(pos) if math.random(PROBABILITY) == 1 then local owner = M(pos):get_string("owner") @@ -92,11 +92,11 @@ local function check_state(pos) nvm.ticks = (nvm.ticks or 0) + 1 local idx = nvm.ticks % TIME_SLOTS local item = Schedule[idx] - + if idx == 1 then nvm.result = true end - + if item then if item.name == "shell" then local res, err = check_shell(pos, param2) @@ -130,7 +130,7 @@ local function check_state(pos) return nvm.result end end - + local function add_laser(pos) local param2 = minetest.get_node(pos).param2 local pos1 = getpos(pos, param2, {3,3}, 1) @@ -144,14 +144,14 @@ local function create_task(pos, task) if not mem.co then mem.co = coroutine.create(task) end - + local _, err = coroutine.resume(mem.co, pos) if err then mem.co = nil --print(err) return end - minetest.after(0.4, create_task, pos) + minetest.after(0.4, create_task, pos, task) end -- Call on_cyclic_check of all magents so that the magnets don't need a FLB. @@ -227,10 +227,10 @@ minetest.register_node("techage:ta4_detector_core", { end return true end, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) techage.on_remove_collider(digger) - techage.remove_node(pos, oldnode, oldmetadata) + techage.remove_node(pos, oldnode, oldmetadata) techage.del_mem(pos) end, }) @@ -247,7 +247,7 @@ local function start_task(pos) local own_num = M(pos):get_string("node_number") local nvm = techage.get_nvm(pos) nvm.magnet_positions = {} - + if term_num and param2 and pos2 then techage.send_single(own_num, term_num, "text", "#### Start ####") @@ -267,7 +267,7 @@ local function start_task(pos) return end techage.send_single(own_num, term_num, "append", "ok") - + coroutine.yield() techage.send_single(own_num, term_num, "text", "- Start magnets...") local t = {} @@ -285,7 +285,7 @@ local function start_task(pos) end nvm.magnet_positions = t techage.send_single(own_num, term_num, "append", "ok") - + coroutine.yield() techage.send_single(own_num, term_num, "text", "- Check magnets...") -- The check will be performed by the timer, so wait 5 sec. @@ -298,7 +298,7 @@ local function start_task(pos) nvm.locked = false return end - + coroutine.yield() techage.send_single(own_num, term_num, "text", "- Check detector...") for _,item in ipairs(Schedule)do @@ -333,14 +333,14 @@ local function start_task(pos) end end techage.send_single(own_num, term_num, "append", "ok") - + coroutine.yield() techage.send_single(own_num, term_num, "text", "Collider started.") nvm.ticks = 0 nvm.running = true end end - + local function test_magnet(pos, payload) local term_num = M(pos):contains("term_num") and M(pos):get_string("term_num") local param2 = minetest.get_node(pos).param2 @@ -363,7 +363,7 @@ techage.register_node({"techage:ta4_detector_core"}, { return true elseif topic == "start" then -- Worker block - nvm.locked = true + nvm.locked = true create_task(pos, start_task) return true elseif topic == "stop" then @@ -381,7 +381,7 @@ techage.register_node({"techage:ta4_detector_core"}, { end elseif topic == "test"then if payload and tonumber(payload) then - test_magnet(pos, payload) + test_magnet(pos, payload) return true else return "Invalid magnet number" @@ -400,7 +400,7 @@ techage.register_node({"techage:ta4_detector_core"}, { on_node_load = function(pos) minetest.get_node_timer(pos):start(CYCLE_TIME) end, -}) +}) minetest.register_craft({ @@ -411,4 +411,3 @@ minetest.register_craft({ {'default:steel_ingot', '', 'techage:aluminum'}, }, }) - diff --git a/techage/collider/inlets.lua b/techage/collider/inlets.lua index 10bd185..7826026 100644 --- a/techage/collider/inlets.lua +++ b/techage/collider/inlets.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA4 Tube/Pipe Inputs/Outputs as part of the Collider ]]-- @@ -64,7 +64,7 @@ minetest.register_node("techage:ta4_collider_tube_inlet", { after_place_node = function(pos, placer, itemstack) VTube:after_place_node(pos) end, - + after_dig_node = function(pos, oldnode) VTube:after_dig_node(pos) techage.del_mem(pos) @@ -87,10 +87,10 @@ techage.register_node({"techage:ta4_collider_tube_inlet"}, { return true end end, -}) +}) -- Used by the detector to check the tube connection -function techage.tube_inlet_command(pos, command, payload) +function techage.tube_inlet_command(pos, command, payload) if command == "distance" then local pos2 = techage.transfer(pos, "F", command, payload, VTube, {"techage:ta4_magnet"}) if type(pos2) == "table" then @@ -144,7 +144,7 @@ minetest.register_node("techage:ta4_collider_pipe_inlet", { Pipe:after_place_node(pos) nvm.liquid = {} end, - + after_dig_node = function(pos, oldnode) Pipe:after_dig_node(pos) techage.del_mem(pos) @@ -180,10 +180,10 @@ techage.register_node({"techage:ta4_collider_pipe_inlet"}, { return true end end, -}) +}) -- Used by the detector to check for gas pressure -function techage.gas_inlet_check(pos, node, meta, nvm) +function techage.gas_inlet_check(pos, node, meta, nvm) nvm.liquid = nvm.liquid or {} if nvm.liquid.amount == GAS_CAPA and nvm.liquid.name == "techage:isobutane" then return true @@ -192,7 +192,7 @@ function techage.gas_inlet_check(pos, node, meta, nvm) end -- Used by the detector to check for cooler connection -function techage.cooler_check(pos, node, meta, nvm) +function techage.cooler_check(pos, node, meta, nvm) if nvm.detector_received then nvm.detector_received = nil return true @@ -247,7 +247,7 @@ minetest.register_node("techage:ta4_collider_pipe_outlet", { init_air(nvm) Pipe:after_place_node(pos) end, - + after_dig_node = function(pos, oldnode) Pipe:after_dig_node(pos) techage.del_mem(pos) @@ -275,7 +275,7 @@ liquid.register_nodes({"techage:ta4_collider_pipe_outlet"}, Pipe, "tank", {"U"}, }) -- Used by the detector to check the vacuum -function techage.air_outlet_check(pos, node, meta, nvm) +function techage.air_outlet_check(pos, node, meta, nvm) nvm.liquid = nvm.liquid or {} if nvm.liquid.amount == 0 then return true @@ -283,7 +283,7 @@ function techage.air_outlet_check(pos, node, meta, nvm) return false, "no vacuum" end -function techage.air_outlet_reset(pos) +function techage.air_outlet_reset(pos) local nvm = techage.get_nvm(pos) init_air(nvm) end @@ -325,13 +325,13 @@ minetest.register_node("techage:ta4_collider_cable_inlet", { Cable:after_place_node(pos) minetest.get_node_timer(pos):start(CYCLE_TIME) end, - + on_timer = function(pos, elapsed) local nvm = techage.get_nvm(pos) nvm.consumed = power.consume_power(pos, Cable, nil, PWR_NEEDED) return true end, - + after_dig_node = function(pos, oldnode) Cable:after_dig_node(pos) techage.del_mem(pos) @@ -339,7 +339,7 @@ minetest.register_node("techage:ta4_collider_cable_inlet", { }) -- Used by the detector to check for power -function techage.power_inlet_check(pos, node, meta, nvm) +function techage.power_inlet_check(pos, node, meta, nvm) if nvm.consumed == PWR_NEEDED then return true end @@ -352,7 +352,7 @@ techage.register_node({"techage:ta4_collider_cable_inlet"}, { on_node_load = function(pos) minetest.get_node_timer(pos):start(CYCLE_TIME) end, -}) +}) minetest.register_craft({ output = "techage:ta4_collider_cable_inlet", diff --git a/techage/collider/magnet.lua b/techage/collider/magnet.lua index b7314f3..4062413 100644 --- a/techage/collider/magnet.lua +++ b/techage/collider/magnet.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA4 Magnet as part of the Collider ]]-- @@ -60,9 +60,9 @@ minetest.register_node("techage:ta4_detector_magnet", { minetest.register_node("techage:ta4_magnet", { description = S("TA4 Collider Magnet"), inventory_image = minetest.inventorycube( - "techage_collider_magnet.png^techage_appl_hole_electric.png", + "techage_collider_magnet.png^techage_appl_hole_electric.png", "techage_collider_magnet.png^techage_appl_hole_pipe.png", - "techage_collider_magnet.png^techage_collider_magnet_tube.png"), + "techage_collider_magnet.png^techage_collider_magnet_tube.png"), tiles = { -- up, down, right, left, back, front "techage_collider_magnet.png^techage_appl_hole_electric.png", @@ -111,7 +111,7 @@ minetest.register_node("techage:ta4_magnet", { VTube:after_place_node(pos) M(pos):set_string("infotext", S("TA4 Collider Magnet") .. " #0") end, - + -- To be called by the detector on_cyclic_check = function(pos) local nvm = techage.get_nvm(pos) @@ -120,15 +120,15 @@ minetest.register_node("techage:ta4_magnet", { if nvm.tube_damage then nvm.tube_damage = nil return -1 - elseif nvm.liquid.amount == CAPACITY and - nvm.liquid.name == "techage:isobutane" and + elseif nvm.liquid.amount == CAPACITY and + nvm.liquid.name == "techage:isobutane" and nvm.consumed == PWR_NEEDED then return 0 end return -2 end, - - tubelib2_on_update2 = function(pos, outdir, tlib2, node) + + tubelib2_on_update2 = function(pos, outdir, tlib2, node) if tlib2.tube_type == "vtube" then local nvm = techage.get_nvm(pos) nvm.tube_damage = true @@ -138,7 +138,7 @@ minetest.register_node("techage:ta4_magnet", { nvm.liquid.amount = 0 end end, - + after_dig_node = function(pos, oldnode) Pipe:after_dig_node(pos) Cable:after_dig_node(pos) @@ -172,14 +172,14 @@ VTube:add_secondary_node_names({"techage:ta4_magnet"}) VTube:set_valid_sides("techage:ta4_magnet", {"R", "L"}) local function send_to_next(pos, in_dir, topic, payload) - return techage.transfer(pos, in_dir, topic, payload, VTube, + return techage.transfer(pos, in_dir, topic, payload, VTube, {"techage:ta4_magnet", "techage:ta4_collider_tube_inlet"}) end --[[ Commands --------- - +-------- + distance : Check distance between all magnets. Returns pos of next magnet or the number of the defect magnet. enumerate : Give each magnet a unique number (1...n) @@ -231,7 +231,7 @@ techage.register_node({"techage:ta4_magnet"}, { end end end, -}) +}) minetest.register_node("techage:ta4_magnet_base", { description = S("TA4 Collider Magnet Base"), @@ -302,4 +302,4 @@ minetest.register_lbm({ nvm.liquid.name = "techage:isobutane" end end, -}) \ No newline at end of file +}) diff --git a/techage/collider/terminal.lua b/techage/collider/terminal.lua index 3d1c7ea..6ef6dd5 100644 --- a/techage/collider/terminal.lua +++ b/techage/collider/terminal.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information TA4 Terminal - + ]]-- local M = minetest.get_meta @@ -25,7 +25,7 @@ machine. Commands can have up to 80 characters. Local commands: - clear = clear screen -- help = this message +- help = this message - pub = switch to public use - priv = switch to private use - connect = connect the machine @@ -77,7 +77,7 @@ end local function command(pos, mem, player) local meta = minetest.get_meta(pos) local owner = meta:get_string("owner") - + if mem.command == "clear" then mem.output = "" mem.command = "" @@ -103,12 +103,12 @@ local function command(pos, mem, player) output(pos, "Switched to private use!") elseif meta:get_int("public") == 1 or owner == player then if mem.command == "clear" then - mem.output = + mem.output = mem.command = "" meta:set_string("formspec", formspec2(mem)) end end -end +end minetest.register_node("techage:ta4_terminal", { description = "TA4 Collider Terminal", @@ -136,7 +136,7 @@ minetest.register_node("techage:ta4_terminal", { {-12/32, -14/32, 12/32, 12/32, 6/32, 14/32}, }, }, - + after_place_node = function(pos, placer) local number = techage.add_node(pos, minetest.get_node(pos).name) local meta = minetest.get_meta(pos) @@ -169,11 +169,11 @@ minetest.register_node("techage:ta4_terminal", { meta:set_string("formspec", formspec2(mem)) end end, - + after_dig_node = function(pos, oldnode, oldmetadata) techage.remove_node(pos, oldnode, oldmetadata) end, - + paramtype = "light", use_texture_alpha = techage.CLIP, sunlight_propagates = true, diff --git a/techage/collider/vacuumtube.lua b/techage/collider/vacuumtube.lua index ad5b2be..9782670 100644 --- a/techage/collider/vacuumtube.lua +++ b/techage/collider/vacuumtube.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA4 Vacuum Tube as part of the Collider ]]-- @@ -18,10 +18,10 @@ local S = techage.S local VTube = tubelib2.Tube:new({ dirs_to_check = {1,2,3,4}, - max_tube_length = 5, + max_tube_length = 5, tube_type = "vtube", show_infotext = false, - primary_node_names = {"techage:ta4_vtubeS", "techage:ta4_vtubeA"}, + primary_node_names = {"techage:ta4_vtubeS", "techage:ta4_vtubeA"}, secondary_node_names = {"techage:ta4_magnet"}, after_place_tube = function(pos, param2, tube_type, num_tubes) minetest.swap_node(pos, {name = "techage:ta4_vtube"..tube_type, param2 = param2}) @@ -63,11 +63,11 @@ minetest.register_node("techage:ta4_vtubeS", { end return false end, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) VTube:after_dig_tube(pos, oldnode, oldmetadata) end, - + paramtype2 = "facedir", -- important! on_rotate = screwdriver.disallow, -- important! paramtype = "light", @@ -108,7 +108,7 @@ minetest.register_node("techage:ta4_vtubeA", { after_dig_node = function(pos, oldnode, oldmetadata, digger) VTube:after_dig_tube(pos, oldnode, oldmetadata) end, - + paramtype2 = "facedir", -- important! on_rotate = screwdriver.disallow, -- important! paramtype = "light", diff --git a/techage/collider/worker.lua b/techage/collider/worker.lua index dba2139..bc04421 100644 --- a/techage/collider/worker.lua +++ b/techage/collider/worker.lua @@ -19,7 +19,7 @@ local S = techage.S local AssemblyPlan = { -- y-offs, path, facedir-offs, name -- 0 = forward, 1 = right, 2 = backward, 3 = left - + -- level 1 -- left/right { 1, {3,3,3,2}, 0, "techage:ta4_colliderblock"}, @@ -45,7 +45,7 @@ local AssemblyPlan = { { 1, {3}, 0, "techage:ta4_detector_magnet"}, { 1, {1}, 0, "techage:ta4_detector_magnet"}, { 1, {1,1}, 0, "techage:ta4_detector_magnet"}, - + -- level 2 -- left/right { 2, {3,3,3,2}, 1, "techage:ta4_collider_pipe_inlet"}, @@ -93,7 +93,7 @@ local AssemblyPlan = { { 3, {}, 0, "techage:ta4_collider_pipe_outlet"}, { 3, {1}, 0, "techage:ta4_detector_magnet"}, { 3, {1,1}, 0, "techage:ta4_detector_magnet"}, - + -- Core block { 1, {}, 0, "techage:ta4_detector_core"}, } @@ -156,12 +156,12 @@ minetest.register_node("techage:ta4_collider_detector_worker", { inv:set_size("src", 9) M(pos):set_string("formspec", formspec()) end, - + on_receive_fields = function(pos, formname, fields, player) if minetest.is_protected(pos, player:get_player_name()) then return end - + local nvm = techage.get_nvm(pos) if fields.build then if not nvm.assemble_locked then @@ -176,7 +176,7 @@ minetest.register_node("techage:ta4_collider_detector_worker", { end end end, - + after_dig_node = function(pos, oldnode) techage.del_mem(pos) end, @@ -207,4 +207,3 @@ minetest.register_craft({ {'default:steel_ingot', 'default:mese_crystal', 'techage:aluminum'}, }, }) - diff --git a/techage/doc/guide.lua b/techage/doc/guide.lua index b65e121..61a8445 100644 --- a/techage/doc/guide.lua +++ b/techage/doc/guide.lua @@ -58,7 +58,7 @@ local function plan(images) end end return table.concat(tbl) -end +end local function formspec_help(meta, manual) local bttn @@ -123,13 +123,13 @@ minetest.register_node("techage:construction_board", { drawtype = "nodebox", node_box = board_box, selection_box = board_box, - + after_place_node = function(pos, placer, itemstack) local meta = minetest.get_meta(pos) meta:set_int("index", 1) meta:set_string("formspec", formspec_help(meta, techage.manual_DE)) end, - + on_receive_fields = function(pos, formname, fields, player) local player_name = player:get_player_name() if minetest.is_protected(pos, player_name) then @@ -149,7 +149,7 @@ minetest.register_node("techage:construction_board", { end end end, - + paramtype2 = "wallmounted", paramtype = "light", use_texture_alpha = techage.CLIP, @@ -175,13 +175,13 @@ minetest.register_node("techage:construction_board_EN", { drawtype = "nodebox", node_box = board_box, selection_box = board_box, - + after_place_node = function(pos, placer, itemstack) local meta = minetest.get_meta(pos) meta:set_int("index", 1) meta:set_string("formspec", formspec_help(meta, techage.manual_EN)) end, - + on_receive_fields = function(pos, formname, fields, player) local player_name = player:get_player_name() if minetest.is_protected(pos, player_name) then @@ -201,7 +201,7 @@ minetest.register_node("techage:construction_board_EN", { end end end, - + paramtype2 = "wallmounted", paramtype = "light", use_texture_alpha = techage.CLIP, diff --git a/techage/doc/items.lua b/techage/doc/items.lua index a2e822e..de6dc6c 100644 --- a/techage/doc/items.lua +++ b/techage/doc/items.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA Items Table ]]-- @@ -118,7 +118,7 @@ techage.Items = { ta3_programmer = "techage:programmer", ta3_doorcontroller = "techage:ta3_doorcontroller", ta3_drill_pipe_wrench = "techage:ta3_drill_pipe_wrench", - ta3_pipe = "techage:ta3_pipeS", + ta3_pipe = "techage:ta3_pipeS", ta3_pipe_wall_entry = "techage:ta3_pipe_wall_entry", ta3_mesecons_converter = "techage:ta3_mesecons_converter", ta3_valve = "techage:ta3_valve_closed", @@ -132,13 +132,13 @@ techage.Items = { ta4_blinklamp = "techage:rotor_signal_lamp_off", ta4_nacelle = "techage:ta4_wind_turbine_nacelle", ta4_minicell = "techage:ta4_solar_minicell", - ta4_pipe = "techage:ta4_pipeS", - ta4_tube = "techage:ta4_tubeS", - ta4_junctionpipe = "techage:ta4_junctionpipe25", - ta4_pipeinlet = "techage:ta4_pipe_inlet", + ta4_pipe = "techage:ta4_pipeS", + ta4_tube = "techage:ta4_tubeS", + ta4_junctionpipe = "techage:ta4_junctionpipe25", + ta4_pipeinlet = "techage:ta4_pipe_inlet", ta4_turbine = "techage:ta4_turbine", ta4_generator = "techage:ta4_generator", - ta4_heatexchanger = "techage:heatexchanger3", + ta4_heatexchanger = "techage:heatexchanger3", ta4_powercable = "techage:ta4_power_cableS", ta4_powerbox = "techage:ta4_power_box", ta4_solarmodule = "techage:ta4_solar_module", @@ -204,9 +204,11 @@ techage.Items = { ta4_recipeblock = "techage:ta4_recipeblock", ---------------------------- ta5_flycontroller = "techage:ta5_flycontroller", - ta5_aichip = "techage:ta5_aichip", - ta5_tele_pipe = "techage:ta5_tele_pipe", - ta5_tele_tube = "techage:ta5_tele_tube", + ta5_aichip = "techage:ta5_aichip", + ta5_tele_pipe = "techage:ta5_tele_pipe", + ta5_tele_tube = "techage:ta5_tele_tube", + ta5_chest = "techage:ta5_hl_chest", + ta5_tank = "techage:ta5_hl_tank", } @@ -214,4 +216,4 @@ function techage.add_manual_items(table_with_items) for name, tbl in pairs(table_with_items) do techage.Items[name] = tbl end -end \ No newline at end of file +end diff --git a/techage/doc/manual_DE.lua b/techage/doc/manual_DE.lua index 78d1df5..3ef0398 100644 --- a/techage/doc/manual_DE.lua +++ b/techage/doc/manual_DE.lua @@ -237,12 +237,13 @@ techage.manual_DE.aTitel = { "3,TA5 Flug Controller", "3,TA5 Hyperloop Kiste / TA5 Hyperloop Chest", "3,TA5 Hyperloop Tank / TA5 Hyperloop Tank", - "3,Hyperloop Teleport Blöcke (geplant)", - "3,TA5 Container (geplant)", + "3,TA5-Raumgleiter (geplant)", + "2,Teleport Blöcke", "3,TA5 Teleport Block Gegenstände / TA5 Teleport Block Items", "3,TA5 Teleport Block Flüssigkeiten / TA5 Teleport Block Liquids", - "3,TA5-Raumgleiter (geplant)", + "3,Hyperloop Teleport Blöcke (geplant)", "2,Weitere TA5 Blöcke/Items", + "3,TA5 Container (geplant)", "3,TA5 KI Chip / TA5 AI Chip", } @@ -2019,35 +2020,39 @@ techage.manual_DE.aText = { "\n".. "\n".. "\n", + "Dank einem Spezialantrieb für Lichtgeschwindigkeit können mit dem Raumgleiter auch große Entfernungen sehr schnell überwunden werden.\n".. + "\n", + "Mit Teleport-Blöcken können Dinge zwischen zwei Teleport-Blöcken übertragen werden\\, ohne dass sich dazwischen eine Röhre oder Leitung befinden muss. Für das Pairing der Blöcke musst du zuerst auf der einen Seite einen Namen für den Block eingeben\\, dann kannst du bei dem anderen Block diesen Namen auswählen und so die beiden Blöcke verbinden. Das Pairung kann nur von einem Spieler durchgeführt werden (Spielername wird geprüft) und muss vor einem Server-Neustart abgeschlossen sein. Anderenfalls gehen die Pairing-Daten verloren.\n".. + "\n".. + "Der Plan rechts zeigt\\, wie die Blöcke genutzt werden können.\n".. + "\n".. + "\n".. + "\n", + "Diese Teleport-Blöcke erlauben die Übertragung von Gegenständen und ersetzen somit eine Röhre. Dabei können Entfernungen von bis zu 200 Blöcken überbrückt werden.\n".. + "\n".. + "Ein Teleport-Block benötigt 12 ku Strom.\n".. + "\n".. + "Für die Nutzung der Teleport-Blöcke werden 60 Erfahrungspunkte benötigt.\n".. + "\n".. + "\n".. + "\n", + "Diese Teleport-Blöcke erlauben die Übertragung von Flüssigkeiten und ersetzen somit eine gelbe Leitung. Dabei können Entfernungen von bis zu 200 Blöcken überbrückt werden.\n".. + "\n".. + "Ein Teleport-Block benötigt 12 ku Strom.\n".. + "\n".. + "Für die Nutzung der Teleport-Blöcke werden 60 Erfahrungspunkte benötigt.\n".. + "\n".. + "\n".. + "\n", "Die Hyperloop Teleport Blöcke erlauben den Aufbau von Hyperloop Netzwerk ohne Hyperloop-Röhren.\n".. "\n".. "Die Nutzung der Hyperloop Teleport Blöcke benötigt 120 Erfahrungspunkte.\n".. "\n", + "", "Der TA5 Container erlaubt Techage Anlagen ein- und an einer anderen Stelle wieder auszupacken.\n".. "\n".. "Für die Nutzung des TA5 Containers werden 80 Erfahrungspunkte benötigt.\n".. "\n", - "Teleportblöcke erlauben den Item-Transport ohne Röhren bis zu einer Entfernung von 200 Blöcken.\n".. - "Für das Pairing musst du zuerst auf der einen Seite einen Namen für den Block eingeben\\, dann kannst du bei dem anderen Block diesen Namen auswählen und so die beiden Blöcke verbinden.\n".. - "\n".. - "Teleportblöcke benötigen jeweils 12 ku Strom.\n".. - "\n".. - "Für die Nutzung der Teleportblöcke werden 60 Erfahrungspunkte benötigt.\n".. - "\n".. - "\n".. - "\n", - "Teleportblöcke erlauben den Flüssigkeiten-Transport ohne Leitungen bis zu einer Entfernung von 200 Blöcken.\n".. - "Für das Pairing musst du zuerst auf der einen Seite einen Namen für den Block eingeben\\, dann kannst du bei dem anderen Block diesen Namen auswählen und so die beiden Blöcke verbinden.\n".. - "\n".. - "Teleportblöcke benötigen jeweils 12 ku Strom.\n".. - "\n".. - "Für die Nutzung der Teleportblöcke werden 60 Erfahrungspunkte benötigt.\n".. - "\n".. - "\n".. - "\n", - "Dank einem Spezialantrieb für Lichtgeschwindigkeit können mit dem Raumgleiter auch große Entfernungen sehr schnell überwunden werden.\n".. - "\n", - "", "Der TA5 KI Chip wird teilweise zur Herstellung von TA5 Blöcken benötigt. Der TA5 KI Chip kann nur auf der TA4 Elektronik Fab hergestellt werden. Dazu werden 10 Erfahrungspunkte benötigt.\n".. "\n".. "\n".. @@ -2289,14 +2294,15 @@ techage.manual_DE.aItemName = { "", "", "ta5_flycontroller", - "ta4_chest", - "ta4_tank", + "ta5_chest", + "ta5_tank", "", "", "ta5_tele_tube", "ta5_tele_pipe", "", "", + "", "ta5_aichip", } @@ -2538,6 +2544,7 @@ techage.manual_DE.aPlanTable = { "", "", "", + "ta5_teleport", "", "", "", @@ -2545,4 +2552,3 @@ techage.manual_DE.aPlanTable = { "", "", } - diff --git a/techage/doc/manual_EN.lua b/techage/doc/manual_EN.lua index 37b4a12..024086f 100644 --- a/techage/doc/manual_EN.lua +++ b/techage/doc/manual_EN.lua @@ -237,11 +237,12 @@ techage.manual_EN.aTitel = { "3,TA5 Flight Controller", "3,TA5 Hyperloop Chest", "3,TA5 Hyperloop Tank", - "3,Hyperloop Teleport Blocks (planned)", - "3,TA5 Container (planned)", + "2,Teleport Blocks", "3,TA5 Teleport Block Items", "3,TA5 Teleport Block Liquids", - "2,More TA5 Blocks / Items", + "3,Hyperloop Teleport Blocks (planned)", + "2,More TA5 Blocks/Items", + "3,TA5 Container (planned)", "3,TA5 AI Chip", } @@ -2016,33 +2017,37 @@ techage.manual_EN.aText = { "\n".. "\n".. "\n", + "Teleport blocks allow things to be transferred between two teleport blocks without the need for a pipe or tube in between. To pair the blocks\\, you first have to enter a name for the block on one side\\, then you can select this name for the other block and thus connect the two blocks. Pairing can only be carried out by one player (player name is checked) and must be completed before the server is restarted. Otherwise the pairing data will be lost.\n".. + "\n".. + "The map on the right shows how the blocks can be used. \n".. + "\n".. + "\n".. + "\n", + "These teleport blocks allow the transfer of items and thus replace a tube. Distances of up to 200 blocks can be bridged.\n".. + "\n".. + "Each Teleport blocks requires 12 ku of electricity.\n".. + "\n".. + "60 experience points are required to use the teleport blocks. \n".. + "\n".. + "\n".. + "\n", + "These teleport blocks allow the transfer of liquids and thus replace a pipe. Distances of up to 200 blocks can be bridged.\n".. + "\n".. + "Each Teleport blocks requires 12 ku of electricity.\n".. + "\n".. + "60 experience points are required to use the teleport blocks. \n".. + "\n".. + "\n".. + "\n", "The Hyperloop Teleport Blocks allow the construction of a Hyperloop network without Hyperloop tubes.\n".. "\n".. "The use of the Hyperloop Teleport Blocks requires 120 experience points.\n".. "\n", + "", "The TA5 container allows Techage systems to be packed and unpacked at another location.\n".. "\n".. "80 experience points are required to use the TA5 container.\n".. "\n", - "Teleport blocks allow items to be transported without tubes up to a distance of 200 blocks.\n".. - "For pairing you first have to enter a name for the block on one side\\, then you can select this name for the other block and thus connect the two blocks.\n".. - "\n".. - "Teleport blocks each require 12 ku of electricity.\n".. - "\n".. - "60 experience points are required to use the Teleport blocks.\n".. - "\n".. - "\n".. - "\n", - "Teleport blocks allow liquids to be transported without pipes up to a distance of 200 blocks.\n".. - "For pairing you first have to enter a name for the block on one side\\, then you can select this name for the other block and thus connect the two blocks.\n".. - "\n".. - "Teleport blocks each require 12 ku of electricity.\n".. - "\n".. - "60 experience points are required to use the Teleport blocks.\n".. - "\n".. - "\n".. - "\n", - "", "The TA5 AI Chip is partly required for the production of TA5 blocks. The TA5 AI Chip can only be manufactured at the TA4 Electronics Fab. This requires 10 experience points.\n".. "\n".. "\n".. @@ -2284,13 +2289,14 @@ techage.manual_EN.aItemName = { "", "", "ta5_flycontroller", - "ta4_chest", - "ta4_tank", - "", + "ta5_chest", + "ta5_tank", "", "ta5_tele_tube", "ta5_tele_pipe", "", + "", + "", "ta5_aichip", } @@ -2531,6 +2537,7 @@ techage.manual_EN.aPlanTable = { "", "", "", + "ta5_teleport", "", "", "", @@ -2538,4 +2545,3 @@ techage.manual_EN.aPlanTable = { "", "", } - diff --git a/techage/doc/manual_api.lua b/techage/doc/manual_api.lua index d133de3..b8eb70b 100644 --- a/techage/doc/manual_api.lua +++ b/techage/doc/manual_api.lua @@ -7,14 +7,14 @@ AGPL v3 See LICENSE.txt for more information - + API to add further chapters to the manuals ]]-- function techage.add_to_manual(language, titles, texts, items, plans) local tbl - + if language == "DE" then tbl = techage.manual_DE elseif language == "EN" then @@ -37,5 +37,3 @@ function techage.add_to_manual(language, titles, texts, items, plans) tbl.aPlanTable[#tbl.aPlanTable + 1] = item end end - - diff --git a/techage/doc/plans.lua b/techage/doc/plans.lua index b2c50f4..6934d54 100644 --- a/techage/doc/plans.lua +++ b/techage/doc/plans.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + Constructioon Plans for TA machines ]]-- @@ -162,8 +162,8 @@ techage.ConstructionPlans["steamengine"] = { {false, BOIL2, false, PI090, false, false, false}, {false, BOIL1, false, PI090, false, false, false}, {false, FIBOX, false, PK090, CYLIN, FLYWH, false}, -} - +} + -- -- TA2 Storage -- @@ -185,7 +185,7 @@ techage.ConstructionPlans["ta2_storage"] = { {false, false, false, AXL90, WCHST, false, false}, {false, false, false, AXL90, false, false, false}, {AXL00, AXL00, AXL00, GRBOX, false, false, false}, -} +} -- -- Item Transport @@ -201,7 +201,7 @@ techage.ConstructionPlans["itemtransport"] = { {false}, {false}, {CHEST, PUSHR, TB000, GRIND, PUSHR, DISTR, TB000, SIEV2, PUSHR, TB000, CHEST}, -} +} -- -- Gravel Rinser @@ -215,7 +215,7 @@ local TK090 = {"techage_tube_knee.png^[transformR90", "techage:tubeS"} -- '7' local TK180 = {"techage_tube_knee.png^[transformR180", "techage:tubeS"} local TK270 = {"techage_tube_knee.png^[transformR270", "techage:tubeS"} -techage.ConstructionPlans["gravelrinser"] = { +techage.ConstructionPlans["gravelrinser"] = { {false, false, false, SIDEV, false, false, false, false}, {false, GLASS, WATER, GLASS, GLASS, GLASS, GLASS, GLASS}, {false, DDIRT, DDIRT, TK000, RINSR, TK270, HOPPR, CHEST}, @@ -290,8 +290,8 @@ techage.ConstructionPlans["ta3_tank"] = { -- -- TA3 Oil Loading station -- -local MCART = {minetest.inventorycube("carts_cart_top.png", - "carts_cart_side.png^minecart_logo.png", "carts_cart_side.png^minecart_logo.png"), +local MCART = {minetest.inventorycube("carts_cart_top.png", + "carts_cart_side.png^minecart_logo.png", "carts_cart_side.png^minecart_logo.png"), "minecart:cart"} local PRAIL = {"carts_rail_straight_pwr.png", "carts:powerrail"} local PRAIH = {"carts_rail_straight_pwr.png^[transformR90", "carts:powerrail"} @@ -493,6 +493,26 @@ techage.ConstructionPlans["ta4_cooler"] = { {false, false, false, false, false, false, false, false, false}, } +-- +-- TA5 Teleport Blocks +-- +local TELEP = {"techage_filling_ta4.png^techage_frame_ta5.png^techage_appl_teleport.png", "techage:ta5_tele_pipe"} +local TELET = {"techage_filling_ta4.png^techage_frame_ta5.png^techage_appl_teleport.png", "techage:ta5_tele_tube"} +local PUMP4 = {"techage_filling_ta4.png^techage_appl_pump.png^techage_frame_ta4.png", "techage:t4_pump"} +local ARROW = {"techage_form_arrow.png"} + +techage.ConstructionPlans["ta5_teleport"] = { + {false, false, false, false, false, false, false, false, false, false, false}, + {false, CHEST, PushR, TELET, false, ARROW, false, TELET, Tubes, CHEST, false}, + {false, false, false, false, false, false, false, false, false, false, false}, + {false, CHEST, Tubes, TELET, false, ARROW, false, TELET, PushR, CHEST, false}, + {false, false, false, false, false, false, false, false, false, false, false}, + {false, false, false, false, false, false, false, false, false, false, false}, + {false, TANK4, PUMP4, TELEP, false, ARROW, false, TELEP, PIPEH, TANK4, false}, + {false, false, false, false, false, false, false, false, false, false, false}, + {false, TANK4, PIPEH, TELEP, false, ARROW, false, TELEP, PUMP4, TANK4, false}, +} + function techage.add_manual_plans(table_with_plans) for name, tbl in pairs(table_with_plans) do techage.ConstructionPlans[name] = tbl diff --git a/techage/energy_storage/generator.lua b/techage/energy_storage/generator.lua index ef0c30c..4621661 100644 --- a/techage/energy_storage/generator.lua +++ b/techage/energy_storage/generator.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA4 TES Generator (dummy) - can be started and stopped - provides netID of cable network @@ -40,7 +40,7 @@ minetest.register_node("techage:ta4_generator", { "techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_generator.png", "techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_generator.png^[transformFX]", }, - + after_place_node = function(pos) M(pos):set_int("outdir", networks.side_to_outdir(pos, "R")) Cable:after_place_node(pos) @@ -86,7 +86,7 @@ minetest.register_node("techage:ta4_generator_on", { }, }, }, - + paramtype2 = "facedir", drop = "", groups = {not_in_creative_inventory=1}, @@ -128,5 +128,3 @@ minetest.register_craft({ {"", "techage:ta4_wlanchip", ""}, }, }) - - diff --git a/techage/energy_storage/heatexchanger1.lua b/techage/energy_storage/heatexchanger1.lua index 198f587..6efc2bb 100644 --- a/techage/energy_storage/heatexchanger1.lua +++ b/techage/energy_storage/heatexchanger1.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA4 Heat Exchanger1 (bottom part) - has a connection to storage and turbine (via pipes) - acts as a cable junction for Exchanger2 @@ -44,7 +44,7 @@ minetest.register_node("techage:heatexchanger1", { "techage_filling_ta4.png^techage_frameB_ta4.png^techage_appl_hole_electric.png", "techage_filling_ta4.png^techage_frameB_ta4.png^techage_appl_hole_electric.png", }, - + after_place_node = function(pos, placer, itemstack, pointed_thing) Cable:after_place_node(pos) Pipe:after_place_node(pos) @@ -99,4 +99,3 @@ minetest.register_craft({ {"", "techage:baborium_ingot", ""}, }, }) - diff --git a/techage/energy_storage/heatexchanger2.lua b/techage/energy_storage/heatexchanger2.lua index d914355..2478288 100644 --- a/techage/energy_storage/heatexchanger2.lua +++ b/techage/energy_storage/heatexchanger2.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA4 Heat Exchanger2 (middle part) (alternatively used as cooler for the TA4 collider) @@ -35,13 +35,13 @@ local DOWN = 5 local PWR_NEEDED = 5 local function heatexchanger1_cmnd(pos, topic, payload) - return techage.transfer({x = pos.x, y = pos.y - 1, z = pos.z}, + return techage.transfer({x = pos.x, y = pos.y - 1, z = pos.z}, nil, topic, payload, nil, {"techage:heatexchanger1"}) end local function heatexchanger3_cmnd(pos, topic, payload) - return techage.transfer({x = pos.x, y = pos.y + 1, z = pos.z}, + return techage.transfer({x = pos.x, y = pos.y + 1, z = pos.z}, nil, topic, payload, nil, {"techage:heatexchanger3"}) end @@ -59,7 +59,7 @@ local function play_sound(pos) local mem = techage.get_mem(pos) if not mem.handle or mem.handle == -1 then mem.handle = minetest.sound_play("techage_booster", { - pos = pos, + pos = pos, gain = 0.3, max_hear_distance = 10, loop = true}) @@ -95,7 +95,7 @@ local function can_start(pos, nvm) return S("No power") end end - -- Used as heat exchanger + -- Used as heat exchanger local netID = networks.determine_netID(pos, Cable, DOWN) if heatexchanger1_cmnd(pos, "netID") ~= netID then return S("Power network connection error") @@ -139,7 +139,7 @@ end local function formspec(self, pos, nvm) local data - + if nvm.used_as_cooler then return cooler_formspec(self, pos, nvm) end @@ -182,7 +182,7 @@ local function check_TES_integrity(pos, nvm) end nvm.check_once_again = true return true -end +end local State = techage.NodeStates:new({ node_name_passive = "techage:heatexchanger2", @@ -200,7 +200,7 @@ local function cooler_timer(pos, nvm) if power.consume_power(pos, Cable, DOWN, PWR_NEEDED) ~= PWR_NEEDED then State:fault(pos, nvm, "No power") stop_sound(pos) - return true + return true end -- Cyclically check pipe connections @@ -218,7 +218,7 @@ local function cooler_timer(pos, nvm) State:fault(pos, nvm, "Pipe connection error") stop_sound(pos) end - return true + return true end local function node_timer(pos, elapsed) @@ -233,7 +233,7 @@ local function node_timer(pos, elapsed) heatexchanger1_cmnd(pos, "stop") power.start_storage_calc(pos, Cable, DOWN) end - + if techage.is_running(nvm) then local capa = power.get_storage_load(pos, Cable, DOWN, nvm.capa_max) or 0 if capa > 0 then @@ -243,7 +243,7 @@ local function node_timer(pos, elapsed) if techage.is_activeformspec(pos) then M(pos):set_string("formspec", formspec(State, pos, nvm)) end - return true + return true end local function can_dig(pos, player) @@ -273,7 +273,7 @@ local function after_place_node(pos, placer) Cable:after_place_node(pos, {DOWN}) State:node_init(pos, nvm, own_num) end - + local function after_dig_node(pos, oldnode, oldmetadata, digger) Cable:after_dig_node(pos) techage.del_mem(pos) @@ -283,7 +283,7 @@ local function on_receive_fields(pos, formname, fields, player) if minetest.is_protected(pos, player:get_player_name()) then return end - + local nvm = techage.get_nvm(pos) State:state_button_event(pos, nvm, fields) M(pos):set_string("formspec", formspec(State, pos, nvm)) @@ -309,12 +309,12 @@ minetest.register_node("techage:heatexchanger2", { "techage_filling_ta4.png^techage_frameM_ta4.png^techage_appl_ribsB.png", "techage_filling_ta4.png^techage_frameM_ta4.png^techage_appl_ribsB.png", }, - + selection_box = { type = "fixed", fixed = {-1/2, -1.5/2, -1/2, 1/2, 1/2, 1/2}, }, - + on_receive_fields = on_receive_fields, on_rightclick = on_rightclick, on_timer = node_timer, diff --git a/techage/energy_storage/heatexchanger3.lua b/techage/energy_storage/heatexchanger3.lua index 70f3713..9c5c2e5 100644 --- a/techage/energy_storage/heatexchanger3.lua +++ b/techage/energy_storage/heatexchanger3.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA4 Heat Exchanger3 (top part) ]]-- @@ -63,10 +63,10 @@ minetest.register_node("techage:heatexchanger3", { "techage_filling_ta4.png^techage_frameT_ta4.png^techage_appl_ribsT.png", "techage_filling_ta4.png^techage_frameT_ta4.png^techage_appl_ribsT.png", }, - + after_place_node = after_place_node, after_dig_node = after_dig_node, - + networks = { pipe2 = {}, }, diff --git a/techage/energy_storage/inlet.lua b/techage/energy_storage/inlet.lua index c9632b8..8cb59d9 100644 --- a/techage/energy_storage/inlet.lua +++ b/techage/energy_storage/inlet.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA4 Pipe Inlet ]]-- @@ -40,10 +40,10 @@ minetest.register_node("techage:ta4_pipe_inlet", { "basic_materials_concrete_block.png^techage_tes_inlet.png", "basic_materials_concrete_block.png^techage_tes_inlet.png", }, - + after_place_node = after_place_node, after_dig_node = after_dig_node, - + networks = { pipe2 = {}, }, @@ -72,7 +72,7 @@ local Numbers = { local function get_diameter(pos, in_dir) local dir = tubelib2.Dir6dToVector[in_dir] local pos2, node - + pos2 = vector.add(pos, vector.multiply(dir, 4)) node = minetest.get_node(pos2) if node.name == "techage:ta3_pipe_wall_entry" then @@ -81,7 +81,7 @@ local function get_diameter(pos, in_dir) if node.name == "techage:ta4_pipe_inlet" then return 5 end - + pos2 = vector.add(pos, vector.multiply(dir, 6)) node = minetest.get_node(pos2) if node.name == "techage:ta3_pipe_wall_entry" then @@ -90,7 +90,7 @@ local function get_diameter(pos, in_dir) if node.name == "techage:ta4_pipe_inlet" then return 7 end - + pos2 = vector.add(pos, vector.multiply(dir, 8)) node = minetest.get_node(pos2) if node.name == "techage:ta3_pipe_wall_entry" then @@ -116,11 +116,11 @@ local function check_volume(pos, in_dir, owner) -- calculate size local pos1 = {x = cpos.x - radius, y = cpos.y - radius, z = cpos.z - radius} local pos2 = {x = cpos.x + radius, y = cpos.y + radius, z = cpos.z + radius} - local _, node_tbl = minetest.find_nodes_in_area(pos1, pos2, - {"default:gravel", "techage:ta4_pipe_inlet", + local _, node_tbl = minetest.find_nodes_in_area(pos1, pos2, + {"default:gravel", "techage:ta4_pipe_inlet", "basic_materials:concrete_block", "default:obsidian_glass", "techage:glow_gravel"}) - if node_tbl["default:obsidian_glass"] > 1 then + if node_tbl["default:obsidian_glass"] > 1 then return S("one window maximum") elseif node_tbl["default:obsidian_glass"] + node_tbl["basic_materials:concrete_block"] ~= Numbers.shell[radius] then return S("wrong number of shell nodes") diff --git a/techage/energy_storage/nodes.lua b/techage/energy_storage/nodes.lua index dcb0f8d..e23b834 100644 --- a/techage/energy_storage/nodes.lua +++ b/techage/energy_storage/nodes.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA4 Nodes ]]-- @@ -34,4 +34,3 @@ minetest.register_node("techage:glow_gravel", { sounds = default.node_sound_gravel_defaults(), drop = "", }) - diff --git a/techage/energy_storage/turbine.lua b/techage/energy_storage/turbine.lua index 69e248f..3231639 100644 --- a/techage/energy_storage/turbine.lua +++ b/techage/energy_storage/turbine.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA4 TES Gas Turbine ]]-- @@ -19,7 +19,7 @@ local S = techage.S local Pipe = techage.LiquidPipe local function generator_cmnd(pos, topic, payload) - return techage.transfer(pos, "R", topic, payload, nil, + return techage.transfer(pos, "R", topic, payload, nil, {"techage:ta4_generator", "techage:ta4_generator_on"}) end @@ -36,7 +36,7 @@ local function play_sound(pos) local mem = techage.get_mem(pos) if not mem.handle or mem.handle == -1 then mem.handle = minetest.sound_play("techage_turbine", { - pos = pos, + pos = pos, gain = 0.4, max_hear_distance = 10, loop = true}) @@ -65,7 +65,7 @@ minetest.register_node("techage:ta4_turbine", { "techage_filling_ta4.png^techage_appl_turbine.png^techage_frame_ta4.png", "techage_filling_ta4.png^techage_appl_turbine.png^techage_frame_ta4.png", }, - + after_place_node = function(pos) Pipe:after_place_node(pos) end, @@ -112,8 +112,8 @@ minetest.register_node("techage:ta4_turbine_on", { }, }, }, - - tubelib2_on_update2 = function(pos, outdir, tlib2, node) + + tubelib2_on_update2 = function(pos, outdir, tlib2, node) swap_node(pos, "techage:ta4_turbine") stop_sound(pos) generator_cmnd(pos, "stop") @@ -151,7 +151,7 @@ techage.register_node({"techage:ta4_turbine", "techage:ta4_turbine_on"}, { on_node_load = function(pos, node) if node.name == "techage:ta4_turbine_on" then play_sound(pos) - end + end end, }) @@ -163,4 +163,3 @@ minetest.register_craft({ {"", "techage:ta4_wlanchip", ""}, }, }) - diff --git a/techage/fermenter/gasflare.lua b/techage/fermenter/gasflare.lua index 191d57d..4f4c741 100644 --- a/techage/fermenter/gasflare.lua +++ b/techage/fermenter/gasflare.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + Biogas flare ]]-- @@ -65,7 +65,7 @@ for idx,ratio in ipairs(lRatio) do }, }, }, - + after_destruct = function(pos, oldnode) pos.y = pos.y + 1 local node = minetest.get_node(pos) @@ -73,7 +73,7 @@ for idx,ratio in ipairs(lRatio) do minetest.remove_node(pos) end end, - + use_texture_alpha = true, inventory_image = "techage_flame.png", paramtype = "light", @@ -93,16 +93,16 @@ end local function start_flarestack(pos, playername) if minetest.is_protected( - {x=pos.x, y=pos.y+1, z=pos.z}, + {x=pos.x, y=pos.y+1, z=pos.z}, playername) then return end local meta = minetest.get_meta(pos) flame({x=pos.x, y=pos.y+1, z=pos.z}) local handle = minetest.sound_play("gasflare", { - pos = pos, - max_hear_distance = 20, - gain = 1, + pos = pos, + max_hear_distance = 20, + gain = 1, loop = true}) --print("handle", handle) meta:set_int("handle", handle) @@ -123,7 +123,7 @@ minetest.register_node("techage:gasflare", { "techage_gasflare.png", "techage_gasflare.png^techage_appl_hole2.png", }, - + after_place_node = function(pos, placer, itemstack, pointed_thing) local node = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}) if node.name ~= "air" then @@ -131,14 +131,14 @@ minetest.register_node("techage:gasflare", { end minetest.add_node({x=pos.x, y=pos.y+1, z=pos.z}, {name = "techage:gasflare2"}) end, - + on_punch = function(pos, node, puncher) local meta = minetest.get_meta(pos) local handle = meta:get_int("handle") minetest.sound_stop(handle) start_flarestack(pos, puncher:get_player_name()) end, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) --print(dump(oldmetadata)) stop_flarestack(pos, oldmetadata.fields.handle) @@ -149,7 +149,7 @@ minetest.register_node("techage:gasflare", { end, paramtype = "light", - light_source = 0, + light_source = 0, sunlight_propagates = true, paramtype2 = "facedir", groups = {cracky=2, crumbly=2, choppy=2}, @@ -163,7 +163,7 @@ minetest.register_node("techage:gasflare2", { "techage_gasflare.png^techage_appl_hole2.png", "techage_gasflare.png" }, - + drawtype = "nodebox", node_box = { type = "fixed", @@ -173,7 +173,7 @@ minetest.register_node("techage:gasflare2", { }, }, paramtype = "light", - light_source = 0, + light_source = 0, sunlight_propagates = true, paramtype2 = "facedir", diggable = false, diff --git a/techage/furnace/booster.lua b/techage/furnace/booster.lua index 8e8be01..123a442 100644 --- a/techage/furnace/booster.lua +++ b/techage/furnace/booster.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3 Booster ]]-- @@ -39,7 +39,7 @@ local function play_sound(pos) local mem = techage.get_mem(pos) if not mem.handle or mem.handle == -1 then mem.handle = minetest.sound_play("techage_booster", { - pos = pos, + pos = pos, gain = 1, max_hear_distance = 7, loop = true}) @@ -82,7 +82,7 @@ minetest.register_node("techage:ta3_booster", { "techage_filling_ta3.png^techage_appl_compressor.png^techage_frame_ta3.png", "techage_filling_ta3.png^techage_appl_compressor.png^[transformFX^techage_frame_ta3.png", }, - + on_timer = function(pos, elapsed) local consumed = power.consume_power(pos, Cable, nil, PWR_NEEDED) if consumed == PWR_NEEDED then @@ -94,7 +94,7 @@ minetest.register_node("techage:ta3_booster", { end, after_place_node = after_place_node, after_dig_node = after_dig_node, - + paramtype2 = "facedir", groups = {cracky=2, crumbly=2, choppy=2}, on_rotate = screwdriver.disallow, @@ -130,7 +130,7 @@ minetest.register_node("techage:ta3_booster_on", { }, }, }, - + on_timer = function(pos, elapsed) local consumed = power.consume_power(pos, Cable, nil, PWR_NEEDED) if consumed < PWR_NEEDED then @@ -142,7 +142,7 @@ minetest.register_node("techage:ta3_booster_on", { end, after_place_node = after_place_node, after_dig_node = after_dig_node, - + paramtype2 = "facedir", groups = {not_in_creative_inventory = 1}, diggable = false, @@ -185,7 +185,7 @@ techage.register_node({"techage:ta3_booster", "techage:ta3_booster_on"}, { on_node_load = function(pos, node) if node.name == "techage:ta3_booster_on" then play_sound(pos) - end + end end, }) @@ -197,4 +197,3 @@ minetest.register_craft({ {"basic_materials:steel_bar", "default:wood", "basic_materials:steel_bar"}, }, }) - diff --git a/techage/furnace/cooking.lua b/techage/furnace/cooking.lua index 8e07c09..54304c4 100644 --- a/techage/furnace/cooking.lua +++ b/techage/furnace/cooking.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - + Cooking routines for furnace - + ]]-- -- for lazy programmers @@ -40,7 +40,7 @@ local function all_ingredients_available(output, ingr) end end end -end +end -- Return a list with all outputs of the given list of ingredients local function get_recipes(ingr) @@ -60,7 +60,7 @@ local function get_recipes(ingr) return KeyList end end - + function techage.furnace.get_ingredients(pos) local inv = M(pos):get_inventory() local tbl = {} @@ -116,7 +116,7 @@ local function process(inv, recipe, output) end end return techage.RUNNING -end +end function techage.furnace.check_if_worth_to_wakeup(pos, nvm) local inv = M(pos):get_inventory() @@ -141,7 +141,7 @@ function techage.furnace.check_if_worth_to_wakeup(pos, nvm) end end return true -end +end function techage.furnace.smelting(pos, nvm, elapsed) local inv = M(pos):get_inventory() @@ -154,11 +154,11 @@ function techage.furnace.smelting(pos, nvm, elapsed) if not recipe then return techage.FAULT, "recipe error" end - + elapsed = elapsed + (nvm.leftover or 0) while elapsed >= recipe.time do state = process(inv, recipe, nvm.output) - if state ~= techage.RUNNING then + if state ~= techage.RUNNING then return state end elapsed = elapsed - recipe.time @@ -225,4 +225,4 @@ function techage.furnace.register_recipe(recipe) recipe.items = recipe.recipe recipe.type = "ta3_melting" techage.recipes.register_craft(recipe) -end \ No newline at end of file +end diff --git a/techage/furnace/firebox.lua b/techage/furnace/firebox.lua index 813a78b..e933d08 100644 --- a/techage/furnace/firebox.lua +++ b/techage/furnace/firebox.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3 Industrial Furnace Firebox ]]-- @@ -72,7 +72,7 @@ end local function booster_cmnd(pos, cmnd) return techage.transfer( - pos, + pos, "L", -- outdir cmnd, -- topic nil, -- payload @@ -102,7 +102,7 @@ minetest.register_node("techage:furnace_firebox", { on_punch = fuel.on_punch, on_receive_fields = fuel.on_receive_fields, on_rightclick = fuel.on_rightclick, - + on_construct = function(pos) local nvm = techage.get_nvm(pos) techage.add_node(pos, "techage:furnace_firebox") @@ -145,7 +145,7 @@ minetest.register_node("techage:furnace_firebox_on", { is_ground_content = false, sounds = default.node_sound_stone_defaults(), drop = "techage:furnace_firebox", - + on_timer = node_timer, can_dig = fuel.can_dig, on_receive_fields = fuel.on_receive_fields, @@ -197,9 +197,9 @@ techage.register_node({"techage:furnace_firebox", "techage:furnace_firebox_on"}, nvm.liquid.amount = (nvm.liquid.amount or 0) + count nvm.liquid.name = "techage:gasoline" inv:set_stack("fuel", 1, nil) - end + end end, -}) +}) liquid.register_nodes({"techage:furnace_firebox", "techage:furnace_firebox_on"}, Pipe, "tank", nil, fuel.get_liquid_table(fuel.BT_OIL, fuel.CAPACITY, start_firebox)) diff --git a/techage/furnace/furnace_top.lua b/techage/furnace/furnace_top.lua index 52e7642..e49e748 100644 --- a/techage/furnace/furnace_top.lua +++ b/techage/furnace/furnace_top.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3 Industrial Furnace Top ]]-- @@ -54,12 +54,12 @@ local function formspec(self, pos, nvm) "tooltip[2,2;1,1;"..self:get_state_tooltip(nvm).."]".. "list[context;dst;3,0;2,2;]".. - + "label[6,0;"..S("Outp")..": "..idx.."/"..num.."]".. "item_image_button[6.5,0.5;1,1;"..outp..";b1;]".. "button[6,1.5;1,1;priv;<<]".. "button[7,1.5;1,1;next;>>]".. - + "list[current_player;main;0,3.5;8,4;]" .. "listring[current_player;main]".. "listring[context;src]" .. @@ -76,7 +76,7 @@ end local function firebox_cmnd(pos, cmnd) return techage.transfer( - {x=pos.x, y=pos.y-1, z=pos.z}, + {x=pos.x, y=pos.y-1, z=pos.z}, nil, -- outdir cmnd, -- topic nil, -- payload @@ -120,7 +120,7 @@ local function keep_running(pos, elapsed) if nvm.toggle then -- progress bar/arrow M(pos):set_string("formspec", formspec(crd.State, pos, nvm)) end -end +end local function allow_metadata_inventory_put(pos, listname, index, stack, player) if minetest.is_protected(pos, player:get_player_name()) then @@ -259,7 +259,7 @@ local tubing = { end, } -local _, node_name_ta3, _ = +local _, node_name_ta3, _ = techage.register_consumer("furnace", S("Furnace Top"), tiles, { drawtype = "normal", cycle_time = CYCLE_TIME, @@ -298,4 +298,3 @@ minetest.register_craft({ {"", "techage:vacuum_tube", ""}, }, }) - diff --git a/techage/furnace/heater.lua b/techage/furnace/heater.lua index e7a4be6..2037d53 100644 --- a/techage/furnace/heater.lua +++ b/techage/furnace/heater.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA4 Industrial Furnace Heater ]]-- @@ -52,7 +52,7 @@ minetest.register_node("techage:furnace_heater", { "techage_concrete.png^techage_frame_ta3.png", "techage_concrete.png^techage_appl_heater.png^techage_frame_ta3.png", }, - + on_timer = function(pos, elapsed) local consumed = power.consume_power(pos, Cable, nil, PWR_NEEDED) if consumed == PWR_NEEDED then @@ -62,7 +62,7 @@ minetest.register_node("techage:furnace_heater", { end, after_place_node = after_place_node, after_dig_node = after_dig_node, - + paramtype2 = "facedir", groups = {cracky=2, crumbly=2, choppy=2}, on_rotate = screwdriver.disallow, @@ -81,7 +81,7 @@ minetest.register_node("techage:furnace_heater_on", { "techage_concrete.png^techage_frame_ta3.png", "techage_concrete.png^techage_appl_heater_on.png^techage_frame_ta3.png", }, - + on_timer = function(pos, elapsed) local consumed = power.consume_power(pos, Cable, nil, PWR_NEEDED) if consumed < PWR_NEEDED then @@ -91,7 +91,7 @@ minetest.register_node("techage:furnace_heater_on", { end, after_place_node = after_place_node, after_dig_node = after_dig_node, - + light_source = 8, paramtype2 = "facedir", groups = {not_in_creative_inventory = 1}, @@ -124,7 +124,7 @@ techage.register_node({"techage:furnace_heater", "techage:furnace_heater_on"}, { return true end end -}) +}) minetest.register_craft({ output = "techage:furnace_heater", diff --git a/techage/furnace/recipes.lua b/techage/furnace/recipes.lua index b853ea2..47a98b2 100644 --- a/techage/furnace/recipes.lua +++ b/techage/furnace/recipes.lua @@ -7,42 +7,42 @@ AGPL v3 See LICENSE.txt for more information - + Cooking recipes for furnace - + ]]-- techage.furnace.register_recipe({ - output = "techage:iron_ingot", - recipe = {"default:iron_lump"}, + output = "techage:iron_ingot", + recipe = {"default:iron_lump"}, time = 2, }) techage.furnace.register_recipe({ - output = "default:obsidian", - recipe = {"default:cobble"}, + output = "default:obsidian", + recipe = {"default:cobble"}, time = 8, }) if techage.modified_recipes_enabled then techage.furnace.register_recipe({ - output = "default:bronze_ingot 4", - recipe = {"default:copper_ingot", "default:copper_ingot", "default:copper_ingot", "default:tin_ingot"}, + output = "default:bronze_ingot 4", + recipe = {"default:copper_ingot", "default:copper_ingot", "default:copper_ingot", "default:tin_ingot"}, time = 2, }) techage.furnace.register_recipe({ - output = "default:steel_ingot 4", - recipe = {"default:coal_lump", "default:iron_lump", "default:iron_lump", "default:iron_lump"}, + output = "default:steel_ingot 4", + recipe = {"default:coal_lump", "default:iron_lump", "default:iron_lump", "default:iron_lump"}, time = 4, }) end if minetest.global_exists("wielded_light") then techage.furnace.register_recipe({ - output = "techage:meridium_ingot", - recipe = {"default:steel_ingot", "default:mese_crystal_fragment"}, + output = "techage:meridium_ingot", + recipe = {"default:steel_ingot", "default:mese_crystal_fragment"}, heat = 4, time = 3, }) @@ -68,15 +68,15 @@ minetest.after(1, function() if recipe.items[1] and string.split(recipe.items[1], ":")[1] == "group" then for _,item in ipairs(node_group(string.split(recipe.items[1], ":")[2])) do techage.furnace.register_recipe({ - output = recipe.output, - recipe = {item}, + output = recipe.output, + recipe = {item}, time = math.floor((recipe.width + 1) / 2), }) end else techage.furnace.register_recipe({ - output = recipe.output, - recipe = recipe.items, + output = recipe.output, + recipe = recipe.items, time = math.floor((recipe.width + 1) / 2), }) end @@ -90,8 +90,8 @@ end) techage.furnace.register_recipe({ output = "techage:basalt_glass2", recipe = { - "techage:basalt_gravel", - "techage:basalt_gravel", + "techage:basalt_gravel", + "techage:basalt_gravel", }, time = 4, }) @@ -99,8 +99,8 @@ techage.furnace.register_recipe({ techage.furnace.register_recipe({ output = "techage:basalt_glass", recipe = { - "techage:sieved_basalt_gravel", - "techage:sieved_basalt_gravel", + "techage:sieved_basalt_gravel", + "techage:sieved_basalt_gravel", }, time = 4, }) @@ -108,7 +108,7 @@ techage.furnace.register_recipe({ techage.furnace.register_recipe({ output = "techage:basalt_glass_thin2 2", recipe = { - "techage:basalt_gravel", + "techage:basalt_gravel", }, time = 4, }) @@ -116,7 +116,7 @@ techage.furnace.register_recipe({ techage.furnace.register_recipe({ output = "techage:basalt_glass_thin 2", recipe = { - "techage:sieved_basalt_gravel", + "techage:sieved_basalt_gravel", }, time = 4, }) @@ -124,7 +124,7 @@ techage.furnace.register_recipe({ techage.furnace.register_recipe({ output = "techage:basalt_glass_thin_xl2", recipe = { - "techage:basalt_gravel", + "techage:basalt_gravel", }, time = 4, }) @@ -132,7 +132,7 @@ techage.furnace.register_recipe({ techage.furnace.register_recipe({ output = "techage:basalt_glass_thin_xl", recipe = { - "techage:sieved_basalt_gravel", + "techage:sieved_basalt_gravel", }, time = 4, }) @@ -140,7 +140,7 @@ techage.furnace.register_recipe({ techage.furnace.register_recipe({ output = "basic_materials:concrete_block 4", recipe = { - "basic_materials:wet_cement", + "basic_materials:wet_cement", "default:sand", "default:gravel", "techage:steelmat", @@ -149,12 +149,12 @@ techage.furnace.register_recipe({ }) if minetest.global_exists("moreores") then - + if techage.modified_recipes_enabled then minetest.clear_craft({output = "moreores:mithril_ingot"}) minetest.clear_craft({output = "moreores:silver_ingot"}) end - + techage.furnace.register_recipe({ output = 'moreores:silver_ingot', recipe = {'moreores:silver_lump'}, diff --git a/techage/hydrogen/electrolyzer.lua b/techage/hydrogen/electrolyzer.lua index fb96019..c3cc336 100644 --- a/techage/hydrogen/electrolyzer.lua +++ b/techage/hydrogen/electrolyzer.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA4 Electrolyzer ]]-- @@ -58,7 +58,7 @@ end local function can_start(pos, nvm, state) nvm.liquid = nvm.liquid or {} nvm.liquid.amount = nvm.liquid.amount or 0 - + if nvm.liquid.amount < CAPACITY then return true end @@ -99,7 +99,7 @@ local function generating(pos, nvm) nvm.num_pwr_units = nvm.num_pwr_units - PWR_UNITS_PER_HYDROGEN_ITEM end end -end +end -- converts power into hydrogen local function node_timer(pos, elapsed) @@ -107,7 +107,7 @@ local function node_timer(pos, elapsed) local nvm = techage.get_nvm(pos) nvm.liquid = nvm.liquid or {} nvm.liquid.amount = nvm.liquid.amount or 0 - + if nvm.liquid.amount < CAPACITY then local in_dir = meta:get_int("in_dir") local curr_load = power.get_storage_load(pos, Cable, in_dir, 1) @@ -183,7 +183,7 @@ local tool_config = { { type = "const", name = "needed", - label = S("Maximum power consumption [ku]"), + label = S("Maximum power consumption [ku]"), tooltip = S("Maximum possible\ncurrent consumption"), value = PWR_NEEDED, }, @@ -191,7 +191,7 @@ local tool_config = { type = "dropdown", choices = "20%,40%,60%,80%,100%", name = "reduction", - label = S("Current limitation"), + label = S("Current limitation"), tooltip = S("Configurable value\nfor the current limit"), default = "100%", }, @@ -199,12 +199,12 @@ local tool_config = { type = "dropdown", choices = "0%,20%,40%,60%,80%", name = "turnoff", - label = S("Turnoff point"), + label = S("Turnoff point"), tooltip = S("If the charge of the storage\nsystem exceeds the configured value,\nthe block switches off"), default = "0%", }, } - + minetest.register_node("techage:ta4_electrolyzer", { description = S("TA4 Electrolyzer"), tiles = { @@ -223,14 +223,14 @@ minetest.register_node("techage:ta4_electrolyzer", { end return liquid.is_empty(pos) end, - + after_place_node = after_place_node, after_dig_node = after_dig_node, on_punch = liquid.on_punch, on_receive_fields = on_receive_fields, on_timer = node_timer, on_rightclick = on_rightclick, - + paramtype2 = "facedir", groups = {cracky=2, crumbly=2, choppy=2}, on_rotate = screwdriver.disallow, @@ -272,7 +272,7 @@ minetest.register_node("techage:ta4_electrolyzer_on", { on_punch = liquid.on_punch, on_timer = node_timer, on_rightclick = on_rightclick, - + paramtype2 = "facedir", groups = {not_in_creative_inventory=1}, on_rotate = screwdriver.disallow, @@ -339,7 +339,7 @@ techage.register_node({"techage:ta4_electrolyzer", "techage:ta4_electrolyzer_on" meta:set_string("turnoff", "0%") end end, -}) +}) minetest.register_craft({ output = "techage:ta4_electrolyzer", @@ -349,4 +349,3 @@ minetest.register_craft({ {'default:steel_ingot', "techage:ta4_wlanchip", 'default:steel_ingot'}, }, }) - diff --git a/techage/hydrogen/fuelcell.lua b/techage/hydrogen/fuelcell.lua index 6fabbab..81301af 100644 --- a/techage/hydrogen/fuelcell.lua +++ b/techage/hydrogen/fuelcell.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA4 Fuel Cell ]]-- @@ -67,7 +67,7 @@ local function can_start(pos, nvm, state) end -local function consuming(pos, nvm) +local function consuming(pos, nvm) if nvm.num_pwr_units <= 0 then nvm.num_pwr_units = nvm.num_pwr_units + PWR_UNITS_PER_HYDROGEN_ITEM nvm.liquid.amount = nvm.liquid.amount - 1 @@ -190,7 +190,7 @@ minetest.register_node("techage:ta4_fuelcell", { end return liquid.is_empty(pos) end, - + after_place_node = after_place_node, after_dig_node = after_dig_node, get_generator_data = get_generator_data, @@ -199,7 +199,7 @@ minetest.register_node("techage:ta4_fuelcell", { on_timer = node_timer, on_rightclick = on_rightclick, ta4_formspec = techage.generator_settings("ta4", PWR_PERF), - + paramtype2 = "facedir", groups = {cracky=2, crumbly=2, choppy=2}, on_rotate = screwdriver.disallow, @@ -304,7 +304,7 @@ techage.register_node({"techage:ta4_fuelcell", "techage:ta4_fuelcell_on"}, { return State:on_receive_message(pos, topic, payload) end end, -}) +}) control.register_nodes({"techage:ta4_fuelcell", "techage:ta4_fuelcell_on"}, { on_receive = function(pos, tlib2, topic, payload) @@ -319,7 +319,7 @@ control.register_nodes({"techage:ta4_fuelcell", "techage:ta4_fuelcell_on"}, { running = techage.is_running(nvm) or false, available = PWR_PERF, provided = nvm.provided or 0, - termpoint = meta:get_string("termpoint"), + termpoint = meta:get_string("termpoint"), } end return false diff --git a/techage/hydrogen/fuelcellstack.lua b/techage/hydrogen/fuelcellstack.lua index 237c6be..6bc14f7 100644 --- a/techage/hydrogen/fuelcellstack.lua +++ b/techage/hydrogen/fuelcellstack.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA4 Hydrogen ]]-- @@ -31,4 +31,3 @@ minetest.register_craft({ {"techage:canister_lye", "techage:ta3_canister_empty"}, } }) - diff --git a/techage/icta_controller/action.lua b/techage/icta_controller/action.lua index be315cb..89ee53b 100644 --- a/techage/icta_controller/action.lua +++ b/techage/icta_controller/action.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + ICTA Controller - Action Registration ]]-- @@ -53,17 +53,17 @@ end function techage.actn_formspec(row, kvSelect) return techage.submenu_generate_formspec( row, "actn", "Action type", aActnTypes, aActnTitles, kvRegisteredActn, kvSelect) -end - +end + -- evaluate the row action input -- and return new data function techage.actn_eval_input(kvSelect, fields) kvSelect = techage.submenu_eval_input(kvRegisteredActn, aActnTypes, aActnTitles, kvSelect, fields) return kvSelect end - - --- return the Lua code + + +-- return the Lua code function techage.code_action(kvSelect, environ) if kvSelect and kvRegisteredActn[kvSelect.choice] then if techage.submenu_verify(environ.owner, kvRegisteredActn, kvSelect) then @@ -84,18 +84,18 @@ techage.icta_register_action("print", { title = "print to output window", formspec = { { - type = "ascii", + type = "ascii", name = "text", - label = "Output the following text", + label = "Output the following text", default = "", }, { - type = "label", - name = "lbl", - label = "Use a '*' character as reference to any\ncondition state", + type = "label", + name = "lbl", + label = "Use a '*' character as reference to any\ncondition state", }, }, - button = function(data, environ) + button = function(data, environ) return 'print("'..data.text:sub(1,12)..'")' end, code = function(data, environ) @@ -105,4 +105,3 @@ techage.icta_register_action("print", { end end, }) - diff --git a/techage/icta_controller/battery.lua b/techage/icta_controller/battery.lua index 2d84c7d..24c710c 100644 --- a/techage/icta_controller/battery.lua +++ b/techage/icta_controller/battery.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + ICTA Controller - Battery ]]-- @@ -85,7 +85,7 @@ minetest.register_node("techage:ta4_battery", { after_dig_node = function(pos, oldnode, oldmetadata, digger) techage.remove_node(pos, oldnode, oldmetadata) end, - + on_timer = on_timer, preserve_metadata = function(pos, oldnode, oldmetadata, drops) @@ -126,12 +126,12 @@ minetest.register_node("techage:ta4_battery_empty", { { -6/32, -6/32, 14/32, 6/32, 6/32, 16/32}, }, }, - + after_place_node = function(pos, placer) local meta = minetest.get_meta(pos) meta:set_int("content", 0) end, - + paramtype = "light", use_texture_alpha = techage.CLIP, sunlight_propagates = true, @@ -167,7 +167,7 @@ techage.register_node({"techage:ta4_battery"}, { on_node_load = function(pos) minetest.get_node_timer(pos):start(30) end, - + on_recv_message = function(pos, src, topic, payload) if topic == "load" then local meta = minetest.get_meta(pos) diff --git a/techage/icta_controller/commands.lua b/techage/icta_controller/commands.lua index 74354c6..09d1b47 100644 --- a/techage/icta_controller/commands.lua +++ b/techage/icta_controller/commands.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + ICTA Controller - Register all controller commands ]]-- @@ -42,9 +42,9 @@ techage.icta_register_condition("initial", { title = "initial", formspec = { { - type = "label", - name = "lbl", - label = "Condition is true only after\ncontroller start.", + type = "label", + name = "lbl", + label = "Condition is true only after\ncontroller start.", }, }, -- Return two chunks of executable Lua code for the controller, according: @@ -65,9 +65,9 @@ techage.icta_register_condition("true", { title = "true", formspec = { { - type = "label", - name = "lbl", - label = "Condition is always true.", + type = "label", + name = "lbl", + label = "Condition is always true.", }, }, code = function(data, environ) @@ -86,23 +86,23 @@ techage.icta_register_condition("condition", { title = "condition", formspec = { { - type = "textlist", + type = "textlist", name = "condition", - label = "condition row number", - choices = "1,2,3,4,5,6,7,8", + label = "condition row number", + choices = "1,2,3,4,5,6,7,8", default = "", }, { type = "textlist", name = "operand", - label = "condition", + label = "condition", choices = "was true, was not true", default = "was true", }, { - type = "label", - name = "lbl", - label = "Used to execute two or more\nactions based on one condition.", + type = "label", + name = "lbl", + label = "Used to execute two or more\nactions based on one condition.", }, }, code = function(data, environ) @@ -140,9 +140,9 @@ techage.icta_register_condition("input", { default = "on", }, { - type = "label", - name = "lbl", - label = "An input is only available,\nif a block sends on/off\ncommands to the controller.", + type = "label", + name = "lbl", + label = "An input is only available,\nif a block sends on/off\ncommands to the controller.", }, }, button = function(data, environ) -- default button label @@ -183,9 +183,9 @@ techage.icta_register_condition("state", { default = "stopped", }, { - type = "label", - name = "lbl", - label = "Read the state of a TA3/TA4 machine.\n", + type = "label", + name = "lbl", + label = "Read the state of a TA3/TA4 machine.\n", }, }, button = function(data, environ) -- default button label @@ -225,12 +225,12 @@ techage.icta_register_condition("fuel", { default = "" }, { - type = "label", - name = "lbl", - label = "Read and evaluate the fuel value\nof a fuel consuming block.", + type = "label", + name = "lbl", + label = "Read and evaluate the fuel value\nof a fuel consuming block.", }, }, - button = function(data, environ) + button = function(data, environ) return 'fuel('..techage.fmt_number(data.number)..","..data.operand..' '..data.value..')' end, code = function(data, environ) @@ -267,12 +267,12 @@ techage.icta_register_condition("load", { default = "" }, { - type = "label", - name = "lbl", - label = "Read and evaluate the load (0..100)\nof a tank/storage block.", + type = "label", + name = "lbl", + label = "Read and evaluate the load (0..100)\nof a tank/storage block.", }, }, - button = function(data, environ) + button = function(data, environ) return 'load('..techage.fmt_number(data.number)..","..data.operand..' '..data.value..')' end, code = function(data, environ) @@ -309,12 +309,12 @@ techage.icta_register_condition("depth", { default = "" }, { - type = "label", - name = "lbl", - label = "Read and evaluate the current\ndepth of a quarry block.", + type = "label", + name = "lbl", + label = "Read and evaluate the current\ndepth of a quarry block.", }, }, - button = function(data, environ) + button = function(data, environ) return 'depth('..techage.fmt_number(data.number)..","..data.operand..' '..data.value..')' end, code = function(data, environ) @@ -351,12 +351,12 @@ techage.icta_register_condition("delivered", { default = "" }, { - type = "label", - name = "lbl", - label = "Read and evaluate the delivered\npower of a generator block.\nPower consuming blocks like accus\ncould also provide a negative value.", + type = "label", + name = "lbl", + label = "Read and evaluate the delivered\npower of a generator block.\nPower consuming blocks like accus\ncould also provide a negative value.", }, }, - button = function(data, environ) + button = function(data, environ) return 'deliv('..techage.fmt_number(data.number)..","..data.operand..' '..data.value..')' end, code = function(data, environ) @@ -394,10 +394,10 @@ techage.icta_register_condition("chest", { default = "empty", }, { - type = "label", - name = "lbl", + type = "label", + name = "lbl", label = "Read the state from a Techage chest\n".. - "and other similar blocks.", + "and other similar blocks.", }, }, button = function(data, environ) -- default button label @@ -436,9 +436,9 @@ techage.icta_register_condition("signaltower", { default = "off", }, { - type = "label", - name = "lbl", - label = "Read the color state\nof a Signal Tower.", + type = "label", + name = "lbl", + label = "Read the color state\nof a Signal Tower.", }, }, button = function(data, environ) -- default button label @@ -459,25 +459,25 @@ techage.icta_register_action("signaltower", { title = "TA4 Signal Tower", formspec = { { - type = "numbers", - name = "number", - label = "Signal Tower number", + type = "numbers", + name = "number", + label = "Signal Tower number", default = "", }, { - type = "textlist", + type = "textlist", name = "value", - label = "lamp color", - choices = "off,green,amber,red", + label = "lamp color", + choices = "off,green,amber,red", default = "red", }, { - type = "label", - name = "lbl", - label = "Turn on/off a Signal Tower lamp.", + type = "label", + name = "lbl", + label = "Turn on/off a Signal Tower lamp.", }, }, - button = function(data, environ) + button = function(data, environ) return 'tower('..techage.fmt_number(data.number)..","..data.value..')' end, code = function(data, environ) @@ -491,32 +491,32 @@ techage.icta_register_action("signallamp", { title = "TA4 Signal Lamp", formspec = { { - type = "numbers", - name = "number", - label = "Signal Tower number", + type = "numbers", + name = "number", + label = "Signal Tower number", default = "", }, { - type = "textlist", + type = "textlist", name = "payload", - label = "lamp number", - choices = "1,2,3,4", + label = "lamp number", + choices = "1,2,3,4", default = "1", }, { - type = "textlist", + type = "textlist", name = "value", - label = "lamp color", - choices = "off,green,amber,red", + label = "lamp color", + choices = "off,green,amber,red", default = "red", }, { - type = "label", - name = "lbl", - label = "Turn on/off a Signal Tower lamp.", + type = "label", + name = "lbl", + label = "Turn on/off a Signal Tower lamp.", }, }, - button = function(data, environ) + button = function(data, environ) return 'tower('..techage.fmt_number(data.number)..","..data.payload..","..data.value..')' end, code = function(data, environ) @@ -530,25 +530,25 @@ techage.icta_register_action("switch", { title = "turn block on/off", formspec = { { - type = "numbers", - name = "number", - label = "block number(s)", + type = "numbers", + name = "number", + label = "block number(s)", default = "", }, { - type = "textlist", + type = "textlist", name = "value", - label = "state", - choices = "on,off", + label = "state", + choices = "on,off", default = "on", }, { - type = "label", - name = "lbl", - label = "Used for lamps, machines, gates,...", + type = "label", + name = "lbl", + label = "Used for lamps, machines, gates,...", }, }, - button = function(data, environ) + button = function(data, environ) return 'turn('..techage.fmt_number(data.number)..","..data.value..')' end, code = function(data, environ) @@ -562,28 +562,28 @@ techage.icta_register_action("display", { title = "Display: overwrite one line", formspec = { { - type = "numbers", - name = "number", - label = "Display number", + type = "numbers", + name = "number", + label = "Display number", default = "", }, { - type = "textlist", - name = "row", - label = "Display line", - choices = "1,2,3,4,5", + type = "textlist", + name = "row", + label = "Display line", + choices = "1,2,3,4,5", default = "1", }, { - type = "ascii", + type = "ascii", name = "text", - label = "text", + label = "text", default = "", }, { - type = "label", - name = "lbl", - label = "Use a '*' character as reference\nto any condition result", + type = "label", + name = "lbl", + label = "Use a '*' character as reference\nto any condition result", }, }, code = function(data, environ) @@ -595,7 +595,7 @@ techage.icta_register_action("display", { techage.send_multi(environ.number, data.number, "set", payload) end end, - button = function(data, environ) + button = function(data, environ) return "lcd("..techage.fmt_number(data.number)..","..data.row..',"'..data.text..'")' end, }) @@ -604,9 +604,9 @@ techage.icta_register_action("cleardisplay", { title = "Display: Clear screen", formspec = { { - type = "number", - name = "number", - label = "Display number", + type = "number", + name = "number", + label = "Display number", default = "", }, }, @@ -615,7 +615,7 @@ techage.icta_register_action("cleardisplay", { techage.send_multi(environ.number, data.number, "clear") end end, - button = function(data, environ) + button = function(data, environ) return "clear lcd("..techage.fmt_number(data.number)..")" end, }) @@ -624,15 +624,15 @@ techage.icta_register_action("chat", { title = "send chat message", formspec = { { - type = "ascii", + type = "ascii", name = "text", - label = "message", + label = "message", default = "", }, { - type = "label", - name = "lbl", - label = "The chat message is send to the\nController owner, only.", + type = "label", + name = "lbl", + label = "The chat message is send to the\nController owner, only.", }, }, code = function(data, environ) @@ -640,7 +640,7 @@ techage.icta_register_action("chat", { minetest.chat_send_player(environ.owner, "[TA4 ICTA Controller] "..data.text) end end, - button = function(data, environ) + button = function(data, environ) return 'chat("'..data.text:sub(1,12)..'")' end, }) @@ -667,23 +667,23 @@ techage.icta_register_action("door", { title = "open/close door", formspec = { { - type = "digits", - name = "pos", - label = "door position like: 123,7,-1200", + type = "digits", + name = "pos", + label = "door position like: 123,7,-1200", default = "", }, { - type = "textlist", + type = "textlist", name = "door_state", - label = "door state", - choices = "open,close", + label = "door state", + choices = "open,close", default = "open", }, { - type = "label", - name = "lbl", + type = "label", + name = "lbl", label = "For standard doors like the Steel Doors.\n".. - "Use the Techage Info Tool to\neasily determine a door position.", + "Use the Techage Info Tool to\neasily determine a door position.", }, }, code = function(data, environ) @@ -691,7 +691,7 @@ techage.icta_register_action("door", { techage.icta_door_toggle(data.pos, environ.owner, data.door_state) end end, - button = function(data, environ) + button = function(data, environ) return 'door("'..data.pos..'",'..data.door_state..")" end, }) @@ -700,16 +700,16 @@ techage.icta_register_action("move", { title = "TA4 Move Controller", formspec = { { - type = "number", - name = "number", - label = "block number", + type = "number", + name = "number", + label = "block number", default = "", }, { - type = "textlist", + type = "textlist", name = "cmnd", - label = "command", - choices = "a2b,b2a,move", + label = "command", + choices = "a2b,b2a,move", default = "a2b", }, }, @@ -727,16 +727,16 @@ techage.icta_register_action("turn", { title = "TA4 Turn Controller", formspec = { { - type = "number", - name = "number", - label = "block number", + type = "number", + name = "number", + label = "block number", default = "", }, { - type = "textlist", + type = "textlist", name = "cmnd", - label = "command", - choices = "left,right,uturn", + label = "command", + choices = "left,right,uturn", default = "left", }, }, @@ -754,28 +754,28 @@ techage.icta_register_action("goto", { title = "TA4 Sequencer", formspec = { { - type = "number", - name = "number", - label = "block number", + type = "number", + name = "number", + label = "block number", default = "", }, { - type = "textlist", + type = "textlist", name = "cmnd", - label = "command", - choices = "goto,stop", + label = "command", + choices = "goto,stop", default = "left", }, { - type = "number", - name = "slot", - label = "time slot", + type = "number", + name = "slot", + label = "time slot", default = "1", }, { - type = "label", - name = "lbl", - label = "The 'stop' command needs no time slot.", + type = "label", + name = "lbl", + label = "The 'stop' command needs no time slot.", }, }, button = function(data, environ) -- default button label @@ -816,12 +816,12 @@ techage.icta_register_condition("playerdetector", { default = "", }, { - type = "label", - name = "lbl", - label = "Read and check the name\nof a Player Detector.\nUse a '*' character for all player names.\n Use a '-' character for no player.", + type = "label", + name = "lbl", + label = "Read and check the name\nof a Player Detector.\nUse a '*' character for all player names.\n Use a '-' character for no player.", }, }, - + code = function(data, environ) local condition = function(env, idx) return techage.icta_player_detect(environ.number, data.number, data.name) @@ -831,7 +831,7 @@ techage.icta_register_condition("playerdetector", { end return condition, result end, - button = function(data, environ) + button = function(data, environ) return "detector("..techage.fmt_number(data.number)..","..data.name:sub(1,8)..")" end, }) @@ -840,32 +840,32 @@ techage.icta_register_action("set_filter", { title = "turn Distributor filter on/off", formspec = { { - type = "number", - name = "number", - label = "distri number", + type = "number", + name = "number", + label = "distri number", default = "", }, { - type = "textlist", + type = "textlist", name = "color", - label = "filter port", - choices = "red,green,blue,yellow", + label = "filter port", + choices = "red,green,blue,yellow", default = "red", }, { - type = "textlist", + type = "textlist", name = "value", - label = "state", - choices = "on,off", + label = "state", + choices = "on,off", default = "on", }, { - type = "label", - name = "lbl", - label = "turn Distributor filter port on/off\n", + type = "label", + name = "lbl", + label = "turn Distributor filter port on/off\n", }, }, - button = function(data, environ) + button = function(data, environ) return 'turn('..techage.fmt_number(data.number)..","..data.color..","..data.value..')' end, code = function(data, environ) @@ -929,24 +929,24 @@ techage.icta_register_action("exchange", { title = "place/remove a block via the Door Controller II", formspec = { { - type = "number", - name = "number", - label = "number", + type = "number", + name = "number", + label = "number", default = "", }, { - type = "number", - name = "slot", - label = "slot no", + type = "number", + name = "slot", + label = "slot no", default = "1", }, { - type = "label", - name = "lbl", - label = "place/remove a block via\nthe Door Controller II\n", + type = "label", + name = "lbl", + label = "place/remove a block via\nthe Door Controller II\n", }, }, - button = function(data, environ) + button = function(data, environ) return 'exch('..techage.fmt_number(data.number)..","..data.slot..')' end, code = function(data, environ) @@ -956,4 +956,3 @@ techage.icta_register_action("exchange", { end end, }) - diff --git a/techage/icta_controller/condition.lua b/techage/icta_controller/condition.lua index 9cb64e0..b407d74 100644 --- a/techage/icta_controller/condition.lua +++ b/techage/icta_controller/condition.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + ICTA Controller - Condition Registration ]]-- @@ -49,16 +49,16 @@ end function techage.cond_formspec(row, kvSelect) return techage.submenu_generate_formspec( row, "cond", "Condition type", aCondTypes, aCondTitles, kvRegisteredCond, kvSelect) -end - +end + -- evaluate the row condition input -- and return new data function techage.cond_eval_input(kvSelect, fields) kvSelect = techage.submenu_eval_input(kvRegisteredCond, aCondTypes, aCondTitles, kvSelect, fields) return kvSelect end - --- return the Lua code + +-- return the Lua code function techage.code_condition(kvSelect, environ) if kvSelect and kvRegisteredCond[kvSelect.choice] then if techage.submenu_verify(environ.owner, kvRegisteredCond, kvSelect) then @@ -82,4 +82,3 @@ techage.icta_register_condition("default", { end, button = function(data, environ) return "..." end, }) - diff --git a/techage/icta_controller/controller.lua b/techage/icta_controller/controller.lua index 998ed82..7c3292e 100644 --- a/techage/icta_controller/controller.lua +++ b/techage/icta_controller/controller.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + ICTA Controller ]]-- @@ -16,11 +16,11 @@ local M = minetest.get_meta local S = techage.S local logic = techage.logic - + -- -- Helper functions -- -local function gen_table(size, val) +local function gen_table(size, val) local tbl = {} for idx = 1,size do if type(val) == "table" then @@ -42,14 +42,14 @@ local function integer(s, min, max) return min end -local sOUTPUT = "Edit commands (see help)" +local sOUTPUT = "Edit commands (see help)" local Cache = {} local FS_DATA = gen_table(techage.NUM_RULES, {}) local function output(pos, text, flush_buffer) local meta = minetest.get_meta(pos) - if not flush_buffer then + if not flush_buffer then text = meta:get_string("output") .. "\n" .. (text or "") text = text:sub(-500,-1) end @@ -123,7 +123,7 @@ local function generate(pos, meta, environ) elseif cond == nil and actn ~= nil then output(pos, "Error in condition in rule "..idx) end - end + end return tbl end @@ -182,7 +182,7 @@ local function battery(pos) return true end return false -end +end local function start_controller(pos, meta) local number = meta:get_string("number") @@ -190,10 +190,10 @@ local function start_controller(pos, meta) meta:set_string("formspec", techage.formspecError(meta)) return false end - + meta:set_string("output", "") meta:set_int("cpu", 0) - + if compile(pos, meta, number) then meta:set_int("state", techage.RUNNING) minetest.get_node_timer(pos):start(1) @@ -243,7 +243,7 @@ local function on_timer(pos, elapsed) local number = meta:get_string("number") if Cache[number] or compile(pos, meta, number) then local res = execute(pos, number, elapsed == -1) - if res then + if res then t = minetest.get_us_time() - t if not update_battery(meta, t) then no_battery(pos) @@ -265,7 +265,7 @@ local function on_receive_fields(pos, formname, fields, player) if player:get_player_name() ~= owner then return end - + --print("fields", dump(fields)) if fields.quit then -- cancel button return @@ -295,7 +295,7 @@ local function on_receive_fields(pos, formname, fields, player) end if fields._exit_ == "ok" then -- exit from sub-menu? if fields._button_ then - techage.formspec_button_update(meta, fields) + techage.formspec_button_update(meta, fields) end -- simulate tab selection fields.tab = "1" @@ -369,12 +369,12 @@ minetest.register_node("techage:ta4_icta_controller", { { -6/32, -6/32, 14/32, 6/32, 6/32, 16/32}, }, }, - + after_place_node = function(pos, placer) local meta = minetest.get_meta(pos) local number = techage.add_node(pos, "techage:ta4_icta_controller") local fs_data = FS_DATA - meta:set_string("fs_data", minetest.serialize(fs_data)) + meta:set_string("fs_data", minetest.serialize(fs_data)) meta:set_string("owner", placer:get_player_name()) meta:set_string("number", number) meta:set_int("state", techage.STOPPED) @@ -384,14 +384,14 @@ minetest.register_node("techage:ta4_icta_controller", { end, on_receive_fields = on_receive_fields, - + after_dig_node = function(pos, oldnode, oldmetadata) techage.remove_node(pos, oldnode, oldmetadata) techage.del_mem(pos) end, - + on_timer = on_timer, - + paramtype = "light", sunlight_propagates = true, paramtype2 = "facedir", @@ -413,7 +413,7 @@ minetest.register_craft({ -- write inputs from remote nodes local function set_input(pos, own_number, rmt_number, val) - if rmt_number then + if rmt_number then if Cache[own_number] and Cache[own_number].env.input then local t = minetest.get_us_time() Cache[own_number].env.input[rmt_number] = val @@ -425,14 +425,14 @@ local function set_input(pos, own_number, rmt_number, val) end end end -end +end techage.register_node({"techage:ta4_icta_controller"}, { on_recv_message = function(pos, src, topic, payload) local meta = minetest.get_meta(pos) local number = meta:get_string("number") local state = meta:get_int("state") - + if state == techage.RUNNING and topic == "on" then set_input(pos, number, src, topic) elseif state == techage.RUNNING and topic == "off" then @@ -444,5 +444,4 @@ techage.register_node({"techage:ta4_icta_controller"}, { return "unsupported" end end, -}) - +}) diff --git a/techage/icta_controller/display.lua b/techage/icta_controller/display.lua index fa01b42..e2a182d 100644 --- a/techage/icta_controller/display.lua +++ b/techage/icta_controller/display.lua @@ -7,20 +7,20 @@ AGPL v3 See LICENSE.txt for more information - + ICTA Controller - Display ]]-- - + local S = techage.S techage.display = {} -local NUM_ROWS = 5 +local NUM_ROWS = 5 local RADIUS = 6 local Param2ToFacedir = {[0] = 0, 0, 3, 1, 2, 0} - -local function lcdlib_bugfix(text_tbl) + +local function lcdlib_bugfix(text_tbl) if text_tbl and next(text_tbl) then local t = {} for _,txt in ipairs(text_tbl) do @@ -34,11 +34,11 @@ local function lcdlib_bugfix(text_tbl) end return "" end - + function techage.display.display_update(pos, objref) pos = vector.round(pos) local nvm = techage.get_nvm(pos) - local text = lcdlib_bugfix(nvm.text) + local text = lcdlib_bugfix(nvm.text) local texture = lcdlib.make_multiline_texture( "default", text, 70, 70, NUM_ROWS, "top", "#000") @@ -49,7 +49,7 @@ end function techage.display.display_updateXL(pos, objref) pos = vector.round(pos) local nvm = techage.get_nvm(pos) - local text = lcdlib_bugfix(nvm.text) + local text = lcdlib_bugfix(nvm.text) local texture = lcdlib.make_multiline_texture( "default", text, 126, 70, NUM_ROWS, "top", "#000") @@ -60,9 +60,9 @@ end function techage.display.on_timer(pos) local mem = techage.get_mem(pos) mem.ticks = mem.ticks or 0 - + if mem.ticks > 0 then - local node = minetest.get_node(pos) + local node = minetest.get_node(pos) -- check if display is loaded and a player in front of the display if node.name ~= "ignore" then local dir = minetest.facedir_to_dir(Param2ToFacedir[node.param2 % 6]) @@ -97,7 +97,7 @@ minetest.register_node("techage:ta4_display", { node_box = techage.display.lcd_box, selection_box = techage.display.lcd_box, light_source = 6, - + display_entities = { ["techage:display_entity"] = { depth = 0.42, on_display_update = techage.display.display_update}, @@ -145,7 +145,7 @@ minetest.register_node("techage:ta4_displayXL", { node_box = techage.display.lcd_boxXL, selection_box = techage.display.lcd_boxXL, light_source = 6, - + display_entities = { ["techage:display_entityXL"] = { depth = 0.42, on_display_update = techage.display.display_updateXL}, @@ -200,11 +200,11 @@ function techage.display.add_line(pos, payload, cycle_time) nvm.text = nvm.text or {} mem.ticks = mem.ticks or 0 local str = tostring(payload) or "oops" - + if mem.ticks == 0 then mem.ticks = cycle_time end - + while #nvm.text >= NUM_ROWS do table.remove(nvm.text, 1) end @@ -218,14 +218,14 @@ function techage.display.write_row(pos, payload, cycle_time) mem.ticks = mem.ticks or 0 local str = tostring(payload.get("str")) or "oops" local row = tonumber(payload.get("row")) or 1 - + if mem.ticks == 0 then mem.ticks = cycle_time end - + if row < 1 then row = 1 end if row > NUM_ROWS then row = NUM_ROWS end - + while #nvm.text < row do table.insert(nvm.text, "") end @@ -236,7 +236,7 @@ function techage.display.clear_screen(pos, cycle_time) local nvm = techage.get_nvm(pos) local mem = techage.get_mem(pos) mem.ticks = mem.ticks or 0 - + if mem.ticks == 0 then mem.ticks = cycle_time end @@ -254,7 +254,7 @@ techage.register_node({"techage:ta4_display"}, { techage.display.clear_screen(pos, 1) end end, -}) +}) techage.register_node({"techage:ta4_displayXL"}, { on_recv_message = function(pos, src, topic, payload) @@ -270,4 +270,3 @@ techage.register_node({"techage:ta4_displayXL"}, { lcdlib.register_display_entity("techage:display_entity") lcdlib.register_display_entity("techage:display_entityXL") - diff --git a/techage/icta_controller/edit.lua b/techage/icta_controller/edit.lua index 7e8e7a7..55a89db 100644 --- a/techage/icta_controller/edit.lua +++ b/techage/icta_controller/edit.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + ICTA Controller - Formspec edit command ]]-- @@ -20,8 +20,8 @@ function techage.edit_command(fs_data, text) if cmnd and pos1 and pos2 then pos1 = math.max(1, math.min(pos1, techage.NUM_RULES)) pos2 = math.max(1, math.min(pos2, techage.NUM_RULES)) - - if cmnd == "x" then + + if cmnd == "x" then local temp = fs_data[pos1] fs_data[pos1] = fs_data[pos2] fs_data[pos2] = temp diff --git a/techage/icta_controller/formspec.lua b/techage/icta_controller/formspec.lua index 09bd4b7..13d682c 100644 --- a/techage/icta_controller/formspec.lua +++ b/techage/icta_controller/formspec.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + ICTA Controller - Formspec ]]-- @@ -26,15 +26,15 @@ Examples for conditions are: - the Player Detector detects a player - a button is pressed - a machine is fault, blocked, standby,... - + Actions are: - switch on/off lamps and machines - send chat messages to the owner - output a text message to the display - + The controller executes all rules cyclically. The cycle time for each rule is configurable -(1..1000 sec). +(1..1000 sec). 0 means, the rule will only be called, if the controller received a command from another blocks, such as buttons. @@ -51,14 +51,14 @@ The 'outp' tab is for debugging outputs via 'print' The 'notes' tab for your notes. The controller needs battery power to work. -The battery pack has to be placed near the -controller (1 node distance). -The needed battery power is directly dependent +The battery pack has to be placed near the +controller (1 node distance). +The needed battery power is directly dependent on the CPU time the controller consumes. - The Manual in German: + The Manual in German: https://github.com/joe7575/techage/blob/master/manuals/ta4_icta_controller_DE.md - + Or the same as PDF: https://github.com/joe7575/techage/blob/master/manuals/ta4_icta_controller_DE.pdf @@ -70,7 +70,7 @@ local lButtonKeys = {} for idx = 1,techage.NUM_RULES do lButtonKeys[#lButtonKeys+1] = "cond"..idx lButtonKeys[#lButtonKeys+1] = "actn"..idx -end +end local function buttons(s) return "button_exit[7.4,7.5;1.8,1;cancel;Cancel]".. @@ -80,7 +80,7 @@ end function techage.formspecError(meta) local running = meta:get_int("state") == techage.RUNNING - local cmnd = running and "stop;Stop" or "start;Start" + local cmnd = running and "stop;Stop" or "start;Start" local init = meta:get_string("init") init = minetest.formspec_escape(init) return "size[4,3]".. @@ -101,7 +101,7 @@ end function techage.listing(fs_data) local tbl = {} - + for idx = 1,techage.NUM_RULES do tbl[#tbl+1] = idx.." ("..fs_data[idx].cycle.."s): IF "..button(fs_data[idx].cond) tbl[#tbl+1] = " THEN "..button(fs_data[idx].actn).." after "..fs_data[idx].after.."s\n" @@ -112,7 +112,7 @@ end local function formspec_rules(fs_data) local tbl = {"field[0,0;0,0;_type_;;main]".. "label[0.4,0;Cycle/s:]label[2.5,0;IF cond:]label[7,0;THEN action:]label[11.5,0;after/s:]"} - + for idx = 1,techage.NUM_RULES do local ypos = idx * 0.75 - 0.4 tbl[#tbl+1] = "label[0,"..(0.2+ypos)..";"..idx.."]" @@ -129,7 +129,7 @@ function techage.store_main_form_data(meta, fields) for idx = 1,techage.NUM_RULES do fs_data[idx].cycle = fields["cycle"..idx] or "" fs_data[idx].after = fields["after"..idx] or "0" - end + end meta:set_string("fs_data", minetest.serialize(fs_data)) end @@ -150,10 +150,10 @@ function techage.formspecSubMenu(meta, key) else local row = tonumber(key:sub(5,5)) return techage.actn_formspec(row, fs_data[row].actn) - end + end end -function techage.formspec_button_update(meta, fields) +function techage.formspec_button_update(meta, fields) local fs_data = minetest.deserialize(meta:get_string("fs_data")) local row = tonumber(fields._row_ or 1) if fields._col_ == "cond" then @@ -164,7 +164,7 @@ function techage.formspec_button_update(meta, fields) meta:set_string("fs_data", minetest.serialize(fs_data)) end -function techage.cond_formspec_update(meta, fields) +function techage.cond_formspec_update(meta, fields) local fs_data = minetest.deserialize(meta:get_string("fs_data")) local row = tonumber(fields._row_ or 1) fs_data[row].cond = techage.cond_eval_input(fs_data[row].cond, fields) @@ -172,7 +172,7 @@ function techage.cond_formspec_update(meta, fields) meta:set_string("fs_data", minetest.serialize(fs_data)) end -function techage.actn_formspec_update(meta, fields) +function techage.actn_formspec_update(meta, fields) local fs_data = minetest.deserialize(meta:get_string("fs_data")) local row = tonumber(fields._row_ or 1) fs_data[row].actn = techage.actn_eval_input(fs_data[row].actn, fields) @@ -183,7 +183,7 @@ end function techage.formspecRules(meta, fs_data, output) local running = meta:get_int("state") == techage.RUNNING - local cmnd = running and "stop;Stop" or "start;Start" + local cmnd = running and "stop;Stop" or "start;Start" local init = meta:get_string("init") init = minetest.formspec_escape(init) return SIZE.. @@ -200,7 +200,7 @@ end function techage.formspecOutput(meta) local running = meta:get_int("state") == techage.RUNNING - local cmnd = running and "stop;Stop" or "start;Start" + local cmnd = running and "stop;Stop" or "start;Start" local output = meta:get_string("output") output = minetest.formspec_escape(output) return SIZE.. @@ -217,7 +217,7 @@ end function techage.formspecNotes(meta) local running = meta:get_int("state") == techage.RUNNING - local cmnd = running and "stop;Stop" or "start;Start" + local cmnd = running and "stop;Stop" or "start;Start" local notes = meta:get_string("notes") or "" if notes == "" then notes = "" end notes = minetest.formspec_escape(notes) diff --git a/techage/icta_controller/signaltower.lua b/techage/icta_controller/signaltower.lua index cf3f723..6377494 100644 --- a/techage/icta_controller/signaltower.lua +++ b/techage/icta_controller/signaltower.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + ICTA Controller - Signal Tower ]]-- @@ -18,14 +18,14 @@ local function switch_on(pos, node, color) meta:set_string("state", color) node.name = "techage:ta4_signaltower_"..color minetest.swap_node(pos, node) -end +end local function switch_off(pos, node) local meta = minetest.get_meta(pos) meta:set_string("state", "off") node.name = "techage:ta4_signaltower" minetest.swap_node(pos, node) -end +end minetest.register_node("techage:ta4_signaltower", { description = "TA4 Signal Tower", @@ -42,7 +42,7 @@ minetest.register_node("techage:ta4_signaltower", { { -5/32, -16/32, -5/32, 5/32, 16/32, 5/32}, }, }, - + after_place_node = function(pos, placer) local number = techage.add_node(pos, "techage:ta4_signaltower") local meta = minetest.get_meta(pos) @@ -62,7 +62,7 @@ minetest.register_node("techage:ta4_signaltower", { paramtype = "light", use_texture_alpha = techage.CLIP, - light_source = 0, + light_source = 0, sunlight_propagates = true, paramtype2 = "facedir", groups = {cracky=2, crumbly=2}, @@ -94,7 +94,7 @@ for _,color in ipairs({"green", "amber", "red"}) do paramtype = "light", use_texture_alpha = techage.CLIP, - light_source = 10, + light_source = 10, sunlight_propagates = true, paramtype2 = "facedir", groups = {crumbly=0, not_in_creative_inventory=1}, @@ -113,9 +113,9 @@ minetest.register_craft({ }, }) -techage.register_node({"techage:ta4_signaltower", - "techage:ta4_signaltower_green", - "techage:ta4_signaltower_amber", +techage.register_node({"techage:ta4_signaltower", + "techage:ta4_signaltower_green", + "techage:ta4_signaltower_amber", "techage:ta4_signaltower_red"}, { on_recv_message = function(pos, src, topic, payload) local node = minetest.get_node(pos) @@ -132,4 +132,4 @@ techage.register_node({"techage:ta4_signaltower", return meta:get_string("state") end end, -}) +}) diff --git a/techage/icta_controller/submenu.lua b/techage/icta_controller/submenu.lua index b865c0b..0e690bd 100644 --- a/techage/icta_controller/submenu.lua +++ b/techage/icta_controller/submenu.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + ICTA Controller - Formspec A sub-menu control to generate a formspec sting for conditions and actions @@ -22,11 +22,10 @@ end -- generate the choice dependent part of the form local function add_controls_to_table(tbl, kvDefinition, kvSelect) - local val = "" local offs = 1.4 if kvDefinition[kvSelect.choice] then local lControls = kvDefinition[kvSelect.choice].formspec - for idx,elem in ipairs(lControls) do + for _,elem in ipairs(lControls) do if elem.type == "label" then tbl[#tbl+1] = "label[0,"..offs..";Description:\n"..elem.label.."]" offs = offs + 0.4 @@ -34,14 +33,14 @@ local function add_controls_to_table(tbl, kvDefinition, kvSelect) tbl[#tbl+1] = "label[0,"..offs..";"..elem.label..":]" offs = offs + 0.4 end - if elem.type == "numbers" or elem.type == "number" or elem.type == "digits" or elem.type == "letters" + if elem.type == "numbers" or elem.type == "number" or elem.type == "digits" or elem.type == "letters" or elem.type == "ascii" then - val = kvSelect[elem.name] or elem.default + local val = kvSelect[elem.name] or elem.default tbl[#tbl+1] = "field[0.3,"..(offs+0.2)..";8,1;"..elem.name..";;"..val.."]" offs = offs + 0.9 elseif elem.type == "textlist" then local l = elem.choices:split(",") - val = index(l, kvSelect[elem.name]) or elem.default + local val = index(l, kvSelect[elem.name]) or elem.default tbl[#tbl+1] = "dropdown[0.0,"..(offs)..";8.5,1.4;"..elem.name..";"..elem.choices..";"..val.."]" offs = offs + 0.9 end @@ -52,13 +51,13 @@ end local function default_data(kvDefinition, kvSelect) local lControls = kvDefinition[kvSelect.choice].formspec - for idx,elem in ipairs(lControls) do + for _,elem in ipairs(lControls) do kvSelect[elem.name] = elem.default end kvSelect.button = kvDefinition[kvSelect.choice].button(kvSelect) return kvSelect end - + -- Copy field/formspec data to the table kvSelect -- kvDefinition: submenu formspec definition -- kvSelect: form data @@ -66,48 +65,48 @@ end local function field_to_kvSelect(kvDefinition, kvSelect, fields) local error = false local lControls = kvDefinition[kvSelect.choice].formspec - for idx,elem in ipairs(lControls) do - if elem.type == "numbers" then + for _,elem in ipairs(lControls) do + if elem.type == "numbers" then if fields[elem.name] then - if fields[elem.name]:find("^[%d ]+$") then + if fields[elem.name]:find("^[%d ]+$") then kvSelect[elem.name] = fields[elem.name] else kvSelect[elem.name] = elem.default error = true end end - elseif elem.type == "number" then + elseif elem.type == "number" then if fields[elem.name] then - if fields[elem.name]:find("^[%d ]+$") then + if fields[elem.name]:find("^[%d ]+$") then kvSelect[elem.name] = fields[elem.name] else kvSelect[elem.name] = elem.default error = true end end - elseif elem.type == "digits" then -- including positions + elseif elem.type == "digits" then -- including positions if fields[elem.name] then - if fields[elem.name]:find("^[+%%-,%d]+$") then + if fields[elem.name]:find("^[+%%-,%d]+$") then kvSelect[elem.name] = fields[elem.name] else kvSelect[elem.name] = elem.default error = true end end - elseif elem.type == "letters" then + elseif elem.type == "letters" then if fields[elem.name] then - if fields[elem.name]:find("^[+-]?%a+$") then + if fields[elem.name]:find("^[+-]?%a+$") then kvSelect[elem.name] = fields[elem.name] else kvSelect[elem.name] = elem.default error = true end end - elseif elem.type == "ascii" then + elseif elem.type == "ascii" then if fields[elem.name] then kvSelect[elem.name] = fields[elem.name] end - elseif elem.type == "textlist" then + elseif elem.type == "textlist" then if fields[elem.name] ~= nil then kvSelect[elem.name] = fields[elem.name] end @@ -131,34 +130,34 @@ end function techage.submenu_verify(owner, kvDefinition, kvSelect) local error = false local lControls = kvDefinition[kvSelect.choice].formspec - for idx,elem in ipairs(lControls) do - if elem.type == "numbers" then - if not kvSelect[elem.name]:find("^[%d ]+$") then - error = true - end - if not techage.check_numbers(kvSelect[elem.name], owner) then - error = true - end - elseif elem.type == "number" then - if not kvSelect[elem.name]:find("^[%d]+$") then - error = true - end - if not techage.check_numbers(kvSelect[elem.name], owner) then - error = true - end - elseif elem.type == "digits" then -- including positions - if not kvSelect[elem.name]:find("^[+%%-,%d]+$") then + for _,elem in ipairs(lControls) do + if elem.type == "numbers" then + if not kvSelect[elem.name]:find("^[%d ]+$") then error = true end - elseif elem.type == "letters" then - if not kvSelect[elem.name]:find("^[+-]?%a+$") then + if not techage.check_numbers(kvSelect[elem.name], owner) then error = true end - elseif elem.type == "ascii" then + elseif elem.type == "number" then + if not kvSelect[elem.name]:find("^[%d]+$") then + error = true + end + if not techage.check_numbers(kvSelect[elem.name], owner) then + error = true + end + elseif elem.type == "digits" then -- including positions + if not kvSelect[elem.name]:find("^[+%%-,%d]+$") then + error = true + end + elseif elem.type == "letters" then + if not kvSelect[elem.name]:find("^[+-]?%a+$") then + error = true + end + elseif elem.type == "ascii" then if kvSelect[elem.name] == "" or kvSelect[elem.name] == nil then error = true end - elseif elem.type == "textlist" then + elseif elem.type == "textlist" then if kvSelect[elem.name] == "" or kvSelect[elem.name] == nil then error = true end @@ -184,7 +183,7 @@ function techage.submenu_generate_formspec(row, col, title, lKeys, lChoice, kvDe default.gui_slots.. "field[0,0;0,0;_row_;;"..row.."]".. "field[0,0;0,0;_col_;;"..col.."]"} - + local sChoice = table.concat(lChoice, ",") local idx = index(lKeys, kvSelect.choice) or 1 tbl[#tbl+1] = "label[0,0;"..title..":]" @@ -195,10 +194,10 @@ function techage.submenu_generate_formspec(row, col, title, lKeys, lChoice, kvDe tbl[#tbl+1] = "button[6,8.4;2,1;_exit_;ok]" return table.concat(tbl) end - + -- return the selected and configured menu item based on user inputs (fields) -function techage.submenu_eval_input(kvDefinition, lKeys, lChoice, kvSelect, fields) +function techage.submenu_eval_input(kvDefinition, lKeys, lChoice, kvSelect, fields) -- determine selected choice if fields.choice then -- load with default values @@ -212,4 +211,3 @@ function techage.submenu_eval_input(kvDefinition, lKeys, lChoice, kvSelect, fiel end return kvSelect end - diff --git a/techage/init.lua b/techage/init.lua index 61dfbd1..50810a8 100644 --- a/techage/init.lua +++ b/techage/init.lua @@ -231,7 +231,7 @@ dofile(MP.."/basic_machines/forceload.lua") -- Lamps dofile(MP.."/lamps/lib.lua") -dofile(MP.."/lamps/lightblock.lua") +dofile(MP.."/lamps/lightblock.lua") dofile(MP.."/lamps/simplelamp.lua") dofile(MP.."/lamps/streetlamp.lua") dofile(MP.."/lamps/streetlamp2.lua") diff --git a/techage/iron_age/charcoalpile.lua b/techage/iron_age/charcoalpile.lua index abd7422..f344069 100644 --- a/techage/iron_age/charcoalpile.lua +++ b/techage/iron_age/charcoalpile.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - + Charcoalpile to produce charcoal - + ]]-- local S = techage.S @@ -124,7 +124,7 @@ local function convert_to_coal(pos) minetest.swap_node(pos, {name = "techage:charcoal"}) make_dirt_with_ash(pos) make_dirt_with_dry_grass(pos) -end +end function techage.start_pile(pos) local meta = minetest.get_meta(pos) @@ -202,7 +202,7 @@ minetest.register_node("techage:charcoal", { minetest.after(COAL_BURN_TIME/2, minetest.remove_node, pos) end, is_ground_content = false, - groups = {crumbly = 2, falling_node = 1}, + groups = {crumbly = 2, falling_node = 1}, sounds = default.node_sound_dirt_defaults(), }) @@ -225,4 +225,3 @@ minetest.register_lbm({ end end }) - diff --git a/techage/iron_age/coalburner.lua b/techage/iron_age/coalburner.lua index bd2db0d..b11f603 100644 --- a/techage/iron_age/coalburner.lua +++ b/techage/iron_age/coalburner.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - + Coalburner as heater for the Meltingpot - + ]]-- local S = techage.S @@ -75,7 +75,7 @@ local function calc_num_coal(height, burn_time) num = math.max(height + math.floor(burn_time/x), 0) end return num -end +end local function flame(pos, height, heat, first_time) local idx @@ -123,7 +123,7 @@ for idx,ratio in ipairs(lRatio) do }, }, }, - + after_destruct = function(pos, oldnode) pos.y = pos.y + 1 local node = techage.get_node_lvm(pos) @@ -131,7 +131,7 @@ for idx,ratio in ipairs(lRatio) do minetest.remove_node(pos) end end, - + drawtype = "glasslike", use_texture_alpha = techage.BLEND, inventory_image = "techage_flame.png", @@ -167,7 +167,7 @@ minetest.register_node("techage:ash", { function techage.start_burner(pos, playername) local height = num_coal(pos) if minetest.is_protected( - {x=pos.x, y=pos.y+height, z=pos.z}, + {x=pos.x, y=pos.y+height, z=pos.z}, playername) then return end @@ -179,9 +179,9 @@ function techage.start_burner(pos, playername) start_burner(pos, height) flame(pos, height, height, true) local handle = minetest.sound_play("techage_gasflare", { - pos = {x=pos.x, y=pos.y+height, z=pos.z}, - max_hear_distance = 20, - gain = height/12.0, + pos = {x=pos.x, y=pos.y+height, z=pos.z}, + max_hear_distance = 20, + gain = height/12.0, loop = true}) meta:set_int("handle", handle) minetest.get_node_timer(pos):start(CYCLE_TIME) @@ -212,9 +212,9 @@ function techage.keep_running_burner(pos) flame(pos, height, num_coal, false) end handle = minetest.sound_play("techage_gasflare", { - pos = {x=pos.x, y=pos.y+height, z=pos.z}, - max_hear_distance = 32, - gain = num_coal/12.0, + pos = {x=pos.x, y=pos.y+height, z=pos.z}, + max_hear_distance = 32, + gain = num_coal/12.0, loop = true}) meta:set_int("handle", handle) else @@ -246,5 +246,3 @@ function techage.stop_burner(pos) minetest.sound_stop(handle) meta:set_int("burn_time", 0) end - - diff --git a/techage/iron_age/gravelsieve.lua b/techage/iron_age/gravelsieve.lua index e2b6fc7..2ef5446 100644 --- a/techage/iron_age/gravelsieve.lua +++ b/techage/iron_age/gravelsieve.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - + Gravel Sieve, sieving gravel to find ores - + ]]-- -- for lazy programmers @@ -53,7 +53,7 @@ local function keep_running(pos, elapsed) if swap_node(pos) then local inv = M(pos):get_inventory() local src, dst - + if inv:contains_item("src", ItemStack("techage:basalt_gravel")) then dst, src = get_random_basalt_ore(), ItemStack("techage:basalt_gravel") elseif inv:contains_item("src", ItemStack("default:gravel")) then @@ -111,12 +111,12 @@ local nodebox_data = { { -8/16, -3/16, 6/16, 8/16, 4/16, 8/16 }, { -8/16, -3/16, -8/16, -6/16, 4/16, 8/16 }, { 6/16, -3/16, -8/16, 8/16, 4/16, 8/16 }, - + { -8/16, -8/16, -8/16, -6/16, -3/16, -6/16 }, { 6/16, -8/16, -8/16, 8/16, -3/16, -6/16 }, { -8/16, -8/16, 6/16, -6/16, -3/16, 8/16 }, { 6/16, -8/16, 6/16, 8/16, -3/16, 8/16 }, - + { -6/16, -2/16, -6/16, 6/16, 8/16, 6/16 }, } @@ -139,10 +139,10 @@ for idx = 0,3 do fixed = { -8/16, -3/16, -8/16, 8/16, 4/16, 8/16 }, }, - on_construct = idx == 3 and on_construct or nil, + on_construct = idx == 3 and on_construct or nil, on_punch = idx == 3 and on_punch or nil, on_timer = keep_running, - + minecart_hopper_takeitem = minecart_hopper_takeitem, minecart_hopper_untakeitem = minecart_hopper_untakeitem, @@ -168,7 +168,7 @@ techage.register_node({"techage:sieve0", "techage:sieve1", "techage:sieve2", "te end return false end, -}) +}) minetest.register_node("techage:sieved_gravel", { description = S("Sieved Gravel"), @@ -210,4 +210,3 @@ minetest.register_craft({ minetest.register_alias("techage:sieve", "techage:sieve3") minetest.register_alias("techage:auto_sieve", "techage:auto_sieve3") - diff --git a/techage/iron_age/hammer.lua b/techage/iron_age/hammer.lua index 5c5a360..058bfbd 100644 --- a/techage/iron_age/hammer.lua +++ b/techage/iron_age/hammer.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - + Hammer to convert stone into gravel - + ]]-- local S = techage.S @@ -213,4 +213,3 @@ minetest.register_craft({ {"", "group:stick", ""}, } }) - diff --git a/techage/iron_age/hopper.lua b/techage/iron_age/hopper.lua index 374eb0f..6f6db01 100644 --- a/techage/iron_age/hopper.lua +++ b/techage/iron_age/hopper.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - + Simple TA1 Hopper - + ]]-- -- Consumer Related Data @@ -23,7 +23,7 @@ minecart.register_inventory( { "techage:chest_ta2", "techage:chest_ta3", "techage:chest_ta4", "techage:meltingpot", "techage:meltingpot_active", - }, + }, { put = { listname = "main", @@ -49,7 +49,7 @@ minecart.register_inventory( allow_inventory_put = function(pos, stack, player_name) CRD(pos).State:start_if_standby(pos) return true - end, + end, listname = "src", }, take = { @@ -61,7 +61,7 @@ minecart.register_inventory( minecart.register_inventory( { "techage:sieve0", "techage:sieve1", "techage:sieve2", "techage:sieve3", - }, + }, { put = { allow_inventory_put = function(pos, stack, player_name) @@ -71,7 +71,7 @@ minecart.register_inventory( minetest.get_node_timer(pos):start(1) return true end - end, + end, listname = "src", }, } diff --git a/techage/iron_age/lighter.lua b/techage/iron_age/lighter.lua index abfc009..8885f0d 100644 --- a/techage/iron_age/lighter.lua +++ b/techage/iron_age/lighter.lua @@ -7,28 +7,28 @@ AGPL v3 See LICENSE.txt for more information - + Lighter for Coalburner and Charcoalpile - + ]]-- local S = techage.S minetest.register_node("techage:lighter_burn", { tiles = {"techage_lighter_burn.png"}, - + after_place_node = function(pos) techage.start_pile(pos) end, - + on_timer = function(pos, elapsed) return techage.keep_running_pile(pos) end, - + on_destruct = function(pos) techage.stop_pile(pos) end, - + drop = "", light_source = 10, is_ground_content = false, @@ -38,21 +38,21 @@ minetest.register_node("techage:lighter_burn", { minetest.register_node("techage:coal_lighter_burn", { tiles = {"techage_lighter_burn.png"}, - + after_place_node = function(pos) local meta = minetest.get_meta(pos) local playername = meta:get_string("playername") techage.start_burner(pos, playername) end, - + on_timer = function(pos, elapsed) return techage.keep_running_burner(pos) end, - + on_destruct = function(pos) techage.stop_burner(pos) end, - + drop = "", light_source = 10, is_ground_content = false, @@ -75,7 +75,7 @@ minetest.register_node("techage:lighter", { meta:set_string("playername", placer:get_player_name()) end, is_ground_content = false, - groups = {crumbly = 3, snappy = 3, oddly_breakable_by_hand = 1, flammable = 2}, + groups = {crumbly = 3, snappy = 3, oddly_breakable_by_hand = 1, flammable = 2}, sounds = default.node_sound_dirt_defaults(), }) @@ -87,4 +87,3 @@ minetest.register_craft({ {''}, } }) - diff --git a/techage/iron_age/main.lua b/techage/iron_age/main.lua index cd5bab5..eb2d59f 100644 --- a/techage/iron_age/main.lua +++ b/techage/iron_age/main.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + ]]-- function techage.ironage_swap_node(pos, name) @@ -26,4 +26,3 @@ function techage.ironage_swap_nodes(pos1, pos2, name1, name2) techage.ironage_swap_node(p, name2) end end - diff --git a/techage/iron_age/meltingpot.lua b/techage/iron_age/meltingpot.lua index 5a286e6..0d3a406 100644 --- a/techage/iron_age/meltingpot.lua +++ b/techage/iron_age/meltingpot.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - - Meltingpot to produce metal and alloy ingots - + + Meltingpot to produce metal and alloy ingots + ]]-- local S = techage.S @@ -36,23 +36,23 @@ local function draw(images) end end return table.concat(tbl) -end +end -local formspec1 = +local formspec1 = "size[8,8]".. default.gui_bg.. default.gui_bg_img.. default.gui_slots.. "tabheader[0,0;tab;"..Tabs..";1;;true]".. "label[1,0.2;"..S("Menu").."]".. - + "container[1,1]".. "list[current_name;src;0,0;2,2;]".. "item_image[2.6,0;0.8,0.8;techage:meltingpot]".. "image[2.3,0.6;1.6,1;gui_furnace_arrow_bg.png^[transformR270]".. "list[current_name;dst;4,0;2,2;]".. "container_end[]".. - + "list[current_player;main;0,4;8,4;]".. "listring[current_name;dst]".. "listring[current_player;main]".. @@ -79,7 +79,7 @@ local function formspec2(idx) default.gui_slots.. "tabheader[0,0;tab;"..Tabs..";2;;true]".. "label[1,0.2;"..S("Melting Guide").."]".. - + "container[1,1]".. "item_image_button[0,0;1,1;"..input1..";b1;]".. "item_image_button[1,0;1,1;"..input2..";b2;]".. @@ -177,7 +177,7 @@ local function get_recipe(inv) end local key = recipe_key(names) local recipe = Recipes[key] - + if recipe then return { input = recipe.input, @@ -210,24 +210,24 @@ local function get_heat(pos) pos.y = pos.y + 1 return 0 end - + pos.y = pos.y - 1 node = techage.get_node_lvm(pos) pos.y = pos.y + 2 - if minetest.get_item_group(node.name, "techage_flame") == 0 and + if minetest.get_item_group(node.name, "techage_flame") == 0 and node.name ~= "techage:charcoal_burn" then return 0 end - - return meta:get_int("heat") + + return meta:get_int("heat") end - + -- Start melting if heat is ok AND source items available function techage.switch_to_active(pos) local meta = minetest.get_meta(pos) local heat = get_heat(pos) local recipe = store_recipe_in_cache(pos) - + if recipe and heat >= recipe.heat then minetest.swap_node(pos, {name = "techage:meltingpot_active"}) minetest.registered_nodes["techage:meltingpot_active"].on_construct(pos) @@ -237,13 +237,13 @@ function techage.switch_to_active(pos) end meta:set_string("infotext", S("Melting Pot inactive (heat=")..heat..")") return false -end +end function techage.update_heat(pos) local meta = minetest.get_meta(pos) local heat = get_heat(pos) meta:set_string("infotext", S("Melting Pot inactive (heat=")..heat..")") -end +end local function set_inactive(meta, pos, heat) minetest.get_node_timer(pos):stop() @@ -258,14 +258,14 @@ local function switch_to_inactive(pos) local heat = get_heat(pos) local hash = minetest.hash_node_position(pos) local recipe = Cache[hash] or store_recipe_in_cache(pos) - + if not recipe or heat < recipe.heat then set_inactive(meta, pos, heat) return true end meta:set_string("infotext", S("Melting Pot active (heat=")..heat..")") return false -end +end local function index(list, x) @@ -300,15 +300,15 @@ local function process(inv, recipe, heat) return true end return false -end +end local function smelting(pos, recipe, heat, elapsed) local meta = minetest.get_meta(pos) local inv = meta:get_inventory() elapsed = elapsed + meta:get_int("leftover") - + while elapsed >= recipe.time do - if process(inv, recipe, heat) == false then + if process(inv, recipe, heat) == false then meta:set_int("leftover", 0) set_inactive(meta, pos, heat) return false @@ -361,7 +361,7 @@ minetest.register_node("techage:meltingpot_active", { type = "fixed", fixed = {-10/16, -8/16, -10/16, 10/16, 9/16, 10/16}, }, - + on_construct = function(pos) local meta = minetest.get_meta(pos) meta:set_string("formspec", formspec1) @@ -369,32 +369,32 @@ minetest.register_node("techage:meltingpot_active", { inv:set_size('src', 4) inv:set_size('dst', 4) end, - + on_timer = function(pos, elapsed) return pot_node_timer(pos, elapsed) end, - + on_receive_fields = function(pos, formname, fields, sender) on_receive_fields(pos, formname, fields, sender) end, - + on_metadata_inventory_move = function(pos) store_recipe_in_cache(pos) switch_to_inactive(pos) end, - + on_metadata_inventory_put = function(pos) store_recipe_in_cache(pos) switch_to_inactive(pos) end, - + on_metadata_inventory_take = function(pos) store_recipe_in_cache(pos) switch_to_inactive(pos) end, - + can_dig = can_dig, - + drop = "techage:meltingpot", is_ground_content = false, groups = {cracky = 3, not_in_creative_inventory=1}, @@ -426,7 +426,7 @@ minetest.register_node("techage:meltingpot", { type = "fixed", fixed = {-10/16, -8/16, -10/16, 10/16, 9/16, 10/16}, }, - + on_construct = function(pos) local meta = minetest.get_meta(pos) meta:set_string("formspec", formspec1) @@ -435,28 +435,28 @@ minetest.register_node("techage:meltingpot", { inv:set_size('src', 4) inv:set_size('dst', 4) end, - + on_metadata_inventory_move = function(pos) store_recipe_in_cache(pos) techage.switch_to_active(pos) end, - + on_metadata_inventory_put = function(pos) store_recipe_in_cache(pos) techage.switch_to_active(pos) end, - + on_metadata_inventory_take = function(pos) store_recipe_in_cache(pos) techage.switch_to_active(pos) end, - + on_receive_fields = function(pos, formname, fields, sender) on_receive_fields(pos, formname, fields, sender) end, - + can_dig = can_dig, - + is_ground_content = false, groups = {cracky = 3}, sounds = default.node_sound_metal_defaults(), @@ -511,4 +511,3 @@ function techage.ironage_register_recipe(recipe) recipe.type = "melting" techage.recipes.register_craft(recipe) end - diff --git a/techage/iron_age/meridium.lua b/techage/iron_age/meridium.lua index 292502b..e456444 100644 --- a/techage/iron_age/meridium.lua +++ b/techage/iron_age/meridium.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - + Brilliant Meririum and tools (mod "wielded_light" needed) - + ]]-- local S = techage.S @@ -118,9 +118,8 @@ minetest.register_craft({ }) techage.ironage_register_recipe({ - output = "techage:meridium_ingot", - recipe = {"default:steel_ingot", "default:mese_crystal_fragment"}, + output = "techage:meridium_ingot", + recipe = {"default:steel_ingot", "default:mese_crystal_fragment"}, heat = 4, time = 3, }) - diff --git a/techage/iron_age/recipes.lua b/techage/iron_age/recipes.lua index c00e7ea..4169811 100644 --- a/techage/iron_age/recipes.lua +++ b/techage/iron_age/recipes.lua @@ -7,10 +7,10 @@ AGPL v3 See LICENSE.txt for more information - + Meltingpot recipes Bucket redefinitions - + ]]-- local S = techage.S @@ -19,15 +19,15 @@ local S = techage.S -- New burner recipes -- techage.ironage_register_recipe({ - output = "default:obsidian", - recipe = {"default:cobble"}, + output = "default:obsidian", + recipe = {"default:cobble"}, heat = 10, time = 8, }) techage.ironage_register_recipe({ - output = "techage:iron_ingot", - recipe = {"default:iron_lump"}, + output = "techage:iron_ingot", + recipe = {"default:iron_lump"}, heat = 5, time = 3, }) @@ -64,7 +64,7 @@ local function register_liquid(source, flowing, itemname, inventory_image, name, if itemname ~= nil then minetest.unregister_item(itemname) - + minetest.register_craftitem(":"..itemname, { description = name, inventory_image = inventory_image, @@ -126,7 +126,7 @@ local function register_liquid(source, flowing, itemname, inventory_image, name, -- see "basis/lib.lua" techage.is_ocean(pos) minetest.set_node(lpos, {name = source, param2 = 1}) end - -------------------------------- End Modification + -------------------------------- End Modification return ItemStack("bucket:bucket_empty") end }) @@ -159,32 +159,32 @@ if techage.modified_recipes_enabled then {'default:bronzeblock'}, } }) - + techage.ironage_register_recipe({ - output = "default:bronze_ingot 4", - recipe = {"default:copper_ingot", "default:copper_ingot", "default:copper_ingot", "default:tin_ingot"}, + output = "default:bronze_ingot 4", + recipe = {"default:copper_ingot", "default:copper_ingot", "default:copper_ingot", "default:tin_ingot"}, heat = 4, time = 8, }) techage.ironage_register_recipe({ - output = "default:steel_ingot 4", - recipe = {"default:coal_lump", "default:iron_lump", "default:iron_lump", "default:iron_lump"}, + output = "default:steel_ingot 4", + recipe = {"default:coal_lump", "default:iron_lump", "default:iron_lump", "default:iron_lump"}, heat = 7, time = 8, }) techage.ironage_register_recipe({ - output = "default:tin_ingot 1", - recipe = {"default:tin_lump"}, + output = "default:tin_ingot 1", + recipe = {"default:tin_lump"}, heat = 4, time = 2, }) - + if minetest.global_exists("moreores") then techage.ironage_register_recipe({ - output = "moreores:silver_ingot 1", - recipe = {"moreores:silver_lump"}, + output = "moreores:silver_ingot 1", + recipe = {"moreores:silver_lump"}, heat = 5, time = 2, }) @@ -217,7 +217,7 @@ if techage.modified_recipes_enabled then minetest.override_item("bucket:bucket_river_water", { inventory_image = "bucket_river_water.png^[colorize:#c7643d:30" }) - + register_liquid( "default:water_source", "default:water_flowing", @@ -235,4 +235,3 @@ if techage.modified_recipes_enabled then "Lava Bucket" ) end - diff --git a/techage/iron_age/tools.lua b/techage/iron_age/tools.lua index c0db0bb..3316ebc 100644 --- a/techage/iron_age/tools.lua +++ b/techage/iron_age/tools.lua @@ -5,7 +5,7 @@ Copyright (C) 2018 Joachim Stolberg Based on mods/default/tools.lua - + AGPL v3 See LICENSE.txt for more information @@ -100,4 +100,3 @@ local function tools() end minetest.after(1, tools) - diff --git a/techage/items/aluminium.lua b/techage/items/aluminium.lua index 0cab2d1..c75381b 100644 --- a/techage/items/aluminium.lua +++ b/techage/items/aluminium.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + Aluminium ]]-- @@ -55,9 +55,9 @@ techage.recipes.add("ta4_doser", { }) techage.furnace.register_recipe({ - output = "techage:aluminum 2", - recipe = {"techage:gibbsite_powder", "techage:gibbsite_powder", - "techage:gibbsite_powder", "techage:gibbsite_powder"}, + output = "techage:aluminum 2", + recipe = {"techage:gibbsite_powder", "techage:gibbsite_powder", + "techage:gibbsite_powder", "techage:gibbsite_powder"}, time = 16, - + }) diff --git a/techage/items/baborium.lua b/techage/items/baborium.lua index 47f80b4..f82f0fb 100644 --- a/techage/items/baborium.lua +++ b/techage/items/baborium.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - + Baborium - + ]]-- local S = techage.S @@ -48,4 +48,4 @@ minetest.register_craft({ output = 'techage:baborium_ingot', recipe = 'techage:baborium_lump', cooktime = 5, -}) \ No newline at end of file +}) diff --git a/techage/items/barrel.lua b/techage/items/barrel.lua index bf7e961..226de59 100644 --- a/techage/items/barrel.lua +++ b/techage/items/barrel.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + Barrel/Liquid/Canister/Water ]]-- @@ -18,14 +18,14 @@ minetest.register_craftitem("techage:water", { description = S("Water"), inventory_image = "techage_liquid2_inv.png^[colorize:#0b6eca:120^techage_liquid1_inv.png", groups = {not_in_creative_inventory=1}, - + }) minetest.register_craftitem("techage:river_water", { description = S("Water"), inventory_image = "techage_liquid2_inv.png^[colorize:#189dc3:120^techage_liquid1_inv.png", groups = {not_in_creative_inventory=1}, - + }) minetest.register_craftitem("techage:barrel_water", { diff --git a/techage/items/basalt.lua b/techage/items/basalt.lua index 8a771d5..e3fe2f6 100644 --- a/techage/items/basalt.lua +++ b/techage/items/basalt.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - + Basalt as result from the lava/water generator - + ]]-- local S = techage.S diff --git a/techage/items/bauxit.lua b/techage/items/bauxit.lua index 730bb6d..cf3102a 100644 --- a/techage/items/bauxit.lua +++ b/techage/items/bauxit.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - + Bauxite - + ]]-- local S = techage.S diff --git a/techage/items/cement.lua b/techage/items/cement.lua index 899678d..ccb8b6f 100644 --- a/techage/items/cement.lua +++ b/techage/items/cement.lua @@ -7,10 +7,10 @@ AGPL v3 See LICENSE.txt for more information - + Cement as ingredient and alternative recipe for basic_materials:wet_cement Cement is cooked and grinded clay - + ]]-- local S = techage.S @@ -26,14 +26,14 @@ if not minetest.get_modpath("bakedclay") then }) minetest.register_craft({ - type = "cooking", + type = "cooking", output = "techage:cement_block", recipe = "default:clay", }) techage.add_grinder_recipe({input="techage:cement_block", output="techage:cement_powder"}) else - -- The block should not exist when the mod baked clay is loaded. + -- The block should not exist when the mod baked clay is loaded. -- But this block was active due to an error and can therefore no longer be deleted. minetest.register_node("techage:cement_block", { description = S("Cement Block"), @@ -42,7 +42,7 @@ else groups = {cracky = 2, stone = 1}, sounds = default.node_sound_stone_defaults(), }) - + techage.add_grinder_recipe({input="techage:cement_block", output="techage:cement_powder"}) techage.add_grinder_recipe({input="bakedclay:white", output="techage:cement_powder"}) end @@ -61,4 +61,3 @@ minetest.register_craft({ }, replacements = {{"bucket:bucket_water", "bucket:bucket_empty"}}, }) - diff --git a/techage/items/ceramic.lua b/techage/items/ceramic.lua index 357fb00..f2d1dcf 100644 --- a/techage/items/ceramic.lua +++ b/techage/items/ceramic.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - + TA4 Ceramic - + ]]-- local S = techage.S @@ -48,8 +48,8 @@ minetest.register_craftitem("techage:ta4_furnace_ceramic", { techage.furnace.register_recipe({ output = "techage:ta4_furnace_ceramic", recipe = { - "techage:ta4_ceramic_material", - "techage:ta4_ceramic_material", + "techage:ta4_ceramic_material", + "techage:ta4_ceramic_material", }, time = 16, }) @@ -66,4 +66,4 @@ techage.furnace.register_recipe({ "techage:ta4_ceramic_material", "techage:ta4_ceramic_material", }, time = 16, -}) \ No newline at end of file +}) diff --git a/techage/items/cracking.lua b/techage/items/cracking.lua index 3555de7..284bda4 100644 --- a/techage/items/cracking.lua +++ b/techage/items/cracking.lua @@ -7,15 +7,15 @@ AGPL v3 See LICENSE.txt for more information - + Cracking breaks long chains of hydrocarbons into short chains using a catalyst. - Gibbsite powder serves as a catalyst (is not consumed). + Gibbsite powder serves as a catalyst (is not consumed). It can be used to convert bitumen into fueloil, fueloil into naphtha and naphtha into gasoline. - In hydrogenation, pairs of hydrogen atoms are added to a molecule to convert short-chain - hydrocarbons into long ones. - Here iron powder is required as a catalyst (is not consumed). - It can be used to convert gas (propan) into isobutane, isobutane into gasoline, gasoline into naphtha, + In hydrogenation, pairs of hydrogen atoms are added to a molecule to convert short-chain + hydrocarbons into long ones. + Here iron powder is required as a catalyst (is not consumed). + It can be used to convert gas (propan) into isobutane, isobutane into gasoline, gasoline into naphtha, naphtha into fueloil, and fueloil into bitumen. ]]-- diff --git a/techage/items/electronic.lua b/techage/items/electronic.lua index 49f7a33..ad180ce 100644 --- a/techage/items/electronic.lua +++ b/techage/items/electronic.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - + Bauxite - + ]]-- local S = techage.S diff --git a/techage/items/epoxy.lua b/techage/items/epoxy.lua index 21a7efd..26a2ae2 100644 --- a/techage/items/epoxy.lua +++ b/techage/items/epoxy.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - - Epoxy - + + Epoxy + ]]-- local S = techage.S @@ -42,4 +42,4 @@ techage.recipes.add("ta4_doser", { techage.register_liquid("techage:barrel_epoxy", "techage:ta3_barrel_empty", 10, "techage:epoxy") techage.register_liquid("techage:canister_epoxy", "techage:ta3_canister_empty", 1, "techage:epoxy") -minetest.register_alias("techage:ta4_epoxy", "techage:canister_epoxy") \ No newline at end of file +minetest.register_alias("techage:ta4_epoxy", "techage:canister_epoxy") diff --git a/techage/items/hydrogen.lua b/techage/items/hydrogen.lua index 24b70bd..1abce56 100644 --- a/techage/items/hydrogen.lua +++ b/techage/items/hydrogen.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA4 Hydrogen ]]-- @@ -17,7 +17,7 @@ local S = techage.S minetest.register_craftitem("techage:hydrogen", { description = S("TA4 Hydrogen"), inventory_image = "techage_hydrogen_inv.png", - groups = {ta_liquid = 1}, + groups = {ta_liquid = 1}, }) minetest.register_craftitem("techage:cylinder_small_hydrogen", { @@ -40,4 +40,4 @@ techage.recipes.add("ta4_doser", { input = { "techage:gas 1", } -}) \ No newline at end of file +}) diff --git a/techage/items/lye.lua b/techage/items/lye.lua index 52cff7d..b69894d 100644 --- a/techage/items/lye.lua +++ b/techage/items/lye.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - + Lye - + ]]-- local S = techage.S diff --git a/techage/items/moreblocks.lua b/techage/items/moreblocks.lua index 63a14ba..67bfa18 100644 --- a/techage/items/moreblocks.lua +++ b/techage/items/moreblocks.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information techage node registrations - + ]]-- local function register_alias(name) @@ -44,13 +44,13 @@ local NodeNames = { "techage:red_stone", "techage:red_stone_block", "techage:red_stone_brick", - + "techage:basalt_cobble", "techage:basalt_stone", "techage:basalt_stone_block", "techage:basalt_stone_brick", "techage:sieved_basalt_gravel", - + "techage:basalt_glass", "techage:basalt_glass2", "techage:bauxite_stone", diff --git a/techage/items/oil.lua b/techage/items/oil.lua index aff256e..02c4614 100644 --- a/techage/items/oil.lua +++ b/techage/items/oil.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information TA3 Oil - + ]]-- -- for lazy programmers @@ -40,9 +40,9 @@ minetest.register_node("techage:oil_source", { animation = { type = "vertical_frames", aspect_w = 16, - aspect_h = 16, + aspect_h = 16, length = 2.0 - } + } } }, @@ -113,10 +113,10 @@ minetest.register_craft({ }) bucket.register_liquid( - "techage:oil_source", - "techage:oil_flowing", - "techage:bucket_oil", - "techage_bucket_oil.png", + "techage:oil_source", + "techage:oil_flowing", + "techage:bucket_oil", + "techage_bucket_oil.png", "Oil Bucket") minetest.register_craftitem("techage:ta3_barrel_oil", { diff --git a/techage/items/petroleum.lua b/techage/items/petroleum.lua index ba82b95..fe9b53f 100644 --- a/techage/items/petroleum.lua +++ b/techage/items/petroleum.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information TA3 Petroleum types: bitumen, fueloil, naphtha, gasoline, isobutane, gas (propan) - + ]]-- local S = techage.S @@ -171,4 +171,3 @@ techage.register_liquid("techage:ta3_canister_naphtha", "techage:ta3_canister_em techage.register_liquid("techage:ta3_canister_gasoline", "techage:ta3_canister_empty", 1, "techage:gasoline") techage.register_liquid("techage:ta3_cylinder_small_gas", "techage:ta3_cylinder_small", 1, "techage:gas") techage.register_liquid("techage:ta4_cylinder_small_isobutane", "techage:ta3_cylinder_small", 1, "techage:isobutane") - diff --git a/techage/items/plastic.lua b/techage/items/plastic.lua index b7d5bbb..1d68412 100644 --- a/techage/items/plastic.lua +++ b/techage/items/plastic.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - - Plastic - + + Plastic + ]]-- local S = techage.S @@ -28,8 +28,8 @@ techage.recipes.add("ta4_doser", { }) techage.furnace.register_recipe({ - output = "basic_materials:plastic_sheet 4", - recipe = {"techage:plastic_granules"}, + output = "basic_materials:plastic_sheet 4", + recipe = {"techage:plastic_granules"}, time = 2, - -}) \ No newline at end of file + +}) diff --git a/techage/items/powder.lua b/techage/items/powder.lua index c53cfa6..1ca6484 100644 --- a/techage/items/powder.lua +++ b/techage/items/powder.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - - Powder - + + Powder + ]]-- local S = techage.S @@ -63,5 +63,3 @@ techage.add_grinder_recipe({input="default:clay", output="techage:clay_powder"}) techage.add_grinder_recipe({input="techage:aluminum", output="techage:aluminum_powder"}) techage.add_grinder_recipe({input="default:silver_sandstone", output="techage:silver_sandstone_powder"}) - - diff --git a/techage/items/redstone.lua b/techage/items/redstone.lua index d1d2950..2008c0f 100644 --- a/techage/items/redstone.lua +++ b/techage/items/redstone.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - + Redstone as result from the redmud/sand - + ]]-- local S = techage.S @@ -60,10 +60,9 @@ minetest.register_craft({ techage.furnace.register_recipe({ output = "techage:red_stone", recipe = { - "techage:canister_redmud", - "default:sand", + "techage:canister_redmud", + "default:sand", }, waste = "techage:ta3_canister_empty", time = 4, }) - diff --git a/techage/items/registered_nodes.lua b/techage/items/registered_nodes.lua index deccdeb..36cf710 100644 --- a/techage/items/registered_nodes.lua +++ b/techage/items/registered_nodes.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + Collect data of registered nodes ]]-- @@ -29,7 +29,7 @@ techage.aAnyKindOfDirtBlocks = {} minetest.register_on_mods_loaded(function() for name, ndef in pairs(minetest.registered_nodes) do - if string.find(name, "dirt") and + if string.find(name, "dirt") and ndef.drawtype == "normal" and ndef.groups.crumbly and ndef.groups.crumbly > 0 then techage.aAnyKindOfDirtBlocks[#techage.aAnyKindOfDirtBlocks + 1] = name @@ -37,4 +37,4 @@ minetest.register_on_mods_loaded(function() end end) -minetest.override_item("default:gravel", {groups = {crumbly = 2, gravel = 1, falling_node = 1}}) \ No newline at end of file +minetest.override_item("default:gravel", {groups = {crumbly = 2, gravel = 1, falling_node = 1}}) diff --git a/techage/items/silicon.lua b/techage/items/silicon.lua index e426e20..2eaac4b 100644 --- a/techage/items/silicon.lua +++ b/techage/items/silicon.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - + TA4 Silicon Wafer - + ]]-- local S = techage.S @@ -22,10 +22,10 @@ minetest.register_craftitem("techage:ta4_silicon_wafer", { techage.furnace.register_recipe({ output = "techage:ta4_silicon_wafer 16", recipe = { - "basic_materials:silicon", - "basic_materials:silicon", - "basic_materials:silicon", + "basic_materials:silicon", + "basic_materials:silicon", + "basic_materials:silicon", "techage:baborium_ingot" }, time = 6, -}) \ No newline at end of file +}) diff --git a/techage/items/steelmat.lua b/techage/items/steelmat.lua index c54fc93..5c158a4 100644 --- a/techage/items/steelmat.lua +++ b/techage/items/steelmat.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - + pillar - + ]]-- local S = techage.S @@ -26,4 +26,4 @@ minetest.register_craft({ {"default:steel_ingot", "techage:iron_ingot", "default:steel_ingot"}, {"", "techage:iron_ingot", ""}, }, -}) \ No newline at end of file +}) diff --git a/techage/items/usmium.lua b/techage/items/usmium.lua index 17d3373..18ce3c4 100644 --- a/techage/items/usmium.lua +++ b/techage/items/usmium.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - - Usminum - + + Usminum + ]]-- local S = techage.S @@ -22,7 +22,7 @@ minetest.register_craftitem("techage:usmium_nuggets", { minetest.register_craftitem("techage:usmium_powder", { description = S("Usmium Powder"), inventory_image = "techage_powder_inv.png^[colorize:#46728E:120", - groups = {powder = 1}, + groups = {powder = 1}, }) techage.add_grinder_recipe({input="techage:usmium_nuggets", output="techage:usmium_powder"}) diff --git a/techage/lamps/ceilinglamp.lua b/techage/lamps/ceilinglamp.lua index b7e79be..ecfae6e 100644 --- a/techage/lamps/ceilinglamp.lua +++ b/techage/lamps/ceilinglamp.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3/TA4 Ceiling Lamp ]]-- diff --git a/techage/lamps/growlight.lua b/techage/lamps/growlight.lua index 9165875..f4b1ac3 100644 --- a/techage/lamps/growlight.lua +++ b/techage/lamps/growlight.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA4 LED Grow Light ]]-- @@ -24,7 +24,7 @@ local Flowers = {} local Plants = {} local Ignore = { ["flowers:waterlily_waving"] = true } -- 9 plant positions below the light -local Positions = { +local Positions = { {x = 0, y =-1, z = 0}, {x =-1, y =-1, z = 0}, {x = 0, y =-1, z =-1}, diff --git a/techage/lamps/industriallamp1.lua b/techage/lamps/industriallamp1.lua index 0475bb4..5fcfeb4 100644 --- a/techage/lamps/industriallamp1.lua +++ b/techage/lamps/industriallamp1.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3/TA4 Industrial Lamp 1 ]]-- diff --git a/techage/lamps/industriallamp2.lua b/techage/lamps/industriallamp2.lua index d6ee575..b0f3227 100644 --- a/techage/lamps/industriallamp2.lua +++ b/techage/lamps/industriallamp2.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3/TA4 Industrial Lamp 2 ]]-- diff --git a/techage/lamps/industriallamp3.lua b/techage/lamps/industriallamp3.lua index 5340ddc..51d27bf 100644 --- a/techage/lamps/industriallamp3.lua +++ b/techage/lamps/industriallamp3.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3/TA4 Industrial Lamp 3 ]]-- diff --git a/techage/lamps/industriallamp4.lua b/techage/lamps/industriallamp4.lua index c56404a..2646136 100644 --- a/techage/lamps/industriallamp4.lua +++ b/techage/lamps/industriallamp4.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA4 Industrial Lamp 4 ]]-- diff --git a/techage/lamps/lampholder.lua b/techage/lamps/lampholder.lua index 3150018..cb7dcaf 100644 --- a/techage/lamps/lampholder.lua +++ b/techage/lamps/lampholder.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3/4 Lamp Holder ]]-- @@ -23,26 +23,26 @@ local function register_holder(name, description, png) node_box = { type = "connected", fixed = {{ -4/32, -4/32, -4/32, 4/32, 4/32, 4/32}}, - + connect_top = {{ -3/32, -3/32, -3/32, 3/32, 16/32, 3/32}}, connect_bottom = {{ -3/32, -16/32, -3/32, 3/32, 3/32, 3/32}}, - connect_left = {{-16/32, -3/32, -3/32, 3/32, 3/32, 3/32}}, - connect_right = {{ -3/32, -3/32, -3/32, 16/32, 3/32, 3/32}}, + connect_left = {{-16/32, -3/32, -3/32, 3/32, 3/32, 3/32}}, + connect_right = {{ -3/32, -3/32, -3/32, 16/32, 3/32, 3/32}}, connect_back = {{ -3/32, -3/32, -3/32, 3/32, 3/32, 16/32}}, connect_front = {{ -3/32, -3/32, -16/32, 3/32, 3/32, 3/32}}, }, connects_to = { - "techage:ceilinglamp_off", "techage:ceilinglamp_on", - "techage:growlight_off", "techage:growlight_on", - "techage:industriallamp1_off", "techage:industriallamp1_on", - "techage:industriallamp2_off", "techage:industriallamp2_on", - "techage:industriallamp3_off", "techage:industriallamp3_on", - "techage:industriallamp4_off", "techage:industriallamp4_on", - "techage:simplelamp_off", "techage:simplelamp_on", - "techage:streetlamp_off", "techage:streetlamp_on", - "techage:streetlamp2_off", "techage:streetlamp2_on", - "techage:streetlamp_arm", "techage:streetlamp_pole", - "techage:streetlamp2_off", "techage:streetlamp2_on", + "techage:ceilinglamp_off", "techage:ceilinglamp_on", + "techage:growlight_off", "techage:growlight_on", + "techage:industriallamp1_off", "techage:industriallamp1_on", + "techage:industriallamp2_off", "techage:industriallamp2_on", + "techage:industriallamp3_off", "techage:industriallamp3_on", + "techage:industriallamp4_off", "techage:industriallamp4_on", + "techage:simplelamp_off", "techage:simplelamp_on", + "techage:streetlamp_off", "techage:streetlamp_on", + "techage:streetlamp2_off", "techage:streetlamp2_on", + "techage:streetlamp_arm", "techage:streetlamp_pole", + "techage:streetlamp2_off", "techage:streetlamp2_on", "techage:power_line", "techage:power_lineS", "techage:power_lineA" }, paramtype = "light", diff --git a/techage/lamps/lib.lua b/techage/lamps/lib.lua index 2d30149..4ef7676 100644 --- a/techage/lamps/lib.lua +++ b/techage/lamps/lib.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + Lamp library ]]-- @@ -49,8 +49,8 @@ local function on_nopower(pos) nvm.turned_on = false end -local function is_running(pos, nvm) - return nvm.turned_on +local function is_running(pos, nvm) + return nvm.turned_on end local function node_timer_off1(pos, elapsed) @@ -89,7 +89,7 @@ local function lamp_on_rightclick(pos, node, clicker) if minetest.is_protected(pos, clicker:get_player_name()) then return end - + local nvm = techage.get_nvm(pos) if not nvm.turned_on and power.power_available(pos, Cable) then nvm.turned_on = true @@ -128,7 +128,7 @@ local function after_dig_node(pos, oldnode) techage.del_mem(pos) end -local function tubelib2_on_update2(pos, outdir, tlib2, node) +local function tubelib2_on_update2(pos, outdir, tlib2, node) power.update_network(pos, outdir, tlib2) end @@ -153,7 +153,7 @@ function techage.register_lamp(basename, ndef_off, ndef_on) ndef_off.groups = {choppy=2, cracky=2, crumbly=2} ndef_off.is_ground_content = false ndef_off.sounds = default.node_sound_glass_defaults() - + if ndef_on.high_power then ndef_on.on_timer = ndef_on.on_timer or node_timer_on2 else @@ -172,13 +172,12 @@ function techage.register_lamp(basename, ndef_off, ndef_on) ndef_on.groups = {not_in_creative_inventory=1} ndef_on.is_ground_content = false ndef_on.sounds = default.node_sound_glass_defaults() - + minetest.register_node(basename.."_off", ndef_off) minetest.register_node(basename.."_on", ndef_on) - + power.register_nodes({basename.."_off", basename.."_on"}, Cable, "con") techage.register_node_for_v1_transition({basename.."_off", basename.."_on"}, function(pos, node) power.update_network(pos, nil, Cable) end) end - diff --git a/techage/lamps/lightblock.lua b/techage/lamps/lightblock.lua index 195727d..a874452 100644 --- a/techage/lamps/lightblock.lua +++ b/techage/lamps/lightblock.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA4 Invisible Light Block ]]-- @@ -15,7 +15,7 @@ local S = techage.S -- 9 light positions in a 3x3 field -local Positions = { +local Positions = { {x =-1, y = 0, z = 0}, {x = 0, y = 0, z =-1}, {x = 1, y = 0, z = 0}, @@ -33,9 +33,9 @@ minetest.register_node("techage:lightblock", { light_source = minetest.LIGHT_MAX, sunlight_propagates = true, walkable = false, - pointable = false, - diggable = false, - buildable_to = true, + pointable = false, + diggable = false, + buildable_to = true, floodable = true, is_ground_content = false, groups = {not_in_creative_inventory=1}, diff --git a/techage/lamps/simplelamp.lua b/techage/lamps/simplelamp.lua index b0db9bf..197b7f8 100644 --- a/techage/lamps/simplelamp.lua +++ b/techage/lamps/simplelamp.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3/TA4 Lamp ]]-- @@ -21,7 +21,7 @@ techage.register_lamp("techage:simplelamp", { }, conn_sides = {"L", "R", "U", "D", "F", "B"}, paramtype = "light", - light_source = 0, + light_source = 0, sunlight_propagates = true, paramtype2 = "facedir", groups = {choppy=2, cracky=2, crumbly=2}, @@ -34,7 +34,7 @@ techage.register_lamp("techage:simplelamp", { }, conn_sides = {"L", "R", "U", "D", "F", "B"}, paramtype = "light", - light_source = minetest.LIGHT_MAX, + light_source = minetest.LIGHT_MAX, sunlight_propagates = true, paramtype2 = "facedir", drop = "techage:test_lamp", diff --git a/techage/lamps/streetlamp.lua b/techage/lamps/streetlamp.lua index 8a55771..945b84b 100644 --- a/techage/lamps/streetlamp.lua +++ b/techage/lamps/streetlamp.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3/TA4 Street Lamp ]]-- diff --git a/techage/lamps/streetlamp2.lua b/techage/lamps/streetlamp2.lua index 07ae388..e07aa73 100644 --- a/techage/lamps/streetlamp2.lua +++ b/techage/lamps/streetlamp2.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA4 LED Street Lamp ]]-- @@ -25,7 +25,7 @@ techage.register_lamp("techage:streetlamp2", { "techage_streetlamp2_housing.png^techage_streetlamp2_off.png", "techage_streetlamp2_housing.png", }, - + paramtype2 = "facedir", -- important! drawtype = "nodebox", node_box = { @@ -61,15 +61,15 @@ minetest.register_node("techage:streetlamp_pole", { tiles = { "techage_streetlamp2_housing.png", }, - + paramtype2 = "facedir", -- important! drawtype = "nodebox", node_box = { type = "connected", fixed = {{ -5/32, -16/32, -5/32, 5/32, 16/32, 5/32}}, - - connect_left = {{-16/32, 8/32, -3/32, 3/32, 14/32, 3/32}}, - connect_right = {{ -3/32, 8/32, -3/32, 16/32, 14/32, 3/32}}, + + connect_left = {{-16/32, 8/32, -3/32, 3/32, 14/32, 3/32}}, + connect_right = {{ -3/32, 8/32, -3/32, 16/32, 14/32, 3/32}}, connect_back = {{ -3/32, 8/32, -3/32, 3/32, 14/32, 16/32}}, connect_front = {{ -3/32, 8/32, -16/32, 3/32, 14/32, 3/32}}, }, @@ -86,7 +86,7 @@ minetest.register_node("techage:streetlamp_arm", { tiles = { "techage_streetlamp2_housing.png", }, - + paramtype2 = "facedir", -- important! drawtype = "nodebox", node_box = { @@ -126,4 +126,3 @@ minetest.register_craft({ {"", "", ""}, }, }) - diff --git a/techage/liquids/filler.lua b/techage/liquids/filler.lua index 2ff3aca..b547185 100644 --- a/techage/liquids/filler.lua +++ b/techage/liquids/filler.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3 Liquid Filler ]]-- @@ -80,7 +80,7 @@ local function node_timer(pos, elapsed) end end return true -end +end minetest.register_node("techage:filler", { description = S("TA Liquid Filler"), @@ -110,17 +110,17 @@ minetest.register_node("techage:filler", { inv:set_size('src', 9) inv:set_size('dst', 9) end, - + after_place_node = function(pos, placer) M(pos):set_string("formspec", formspec(pos)) end, - + on_rightclick = on_rightclick, on_timer = node_timer, can_dig = can_dig, allow_metadata_inventory_put = allow_metadata_inventory_put, allow_metadata_inventory_take = allow_metadata_inventory_take, - + on_rotate = screwdriver.disallow, -- important! paramtype = "light", sunlight_propagates = true, @@ -144,7 +144,7 @@ techage.register_node({"techage:filler"}, { local inv = M(pos):get_inventory() return techage.put_items(inv, "dst", stack) end, -}) +}) minetest.register_craft({ diff --git a/techage/liquids/liquid_pipe.lua b/techage/liquids/liquid_pipe.lua index 9f485ce..40a366f 100644 --- a/techage/liquids/liquid_pipe.lua +++ b/techage/liquids/liquid_pipe.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3/TA4 Liquid Pipes ]]-- @@ -24,14 +24,14 @@ local power = networks.power local Pipe = tubelib2.Tube:new({ dirs_to_check = {1,2,3,4,5,6}, - max_tube_length = MAX_PIPE_LENGHT, + max_tube_length = MAX_PIPE_LENGHT, show_infotext = false, force_to_use_tubes = false, tube_type = "pipe2", primary_node_names = { - "techage:ta3_pipeS", "techage:ta3_pipeA", - "techage:ta3_pipe_wall_entry", "techage:ta3_valve_open", - }, + "techage:ta3_pipeS", "techage:ta3_pipeA", + "techage:ta3_pipe_wall_entry", "techage:ta3_valve_open", + }, secondary_node_names = {}, after_place_tube = function(pos, param2, tube_type, num_tubes) local name = minetest.get_node(pos).name @@ -60,7 +60,7 @@ minetest.register_node("techage:ta3_pipeS", { "techage_gaspipe_hole2.png", "techage_gaspipe_hole2.png", }, - + after_place_node = function(pos, placer, itemstack, pointed_thing) if not Pipe:after_place_tube(pos, placer, pointed_thing) then minetest.remove_node(pos) @@ -68,11 +68,11 @@ minetest.register_node("techage:ta3_pipeS", { end return false end, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) Pipe:after_dig_tube(pos, oldnode, oldmetadata) end, - + paramtype2 = "facedir", -- important! drawtype = "nodebox", node_box = { @@ -100,11 +100,11 @@ minetest.register_node("techage:ta3_pipeA", { "techage_gaspipe_knee2.png", "techage_gaspipe_hole2.png", }, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) Pipe:after_dig_tube(pos, oldnode, oldmetadata) end, - + paramtype2 = "facedir", -- important! drawtype = "nodebox", node_box = { @@ -203,4 +203,3 @@ minetest.register_alias("techage:ta4_pipeA", "techage:ta3_pipeA") minetest.register_alias("techage:ta4_pipeS", "techage:ta3_pipeS") techage.LiquidPipe = Pipe - diff --git a/techage/liquids/pipe_wall_entry.lua b/techage/liquids/pipe_wall_entry.lua index 9263186..f94afd2 100644 --- a/techage/liquids/pipe_wall_entry.lua +++ b/techage/liquids/pipe_wall_entry.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3/TA4 Liquid Pipe Wall Entry ]]-- @@ -27,7 +27,7 @@ minetest.register_node("techage:ta3_pipe_wall_entry", { "basic_materials_concrete_block.png^techage_appl_hole_pipe.png", "basic_materials_concrete_block.png^techage_appl_hole_pipe.png", }, - + after_place_node = function(pos, placer, itemstack, pointed_thing) if not Pipe:after_place_tube(pos, placer, pointed_thing) then minetest.remove_node(pos) @@ -35,11 +35,11 @@ minetest.register_node("techage:ta3_pipe_wall_entry", { end return false end, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) Pipe:after_dig_tube(pos, oldnode, oldmetadata) end, - + paramtype2 = "facedir", -- important! on_rotate = screwdriver.disallow, -- important! groups = {crumbly = 2, cracky = 2, snappy = 2}, diff --git a/techage/liquids/pump.lua b/techage/liquids/pump.lua index 9f25800..0a49247 100644 --- a/techage/liquids/pump.lua +++ b/techage/liquids/pump.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3/TA4 Pump ]]-- @@ -28,7 +28,7 @@ local CAPA = 4 local WRENCH_MENU = {{ type = "output", name = "flowrate", - label = S("Total flow rate"), + label = S("Total flow rate"), tooltip = S("Total flow rate in liquid units"), }} @@ -96,19 +96,19 @@ local function node_timer3(pos, elapsed) local nvm = techage.get_nvm(pos) pumping(pos, nvm, State3, CAPA) return State3:is_active(nvm) -end +end local function node_timer4(pos, elapsed) local nvm = techage.get_nvm(pos) nvm.flowrate = (nvm.flowrate or 0) + pumping(pos, nvm, State4, CAPA * 2) return State4:is_active(nvm) -end +end local function on_rightclick(pos, node, clicker) if minetest.is_protected(pos, clicker:get_player_name()) then return end - + local nvm = techage.get_nvm(pos) if node.name == "techage:t3_pump" then local mem = techage.get_mem(pos) diff --git a/techage/liquids/silo.lua b/techage/liquids/silo.lua index f570f78..0ef45c8 100644 --- a/techage/liquids/silo.lua +++ b/techage/liquids/silo.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3/TA4 Powder Silo ]]-- @@ -28,7 +28,7 @@ local function allow_metadata_inventory_put(pos, listname, index, stack, player) return 0 end -- check if it is powder or techage liquid item (migration function) - local ndef = minetest.registered_craftitems[stack:get_name()] or + local ndef = minetest.registered_craftitems[stack:get_name()] or minetest.registered_items[stack:get_name()] or {} if ndef.groups and (ndef.groups.powder == 1 or ndef.groups.ta_liquid == 1) then local nvm = techage.get_nvm(pos) @@ -71,7 +71,7 @@ local function get_item_name(nvm, inv) return nvm.item_name end end -end +end local function get_item_count(pos) local inv = M(pos):get_inventory() @@ -81,7 +81,7 @@ local function get_item_count(pos) count = count + stack:get_count() end return count -end +end local function get_silo_capa(pos) local inv = M(pos):get_inventory() @@ -92,7 +92,7 @@ local function get_silo_capa(pos) end end return inv:get_size("main") * STACKMAX -end +end local function formspec3() return "size[8,5]".. @@ -257,7 +257,7 @@ techage.register_node({"techage:ta3_silo", "techage:ta4_silo"}, { on_pull_item = function(pos, in_dir, num) local inv = M(pos):get_inventory() if not inv:is_empty("main") then - local taken = techage.get_items(pos, inv, "main", num) + local taken = techage.get_items(pos, inv, "main", num) local nvm = techage.get_nvm(pos) nvm.item_count = nvm.item_count or get_item_count(pos) nvm.item_count = nvm.item_count - taken:get_count() @@ -270,7 +270,7 @@ techage.register_node({"techage:ta3_silo", "techage:ta4_silo"}, { local ndef = minetest.registered_craftitems[name] or {} if ndef.groups and ndef.groups.powder == 1 then local inv = M(pos):get_inventory() - + if inv:is_empty("main") then inv:add_item("main", stack) local nvm = techage.get_nvm(pos) @@ -278,7 +278,7 @@ techage.register_node({"techage:ta3_silo", "techage:ta4_silo"}, { nvm.item_count = nvm.item_count + stack:get_count() return true end - + if inv:contains_item("main", name) and inv:room_for_item("main", stack) then inv:add_item("main", stack) local nvm = techage.get_nvm(pos) @@ -316,7 +316,7 @@ techage.register_node({"techage:ta3_silo", "techage:ta4_silo"}, { local nvm = techage.get_nvm(pos) nvm.item_count = nil end, -}) +}) liquid.register_nodes({"techage:ta3_silo", "techage:ta4_silo"}, Pipe, "tank", nil, tLiquid) diff --git a/techage/liquids/ta5_tank.lua b/techage/liquids/ta5_tank.lua index 6f64416..f8b470b 100644 --- a/techage/liquids/ta5_tank.lua +++ b/techage/liquids/ta5_tank.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA5 Hyperloop Tank ]]-- @@ -93,7 +93,7 @@ liquid.register_nodes({"techage:ta5_hl_tank"}, } ) -techage.register_node({"techage:ta5_hl_tank"}, techage.liquid.recv_message) +techage.register_node({"techage:ta5_hl_tank"}, techage.liquid.recv_message) minetest.register_craft({ output = "techage:ta5_hl_tank", diff --git a/techage/liquids/tank.lua b/techage/liquids/tank.lua index fbd149b..b970c50 100644 --- a/techage/liquids/tank.lua +++ b/techage/liquids/tank.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3/TA4 Tank, Oil Tank ]]-- @@ -35,7 +35,7 @@ local function node_timer(pos, elapsed) local nvm = techage.get_nvm(pos) M(pos):set_string("formspec", techage.liquid.formspec(pos, nvm)) return true - end + end return false end @@ -62,7 +62,7 @@ local function take_liquid(pos, indir, name, amount) end return amount, name end - + local function put_liquid(pos, indir, name, amount) -- check if it is not powder local ndef = minetest.registered_craftitems[name] or {} @@ -251,7 +251,7 @@ liquid.register_nodes({"techage:ta4_tank"}, } ) -techage.register_node({"techage:ta3_tank", "techage:ta4_tank", "techage:oiltank"}, techage.liquid.recv_message) +techage.register_node({"techage:ta3_tank", "techage:ta4_tank", "techage:oiltank"}, techage.liquid.recv_message) minetest.register_craft({ output = "techage:ta3_tank 2", diff --git a/techage/liquids/valve.lua b/techage/liquids/valve.lua index 40406aa..8c9edd7 100644 --- a/techage/liquids/valve.lua +++ b/techage/liquids/valve.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3 Valve ]]-- @@ -29,7 +29,7 @@ minetest.register_node("techage:ta3_valve_open", { "techage_gaspipe_valve_hole.png", "techage_gaspipe_valve_hole.png", }, - + after_place_node = function(pos, placer, itemstack, pointed_thing) if not Pipe:after_place_tube(pos, placer, pointed_thing) then minetest.remove_node(pos) @@ -48,7 +48,7 @@ minetest.register_node("techage:ta3_valve_open", { end if liquid.turn_valve_off(pos, Pipe, "techage:ta3_valve_closed", "techage:ta3_valve_open") then minetest.sound_play("techage_valve", { - pos = pos, + pos = pos, gain = 1, max_hear_distance = 10}) end @@ -56,7 +56,7 @@ minetest.register_node("techage:ta3_valve_open", { after_dig_node = function(pos, oldnode, oldmetadata, digger) Pipe:after_dig_tube(pos, oldnode, oldmetadata) end, - + paramtype2 = "facedir", -- important! drawtype = "nodebox", node_box = { @@ -85,14 +85,14 @@ minetest.register_node("techage:ta3_valve_closed", { "techage_gaspipe_valve_hole.png", "techage_gaspipe_valve_hole.png", }, - + on_rightclick = function(pos, node, clicker) if minetest.is_protected(pos, clicker:get_player_name()) then return end if liquid.turn_valve_on(pos, Pipe, "techage:ta3_valve_closed", "techage:ta3_valve_open") then minetest.sound_play("techage_valve", { - pos = pos, + pos = pos, gain = 1, max_hear_distance = 10}) end @@ -101,7 +101,7 @@ minetest.register_node("techage:ta3_valve_closed", { Pipe:after_dig_node(pos) techage.remove_node(pos, oldnode, oldmetadata) end, - + paramtype2 = "facedir", -- important! drawtype = "nodebox", node_box = { @@ -139,9 +139,9 @@ techage.register_node({"techage:ta3_valve_closed", "techage:ta3_valve_open"}, { return "unsupported" end end, -}) +}) -liquid.register_nodes({"techage:ta3_valve_closed"}, Pipe, "special", {}, {}) +liquid.register_nodes({"techage:ta3_valve_closed"}, Pipe, "special", {}, {}) minetest.register_craft({ output = "techage:ta3_valve_open", diff --git a/techage/liquids/waterinlet.lua b/techage/liquids/waterinlet.lua index 10f210b..afb29c0 100644 --- a/techage/liquids/waterinlet.lua +++ b/techage/liquids/waterinlet.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - + TA4 Water Inlet (replacement for the water pump) - + ]]-- -- for lazy programmers @@ -20,16 +20,16 @@ local Pipe = techage.LiquidPipe local liquid = networks.liquid local function is_ocean(pos) - if pos.y > 1 then + if pos.y > 1 then M(pos):set_string("infotext", S("Error: Not on sea level!")) - return false + return false end local node = techage.get_node_lvm({x = pos.x, y = pos.y - 1, z = pos.z}) - if node.name ~= "default:water_source" then + if node.name ~= "default:water_source" then M(pos):set_string("infotext", S("Error: No water available!")) - return false + return false end - if node.param2 == 1 then + if node.param2 == 1 then M(pos):set_string("infotext", S("Error: No natural water!")) return false end @@ -56,7 +56,7 @@ local function take_liquid(pos, indir, name, amount) end return mem.liquid_amount or 0, mem.liquid_name end - + local function untake_liquid(pos, indir, name, amount) return 0 @@ -106,4 +106,3 @@ minetest.register_craft({ {"techage:iron_ingot", "techage:ta3_barrel_empty", "techage:iron_ingot"}, }, }) - diff --git a/techage/liquids/waterpump.lua b/techage/liquids/waterpump.lua index 8e8858a..82ecf08 100644 --- a/techage/liquids/waterpump.lua +++ b/techage/liquids/waterpump.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - + TA4 Water Pump - + ]]-- -- for lazy programmers @@ -144,7 +144,7 @@ minetest.register_node("techage:t4_waterpump", { after_dig_node = after_dig_node, on_receive_fields = on_receive_fields, on_timer = node_timer, - + paramtype2 = "facedir", groups = {cracky=2, crumbly=2, choppy=2, not_in_creative_inventory = 1}, on_rotate = screwdriver.disallow, @@ -158,4 +158,4 @@ techage.register_node({"techage:t4_waterpump"}, { on_recv_message = function(pos, src, topic, payload) return State:on_receive_message(pos, topic, payload) end, -}) +}) diff --git a/techage/logic/button.lua b/techage/logic/button.lua index 7840d8c..9778e6d 100644 --- a/techage/logic/button.lua +++ b/techage/logic/button.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information TA3 & TA4 Logic button - + ]]-- -- for lazy programmers @@ -23,7 +23,7 @@ local WRENCH_MENU = { { type = "ascii", name = "command", - label = S("Command"), + label = S("Command"), tooltip = S("Command to be sent"), default = "on", }, @@ -71,7 +71,7 @@ local function formspec(meta) if idx == 0 then idx = 1 end local access_idx = meta:get_string("public") == "true" and 3 or meta:get_string("protected") == "true" and 2 or 1 return "size[7.5,6]".. - "dropdown[0.2,0;3;type;switch,button 1s,button 2s,button 4s,button 8s,button 16s,button 32s;"..idx.."]".. + "dropdown[0.2,0;3;type;switch,button 1s,button 2s,button 4s,button 8s,button 16s,button 32s;"..idx.."]".. "field[0.5,2;7,1;numbers;"..S("Insert destination node number(s)")..";"..numbers.."]" .. "label[0.2,3;"..S("Access:").."]".. "dropdown[3,3;4;access;private,protected,public;"..access_idx.."]".. @@ -200,7 +200,7 @@ minetest.register_node("techage:ta3_button_off", { on_rightclick = on_rightclick_on, techage_set_numbers = techage_set_numbers, after_dig_node = after_dig_node, - + on_rotate = screwdriver.disallow, paramtype2 = "facedir", groups = {choppy=2, cracky=2, crumbly=2}, @@ -267,7 +267,7 @@ minetest.register_node("techage:ta4_button_off", { on_rightclick = on_rightclick_on, techage_set_numbers = techage_set_numbers, after_dig_node = after_dig_node, - + on_rotate = screwdriver.disallow, paramtype = "light", use_texture_alpha = techage.CLIP, @@ -331,4 +331,3 @@ minetest.register_craft({ {"", "", ""}, }, }) - diff --git a/techage/logic/button_2x.lua b/techage/logic/button_2x.lua index 3d46904..82a1579 100644 --- a/techage/logic/button_2x.lua +++ b/techage/logic/button_2x.lua @@ -9,13 +9,13 @@ See LICENSE.txt for more information TA4 Logic twofold button - + ]]-- -- for lazy programmers local M = minetest.get_meta local S = techage.S - + local function get_button_num(pos, clicker, pointed_thing) -- use the node behind the button to get better results if clicker and pointed_thing then @@ -24,7 +24,7 @@ local function get_button_num(pos, clicker, pointed_thing) pointed_thing.above = vector.add(pointed_thing.above, offs) local pos1 = minetest.pointed_thing_to_face_pos(clicker, pointed_thing) local y = pos1.y - pos.y - + if y > 0.03 then return 1 elseif y < -0.03 then @@ -45,42 +45,42 @@ local WRENCH_MENU = { { type = "ascii", name = "label1", - label = S("Label") .. " 1", + label = S("Label") .. " 1", tooltip = S("Label for the button"), default = "1", }, { type = "numbers", name = "dest_number1", - label = S("Number") .. " 1", + label = S("Number") .. " 1", tooltip = S("Destination block number"), default = "", }, { type = "ascii", name = "command1", - label = S("Command") .. " 1", + label = S("Command") .. " 1", tooltip = S("Command to be sent (ignored for switches)"), default = "1", }, { type = "ascii", name = "label2", - label = S("Label") .. " 2", + label = S("Label") .. " 2", tooltip = S("Label for the button"), default = "1", }, { type = "numbers", name = "dest_number2", - label = S("Number") .. " 2", + label = S("Number") .. " 2", tooltip = S("Destination block number"), default = "", }, { type = "ascii", name = "command2", - label = S("Command") .. " 2", + label = S("Command") .. " 2", tooltip = S("Command to be sent (ignored for switches)"), default = "2", }, @@ -88,7 +88,7 @@ local WRENCH_MENU = { type = "dropdown", choices = "private,protected,public", name = "access", - label = S("Access"), + label = S("Access"), tooltip = S("Button protection"), default = "8", }, @@ -117,7 +117,7 @@ local function button_update(pos, objref) local tbl = {" ", " ", meta:get_string("label1"), " ", meta:get_string("label2")} local text = "< " .. table.concat(tbl, "\n< ") local texture = lcdlib.make_multiline_texture("default", text, 96, 96, 7, "top", "#000", 6) - + if nvm.button[1] then texture = texture .. "^techage_smartline_button_4x_on2.png" end diff --git a/techage/logic/button_4x.lua b/techage/logic/button_4x.lua index 7377265..609cba1 100644 --- a/techage/logic/button_4x.lua +++ b/techage/logic/button_4x.lua @@ -9,13 +9,13 @@ See LICENSE.txt for more information TA4 Logic fourfold button - + ]]-- -- for lazy programmers local M = minetest.get_meta local S = techage.S - + local function get_button_num(pos, clicker, pointed_thing) -- use the node behind the button to get better results if clicker and pointed_thing then @@ -24,7 +24,7 @@ local function get_button_num(pos, clicker, pointed_thing) pointed_thing.above = vector.add(pointed_thing.above, offs) local pos1 = minetest.pointed_thing_to_face_pos(clicker, pointed_thing) local y = pos1.y - pos.y - + if y < -0.3 then return 4 elseif y < -0.03 and y > -0.22 then @@ -49,84 +49,84 @@ local WRENCH_MENU = { { type = "ascii", name = "label1", - label = S("Label") .. " 1", + label = S("Label") .. " 1", tooltip = S("Label for the button"), default = "1", }, { type = "numbers", name = "dest_number1", - label = S("Number") .. " 1", + label = S("Number") .. " 1", tooltip = S("Destination block number"), default = "", }, { type = "ascii", name = "command1", - label = S("Command") .. " 1", + label = S("Command") .. " 1", tooltip = S("Command to be sent (ignored for switches)"), default = "1", }, { type = "ascii", name = "label2", - label = S("Label") .. " 2", + label = S("Label") .. " 2", tooltip = S("Label for the button"), default = "1", }, { type = "numbers", name = "dest_number2", - label = S("Number") .. " 2", + label = S("Number") .. " 2", tooltip = S("Destination block number"), default = "", }, { type = "ascii", name = "command2", - label = S("Command") .. " 2", + label = S("Command") .. " 2", tooltip = S("Command to be sent (ignored for switches)"), default = "2", }, { type = "ascii", name = "label3", - label = S("Label") .. " 3", + label = S("Label") .. " 3", tooltip = S("Label for the button"), default = "1", }, { type = "numbers", name = "dest_number3", - label = S("Number") .. " 3", + label = S("Number") .. " 3", tooltip = S("Destination block number"), default = "", }, { type = "ascii", name = "command3", - label = S("Command") .. " 3", + label = S("Command") .. " 3", tooltip = S("Command to be sent (ignored for switches)"), default = "3", }, { type = "ascii", name = "label4", - label = S("Label") .. " 4", + label = S("Label") .. " 4", tooltip = S("Label for the button"), default = "1", }, { type = "numbers", name = "dest_number4", - label = S("Number") .. " 4", + label = S("Number") .. " 4", tooltip = S("Destination block number"), default = "", }, { type = "ascii", name = "command4", - label = S("Command") .. " 4", + label = S("Command") .. " 4", tooltip = S("Command to be sent (ignored for switches)"), default = "4", }, @@ -134,7 +134,7 @@ local WRENCH_MENU = { type = "dropdown", choices = "private,protected,public", name = "access", - label = S("Access"), + label = S("Access"), tooltip = S("Button protection"), default = "8", }, @@ -163,7 +163,7 @@ local function button_update(pos, objref) local tbl = {meta:get_string("label1"), " ", meta:get_string("label2"), " ", meta:get_string("label3"), " ", meta:get_string("label4")} local text = "< " .. table.concat(tbl, "\n< ") local texture = lcdlib.make_multiline_texture("default", text, 96, 96, 7, "top", "#000", 6) - + if nvm.button[1] then texture = texture .. "^techage_smartline_button_4x_on1.png" end diff --git a/techage/logic/cart_detector.lua b/techage/logic/cart_detector.lua index 4457374..244e40f 100644 --- a/techage/logic/cart_detector.lua +++ b/techage/logic/cart_detector.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + Cart Detector/Starter ]]-- @@ -58,7 +58,7 @@ local function on_receive_fields(pos, formname, fields, player) if minetest.is_protected(pos, player:get_player_name()) then return end - + local meta = minetest.get_meta(pos) if fields.accept then if techage.check_numbers(fields.numbers, player:get_player_name()) then @@ -154,7 +154,7 @@ techage.register_node({"techage:ta3_cartdetector_off", "techage:ta3_cartdetector on_node_load = function(pos) minetest.get_node_timer(pos):start(CYCLE_TIME) end, -}) +}) -- Register default cart in addition -minecart.tEntityNames["carts:cart"] = true \ No newline at end of file +minecart.tEntityNames["carts:cart"] = true diff --git a/techage/logic/collector.lua b/techage/logic/collector.lua index 414b491..d50a1e0 100644 --- a/techage/logic/collector.lua +++ b/techage/logic/collector.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA4 Collector Collects states from other nodes, acting as a state concentrator. @@ -24,14 +24,14 @@ local CYCLE_TIME = 1 local tStates = {stopped = 0, running = 0, standby = 1, blocked = 2, nopower = 3, fault = 4} local tDropdownPos = {["1 standby"] = 1, ["2 blocked"] = 2, ["3 nopower"] = 3, ["4 fault"] = 4} local lStates = {[0] = "stopped", "standby", "blocked", "nopower", "fault"} - + local function formspec(nvm, meta) nvm.poll_numbers = nvm.poll_numbers or {} local poll_numbers = table.concat(nvm.poll_numbers, " ") local event_number = meta:get_string("event_number") local dropdown_pos = meta:get_int("dropdown_pos") if dropdown_pos == 0 then dropdown_pos = 1 end - + return "size[9,6]".. default.gui_bg.. default.gui_bg_img.. @@ -41,7 +41,7 @@ local function formspec(nvm, meta) "label[1.3,2.8;"..S("Send an event if state is equal or larger than")..":]".. "dropdown[1.2,3.4;7,4;severity;1 standby,2 blocked,3 nopower,4 fault;"..dropdown_pos.."]".. "button_exit[3,5;2,1;exit;Save]" -end +end local function send_event(nvm, meta) @@ -75,7 +75,7 @@ local function on_timer(pos,elapsed) local meta = minetest.get_meta(pos) nvm.idx = (nvm.idx or 0) + 1 nvm.common_state = nvm.common_state or 0 - + if not nvm.poll_numbers then local own_number = meta:get_string("own_number") meta:set_string("infotext", S("TA4 State Collector").." "..own_number..": stopped") @@ -83,7 +83,7 @@ local function on_timer(pos,elapsed) nvm.idx = 1 return false end - + if nvm.idx > #nvm.poll_numbers then nvm.idx = 1 if nvm.stored_state ~= nvm.common_state then @@ -94,7 +94,7 @@ local function on_timer(pos,elapsed) end nvm.common_state = 0 -- reset for the next round end - + request_state(nvm, meta) return true end @@ -140,7 +140,7 @@ minetest.register_node("techage:ta4_collector", { local nvm = techage.get_nvm(pos) local timer = minetest.get_node_timer(pos) local own_number = meta:get_string("own_number") - + if fields.quit == "true" and fields.poll_numbers then if techage.check_numbers(fields.event_number, player:get_player_name()) then meta:set_string("event_number", fields.event_number) @@ -166,7 +166,7 @@ minetest.register_node("techage:ta4_collector", { meta:set_string("formspec", formspec(nvm, meta)) end end, - + techage_set_numbers = function(pos, numbers, player_name) local nvm = techage.get_nvm(pos) local meta = M(pos) @@ -174,9 +174,9 @@ minetest.register_node("techage:ta4_collector", { meta:set_string("formspec", formspec(nvm, meta)) return res end, - + on_timer = on_timer, - + after_dig_node = function(pos, oldnode, oldmetadata) techage.remove_node(pos, oldnode, oldmetadata) end, @@ -210,4 +210,4 @@ techage.register_node({"techage:ta4_collector"}, { on_node_load = function(pos) minetest.get_node_timer(pos):start(CYCLE_TIME) end, -}) +}) diff --git a/techage/logic/detector.lua b/techage/logic/detector.lua index b89816e..b0e709b 100644 --- a/techage/logic/detector.lua +++ b/techage/logic/detector.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information TA3/TA4 Item detector - + ]]-- -- for lazy programmers @@ -26,7 +26,7 @@ local WRENCH_MENU = { type = "dropdown", choices = "1,2,4,6,8,12,16", name = "ontime", - label = S("On Time") .. " [s]", + label = S("On Time") .. " [s]", tooltip = S("The time between the 'on' and 'off' commands."), default = "1", }, @@ -34,14 +34,14 @@ local WRENCH_MENU = { type = "dropdown", choices = "2,4,6,8,12,16,20", name = "blockingtime", - label = S("Blocking Time") .. " [s]", + label = S("Blocking Time") .. " [s]", tooltip = S("The time after the 'off' command\nuntil the next 'on' command is accepted."), default = "8", }, { type = "items", name = "config", - label = S("Configured Items"), + label = S("Configured Items"), tooltip = S("Items which generate an 'on' command.\nIf empty, all passed items generate an 'on' command."), size = 4, } @@ -131,7 +131,7 @@ minetest.register_node("techage:ta3_detector_off", { techage_set_numbers = techage_set_numbers, after_dig_node = after_dig_node, ta3_formspec = WRENCH_MENU, - + on_rotate = screwdriver.disallow, paramtype = "light", sunlight_propagates = true, @@ -159,7 +159,7 @@ minetest.register_node("techage:ta3_detector_on", { techage_set_numbers = techage_set_numbers, after_dig_node = after_dig_node, ta3_formspec = WRENCH_MENU, - + paramtype2 = "facedir", groups = {choppy=2, cracky=2, crumbly=2, not_in_creative_inventory=1}, is_ground_content = false, @@ -184,7 +184,7 @@ minetest.register_node("techage:ta4_detector_off", { techage_set_numbers = techage_set_numbers, after_dig_node = after_dig_node, ta3_formspec = WRENCH_MENU, - + on_rotate = screwdriver.disallow, paramtype = "light", sunlight_propagates = true, @@ -212,7 +212,7 @@ minetest.register_node("techage:ta4_detector_on", { techage_set_numbers = techage_set_numbers, after_dig_node = after_dig_node, ta3_formspec = WRENCH_MENU, - + paramtype2 = "facedir", groups = {choppy=2, cracky=2, crumbly=2, not_in_creative_inventory=1}, is_ground_content = false, @@ -250,7 +250,7 @@ techage.register_node({"techage:ta3_detector_off", "techage:ta3_detector_on"}, { return false end, is_pusher = true, -- is a pulling/pushing node -}) +}) techage.register_node({"techage:ta4_detector_off", "techage:ta4_detector_on"}, { on_push_item = function(pos, in_dir, stack) @@ -263,7 +263,7 @@ techage.register_node({"techage:ta4_detector_off", "techage:ta4_detector_on"}, { return false end, is_pusher = true, -- is a pulling/pushing node - + on_recv_message = function(pos, src, topic, payload) if topic == "count" then local nvm = techage.get_nvm(pos) @@ -276,5 +276,4 @@ techage.register_node({"techage:ta4_detector_off", "techage:ta4_detector_on"}, { return "unsupported" end end, -}) - +}) diff --git a/techage/logic/lib.lua b/techage/logic/lib.lua index 1d21911..248c3ff 100644 --- a/techage/logic/lib.lua +++ b/techage/logic/lib.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information Logic library - + ]]-- -- for lazy programmers @@ -27,7 +27,7 @@ local Face2Dir = {[0]= {x=0, y=1, z=0} } --- Determine the destination position based on the position, +-- Determine the destination position based on the position, -- the node param2, and a route table like : {0,0,3} -- 0 = forward, 1 = right, 2 = backward, 3 = left function techage.logic.dest_pos(pos, param2, route) diff --git a/techage/logic/logic_block.lua b/techage/logic/logic_block.lua index 4f91d0c..0b83272 100644 --- a/techage/logic/logic_block.lua +++ b/techage/logic/logic_block.lua @@ -42,8 +42,8 @@ local ValidSymbols = { } local Dropdown = { - [""] = 1, - ["on"] = 2, + [""] = 1, + ["on"] = 2, ["off"] = 3 } @@ -55,7 +55,7 @@ local function check_expr(pos, expr) expr = expr:gsub("~=", " ~= ") expr = expr:gsub("%(", " ( ") expr = expr:gsub("%)", " ) ") - + -- First syntax check local old_sym = "or" -- valid default value for sym in expr:gmatch("[^%s]+") do @@ -80,7 +80,7 @@ end local function check_num(pos, num, player_name) local nvm = techage.get_nvm(pos) - + if num ~= "me" and (num == nvm.own_num or not techage.check_numbers(num, player_name)) then return "Invalid node number '"..num.."'" @@ -94,13 +94,13 @@ local function debug(mem, text) end local s = string.format("%.3f", techage.SystemTime) .. " s: " .. text table.insert(mem.debug, s) -end +end local function send(pos, num, val) local nvm = techage.get_nvm(pos) local mem = techage.get_mem(pos) debug(mem, "(outp) " .. num .. " = " .. val) - + if num == "me" then nvm.outp_tbl = nvm.outp_tbl or {} nvm.outp_tbl.me = val @@ -125,7 +125,7 @@ local function get_inputs(pos) end return nvm.old_inp_tbl end - + local function check_syntax(pos, line, owner, outp, expr) local err = check_num(pos, outp, owner) if not err then @@ -135,7 +135,7 @@ local function check_syntax(pos, line, owner, outp, expr) end end return false, "Error(" .. line .. "): " .. err -end +end local function compile(nvm, str) if str then @@ -169,12 +169,12 @@ local function get_code(pos, nvm, mem) local owner = M(pos):get_string("owner") nvm.own_num = nvm.own_num or M(pos):get_string("node_number") mem.outp_num = {} - + for i = 1,NUM_RULES do local outp = meta:get_string("outp" .. i) local val = meta:get_string("val" .. i) local expr = meta:get_string("expr" .. i) - + if outp ~= "" and val ~= "" and expr ~= "" then local res, err = check_syntax(pos, i, owner, outp, expr) if res then @@ -190,16 +190,16 @@ local function get_code(pos, nvm, mem) end end end - + local str = table.concat(tbl, "\n") local code = compile(nvm, str) if code then - local env = {} + local env = {} env.send = send env.pos = pos env.get_inputs = get_inputs setfenv(code, env) - + return code end end @@ -219,14 +219,14 @@ end local function rules(meta) local tbl = {} - + tbl[#tbl + 1] = "label[-0.2,0;]" tbl[#tbl + 1] = "label[1.4,0;=]" tbl[#tbl + 1] = "label[1.8,0;]" tbl[#tbl + 1] = "label[3.5,0;if]" tbl[#tbl + 1] = "label[4.2,0; is true]" - - + + for i = 1,NUM_RULES do local y1 = (i * 0.9) - 0.1 local y2 = (i * 0.9) - 0.2 @@ -235,7 +235,7 @@ local function rules(meta) local val = meta:get_string("val" .. i) local expr = meta:get_string("expr" .. i) val = Dropdown[val] or 1 - + tbl[#tbl + 1] = "field[0," .. y1 .. ";1.6,1;outp" .. i ..";;" .. outp .. "]" tbl[#tbl + 1] = "label[1.4," .. y2 .. ";=]" tbl[#tbl + 1] = "dropdown[1.8," .. y3 .. ";1.6,1;val" .. i ..";,on,off;" .. val .. "]" @@ -257,11 +257,11 @@ local function formspec(pos, meta) "container[0.4,0.1]" .. rules(meta) .. "container_end[]" .. - + "label[0.2,4.4;" .. S("Blocking Time") .. "]".. "field[4.6,4.5;2,1;bt;;" .. bt .. "]".. "label[6.3,4.4;s]".. - + "label[0,5.3;" .. S("Inputs") .. ":]" .. "label[2,5.3;" .. inputs .."]" .. "label[0,5.9;" .. S("Outputs") .. ":]" .. @@ -310,9 +310,9 @@ minetest.register_node("techage:ta3_logic2", { if minetest.is_protected(pos, player:get_player_name()) then return end - + local meta = M(pos) - + if fields.store then for i = 1,NUM_RULES do meta:set_string("outp" .. i, fields["outp" .. i] or "") @@ -331,7 +331,7 @@ minetest.register_node("techage:ta3_logic2", { mem.debug = {} meta:set_string("formspec", formspec_debug(mem)) end - + if fields.tab == "2" then meta:set_string("formspec", formspec_help()) elseif fields.tab == "3" then @@ -345,27 +345,27 @@ minetest.register_node("techage:ta3_logic2", { meta:set_string("formspec", formspec(pos, meta)) end end, - + on_timer = function(pos) execute(pos) return false end, - + on_rightclick = function(pos, node, clicker) if minetest.is_protected(pos, clicker:get_player_name()) then return end - + local meta = M(pos) local nvm = techage.get_nvm(pos) meta:set_string("formspec", formspec(pos, meta)) end, - + after_dig_node = function(pos, oldnode, oldmetadata) techage.remove_node(pos, oldnode, oldmetadata) techage.del_mem(pos) end, - + paramtype2 = "facedir", groups = {choppy=2, cracky=2, crumbly=2}, is_ground_content = false, @@ -389,7 +389,7 @@ techage.register_node({"techage:ta3_logic2"}, { nvm.own_num = nvm.own_num or M(pos):get_string("node_number") nvm.blocking_time = nvm.blocking_time or M(pos):get_float("blocking_time") nvm.inp_tbl = nvm.inp_tbl or {} - + if src ~= nvm.own_num then if topic == "on" then debug(mem, "(inp) " .. src .. " = on") @@ -401,12 +401,10 @@ techage.register_node({"techage:ta3_logic2"}, { debug(mem, "(inp) invalid command") return "unsupported" end - + local t = math.max((mem.ttl or 0) - techage.SystemTime, 0.1) minetest.get_node_timer(pos):start(t) mem.ttl = techage.SystemTime + (nvm.blocking_time or 0) end end, -}) - - +}) diff --git a/techage/logic/lua_logic.lua b/techage/logic/lua_logic.lua index f8b0ab7..57cc629 100644 --- a/techage/logic/lua_logic.lua +++ b/techage/logic/lua_logic.lua @@ -89,7 +89,7 @@ local function eval(pos, nvm) if sts == true and nvm.inp_tbl.outp ~= true then nvm.inp_tbl.outp = sts return "on" - elseif sts == false and nvm.inp_tbl.outp ~= false then + elseif sts == false and nvm.inp_tbl.outp ~= false then nvm.inp_tbl.outp = sts return "off" end @@ -116,7 +116,7 @@ local function formspec(pos, meta) local then_expr = meta:get_string("then_expr") or "" local else_expr = meta:get_string("else_expr") or "" local err = nvm.error or "ok" - if err ~= "ok" then + if err ~= "ok" then err = string.sub(err, 15) end err = minetest.formspec_escape(err) @@ -164,7 +164,7 @@ minetest.register_node("techage:ta3_logic", { if minetest.is_protected(pos, player:get_player_name()) then return end - + local meta = M(pos) local nvm = techage.get_nvm(pos) if fields.numbers and fields.numbers ~= "" then @@ -187,7 +187,7 @@ minetest.register_node("techage:ta3_logic", { end meta:set_string("formspec", formspec(pos, meta)) end, - + on_timer = function(pos,elapsed) local nvm = techage.get_nvm(pos) local topic = eval(pos, nvm) @@ -199,19 +199,19 @@ minetest.register_node("techage:ta3_logic", { end return false end, - + techage_set_numbers = function(pos, numbers, player_name) local meta = M(pos) local res = logic.set_numbers(pos, numbers, player_name, S("TA3 Logic Block")) meta:set_string("formspec", formspec(pos, meta)) return res end, - + after_dig_node = function(pos, oldnode, oldmetadata) techage.remove_node(pos, oldnode, oldmetadata) techage.del_mem(pos) end, - + paramtype2 = "facedir", groups = {choppy=2, cracky=2, crumbly=2}, is_ground_content = false, @@ -234,7 +234,7 @@ techage.register_node({"techage:ta3_logic"}, { on_recv_message = function(pos, src, topic, payload) local nvm = techage.get_nvm(pos) nvm.inp_tbl = nvm.inp_tbl or {outp = false} - + if topic == "on" then nvm.inp_tbl.inp = true nvm.inp_tbl["n"..src] = true @@ -247,8 +247,6 @@ techage.register_node({"techage:ta3_logic"}, { minetest.get_node_timer(pos):start(0.1) end, on_node_load = function(pos) - + end, -}) - - +}) diff --git a/techage/logic/mba_detector.lua b/techage/logic/mba_detector.lua index 8947676..96cdd17 100644 --- a/techage/logic/mba_detector.lua +++ b/techage/logic/mba_detector.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA4 Mapblock Active Detector ]]-- @@ -38,20 +38,20 @@ minetest.register_node("techage:ta4_mbadetector", { { -6/32, -6/32, 14/32, 6/32, 6/32, 16/32}, }, }, - + after_place_node = function(pos, placer) local meta = M(pos) logic.after_place_node(pos, placer, "techage:ta4_mbadetector", S("TA4 Mapblock Active Detector")) logic.infotext(meta, S("TA4 Mapblock Active Detector")) minetest.get_node_timer(pos):start(1) end, - + on_timer = function(pos, elapsed) local mem = techage.get_mem(pos) mem.gametime = minetest.get_gametime() return true end, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) techage.remove_node(pos, oldnode, oldmetadata) techage.del_mem(pos) @@ -96,5 +96,4 @@ techage.register_node({"techage:ta4_mbadetector"}, { minetest.get_node_timer(pos):start(1) end, } -) - +) diff --git a/techage/logic/mesecons_converter.lua b/techage/logic/mesecons_converter.lua index f1ccab4..9ab28e9 100644 --- a/techage/logic/mesecons_converter.lua +++ b/techage/logic/mesecons_converter.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information Mesecons converter - + ]]-- -- for lazy programmers @@ -74,20 +74,20 @@ minetest.register_node("techage:ta3_mesecons_converter", { end minetest.get_node_timer(pos):start(CYCLE_TIME) end, - + on_timer = function(pos,elapsed) local mem = techage.get_mem(pos) mem.overload_cnt = 0 return true end, - + techage_set_numbers = function(pos, numbers, player_name) local meta = M(pos) local res = logic.set_numbers(pos, numbers, player_name, S("TA3 Mesecons Converter")) meta:set_string("formspec", formspec(meta)) return res end, - + mesecons = { receptor = { state = mesecon.state.off, @@ -106,7 +106,7 @@ minetest.register_node("techage:ta3_mesecons_converter", { end, } }, - + after_dig_node = function(pos, oldnode, oldmetadata) techage.remove_node(pos, oldnode, oldmetadata) techage.del_mem(pos) @@ -118,7 +118,7 @@ minetest.register_node("techage:ta3_mesecons_converter", { is_ground_content = false, sounds = default.node_sound_wood_defaults(), }) - + minetest.register_craft({ output = "techage:ta3_mesecons_converter", @@ -144,4 +144,4 @@ techage.register_node({"techage:ta3_mesecons_converter"}, { on_node_load = function(pos) minetest.get_node_timer(pos):start(CYCLE_TIME) end, -}) +}) diff --git a/techage/logic/node_detector.lua b/techage/logic/node_detector.lua index eed6d7f..7d3c89c 100644 --- a/techage/logic/node_detector.lua +++ b/techage/logic/node_detector.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + Node Detector ]]-- @@ -62,12 +62,12 @@ local function any_node_changed(pos) end local num1 = #minetest.find_nodes_in_area(nvm.pos1, nvm.pos2, {"air"}) local num2 = #minetest.find_nodes_in_area(nvm.pos1, nvm.pos2, {"ignore"}) - + if num2 == 0 and nvm.num ~= num1 then - if nvm.mode == 1 and num1 < nvm.num then + if nvm.mode == 1 and num1 < nvm.num then nvm.num = num1 return true - elseif nvm.mode == 2 and num1 > nvm.num then + elseif nvm.mode == 2 and num1 > nvm.num then nvm.num = num1 return true elseif nvm.mode == 3 then @@ -83,7 +83,7 @@ local function on_receive_fields(pos, formname, fields, player) if minetest.is_protected(pos, player:get_player_name()) then return end - + local nvm = techage.get_nvm(pos) local meta = M(pos) if fields.accept then @@ -113,7 +113,7 @@ minetest.register_node("techage:ta3_nodedetector_off", { "techage_filling_ta3.png^techage_frame_ta3_top.png", "techage_filling_ta3.png^techage_frame_ta3.png^techage_appl_nodedetector.png", }, - + after_place_node = function(pos, placer) local meta = M(pos) local nvm = techage.get_nvm(pos) @@ -124,22 +124,22 @@ minetest.register_node("techage:ta3_nodedetector_off", { minetest.get_node_timer(pos):start(CYCLE_TIME) any_node_changed(pos) end, - + on_timer = node_timer, on_receive_fields = on_receive_fields, - + techage_set_numbers = function(pos, numbers, player_name) local meta = M(pos) local res = logic.set_numbers(pos, numbers, player_name, S("TA3 Node Detector")) meta:set_string("formspec", formspec(meta, techage.get_nvm(pos))) return res end, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) techage.remove_node(pos, oldnode, oldmetadata) techage.del_mem(pos) end, - + on_rotate = screwdriver.disallow, paramtype2 = "facedir", is_ground_content = false, @@ -155,21 +155,21 @@ minetest.register_node("techage:ta3_nodedetector_on", { "techage_filling_ta3.png^techage_frame_ta3_top.png", "techage_filling_ta3.png^techage_frame_ta3.png^techage_appl_nodedetector_on.png", }, - + on_timer = node_timer, - + techage_set_numbers = function(pos, numbers, player_name) local meta = M(pos) local res = logic.set_numbers(pos, numbers, player_name, S("TA3 Node Detector")) meta:set_string("formspec", formspec(meta, techage.get_nvm(pos))) return res end, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) techage.remove_node(pos, oldnode, oldmetadata) techage.del_mem(pos) end, - + on_rotate = screwdriver.disallow, paramtype2 = "facedir", is_ground_content = false, @@ -206,5 +206,4 @@ techage.register_node({"techage:ta3_nodedetector_off", "techage:ta3_nodedetector on_node_load = function(pos) minetest.get_node_timer(pos):start(CYCLE_TIME) end, -}) - +}) diff --git a/techage/logic/player_detector.lua b/techage/logic/player_detector.lua index 71566e7..791eb8d 100644 --- a/techage/logic/player_detector.lua +++ b/techage/logic/player_detector.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3 & TA4 Player Detector ]]-- @@ -38,14 +38,14 @@ local function scan_for_player(pos) local names = meta:get_string("names") or "" for _, object in pairs(minetest.get_objects_inside_radius(pos, 4)) do if object:is_player() then - if names == "" then + if names == "" then nvm.player_name = object:get_player_name() - return true + return true end for _,name in ipairs(string.split(names, " ")) do - if object:get_player_name() == name then + if object:get_player_name() == name then nvm.player_name = name - return true + return true end end end @@ -84,7 +84,7 @@ local function on_receive_fields(pos, formname, fields, player) if minetest.is_protected(pos, player:get_player_name()) then return end - + local meta = minetest.get_meta(pos) if fields.exit == "Save" then if techage.check_numbers(fields.numbers, player:get_player_name()) then @@ -117,7 +117,7 @@ minetest.register_node("techage:ta3_playerdetector_off", { end, on_receive_fields = on_receive_fields, - + on_timer = function (pos, elapsed) if scan_for_player(pos) then switch_on(pos, 3) @@ -131,12 +131,12 @@ minetest.register_node("techage:ta3_playerdetector_off", { meta:set_string("formspec", formspec(meta)) return res end, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) techage.remove_node(pos, oldnode, oldmetadata) techage.del_mem(pos) end, - + paramtype2 = "facedir", groups = {choppy=2, cracky=2, crumbly=2}, is_ground_content = false, @@ -152,21 +152,21 @@ minetest.register_node("techage:ta3_playerdetector_on", { "techage_filling_ta3.png^techage_frame_ta3.png^techage_appl_playerdetector_on.png", }, on_receive_fields = on_receive_fields, - + on_timer = function (pos, elapsed) if not scan_for_player(pos) then switch_off(pos, 3) end return true end, - + techage_set_numbers = function(pos, numbers, player_name) local meta = M(pos) local res = logic.set_numbers(pos, numbers, player_name, S("TA3 Player Detector")) meta:set_string("formspec", formspec(meta)) return res end, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) techage.remove_node(pos, oldnode, oldmetadata) techage.del_mem(pos) @@ -208,7 +208,7 @@ minetest.register_node("techage:ta4_playerdetector_off", { end, on_receive_fields = on_receive_fields, - + on_timer = function (pos, elapsed) if scan_for_player(pos) then switch_on(pos, 4) @@ -222,12 +222,12 @@ minetest.register_node("techage:ta4_playerdetector_off", { meta:set_string("formspec", formspec(meta)) return res end, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) techage.remove_node(pos, oldnode, oldmetadata) techage.del_mem(pos) end, - + paramtype = "light", sunlight_propagates = true, paramtype2 = "facedir", @@ -257,21 +257,21 @@ minetest.register_node("techage:ta4_playerdetector_on", { }, }, on_receive_fields = on_receive_fields, - + on_timer = function (pos, elapsed) if not scan_for_player(pos) then switch_off(pos, 4) end return true end, - + techage_set_numbers = function(pos, numbers, player_name) local meta = M(pos) local res = logic.set_numbers(pos, numbers, player_name, S("TA4 Player Detector")) meta:set_string("formspec", formspec(meta)) return res end, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) techage.remove_node(pos, oldnode, oldmetadata) techage.del_mem(pos) @@ -313,7 +313,7 @@ techage.register_node({ return nvm.player_name or "" elseif topic == "state" then local node = techage.get_node_lvm(pos) - if node.name == "techage:ta3_playerdetector_on" or + if node.name == "techage:ta3_playerdetector_on" or node.name == "techage:ta4_playerdetector_on" then return "on" else @@ -327,5 +327,4 @@ techage.register_node({ minetest.get_node_timer(pos):start(CYCLE_TIME) end, } -) - +) diff --git a/techage/logic/programmer.lua b/techage/logic/programmer.lua index efe2b09..c119720 100644 --- a/techage/logic/programmer.lua +++ b/techage/logic/programmer.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information Number programmer - + ]]-- -- for lazy programmers @@ -28,7 +28,7 @@ local function reset_programmer(itemstack, user, pointed_thing) user:get_meta():set_string("techage_prog_numbers", nil) minetest.chat_send_player(user:get_player_name(), S("[TechAge Programmer] programmer reset")) return itemstack -end +end local function read_number(itemstack, user, pointed_thing) local pos = pointed_thing.under @@ -98,4 +98,3 @@ minetest.register_craft({ {"", "dye:red", ""}, }, }) - diff --git a/techage/logic/repeater.lua b/techage/logic/repeater.lua index 8de4e50..24a2d8b 100644 --- a/techage/logic/repeater.lua +++ b/techage/logic/repeater.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information Signal Repeater - + ]]-- -- for lazy programmers @@ -58,20 +58,20 @@ minetest.register_node("techage:ta3_repeater", { meta:set_string("formspec", formspec(meta)) end end, - + on_timer = function(pos,elapsed) local mem = techage.get_mem(pos) mem.overload_cnt = 0 return true end, - + techage_set_numbers = function(pos, numbers, player_name) local meta = M(pos) local res = logic.set_numbers(pos, numbers, player_name, S("TA3 Repeater")) meta:set_string("formspec", formspec(meta)) return res end, - + after_dig_node = function(pos, oldnode, oldmetadata) techage.remove_node(pos, oldnode, oldmetadata) techage.del_mem(pos) @@ -111,5 +111,4 @@ techage.register_node({"techage:ta3_repeater"}, { on_node_load = function(pos) minetest.get_node_timer(pos):start(CYCLE_TIME) end, -}) - +}) diff --git a/techage/logic/sequencer.lua b/techage/logic/sequencer.lua index 2784c11..e2c6005 100644 --- a/techage/logic/sequencer.lua +++ b/techage/logic/sequencer.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information TA3 Sequencer - + ]]-- -- for lazy programmers @@ -37,7 +37,7 @@ local function formspec(state, rules, endless) default.gui_bg_img.. default.gui_slots.. "label[0,0;Number(s)]label[2.1,0;Command]label[6.4,0;Offset/s]"} - + for idx, rule in ipairs(rules or {}) do tbl[#tbl+1] = "field[0.2,"..(-0.2+idx)..";2,1;num"..idx..";;"..(rule.num or "").."]" tbl[#tbl+1] = "dropdown[2,"..(-0.4+idx)..";3.9,1;act"..idx..";"..sAction..";"..(rule.act or "").."]" @@ -47,7 +47,7 @@ local function formspec(state, rules, endless) tbl[#tbl+1] = "button[2.2,8.5;1.5,1;help;help]" tbl[#tbl+1] = "button[4.2,8.5;1.5,1;save;Save]" tbl[#tbl+1] = "image_button[6.2,8.5;1,1;".. techage.state_button(state) ..";button;]" - + return table.concat(tbl) end @@ -97,7 +97,7 @@ local function restart_timer(pos, time) time = math.max(time, 0.2) timer:start(time) end -end +end local function check_rules(pos, elapsed) local nvm = techage.get_nvm(pos) @@ -150,23 +150,23 @@ local function on_receive_fields(pos, formname, fields, player) if minetest.is_protected(pos, player:get_player_name()) then return end - + local meta = M(pos) local nvm = techage.get_nvm(pos) nvm.running = nvm.running or false nvm.endless = nvm.endless or false nvm.rules = nvm.rules or new_rules() - + if fields.help ~= nil then meta:set_string("formspec", formspec_help()) return end - + if fields.endless ~= nil then nvm.endless = fields.endless == "true" nvm.index = 1 end - + if fields.exit ~= nil then if nvm.running then meta:set_string("formspec", formspec(techage.RUNNING, nvm.rules, nvm.endless)) @@ -180,7 +180,7 @@ local function on_receive_fields(pos, formname, fields, player) if fields["offs"..idx] ~= nil then nvm.rules[idx].offs = tonumber(fields["offs"..idx]) or "" end - if fields["num"..idx] ~= nil and + if fields["num"..idx] ~= nil and techage.check_numbers(fields["num"..idx], player:get_player_name()) then nvm.rules[idx].num = fields["num"..idx] end @@ -214,7 +214,7 @@ minetest.register_node("techage:ta3_sequencer", { "techage_filling_ta3.png^techage_frame_ta3_top.png", "techage_filling_ta3.png^techage_frame_ta3.png^techage_appl_sequencer.png", }, - + after_place_node = function(pos, placer) local meta = M(pos) local nvm = techage.get_nvm(pos) @@ -228,7 +228,7 @@ minetest.register_node("techage:ta3_sequencer", { end, on_receive_fields = on_receive_fields, - + can_dig = function(pos, puncher) if minetest.is_protected(pos, puncher:get_player_name()) then return false @@ -236,14 +236,14 @@ minetest.register_node("techage:ta3_sequencer", { local nvm = techage.get_nvm(pos) return not nvm.running end, - + after_dig_node = function(pos, oldnode, oldmetadata) techage.remove_node(pos, oldnode, oldmetadata) techage.del_mem(pos) end, - + on_timer = check_rules, - + paramtype2 = "facedir", groups = {choppy=2, cracky=2, crumbly=2}, is_ground_content = false, @@ -284,5 +284,4 @@ techage.register_node({"techage:ta3_sequencer"}, { minetest.get_node_timer(pos):start(1) end end, -}) - +}) diff --git a/techage/logic/sequencer2.lua b/techage/logic/sequencer2.lua index fe407fe..e051ab9 100644 --- a/techage/logic/sequencer2.lua +++ b/techage/logic/sequencer2.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information TA4 Sequencer - + ]]-- -- for lazy programmers @@ -65,20 +65,20 @@ local function add_error(text, line_num) end end return table.concat(tbl, "\n") -end +end local function exception(tRes, line, s) if tRes then tRes.line = line tRes.error = s end -end +end local function compile(s, tRes) local tCode = {} local old_idx = 0 local start_idx - + for i, line in ipairs(strsplit(s)) do line = trim(line) line = string.split(line, "--", true, 1)[1] or "" @@ -114,7 +114,7 @@ local function compile(s, tRes) old_idx = idx end end - -- Returns: + -- Returns: -- { -- start_idx = 1, -- tCode = { @@ -174,7 +174,7 @@ local function restart_timer(pos, time) timer:stop() end timer:start(time / 10) -end +end local function node_timer(pos, elapsed) local nvm = techage.get_nvm(pos) @@ -184,8 +184,8 @@ local function node_timer(pos, elapsed) if mem.code then mem.idx = mem.idx or mem.code.start_idx local code = mem.code.tCode[mem.idx] - if code and code.cmnd then - local src = M(pos):get_string("node_number") + if code and code.cmnd then + local src = M(pos):get_string("node_number") techage.counting_start(M(pos):get_string("owner")) techage.send_single(src, code.number, code.cmnd, code.payload) techage.counting_stop() @@ -209,12 +209,12 @@ local function on_receive_fields(pos, formname, fields, player) if minetest.is_protected(pos, player:get_player_name()) then return end - + local meta = M(pos) local nvm = techage.get_nvm(pos) local mem = techage.get_mem(pos) nvm.running = nvm.running or false - + if fields.stop then nvm.running = false minetest.get_node_timer(pos):stop() @@ -227,7 +227,7 @@ local function on_receive_fields(pos, formname, fields, player) meta:set_string("formspec", formspec(nvm, meta)) return end - + if fields.save then nvm.running = false meta:set_string("text", fields.text or "") @@ -255,7 +255,7 @@ minetest.register_node("techage:ta4_sequencer", { "techage_filling_ta4.png^techage_frame_ta4_top.png", "techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_sequencer.png", }, - + after_place_node = function(pos, placer) local meta = M(pos) local nvm = techage.get_nvm(pos) @@ -266,14 +266,14 @@ minetest.register_node("techage:ta4_sequencer", { end, on_receive_fields = on_receive_fields, - + after_dig_node = function(pos, oldnode, oldmetadata) techage.remove_node(pos, oldnode, oldmetadata) techage.del_mem(pos) end, - + on_timer = node_timer, - + paramtype2 = "facedir", groups = {choppy=2, cracky=2, crumbly=2}, is_ground_content = false, @@ -311,5 +311,4 @@ techage.register_node({"techage:ta4_sequencer"}, { return "unsupported" end end, -}) - +}) diff --git a/techage/logic/signallamp.lua b/techage/logic/signallamp.lua index 2338faa..0a7ae1c 100644 --- a/techage/logic/signallamp.lua +++ b/techage/logic/signallamp.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information Colored Signal Lamp (requires unifieddyes) - + ]]-- -- for lazy programmers @@ -24,12 +24,12 @@ local COLORED = minetest.get_modpath("unifieddyes") and minetest.global_exists(" local function switch_on(pos, node) node.name = "techage:signal_lamp_on" minetest.swap_node(pos, node) -end +end local function switch_off(pos, node) node.name = "techage:signal_lamp_off" minetest.swap_node(pos, node) -end +end minetest.register_node("techage:signal_lamp_off", { description = S("TechAge Signal Lamp (can be colored)"), @@ -62,7 +62,7 @@ minetest.register_node("techage:signal_lamp_off", { on_construct = COLORED and unifieddyes.on_construct or nil, on_dig = COLORED and unifieddyes.on_dig or nil, - + paramtype = "light", paramtype2 = "color", palette = COLORED and "unifieddyes_palette_extended.png" or 'techage_color16.png', @@ -92,19 +92,19 @@ minetest.register_node("techage:signal_lamp_on", { paramtype2 = "color", palette = COLORED and "unifieddyes_palette_extended.png" or 'techage_color16.png', groups = {choppy=2, cracky=1, not_in_creative_inventory=1, ud_param2_colorable = 1}, - + on_construct = COLORED and unifieddyes.on_construct or nil, after_place_node = COLORED and unifieddyes.recolor_on_place or nil, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) techage.remove_node(pos, oldnode, oldmetadata) if COLORED then unifieddyes.after_dig_node(pos, oldnode, oldmetadata, digger) end end, - + on_dig = COLORED and unifieddyes.on_dig or nil, - light_source = 10, + light_source = 10, is_ground_content = false, drop = "techage:signal_lamp_off" }) @@ -121,7 +121,7 @@ techage.register_node({"techage:signal_lamp_off", "techage:signal_lamp_on"}, { return "unsupported" end end, -}) +}) minetest.register_craft({ output = "techage:signal_lamp_off", @@ -131,4 +131,3 @@ minetest.register_craft({ {"", "techage:vacuum_tube", ""}, }, }) - diff --git a/techage/logic/signallamp_2x.lua b/techage/logic/signallamp_2x.lua index 58ef893..793cca9 100644 --- a/techage/logic/signallamp_2x.lua +++ b/techage/logic/signallamp_2x.lua @@ -9,30 +9,30 @@ See LICENSE.txt for more information TA4 Logic twofold signal lamp - + ]]-- -- for lazy programmers local M = minetest.get_meta local S = techage.S - + local OFF = 0 local RED = 1 local GREEN = 2 -local AMBER = 3 - +local AMBER = 3 + local WRENCH_MENU = { { type = "ascii", name = "label1", - label = S("Label") .. " 1", + label = S("Label") .. " 1", tooltip = S("Label for the lamp"), default = "1", }, { type = "ascii", name = "label2", - label = S("Label") .. " 2", + label = S("Label") .. " 2", tooltip = S("Label for the lamp"), default = "2", }, @@ -46,7 +46,7 @@ local function lamp_update(pos, objref) local tbl = {" ", " ", meta:get_string("label1"), " ", meta:get_string("label2")} local text = "< " .. table.concat(tbl, "\n< ") local texture = lcdlib.make_multiline_texture("default", text, 96, 96, 7, "top", "#000", 6) - + if nvm.lamp[1] == RED then texture = texture .. "^techage_smartline_signal_red2.png" elseif nvm.lamp[1] == GREEN then @@ -54,7 +54,7 @@ local function lamp_update(pos, objref) elseif nvm.lamp[1] == AMBER then texture = texture .. "^techage_smartline_signal_amber2.png" end - + if nvm.lamp[2] == RED then texture = texture .. "^techage_smartline_signal_red3.png" elseif nvm.lamp[2] == GREEN then @@ -62,7 +62,7 @@ local function lamp_update(pos, objref) elseif nvm.lamp[2] == AMBER then texture = texture .. "^techage_smartline_signal_amber3.png" end - + objref:set_properties({ textures = {texture}, visual_size = {x=1, y=1} }) end @@ -106,7 +106,7 @@ minetest.register_node("techage:ta4_signallamp_2x", { ta_after_formspec = function(pos, fields, playername) lcdlib.update_entities(pos) end, - + ta3_formspec = WRENCH_MENU, on_place = lcdlib.on_place, on_construct = lcdlib.on_construct, @@ -139,7 +139,7 @@ techage.register_node({"techage:ta4_signallamp_2x"}, { lcdlib.update_entities(pos) end end, -}) +}) minetest.register_craft({ output = "techage:ta4_signallamp_2x", diff --git a/techage/logic/signallamp_4x.lua b/techage/logic/signallamp_4x.lua index 8edf379..6482785 100644 --- a/techage/logic/signallamp_4x.lua +++ b/techage/logic/signallamp_4x.lua @@ -9,44 +9,44 @@ See LICENSE.txt for more information TA4 Logic fourfold signal lamp - + ]]-- -- for lazy programmers local M = minetest.get_meta local S = techage.S - + local OFF = 0 local RED = 1 local GREEN = 2 -local AMBER = 3 - +local AMBER = 3 + local WRENCH_MENU = { { type = "ascii", name = "label1", - label = S("Label") .. " 1", + label = S("Label") .. " 1", tooltip = S("Label for the lamp"), default = "1", }, { type = "ascii", name = "label2", - label = S("Label") .. " 2", + label = S("Label") .. " 2", tooltip = S("Label for the lamp"), default = "2", }, { type = "ascii", name = "label3", - label = S("Label") .. " 3", + label = S("Label") .. " 3", tooltip = S("Label for the lamp"), default = "3", }, { type = "ascii", name = "label4", - label = S("Label") .. " 4", + label = S("Label") .. " 4", tooltip = S("Label for the lamp"), default = "4", }, @@ -60,7 +60,7 @@ local function lamp_update(pos, objref) local tbl = {meta:get_string("label1"), " ", meta:get_string("label2"), " ", meta:get_string("label3"), " ", meta:get_string("label4")} local text = "< " .. table.concat(tbl, "\n< ") local texture = lcdlib.make_multiline_texture("default", text, 96, 96, 7, "top", "#000", 6) - + if nvm.lamp[1] == RED then texture = texture .. "^techage_smartline_signal_red1.png" elseif nvm.lamp[1] == GREEN then @@ -68,7 +68,7 @@ local function lamp_update(pos, objref) elseif nvm.lamp[1] == AMBER then texture = texture .. "^techage_smartline_signal_amber1.png" end - + if nvm.lamp[2] == RED then texture = texture .. "^techage_smartline_signal_red2.png" elseif nvm.lamp[2] == GREEN then @@ -76,7 +76,7 @@ local function lamp_update(pos, objref) elseif nvm.lamp[2] == AMBER then texture = texture .. "^techage_smartline_signal_amber2.png" end - + if nvm.lamp[3] == RED then texture = texture .. "^techage_smartline_signal_red3.png" elseif nvm.lamp[3] == GREEN then @@ -137,7 +137,7 @@ minetest.register_node("techage:ta4_signallamp_4x", { ta_after_formspec = function(pos, fields, playername) lcdlib.update_entities(pos) end, - + ta3_formspec = WRENCH_MENU, on_place = lcdlib.on_place, on_construct = lcdlib.on_construct, @@ -170,7 +170,7 @@ techage.register_node({"techage:ta4_signallamp_4x"}, { lcdlib.update_entities(pos) end end, -}) +}) minetest.register_craft({ output = "techage:ta4_signallamp_4x", diff --git a/techage/logic/terminal.lua b/techage/logic/terminal.lua index cf63084..53a82e3 100644 --- a/techage/logic/terminal.lua +++ b/techage/logic/terminal.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information terminal.lua: - + ]]-- local M = minetest.get_meta @@ -22,7 +22,7 @@ Local commands: - Output this message with 'help' - Switch to public use of buttons with 'pub' - Switch to private use of buttons with 'priv' -- Program a user button with +- Program a user button with 'set ' Example: 'set 1 ON cmd 1234 on' - send a command with 'cmd ' @@ -35,7 +35,7 @@ Local commands: - Output this message with 'help' - Switch to public use of buttons with 'pub' - Switch to private use of buttons with 'priv' -- Program a user button with +- Program a user button with 'set ' Example: 'set 1 ON cmd 1234 on' - send a command with 'cmd ' @@ -110,7 +110,7 @@ local function server_debug(pos, command, player) return end local resp = techage.transfer( - pos, + pos, "B", -- outdir cmnd, -- topic payload, -- payload @@ -119,7 +119,7 @@ local function server_debug(pos, command, player) output(pos, dump(resp)) return true end - + cmnd, payload = command:match('^axle%s+([%w_]+)%s*(.*)$') if cmnd then if not minetest.check_player_privs(player, "server") then @@ -127,7 +127,7 @@ local function server_debug(pos, command, player) return end local resp = techage.transfer( - pos, + pos, "B", -- outdir cmnd, -- topic payload, -- payload @@ -136,7 +136,7 @@ local function server_debug(pos, command, player) output(pos, dump(resp)) return true end - + cmnd, payload = command:match('^vtube%s+([%w_]+)%s*(.*)$') if cmnd then if not minetest.check_player_privs(player, "server") then @@ -144,7 +144,7 @@ local function server_debug(pos, command, player) return end local resp = techage.transfer( - pos, + pos, "B", -- outdir cmnd, -- topic payload, -- payload @@ -158,11 +158,11 @@ end local function command(pos, command, player, is_ta4) local meta = minetest.get_meta(pos) local owner = meta:get_string("owner") or "" - + command = command:sub(1,80) command = string.trim(command) local cmnd, data = command:match('^(%w+)%s*(.*)$') - + if cmnd == "clear" then meta:set_string("output", "") meta:set_string("formspec", formspec2(meta)) @@ -202,7 +202,7 @@ local function command(pos, command, player, is_ta4) local own_num = meta:get_string("node_number") local connected_to = meta:contains("connected_to") and meta:get_string("connected_to") local bttn_num, label, num, cmnd, payload - + num, cmnd, payload = command:match('^cmd%s+([0-9]+)%s+(%w+)%s*(.*)$') if num and cmnd then if techage.not_protected(num, owner, owner) then @@ -215,7 +215,7 @@ local function command(pos, command, player, is_ta4) end return end - + num, cmnd = command:match('^turn%s+([0-9]+)%s+([onf]+)$') if num and (cmnd == "on" or cmnd == "off") then if techage.not_protected(num, owner, owner) then @@ -224,7 +224,7 @@ local function command(pos, command, player, is_ta4) end return end - + bttn_num, label, cmnd = command:match('^set%s+([1-9])%s+([%w_]+)%s+(.+)$') if bttn_num and label and cmnd then meta:set_string("bttn_text"..bttn_num, label) @@ -232,11 +232,11 @@ local function command(pos, command, player, is_ta4) meta:set_string("formspec", formspec2(meta)) return end - + if server_debug(pos, command, player) then return end - + if connected_to then local cmnd, payload = command:match('^(%w+)%s*(.*)$') if cmnd then @@ -251,12 +251,12 @@ local function command(pos, command, player, is_ta4) return end end - + if command ~= "" then output(pos, SYNTAX_ERR) end end -end +end local function send_cmnd(pos, meta, num) local cmnd = meta:get_string("bttn_cmnd"..num) @@ -271,7 +271,7 @@ local function register_terminal(name, description, tiles, node_box, selection_b drawtype = "nodebox", node_box = node_box, selection_box = selection_box, - + after_place_node = function(pos, placer) local number = techage.add_node(pos, minetest.get_node(pos).name) local meta = minetest.get_meta(pos) @@ -284,9 +284,9 @@ local function register_terminal(name, description, tiles, node_box, selection_b on_receive_fields = function(pos, formname, fields, player) local meta = minetest.get_meta(pos) - local public = meta:get_int("public") == 1 + local public = meta:get_int("public") == 1 local protected = minetest.is_protected(pos, player:get_player_name()) - + if not protected then local evt = minetest.explode_table_event(fields.output) if evt.type == "DCL" then @@ -324,11 +324,11 @@ local function register_terminal(name, description, tiles, node_box, selection_b end end end, - + after_dig_node = function(pos, oldnode, oldmetadata) techage.remove_node(pos, oldnode, oldmetadata) end, - + paramtype = "light", use_texture_alpha = techage.CLIP, sunlight_propagates = true, diff --git a/techage/logic/timer.lua b/techage/logic/timer.lua index 5794262..2e55613 100644 --- a/techage/logic/timer.lua +++ b/techage/logic/timer.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information TA3 Sequencer - + ]]-- -- for lazy programmers @@ -20,9 +20,9 @@ local logic = techage.logic local CYCLE_TIME = 8 local tTime = { - ["00:00"] = 1, ["02:00"] = 2, ["04:00"] = 3, + ["00:00"] = 1, ["02:00"] = 2, ["04:00"] = 3, ["06:00"] = 4, ["08:00"] = 5, ["10:00"] = 6, - ["12:00"] = 7, ["14:00"] = 8, ["16:00"] = 9, + ["12:00"] = 7, ["14:00"] = 8, ["16:00"] = 9, ["18:00"] =10, ["20:00"] =11, ["22:00"] =12, } @@ -48,32 +48,32 @@ local function formspec(events, numbers, actions) default.gui_bg.. default.gui_bg_img.. default.gui_slots.. - + "label[0,0;Time]label[2.3,0;Number(s)]label[4.5,0;Command]".. - "dropdown[0,1;2,1;e1;"..sTime..";"..events[1].."]".. + "dropdown[0,1;2,1;e1;"..sTime..";"..events[1].."]".. "field[2.3,1.2;2,1;n1;;"..numbers[1].."]" .. - "dropdown[4.5,1;3,1;a1;"..sAction..";"..tAction[actions[1]].."]".. - - "dropdown[0,2;2,1;e2;"..sTime..";"..events[2].."]".. + "dropdown[4.5,1;3,1;a1;"..sAction..";"..tAction[actions[1]].."]".. + + "dropdown[0,2;2,1;e2;"..sTime..";"..events[2].."]".. "field[2.3,2.2;2,1;n2;;"..numbers[2].."]" .. - "dropdown[4.5,2;3,1;a2;"..sAction..";"..tAction[actions[2]].."]".. - - "dropdown[0,3;2,1;e3;"..sTime..";"..events[3].."]".. + "dropdown[4.5,2;3,1;a2;"..sAction..";"..tAction[actions[2]].."]".. + + "dropdown[0,3;2,1;e3;"..sTime..";"..events[3].."]".. "field[2.3,3.2;2,1;n3;;"..numbers[3].."]" .. - "dropdown[4.5,3;3,1;a3;"..sAction..";"..tAction[actions[3]].."]".. - - "dropdown[0,4;2,1;e4;"..sTime..";"..events[4].."]".. + "dropdown[4.5,3;3,1;a3;"..sAction..";"..tAction[actions[3]].."]".. + + "dropdown[0,4;2,1;e4;"..sTime..";"..events[4].."]".. "field[2.3,4.2;2,1;n4;;"..numbers[4].."]" .. - "dropdown[4.5,4;3,1;a4;"..sAction..";"..tAction[actions[4]].."]".. - - "dropdown[0,5;2,1;e5;"..sTime..";"..events[5].."]".. + "dropdown[4.5,4;3,1;a4;"..sAction..";"..tAction[actions[4]].."]".. + + "dropdown[0,5;2,1;e5;"..sTime..";"..events[5].."]".. "field[2.3,5.2;2,1;n5;;"..numbers[5].."]" .. - "dropdown[4.5,5;3,1;a5;"..sAction..";"..tAction[actions[5]].."]".. - - "dropdown[0,6;2,1;e6;"..sTime..";"..events[6].."]".. + "dropdown[4.5,5;3,1;a5;"..sAction..";"..tAction[actions[5]].."]".. + + "dropdown[0,6;2,1;e6;"..sTime..";"..events[6].."]".. "field[2.3,6.2;2,1;n6;;"..numbers[6].."]" .. - "dropdown[4.5,6;3,1;a6;"..sAction..";"..tAction[actions[6]].."]".. - + "dropdown[4.5,6;3,1;a6;"..sAction..";"..tAction[actions[6]].."]".. + "button_exit[3,7;2,1;exit;close]" end @@ -87,8 +87,8 @@ local function check_rules(pos,elapsed) local numbers = deserialize(meta, "numbers") local actions = deserialize(meta, "actions") local number = meta:get_string("node_number") - - if events and numbers and actions then + + if events and numbers and actions then -- check all rules for idx,act in ipairs(actions) do if act ~= "" and numbers[idx] ~= "" then @@ -103,7 +103,7 @@ local function check_rules(pos,elapsed) end end end - + -- prepare for the next day if hour == 23 then nvm.done = {false,false,false,false,false,false} @@ -144,7 +144,7 @@ minetest.register_node("techage:ta3_timer", { if minetest.is_protected(pos, player:get_player_name()) then return end - + local events = minetest.deserialize(meta:get_string("events")) for idx, evt in ipairs({fields.e1, fields.e2, fields.e3, fields.e4, fields.e5, fields.e6}) do if evt ~= nil then @@ -172,7 +172,7 @@ minetest.register_node("techage:ta3_timer", { local nvm = techage.get_nvm(pos) nvm.done = {false,false,false,false,false,false} end, - + on_timer = check_rules, after_dig_node = function(pos, oldnode, oldmetadata) @@ -207,4 +207,3 @@ techage.register_node({"techage:ta3_timer"}, { check_rules(pos,0) end, }) - diff --git a/techage/lua_controller/commands.lua b/techage/lua_controller/commands.lua index ef3bd0e..dfe48f3 100644 --- a/techage/lua_controller/commands.lua +++ b/techage/lua_controller/commands.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information commands.lua: - + Register all basic controller commands ]]-- @@ -65,7 +65,7 @@ techage.lua_ctlr.register_function("read_data", { }) techage.lua_ctlr.register_function("time_as_str", { - cmnd = function(self) + cmnd = function(self) local t = minetest.get_timeofday() local h = math.floor(t*24) % 24 local m = math.floor(t*1440) % 60 @@ -77,7 +77,7 @@ techage.lua_ctlr.register_function("time_as_str", { }) techage.lua_ctlr.register_function("time_as_num", { - cmnd = function(self, num) + cmnd = function(self, num) local t = minetest.get_timeofday() local h = math.floor(t*24) % 24 local m = math.floor(t*1440) % 60 @@ -89,7 +89,7 @@ techage.lua_ctlr.register_function("time_as_num", { }) techage.lua_ctlr.register_action("send_cmnd", { - cmnd = function(self, num, cmnd, data) + cmnd = function(self, num, cmnd, data) num = tostring(num or "") cmnd = tostring(cmnd or "") if not_protected(self.meta.owner, num) then @@ -104,7 +104,7 @@ techage.lua_ctlr.register_action("send_cmnd", { }) techage.lua_ctlr.register_action("set_filter", { - cmnd = function(self, num, slot, val) + cmnd = function(self, num, slot, val) num = tostring(num or "") slot = tostring(slot or "red") val = tostring(val or "on") @@ -158,11 +158,11 @@ techage.lua_ctlr.register_action("display", { " and add a new line. If the first char of the string\n".. " is a blank, the text will be horizontally centered.\n".. ' example: $display("123", 1, "Hello "..name)' - + }) techage.lua_ctlr.register_action("clear_screen", { - cmnd = function(self, num) + cmnd = function(self, num) num = tostring(num or "") if not_protected(self.meta.owner, num) then techage.send_single(self.meta.number, num, "clear", nil) @@ -175,7 +175,7 @@ techage.lua_ctlr.register_action("clear_screen", { }) techage.lua_ctlr.register_action("chat", { - cmnd = function(self, text) + cmnd = function(self, text) text = tostring(text or "") minetest.chat_send_player(self.meta.owner, "[TA4 Lua Controller] "..text) end, @@ -185,7 +185,7 @@ techage.lua_ctlr.register_action("chat", { }) techage.lua_ctlr.register_action("door", { - cmnd = function(self, pos, text) + cmnd = function(self, pos, text) pos = tostring(pos or "") text = tostring(text or "") pos = minetest.string_to_pos("("..pos..")") diff --git a/techage/lua_controller/controller.lua b/techage/lua_controller/controller.lua index 6857b1e..68fe4df 100644 --- a/techage/lua_controller/controller.lua +++ b/techage/lua_controller/controller.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + Lua Controller ]]-- @@ -18,13 +18,13 @@ local M = minetest.get_meta local sHELP = [[TA4 Lua Controller - This controller is used to control and monitor + This controller is used to control and monitor TechAge machines. This controller can be programmed in Lua. - - See on GitHub for more help: + + See on GitHub for more help: https://github.com/joe7575/techage/blob/master/manuals/ta4_lua_controller_EN.md - + or download the PDF file from: https://github.com/joe7575/techage/blob/master/manuals/ta4_lua_controller_EN.pdf @@ -46,8 +46,8 @@ local tHelpTexts = {[" Overview"] = sHELP, [" Data structures"] = safer_lua.Data local sFunctionList = "" local tFunctionIndex = {} -minetest.after(2, function() - sFunctionList = table.concat(tFunctions, ",") +minetest.after(2, function() + sFunctionList = table.concat(tFunctions, ",") for idx,key in ipairs(tFunctions) do tFunctionIndex[key] = idx end @@ -289,7 +289,7 @@ local function patch_error_string(err, line_offs) else table.insert(tbl, s) end - end + end return table.concat(tbl, "\n") end @@ -317,7 +317,7 @@ local function compile(pos, meta, number) local env = table.copy(tCommands) env.meta = {pos=pos, owner=owner, number=number, error=error} local code = safer_lua.init(pos, init, func.."\n"..loop, env, error) - + if code then Cache[number] = {code=code, inputs={}, events=env.meta.events} Cache[number].inputs.term = nil -- terminal inputs @@ -335,7 +335,7 @@ local function battery(pos) return true end return false -end +end local function start_controller(pos) local meta = minetest.get_meta(pos) @@ -344,12 +344,12 @@ local function start_controller(pos) meta:set_string("formspec", formspec0(meta)) return false end - + meta:set_string("output", "") meta:set_int("cycletime", 1) meta:set_int("cyclecount", 0) meta:set_int("cpu", 0) - + if compile(pos, meta, number) then meta:set_int("state", techage.RUNNING) meta:set_int("running", STATE_RUNNING) @@ -402,7 +402,7 @@ local function call_loop(pos, meta, elapsed) local cpu = meta:get_int("cpu") or 0 local code = Cache[number].code local res = safer_lua.run_loop(pos, elapsed, code, error) - if res then + if res then -- Don't count thread changes t = math.min(minetest.get_us_time() - t, 1000) cpu = math.floor(((cpu * 20) + t) / 21) @@ -445,7 +445,7 @@ local function on_receive_fields(pos, formname, fields, player) return end local meta = minetest.get_meta(pos) - + --print(dump(fields)) if fields.cancel == nil then if fields.init then @@ -460,9 +460,9 @@ local function on_receive_fields(pos, formname, fields, player) elseif fields.notes then meta:set_string("notes", fields.notes) meta:set_string("formspec", formspec5(meta)) - end + end end - + if fields.update then meta:set_string("formspec", formspec4(meta)) techage.set_activeformspec(pos, player) @@ -517,7 +517,7 @@ minetest.register_node("techage:ta4_lua_controller", { { -6/32, -6/32, 14/32, 6/32, 6/32, 16/32}, }, }, - + after_place_node = function(pos, placer) local meta = minetest.get_meta(pos) local number = techage.add_node(pos, "techage:ta4_lua_controller") @@ -538,7 +538,7 @@ minetest.register_node("techage:ta4_lua_controller", { end, on_receive_fields = on_receive_fields, - + on_rightclick = function(pos, node, clicker) local meta = M(pos) if meta:get_int("running") == STATE_RUNNING then @@ -546,14 +546,14 @@ minetest.register_node("techage:ta4_lua_controller", { meta:set_string("formspec", formspec4(meta)) end end, - + after_dig_node = function(pos, oldnode, oldmetadata) techage.remove_node(pos, oldnode, oldmetadata) techage.del_mem(pos) end, - + on_timer = on_timer, - + paramtype = "light", use_texture_alpha = techage.CLIP, sunlight_propagates = true, @@ -575,7 +575,7 @@ minetest.register_craft({ -- write inputs from remote nodes local function set_input(pos, number, input, val) - if input and M(pos):get_int("state") == techage.RUNNING then + if input and M(pos):get_int("state") == techage.RUNNING then if (Cache[number] or compile(pos, M(pos), number)) and Cache[number].inputs then if input == "msg" then if #Cache[number].inputs["msg"] < 10 then @@ -594,17 +594,17 @@ local function set_input(pos, number, input, val) end end end -end +end -- used by the command "input" function techage.lua_ctlr.get_input(number, input) - if input then + if input then if Cache[number] and Cache[number].inputs then return Cache[number].inputs[input] or "off" end end return "off" -end +end function techage.lua_ctlr.get_next_input(number) if Cache[number] and Cache[number].inputs then @@ -616,7 +616,7 @@ function techage.lua_ctlr.get_next_input(number) return num, state end end -end +end -- used for Terminal commands function techage.lua_ctlr.get_command(number) @@ -625,20 +625,20 @@ function techage.lua_ctlr.get_command(number) Cache[number].inputs["term"] = nil return cmnd end -end +end -- used for queued messages function techage.lua_ctlr.get_msg(number) if Cache[number] and Cache[number].inputs then return table.remove(Cache[number].inputs["msg"], 1) end -end +end techage.register_node({"techage:ta4_lua_controller"}, { on_recv_message = function(pos, src, topic, payload) local meta = minetest.get_meta(pos) local number = meta:get_string("number") - + if topic == "on" then set_input(pos, number, src, topic) elseif topic == "off" then @@ -654,4 +654,4 @@ techage.register_node({"techage:ta4_lua_controller"}, { return "unsupported" end end, -}) +}) diff --git a/techage/lua_controller/sensorchest.lua b/techage/lua_controller/sensorchest.lua index 3ec47df..5a483b9 100644 --- a/techage/lua_controller/sensorchest.lua +++ b/techage/lua_controller/sensorchest.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - + TA4 Sensor Chest - + ]]-- -- for lazy programmers @@ -25,7 +25,7 @@ local function store_action(pos, player, action) local name = player and player:get_player_name() or "" local number = meta:get_string("node_number") PlayerActions[number] = {name, action} -end +end local function send_off_command(pos) local meta = minetest.get_meta(pos) @@ -134,7 +134,7 @@ minetest.register_node("techage:ta4_sensor_chest", { local inv = meta:get_inventory() inv:set_size('main', 4) end, - + after_place_node = function(pos, placer) local meta = minetest.get_meta(pos) local number = techage.add_node(pos, "techage:ta4_sensor_chest") @@ -148,11 +148,11 @@ minetest.register_node("techage:ta4_sensor_chest", { on_receive_fields = function(pos, formname, fields, player) local meta = M(pos) local nvm = techage.get_nvm(pos) - + if meta:get_string("public") ~= "true" and minetest.is_protected(pos, player:get_player_name()) then return 0 end - + if fields.public then meta:set_string("public", fields.public) end @@ -174,11 +174,11 @@ minetest.register_node("techage:ta4_sensor_chest", { meta:set_string("formspec", formspec2(pos)) end end, - + techage_set_numbers = function(pos, numbers, player_name) return techage.logic.set_numbers(pos, numbers, player_name, S("TA4 Sensor Chest")) end, - + can_dig = can_dig, after_dig_node = after_dig_node, allow_metadata_inventory_put = allow_metadata_inventory_put, @@ -206,7 +206,7 @@ techage.register_node({"techage:ta4_sensor_chest"}, { local inv = meta:get_inventory() return techage.put_items(inv, "main", stack) end, - + on_recv_message = function(pos, src, topic, payload) if topic == "state" then local meta = minetest.get_meta(pos) @@ -226,11 +226,10 @@ techage.register_node({"techage:ta4_sensor_chest"}, { return "unsupported" end end, -}) +}) minetest.register_craft({ type = "shapeless", output = "techage:ta4_sensor_chest", recipe = {"techage:chest_ta4", "techage:ta4_wlanchip"} }) - diff --git a/techage/lua_controller/server.lua b/techage/lua_controller/server.lua index eeff021..1c076a2 100644 --- a/techage/lua_controller/server.lua +++ b/techage/lua_controller/server.lua @@ -56,7 +56,7 @@ minetest.register_node("techage:ta4_server", { { -3/16, -8/16, -7/16, 3/16, 6/16, 7/16}, }, }, - + after_place_node = function(pos, placer) local meta = M(pos) local nvm = techage.get_nvm(pos) @@ -68,7 +68,7 @@ minetest.register_node("techage:ta4_server", { meta:set_string("infotext", "Server "..number..": ("..nvm.size.."/"..SERVER_CAPA..")") minetest.get_node_timer(pos):start(20) end, - + on_receive_fields = function(pos, formname, fields, player) local meta = M(pos) local nvm = techage.get_nvm(pos) @@ -80,7 +80,7 @@ minetest.register_node("techage:ta4_server", { end end end, - + on_dig = function(pos, node, puncher, pointed_thing) if minetest.is_protected(pos, puncher:get_player_name()) then return @@ -88,7 +88,7 @@ minetest.register_node("techage:ta4_server", { techage.del_mem(pos) minetest.node_dig(pos, node, puncher, pointed_thing) end, - + after_dig_node = function(pos, oldnode, oldmetadata) techage.remove_node(pos, oldnode, oldmetadata) end, @@ -101,7 +101,7 @@ minetest.register_node("techage:ta4_server", { meta:set_string("infotext", "Server "..number..": ("..nvm.size.."/"..SERVER_CAPA..")") return true end, - + paramtype = "light", sunlight_propagates = true, use_texture_alpha = techage.CLIP, @@ -158,7 +158,7 @@ minetest.register_node("techage:ta4_server2", { {-0.5, -0.0625, -0.4375, -0.4375, 0, 0.4375}, } }, - + after_place_node = function(pos, placer) local meta = M(pos) local nvm = techage.get_nvm(pos) @@ -170,7 +170,7 @@ minetest.register_node("techage:ta4_server2", { meta:set_string("infotext", "Server "..number..": ("..nvm.size.."/"..SERVER_CAPA..")") minetest.get_node_timer(pos):start(20) end, - + on_receive_fields = function(pos, formname, fields, player) local meta = M(pos) local nvm = techage.get_nvm(pos) @@ -182,7 +182,7 @@ minetest.register_node("techage:ta4_server2", { end end end, - + on_dig = function(pos, node, puncher, pointed_thing) if minetest.is_protected(pos, puncher:get_player_name()) then return @@ -190,7 +190,7 @@ minetest.register_node("techage:ta4_server2", { techage.del_mem(pos) minetest.node_dig(pos, node, puncher, pointed_thing) end, - + after_dig_node = function(pos, oldnode, oldmetadata) techage.remove_node(pos, oldnode, oldmetadata) end, @@ -203,7 +203,7 @@ minetest.register_node("techage:ta4_server2", { meta:set_string("infotext", "Server "..number..": ("..nvm.size.."/"..SERVER_CAPA..")") return true end, - + paramtype = "light", sunlight_propagates = true, use_texture_alpha = techage.CLIP, @@ -268,7 +268,7 @@ local function write_value(nvm, key, item) return true end return false -end +end local function read_value(nvm, key) local item = nvm.data[key] @@ -276,7 +276,7 @@ local function read_value(nvm, key) item = safer_lua.table_to_datastruct(item) end return item -end +end techage.register_node({"techage:ta4_server", "techage:ta4_server2"}, { on_recv_message = function(pos, src, topic, payload) @@ -285,11 +285,11 @@ techage.register_node({"techage:ta4_server", "techage:ta4_server2"}, { on_node_load = function(pos) minetest.get_node_timer(pos):start(20) end, -}) +}) techage.lua_ctlr.register_function("server_read", { - cmnd = function(self, num, key) + cmnd = function(self, num, key) if type(key) == "string" then local nvm = get_memory(num, self.meta.owner) if nvm then @@ -323,5 +323,3 @@ techage.lua_ctlr.register_action("server_write", { " return value: true if successful or false\n".. ' example: res = $server_write("123", "state", state)' }) - - diff --git a/techage/lua_controller/terminal.lua b/techage/lua_controller/terminal.lua index 26bc63b..78d5824 100644 --- a/techage/lua_controller/terminal.lua +++ b/techage/lua_controller/terminal.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information terminal.lua: - + ]]-- local HELP = [[#### TA4 Lua Controller Terminal #### @@ -21,7 +21,7 @@ Controller to the Terminal. Commands can have up to 80 characters. Local commands: - clear = clear screen -- help = this message +- help = this message - pub = switch to public use - priv = switch to private use Global commands: @@ -71,7 +71,7 @@ local function command(pos, cmnd, player) local owner = meta:get_string("owner") if cmnd then cmnd = cmnd:sub(1,80) - + if cmnd == "clear" then meta:set_string("output", "") meta:set_string("formspec", formspec2(meta)) @@ -121,7 +121,7 @@ local function command(pos, cmnd, player) end end end -end +end minetest.register_node("techage:ta4_terminal", { description = "TA4 Lua Controller Terminal", @@ -149,7 +149,7 @@ minetest.register_node("techage:ta4_terminal", { {-12/32, -14/32, 12/32, 12/32, 6/32, 14/32}, }, }, - + after_place_node = function(pos, placer) local number = techage.add_node(pos, minetest.get_node(pos).name) local meta = minetest.get_meta(pos) @@ -173,11 +173,11 @@ minetest.register_node("techage:ta4_terminal", { command(pos, fields.cmnd, player:get_player_name()) end end, - + after_dig_node = function(pos, oldnode, oldmetadata) techage.remove_node(pos, oldnode, oldmetadata) end, - + paramtype = "light", use_texture_alpha = techage.CLIP, sunlight_propagates = true, @@ -259,4 +259,3 @@ techage.lua_ctlr.register_action("send_msg", { ' Send a message to the controller with number "num".\n'.. ' example: $send_msg("0123", "test")' }) - diff --git a/techage/manuals/manual_ta5_DE.md b/techage/manuals/manual_ta5_DE.md index 8fe44f1..599594b 100644 --- a/techage/manuals/manual_ta5_DE.md +++ b/techage/manuals/manual_ta5_DE.md @@ -40,7 +40,7 @@ Für das Pairing musst du zuerst auf der einen Seite einen Namen für die Kiste Die Nutzung der TA5 Hyperloop Kiste benötigt 20 Erfahrungspunkte. -[ta4_chest|image] +[ta5_chest|image] ### TA5 Hyperloop Tank / TA5 Hyperloop Tank @@ -52,7 +52,39 @@ Für das Pairing musst du zuerst auf der einen Seite einen Namen für den Tank e Die Nutzung des TA5 Hyperloop Tanks benötigt 20 Erfahrungspunkte. -[ta4_tank|image] +[ta5_tank|image] + +### TA5-Raumgleiter (geplant) + +Dank einem Spezialantrieb für Lichtgeschwindigkeit können mit dem Raumgleiter auch große Entfernungen sehr schnell überwunden werden. + +## Teleport Blöcke + +Mit Teleport-Blöcken können Dinge zwischen zwei Teleport-Blöcken übertragen werden, ohne dass sich dazwischen eine Röhre oder Leitung befinden muss. Für das Pairing der Blöcke musst du zuerst auf der einen Seite einen Namen für den Block eingeben, dann kannst du bei dem anderen Block diesen Namen auswählen und so die beiden Blöcke verbinden. Das Pairung kann nur von einem Spieler durchgeführt werden (Spielername wird geprüft) und muss vor einem Server-Neustart abgeschlossen sein. Anderenfalls gehen die Pairing-Daten verloren. + +Der Plan rechts zeigt, wie die Blöcke genutzt werden können. + +[ta5_teleport|plan] + +### TA5 Teleport Block Gegenstände / TA5 Teleport Block Items + +Diese Teleport-Blöcke erlauben die Übertragung von Gegenständen und ersetzen somit eine Röhre. Dabei können Entfernungen von bis zu 200 Blöcken überbrückt werden. + +Ein Teleport-Block benötigt 12 ku Strom. + +Für die Nutzung der Teleport-Blöcke werden 60 Erfahrungspunkte benötigt. + +[ta5_tele_tube|image] + +### TA5 Teleport Block Flüssigkeiten / TA5 Teleport Block Liquids + +Diese Teleport-Blöcke erlauben die Übertragung von Flüssigkeiten und ersetzen somit eine gelbe Leitung. Dabei können Entfernungen von bis zu 200 Blöcken überbrückt werden. + +Ein Teleport-Block benötigt 12 ku Strom. + +Für die Nutzung der Teleport-Blöcke werden 60 Erfahrungspunkte benötigt. + +[ta5_tele_pipe|image] ### Hyperloop Teleport Blöcke (geplant) @@ -60,40 +92,14 @@ Die Hyperloop Teleport Blöcke erlauben den Aufbau von Hyperloop Netzwerk ohne H Die Nutzung der Hyperloop Teleport Blöcke benötigt 120 Erfahrungspunkte. +## Weitere TA5 Blöcke/Items + ### TA5 Container (geplant) Der TA5 Container erlaubt Techage Anlagen ein- und an einer anderen Stelle wieder auszupacken. Für die Nutzung des TA5 Containers werden 80 Erfahrungspunkte benötigt. -### TA5 Teleport Block Gegenstände / TA5 Teleport Block Items - -Teleportblöcke erlauben den Item-Transport ohne Röhren bis zu einer Entfernung von 200 Blöcken. -Für das Pairing musst du zuerst auf der einen Seite einen Namen für den Block eingeben, dann kannst du bei dem anderen Block diesen Namen auswählen und so die beiden Blöcke verbinden. - -Teleportblöcke benötigen jeweils 12 ku Strom. - -Für die Nutzung der Teleportblöcke werden 60 Erfahrungspunkte benötigt. - -[ta5_tele_tube|image] - -### TA5 Teleport Block Flüssigkeiten / TA5 Teleport Block Liquids - -Teleportblöcke erlauben den Flüssigkeiten-Transport ohne Leitungen bis zu einer Entfernung von 200 Blöcken. -Für das Pairing musst du zuerst auf der einen Seite einen Namen für den Block eingeben, dann kannst du bei dem anderen Block diesen Namen auswählen und so die beiden Blöcke verbinden. - -Teleportblöcke benötigen jeweils 12 ku Strom. - -Für die Nutzung der Teleportblöcke werden 60 Erfahrungspunkte benötigt. - -[ta5_tele_pipe|image] - -### TA5-Raumgleiter (geplant) - -Dank einem Spezialantrieb für Lichtgeschwindigkeit können mit dem Raumgleiter auch große Entfernungen sehr schnell überwunden werden. - -## Weitere TA5 Blöcke/Items - ### TA5 KI Chip / TA5 AI Chip Der TA5 KI Chip wird teilweise zur Herstellung von TA5 Blöcken benötigt. Der TA5 KI Chip kann nur auf der TA4 Elektronik Fab hergestellt werden. Dazu werden 10 Erfahrungspunkte benötigt. diff --git a/techage/manuals/manual_ta5_EN.md b/techage/manuals/manual_ta5_EN.md index 5877f5b..f61e370 100644 --- a/techage/manuals/manual_ta5_EN.md +++ b/techage/manuals/manual_ta5_EN.md @@ -40,7 +40,7 @@ For pairing you first have to enter a name for the chest on one side, then you c The use of the TA5 Hyperloop Chest requires 20 experience points. -[ta4_chest|image] +[ta5_chest|image] ### TA5 Hyperloop Tank @@ -52,7 +52,37 @@ For pairing you first have to enter a name for the tank on one side, then you ca The use of the TA5 Hyperloop Tank requires 20 experience points. -[ta4_tank|image] +[ta5_tank|image] + + + +## Teleport Blocks + +Teleport blocks allow things to be transferred between two teleport blocks without the need for a pipe or tube in between. To pair the blocks, you first have to enter a name for the block on one side, then you can select this name for the other block and thus connect the two blocks. Pairing can only be carried out by one player (player name is checked) and must be completed before the server is restarted. Otherwise the pairing data will be lost. + +The map on the right shows how the blocks can be used. + +[ta5_teleport|plan] + +### TA5 Teleport Block Items + +These teleport blocks allow the transfer of items and thus replace a tube. Distances of up to 200 blocks can be bridged. + +Each Teleport blocks requires 12 ku of electricity. + +60 experience points are required to use the teleport blocks. + +[ta5_tele_tube|image] + +### TA5 Teleport Block Liquids + +These teleport blocks allow the transfer of liquids and thus replace a pipe. Distances of up to 200 blocks can be bridged. + +Each Teleport blocks requires 12 ku of electricity. + +60 experience points are required to use the teleport blocks. + +[ta5_tele_pipe|image] ### Hyperloop Teleport Blocks (planned) @@ -60,36 +90,16 @@ The Hyperloop Teleport Blocks allow the construction of a Hyperloop network with The use of the Hyperloop Teleport Blocks requires 120 experience points. + + +## More TA5 Blocks/Items + ### TA5 Container (planned) The TA5 container allows Techage systems to be packed and unpacked at another location. 80 experience points are required to use the TA5 container. -### TA5 Teleport Block Items - -Teleport blocks allow items to be transported without tubes up to a distance of 200 blocks. -For pairing you first have to enter a name for the block on one side, then you can select this name for the other block and thus connect the two blocks. - -Teleport blocks each require 12 ku of electricity. - -60 experience points are required to use the Teleport blocks. - -[ta5_tele_tube|image] - -### TA5 Teleport Block Liquids - -Teleport blocks allow liquids to be transported without pipes up to a distance of 200 blocks. -For pairing you first have to enter a name for the block on one side, then you can select this name for the other block and thus connect the two blocks. - -Teleport blocks each require 12 ku of electricity. - -60 experience points are required to use the Teleport blocks. - -[ta5_tele_pipe|image] - -## More TA5 Blocks / Items - ### TA5 AI Chip The TA5 AI Chip is partly required for the production of TA5 blocks. The TA5 AI Chip can only be manufactured at the TA4 Electronics Fab. This requires 10 experience points. diff --git a/techage/manuals/toc_DE.md b/techage/manuals/toc_DE.md index e1c7aa8..b55e835 100644 --- a/techage/manuals/toc_DE.md +++ b/techage/manuals/toc_DE.md @@ -236,10 +236,11 @@ - [TA5 Flug Controller](./manual_ta5_DE.md#ta5-flug-controller) - [TA5 Hyperloop Kiste / TA5 Hyperloop Chest](./manual_ta5_DE.md#ta5-hyperloop-kiste--ta5-hyperloop-chest) - [TA5 Hyperloop Tank / TA5 Hyperloop Tank](./manual_ta5_DE.md#ta5-hyperloop-tank--ta5-hyperloop-tank) - - [Hyperloop Teleport Blöcke (geplant)](./manual_ta5_DE.md#hyperloop-teleport-blöcke-(geplant)) - - [TA5 Container (geplant)](./manual_ta5_DE.md#ta5-container-(geplant)) + - [TA5-Raumgleiter (geplant)](./manual_ta5_DE.md#ta5-raumgleiter-(geplant)) + - [Teleport Blöcke](./manual_ta5_DE.md#teleport-blöcke) - [TA5 Teleport Block Gegenstände / TA5 Teleport Block Items](./manual_ta5_DE.md#ta5-teleport-block-gegenstände--ta5-teleport-block-items) - [TA5 Teleport Block Flüssigkeiten / TA5 Teleport Block Liquids](./manual_ta5_DE.md#ta5-teleport-block-flüssigkeiten--ta5-teleport-block-liquids) - - [TA5-Raumgleiter (geplant)](./manual_ta5_DE.md#ta5-raumgleiter-(geplant)) + - [Hyperloop Teleport Blöcke (geplant)](./manual_ta5_DE.md#hyperloop-teleport-blöcke-(geplant)) - [Weitere TA5 Blöcke/Items](./manual_ta5_DE.md#weitere-ta5-blöckeitems) + - [TA5 Container (geplant)](./manual_ta5_DE.md#ta5-container-(geplant)) - [TA5 KI Chip / TA5 AI Chip](./manual_ta5_DE.md#ta5-ki-chip--ta5-ai-chip) \ No newline at end of file diff --git a/techage/manuals/toc_EN.md b/techage/manuals/toc_EN.md index d2e59e5..359853c 100644 --- a/techage/manuals/toc_EN.md +++ b/techage/manuals/toc_EN.md @@ -236,9 +236,10 @@ - [TA5 Flight Controller](./manual_ta5_EN.md#ta5-flight-controller) - [TA5 Hyperloop Chest](./manual_ta5_EN.md#ta5-hyperloop-chest) - [TA5 Hyperloop Tank](./manual_ta5_EN.md#ta5-hyperloop-tank) - - [Hyperloop Teleport Blocks (planned)](./manual_ta5_EN.md#hyperloop-teleport-blocks-(planned)) - - [TA5 Container (planned)](./manual_ta5_EN.md#ta5-container-(planned)) + - [Teleport Blocks](./manual_ta5_EN.md#teleport-blocks) - [TA5 Teleport Block Items](./manual_ta5_EN.md#ta5-teleport-block-items) - [TA5 Teleport Block Liquids](./manual_ta5_EN.md#ta5-teleport-block-liquids) - - [More TA5 Blocks / Items](./manual_ta5_EN.md#more-ta5-blocks--items) + - [Hyperloop Teleport Blocks (planned)](./manual_ta5_EN.md#hyperloop-teleport-blocks-(planned)) + - [More TA5 Blocks/Items](./manual_ta5_EN.md#more-ta5-blocksitems) + - [TA5 Container (planned)](./manual_ta5_EN.md#ta5-container-(planned)) - [TA5 AI Chip](./manual_ta5_EN.md#ta5-ai-chip) \ No newline at end of file diff --git a/techage/mod.conf b/techage/mod.conf index 4fae9d8..cd7e53a 100644 --- a/techage/mod.conf +++ b/techage/mod.conf @@ -1,4 +1,4 @@ name = techage depends = default,doors,flowers,tubelib2,networks,basic_materials,bucket,stairs,screwdriver,minecart,lcdlib,safer_lua -optional_depends = unified_inventory,wielded_light,unifieddyes,moreores,ethereal,mesecon,digtron,bakedclay,moreblocks,i3 +optional_depends = unified_inventory,wielded_light,unifieddyes,moreores,ethereal,mesecon,digtron,bakedclay,moreblocks,i3,creative,craftguide description = Techage, go through 5 tech ages in search of wealth and power! diff --git a/techage/move_controller/doorblock.lua b/techage/move_controller/doorblock.lua index 5dcee0b..f0b215b 100644 --- a/techage/move_controller/doorblock.lua +++ b/techage/move_controller/doorblock.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information Door block - + ]]-- local M = minetest.get_meta @@ -20,20 +20,20 @@ local NUM_TEXTURES = 22 local sTextures = "Wood,Aspen Wood,Jungle Wood,Pine Wood,".. "Cobblestone,Sandstone,Stone,Desert Sandstone,".. - "Desert Stone,Silver Sandstone,Mossy Cobble,Desert Cobble,".. + "Desert Stone,Silver Sandstone,Mossy Cobble,Desert Cobble,".. "Copper,Steel,Tin,Coral,".. "Glas,Obsidian Glas,Basalt Glass,Basalt Glass 2,".. - "Ice,Gate Wood" + "Ice,Gate Wood" local tTextures = { ["Wood"]=1, ["Aspen Wood"]=2, ["Jungle Wood"]=3, ["Pine Wood"]=4, ["Cobblestone"]=5, ["Sandstone"]=6, ["Stone"]=7, ["Desert Sandstone"]=8, ["Desert Stone"]=9, ["Silver Sandstone"]=10, ["Mossy Cobble"]=11, ["Desert Cobble"]=12, ["Copper"]=13, ["Steel"]=14, ["Tin"]=15, ["Coral"]=16, - ["Glas"]=17, ["Obsidian Glas"]=18, ["Basalt Glass"]=19, ["Basalt Glass 2"]=20, + ["Glas"]=17, ["Obsidian Glas"]=18, ["Basalt Glass"]=19, ["Basalt Glass 2"]=20, ["Ice"]=21, ["Gate Wood"]=22, } - + local tPgns = {"default_wood.png", "default_aspen_wood.png", "default_junglewood.png", "default_pine_wood.png", "default_cobble.png", "default_sandstone.png", "default_stone.png", "default_desert_sandstone.png", "default_desert_stone_block.png", "default_silver_sandstone.png", "default_mossycobble.png", "default_desert_cobble.png", @@ -63,7 +63,7 @@ for idx,pgn in ipairs(tPgns) do after_place_node = function(pos, placer) M(pos):set_string("formspec", "size[3,2]".. "label[0,0;Select texture]".. - "dropdown[0,0.5;3;type;"..sTextures..";"..NUM_TEXTURES.."]".. + "dropdown[0,0.5;3;type;"..sTextures..";"..NUM_TEXTURES.."]".. "button_exit[0.5,1.5;2,1;exit;Save]") end, @@ -80,7 +80,7 @@ for idx,pgn in ipairs(tPgns) do meta:set_string("infotext", S("TechAge Door Block").." "..number) end end, - + after_dig_node = function(pos, oldnode, oldmetadata) techage.remove_node(pos, oldnode, oldmetadata) end, @@ -90,7 +90,7 @@ for idx,pgn in ipairs(tPgns) do use_texture_alpha = techage.BLEND, sunlight_propagates = true, sounds = default.node_sound_stone_defaults(), - groups = {cracky=2, choppy=2, crumbly=2, techage_door = 1, + groups = {cracky=2, choppy=2, crumbly=2, techage_door = 1, not_in_creative_inventory = idx==NUM_TEXTURES and 0 or 1}, is_ground_content = false, drop = "techage:doorblock"..NUM_TEXTURES, diff --git a/techage/move_controller/doorcontroller.lua b/techage/move_controller/doorcontroller.lua index 1ace3a0..f859290 100644 --- a/techage/move_controller/doorcontroller.lua +++ b/techage/move_controller/doorcontroller.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information Door/Gate Controller - + ]]-- -- for lazy programmers @@ -54,7 +54,7 @@ local function swap_door_nodes(pos, open) item.removed = false end elseif techage.is_air_like(node.name) and item.removed then - minetest.add_node(item.pos, {name = item.name, param2 = item.param2}) + minetest.add_node(item.pos, {name = item.name, param2 = item.param2}) end end end @@ -92,7 +92,7 @@ minetest.register_node("techage:ta3_doorcontroller", { store_door_data(pos) end end, - + techage_set_numbers = function(pos, numbers, player_name) local meta = M(pos) local res = logic.set_numbers(pos, numbers, player_name, S("TA3 Door Controller")) @@ -103,7 +103,7 @@ minetest.register_node("techage:ta3_doorcontroller", { end return res end, - + after_dig_node = function(pos, oldnode, oldmetadata) swap_door_nodes(pos, false) techage.remove_node(pos, oldnode, oldmetadata) @@ -124,7 +124,7 @@ techage.register_node({"techage:ta3_doorcontroller"}, { swap_door_nodes(pos, false) end end, -}) +}) minetest.register_craft({ output = "techage:ta3_doorcontroller", @@ -134,4 +134,3 @@ minetest.register_craft({ {"", "group:wood", ""}, }, }) - diff --git a/techage/move_controller/doorcontroller2.lua b/techage/move_controller/doorcontroller2.lua index 2ab46ef..0a7f458 100644 --- a/techage/move_controller/doorcontroller2.lua +++ b/techage/move_controller/doorcontroller2.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information Door/Gate Controller II - + ]]-- -- for lazy programmers @@ -19,27 +19,27 @@ local S = techage.S local logic = techage.logic -local MarkedNodes = {} -- t[player] = {{entity, pos},...} +local MarkedNodes = {} -- t[player] = {{entity, pos},...} local CurrentPos -- to mark punched entities local RegisteredNodes = {} -- to be checked before removed/placed local function is_simple_node(name) -- special handling - if RegisteredNodes[name] ~= nil then - return RegisteredNodes[name] + if RegisteredNodes[name] ~= nil then + return RegisteredNodes[name] end - + local ndef = minetest.registered_nodes[name] if not ndef or name == "air" then return true end if ndef.groups and ndef.groups.techage_door == 1 then return true end - + -- don't remove nodes with some intelligence or undiggable nodes if ndef.drop == "" then return false end if ndef.diggable == false then return false end if ndef.after_dig_node then return false end - + return true -end +end local function unmark_position(name, pos) pos = vector.round(pos) @@ -145,7 +145,7 @@ end local function play_sound(pos) minetest.sound_play("techage_button", { - pos = pos, + pos = pos, gain = 1, max_hear_distance = 15}) end @@ -170,7 +170,7 @@ end local function exchange_nodes(pos, nvm, slot) local meta = M(pos) local inv = meta:get_inventory() - + local item_list = inv:get_list("main") local owner = meta:get_string("owner") local res = false @@ -184,7 +184,7 @@ local function exchange_nodes(pos, nvm, slot) res = true end end - + inv:set_list("main", item_list) return res end @@ -195,7 +195,7 @@ local function show_nodes(pos) nvm.is_on = true if nvm.play_sound then minetest.sound_play("doors_door_close", { - pos = pos, + pos = pos, gain = 1, max_hear_distance = 15}) end @@ -209,7 +209,7 @@ local function hide_nodes(pos) nvm.is_on = false if nvm.play_sound then minetest.sound_play("doors_door_open", { - pos = pos, + pos = pos, gain = 1, max_hear_distance = 15}) end @@ -243,7 +243,7 @@ minetest.register_node("techage:ta3_doorcontroller2", { local meta = M(pos) local nvm = techage.get_nvm(pos) - + if fields.tab == "2" then meta:set_string("formspec", formspec2(meta)) return @@ -289,7 +289,7 @@ minetest.register_node("techage:ta3_doorcontroller2", { meta:set_string("formspec", formspec1(nvm, meta)) end end, - + allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) if minetest.is_protected(pos, player:get_player_name()) then return 0 @@ -311,16 +311,16 @@ minetest.register_node("techage:ta3_doorcontroller2", { end return 0 end, - + can_dig = function(pos, player) if player and minetest.is_protected(pos, player:get_player_name()) then return 0 end - + local inv = minetest.get_inventory({type="node", pos=pos}) return inv:is_empty("main") end, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) local name = digger:get_player_name() unmark_all(name) @@ -365,7 +365,7 @@ techage.register_node({"techage:ta3_doorcontroller2"}, { meta:set_string("param2_list", "") end end, -}) +}) minetest.register_craft({ type = "shapeless", @@ -376,11 +376,11 @@ minetest.register_craft({ minetest.register_on_punchnode(function(pos, node, puncher, pointed_thing) if puncher and puncher:is_player() then local name = puncher:get_player_name() - + if not MarkedNodes[name] then return end - + if not minetest.is_protected(pointed_thing.under, name) then mark_position(name, pointed_thing.under) end diff --git a/techage/move_controller/flycontroller.lua b/techage/move_controller/flycontroller.lua index a1db0fd..ca12aa1 100644 --- a/techage/move_controller/flycontroller.lua +++ b/techage/move_controller/flycontroller.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information TA4 Move Controller - + ]]-- -- for lazy programmers @@ -19,8 +19,8 @@ local S2P = minetest.string_to_pos local S = techage.S local MP = minetest.get_modpath("techage") -local fly = dofile(MP .. "/basis/fly_lib.lua") -local mark = dofile(MP .. "/basis/mark_lib.lua") +local fly = dofile(MP .. "/basis/fly_lib.lua") +local mark = dofile(MP .. "/basis/mark_lib.lua") local MAX_DIST = 500 local MAX_BLOCKS = 16 @@ -31,14 +31,14 @@ local WRENCH_MENU = { type = "dropdown", choices = "0.5,1,2,4,6,8", name = "max_speed", - label = S("Maximum Speed"), + label = S("Maximum Speed"), tooltip = S("Maximum speed for moving blocks"), default = "8", }, { type = "float", name = "height", - label = S("Move block height"), + label = S("Move block height"), tooltip = S("Value in the range of 0.0 to 1.0"), default = "1.0", }, @@ -88,7 +88,7 @@ minetest.register_node("techage:ta5_flycontroller", { if techage.get_expoints(player) < EX_POINTS then return end - + local meta = M(pos) local nvm = techage.get_nvm(pos) @@ -190,7 +190,7 @@ minetest.register_node("techage:ta5_flycontroller", { meta:set_string("formspec", formspec(nvm, meta)) end end, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) local name = digger:get_player_name() mark.unmark_all(name) @@ -229,7 +229,7 @@ techage.register_node({"techage:ta5_flycontroller"}, { end return false end, -}) +}) minetest.register_craft({ output = "techage:ta5_flycontroller", diff --git a/techage/move_controller/gateblock.lua b/techage/move_controller/gateblock.lua index c93955e..e0a764c 100644 --- a/techage/move_controller/gateblock.lua +++ b/techage/move_controller/gateblock.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - + Gate Block to disappear - + ]]-- local M = minetest.get_meta @@ -20,20 +20,20 @@ local NUM_TEXTURES = 22 local sTextures = "Wood,Aspen Wood,Jungle Wood,Pine Wood,".. "Cobblestone,Sandstone,Stone,Desert Sandstone,".. - "Desert Stone,Silver Sandstone,Mossy Cobble,Desert Cobble,".. + "Desert Stone,Silver Sandstone,Mossy Cobble,Desert Cobble,".. "Copper,Steel,Tin,Coral,".. "Glas,Obsidian Glas,Basalt Glass,Basalt Glass 2,".. - "Ice,Gate Wood" + "Ice,Gate Wood" local tTextures = { ["Wood"]=1, ["Aspen Wood"]=2, ["Jungle Wood"]=3, ["Pine Wood"]=4, ["Cobblestone"]=5, ["Sandstone"]=6, ["Stone"]=7, ["Desert Sandstone"]=8, ["Desert Stone"]=9, ["Silver Sandstone"]=10, ["Mossy Cobble"]=11, ["Desert Cobble"]=12, ["Copper"]=13, ["Steel"]=14, ["Tin"]=15, ["Coral"]=16, - ["Glas"]=17, ["Obsidian Glas"]=18, ["Basalt Glass"]=19, ["Basalt Glass 2"]=20, + ["Glas"]=17, ["Obsidian Glas"]=18, ["Basalt Glass"]=19, ["Basalt Glass 2"]=20, ["Ice"]=21, ["Gate Wood"]=22, } - + local tPgns = {"default_wood.png", "default_aspen_wood.png", "default_junglewood.png", "default_pine_wood.png", "default_cobble.png", "default_sandstone.png", "default_stone.png", "default_desert_sandstone.png", "default_desert_stone_block.png", "default_silver_sandstone.png", "default_mossycobble.png", "default_desert_cobble.png", @@ -49,7 +49,7 @@ for idx,pgn in ipairs(tPgns) do after_place_node = function(pos, placer) M(pos):set_string("formspec", "size[3,2]".. "label[0,0;Select texture]".. - "dropdown[0,0.5;3;type;"..sTextures..";"..NUM_TEXTURES.."]".. + "dropdown[0,0.5;3;type;"..sTextures..";"..NUM_TEXTURES.."]".. "button_exit[0.5,1.5;2,1;exit;Save]") end, @@ -66,7 +66,7 @@ for idx,pgn in ipairs(tPgns) do meta:set_string("infotext", S("TechAge Gate Block").." "..number) end end, - + after_dig_node = function(pos, oldnode, oldmetadata) techage.remove_node(pos, oldnode, oldmetadata) end, @@ -76,7 +76,7 @@ for idx,pgn in ipairs(tPgns) do use_texture_alpha = techage.BLEND, sunlight_propagates = true, sounds = default.node_sound_stone_defaults(), - groups = {cracky=2, choppy=2, crumbly=2, techage_door = 1, + groups = {cracky=2, choppy=2, crumbly=2, techage_door = 1, not_in_creative_inventory = idx==NUM_TEXTURES and 0 or 1}, is_ground_content = false, drop = "techage:gateblock"..NUM_TEXTURES, @@ -92,4 +92,3 @@ minetest.register_craft({ {"group:wood", "", ""}, }, }) - diff --git a/techage/move_controller/movecontroller.lua b/techage/move_controller/movecontroller.lua index e72d918..92e2348 100644 --- a/techage/move_controller/movecontroller.lua +++ b/techage/move_controller/movecontroller.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information TA4 Move Controller - + ]]-- -- for lazy programmers @@ -19,8 +19,8 @@ local S2P = minetest.string_to_pos local S = techage.S local MP = minetest.get_modpath("techage") -local fly = dofile(MP .. "/basis/fly_lib.lua") -local mark = dofile(MP .. "/basis/mark_lib.lua") +local fly = dofile(MP .. "/basis/fly_lib.lua") +local mark = dofile(MP .. "/basis/mark_lib.lua") local MAX_DIST = 100 local MAX_BLOCKS = 16 @@ -30,35 +30,35 @@ local WRENCH_MENU = { type = "dropdown", choices = "0.5,1,2,4,6,8", name = "max_speed", - label = S("Maximum Speed"), + label = S("Maximum Speed"), tooltip = S("Maximum speed for moving blocks"), default = "8", }, { type = "number", name = "handoverB", - label = S("Handover to B"), + label = S("Handover to B"), tooltip = S("Number of the next movecontroller"), default = "", }, { type = "number", name = "handoverA", - label = S("Handover to A"), + label = S("Handover to A"), tooltip = S("Number of the previous movecontroller"), default = "", }, { type = "float", name = "height", - label = S("Move block height"), + label = S("Move block height"), tooltip = S("Value in the range of 0.0 to 1.0"), default = "1.0", }, { type = "float", name = "offset", - label = S("Object offset"), + label = S("Object offset"), tooltip = S("Y-offset for non-player objects like vehicles (-0.5 to 0.5)"), default = "0.0", }, @@ -165,7 +165,7 @@ minetest.register_node("techage:ta4_movecontroller", { meta:set_string("formspec", formspec(nvm, meta)) end end, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) local name = digger:get_player_name() mark.unmark_all(name) @@ -204,7 +204,7 @@ techage.register_node({"techage:ta4_movecontroller"}, { end return false end, -}) +}) minetest.register_craft({ output = "techage:ta4_movecontroller", diff --git a/techage/move_controller/soundblock.lua b/techage/move_controller/soundblock.lua index 87982bc..24ab6fd 100644 --- a/techage/move_controller/soundblock.lua +++ b/techage/move_controller/soundblock.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - + Sound Block - + ]]-- -- for lazy programmers @@ -29,7 +29,7 @@ local GAIN = {0.05 ,0.1, 0.2, 0.5, 1.0} local function play_sound(pos, ogg, gain) minetest.sound_play(ogg, { - pos = pos, + pos = pos, gain = GAIN[gain or 1] or 1, max_hear_distance = 15}) end @@ -38,7 +38,7 @@ local function formspec(meta) local idx = meta:contains("idx") and meta:get_int("idx") or 1 local gain = meta:contains("gain") and meta:get_int("gain") or 1 return "size[8,8]".. - "tablecolumns[text,width=5;text]".. + "tablecolumns[text,width=5;text]".. "table[0,0;8,6;oggfiles;" .. OGG_FILES .. ";" .. idx .. "]" .. "dropdown[0,6.5;5.5,1.4;gain;1,2,3,4,5;" .. gain .. "]" .. "button[2.5,7.2;3,1;play;" .. S("Play") .. "]" @@ -80,7 +80,7 @@ minetest.register_node("techage:ta3_soundblock", { play_sound(pos, ogg, M(pos):get_int("gain")) end end, - + paramtype2 = "facedir", groups = {choppy=2, cracky=2, crumbly=2}, is_ground_content = false, @@ -115,7 +115,7 @@ techage.register_node({"techage:ta3_soundblock"}, { local meta = M(pos) meta:set_string("formspec", formspec(meta)) end -}) +}) minetest.register_craft({ output = "techage:ta3_soundblock", @@ -125,4 +125,3 @@ minetest.register_craft({ {"", "group:wood", ""}, }, }) - diff --git a/techage/move_controller/turncontroller.lua b/techage/move_controller/turncontroller.lua index fa89f07..a41fedf 100644 --- a/techage/move_controller/turncontroller.lua +++ b/techage/move_controller/turncontroller.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information TA4 Turn Controller - + ]]-- -- for lazy programmers @@ -19,8 +19,8 @@ local S2P = minetest.string_to_pos local S = techage.S local MP = minetest.get_modpath("techage") -local fly = dofile(MP .. "/basis/fly_lib.lua") -local mark = dofile(MP .. "/basis/mark_lib.lua") +local fly = dofile(MP .. "/basis/fly_lib.lua") +local mark = dofile(MP .. "/basis/mark_lib.lua") local MAX_BLOCKS = 16 @@ -85,7 +85,7 @@ minetest.register_node("techage:ta4_turncontroller", { meta:set_string("status", "") local new_posses = fly.rotate_nodes(pos, nvm.lpos, "l") if new_posses then - nvm.lpos = new_posses + nvm.lpos = new_posses local name = player:get_player_name() mark.stop(name) end @@ -94,14 +94,14 @@ minetest.register_node("techage:ta4_turncontroller", { meta:set_string("status", "") local new_posses = fly.rotate_nodes(pos, nvm.lpos, "r") if new_posses then - nvm.lpos = new_posses + nvm.lpos = new_posses local name = player:get_player_name() mark.stop(name) end meta:set_string("formspec", formspec(nvm, meta)) end end, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) local name = digger:get_player_name() mark.unmark_all(name) @@ -125,7 +125,7 @@ techage.register_node({"techage:ta4_turncontroller"}, { local nvm = techage.get_nvm(pos) local new_posses = fly.rotate_nodes(pos, nvm.lpos, "l") if new_posses then - nvm.lpos = new_posses + nvm.lpos = new_posses return true end return false @@ -133,7 +133,7 @@ techage.register_node({"techage:ta4_turncontroller"}, { local nvm = techage.get_nvm(pos) local new_posses = fly.rotate_nodes(pos, nvm.lpos, "r") if new_posses then - nvm.lpos = new_posses + nvm.lpos = new_posses return true end return false @@ -141,10 +141,10 @@ techage.register_node({"techage:ta4_turncontroller"}, { local nvm = techage.get_nvm(pos) local new_posses = fly.rotate_nodes(pos, nvm.lpos, "r") if new_posses then - nvm.lpos = new_posses + nvm.lpos = new_posses new_posses = fly.rotate_nodes(pos, nvm.lpos, "r") if new_posses then - nvm.lpos = new_posses + nvm.lpos = new_posses return true end end @@ -152,7 +152,7 @@ techage.register_node({"techage:ta4_turncontroller"}, { end return false end, -}) +}) minetest.register_craft({ output = "techage:ta4_turncontroller", diff --git a/techage/oil/distiller.lua b/techage/oil/distiller.lua index ac57644..ff4dec8 100644 --- a/techage/oil/distiller.lua +++ b/techage/oil/distiller.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3 Distillation Tower ]]-- @@ -70,7 +70,7 @@ minetest.register_node("techage:ta3_distiller_base", { }, after_place_node = after_place_node, after_dig_node = after_dig_node, - + paramtype2 = "facedir", on_rotate = screwdriver.disallow, groups = {cracky=2}, @@ -129,7 +129,7 @@ minetest.register_node("techage:ta3_distiller2", { after_place_node = function(pos, placer) return orientation(pos, {"techage:ta3_distiller1", "techage:ta3_distiller3"}) end, - + paramtype = "light", paramtype2 = "facedir", on_rotate = screwdriver.disallow, @@ -157,7 +157,7 @@ minetest.register_node("techage:ta3_distiller3", { return res end, after_dig_node = after_dig_node, - + paramtype = "light", paramtype2 = "facedir", on_rotate = screwdriver.disallow, @@ -188,7 +188,7 @@ minetest.register_node("techage:ta3_distiller4", { return res end, after_dig_node = after_dig_node, - + paramtype = "light", paramtype2 = "facedir", on_rotate = screwdriver.disallow, @@ -208,7 +208,7 @@ techage.register_node({"techage:ta3_distiller1"}, { local nvm = techage.get_nvm(pos) nvm.idx = nvm.idx or 1 local outdir - if nvm.idx == 5 then + if nvm.idx == 5 then outdir = 6 -- up else outdir = M(pos):get_int("outdir") diff --git a/techage/oil/drillbox.lua b/techage/oil/drillbox.lua index bcc4466..deec9fb 100644 --- a/techage/oil/drillbox.lua +++ b/techage/oil/drillbox.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information TA3 Oil Drill Box - + ]]-- -- for lazy programmers @@ -34,7 +34,7 @@ local function play_sound(pos) local mem = techage.get_mem(pos) if not mem.handle or mem.handle == -1 then mem.handle = minetest.sound_play("techage_oildrill", { - pos = pos, + pos = pos, gain = 1, max_hear_distance = 15, loop = true}) @@ -130,7 +130,7 @@ local function drilling(pos, crd, nvm, inv) local curr_depth = pos.y - (nvm.drill_pos or pos).y local node = techage.get_node_lvm(nvm.drill_pos) local ndef = minetest.registered_nodes[node.name] - + if not inv:contains_item("src", ItemStack("techage:oil_drillbit")) then crd.State:idle(pos, nvm, S("Drill bits missing")) elseif curr_depth >= depth then @@ -265,7 +265,7 @@ local tubing = { end, } -local _, node_name_ta3, _ = +local _, node_name_ta3, _ = techage.register_consumer("drillbox", S("Oil Drill Box"), tiles, { drawtype = "normal", cycle_time = CYCLE_TIME, @@ -279,7 +279,7 @@ local _, node_name_ta3, _ = inv:set_size("dst", 1) local info = techage.explore.get_oil_info(pos) M(pos):set_int("depth", info.depth - 5) -- oil bubble - M(pos):set_int("amount", info.amount) + M(pos):set_int("amount", info.amount) M(pos):set_string("oil_found", "false") M(pos):set_string("owner", placer:get_player_name()) end, diff --git a/techage/oil/explore.lua b/techage/oil/explore.lua index afddfca..a628915 100644 --- a/techage/oil/explore.lua +++ b/techage/oil/explore.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information TA3 Oil Explorer - + ]]-- -- for lazy programmers @@ -40,8 +40,8 @@ local ValidGroundNodes = { local function oil_amount(pos) if pos.y > YPOS_MAX then return 0 end - local block_key = seed + - math.floor((pos.z + 32768) / 16) * 4096 * 4096 + + local block_key = seed + + math.floor((pos.z + 32768) / 16) * 4096 * 4096 + math.floor((pos.y + 32768) / 16) * 4096 + math.floor((pos.x + 32768) / 16) math.randomseed(block_key) @@ -68,7 +68,7 @@ local function mapblock_coordinates(pos) local pos2 = {x = pos1.x + 15, y = pos1.y + 15, z = pos1.z + 15} return pos1, pos2 end - + local function calc_depth(pos, explore_pos) return pos.y - explore_pos.y + 1 end @@ -78,7 +78,7 @@ end -- function returns the real position {x,y,z} local function calc_vmdata_pos(posC, idx) local rest, xoffs, yoffs, zoffs - + rest = idx - 1 xoffs = rest % 16 rest = math.floor(rest / 16) @@ -86,12 +86,12 @@ local function calc_vmdata_pos(posC, idx) rest = math.floor(rest / 16) yoffs = rest % 16 return {x = basis(posC.x) + xoffs, y = basis(posC.y) + yoffs, z = basis(posC.z) + zoffs} -end +end local function calc_vmdata_index(xoffs, yoffs, zoffs) return (xoffs + (yoffs * 16) + (zoffs * 16 * 16)) + 1 end - + -- from/to are x/z-offsets (0..15) for one layer of oil within one mapblock local function gen_oil_slice(yoffs, from, to, vmdata, id) for xoffs = from, to do @@ -103,7 +103,7 @@ end local function gen_oil_bubble(vmdata) local id = minetest.get_content_id("techage:oil_source") - + gen_oil_slice(1, 3, 12, vmdata, id) gen_oil_slice(2, 2, 13, vmdata, id) for offs = 3, 12 do @@ -111,8 +111,8 @@ local function gen_oil_bubble(vmdata) end gen_oil_slice(13, 2, 13, vmdata, id) gen_oil_slice(14, 3, 12, vmdata, id) -end - +end + local function useable_stone_block(data) local valid = {} for _,id in ipairs(data) do @@ -120,8 +120,8 @@ local function useable_stone_block(data) local itemname = minetest.get_name_from_content_id(id) if not ValidGroundNodes[itemname] then local ndef = minetest.registered_nodes[itemname] - if InvalidGroundNodes[itemname] or not ndef or ndef.is_ground_content == false then - return false + if InvalidGroundNodes[itemname] or not ndef or ndef.is_ground_content == false then + return false end end valid[id] = true @@ -129,7 +129,7 @@ local function useable_stone_block(data) end return true end - + local function get_next_explore_pos(pos) local meta = M(pos) local ypos = meta:get_int("exploration_ypos") @@ -147,7 +147,7 @@ local function get_next_explore_pos(pos) -- load world and pause for one step minetest.emerge_area(posC, posC) end - + end return {x = center(pos.x), y = center(ypos), z = center(pos.z)} end @@ -164,7 +164,7 @@ end local function status(pos, player_name, explore_pos, amount) local depth = calc_depth(pos, explore_pos) - minetest.chat_send_player(player_name, + minetest.chat_send_player(player_name, "[TA Oil] "..P2S(explore_pos).." "..S("depth")..": "..depth..", "..S("Oil")..": "..amount.." ") end @@ -180,7 +180,7 @@ local function generate_oil_bubble(posC, amount) local pos1, pos2 = mapblock_coordinates(posC) local vm = minetest.get_voxel_manip(pos1, pos2) local data = vm:get_data() - + if useable_stone_block(data) then gen_oil_bubble(data) vm:set_data(data) @@ -195,14 +195,14 @@ end local function explore_area(pos, node, player_name) if M(pos):get_int("oil_amount") == 0 then -- nothing found so far? local posC, amount - + node.name = "techage:oilexplorer_on" minetest.swap_node(pos, node) minetest.get_node_timer(pos):start(2.2) minetest.sound_play("techage_explore", { - pos = pos, + pos = pos, max_hear_distance = 8}) - + for i = 1,4 do posC = get_next_explore_pos(pos) amount = oil_amount(posC) @@ -210,7 +210,7 @@ local function explore_area(pos, node, player_name) break end end - + if amount > 0 then if get_oil_amount(posC) == 0 then -- not explored so far? if generate_oil_bubble(posC, amount) then @@ -221,7 +221,7 @@ local function explore_area(pos, node, player_name) end M(pos):set_int("oil_amount", amount) end - + minetest.after(2, status, pos, player_name, posC, amount) else local explore_pos = {x = center(pos.x), y = M(pos):get_int("exploration_ypos"), z = center(pos.z)} @@ -273,7 +273,7 @@ minetest.register_node("techage:oilexplorer_on", { backface_culling = false, animation = { type = "vertical_frames", - + aspect_w = 32, aspect_h = 32, length = 1.2, @@ -288,7 +288,7 @@ minetest.register_node("techage:oilexplorer_on", { node.name = "techage:oilexplorer" minetest.swap_node(pos, node) end, - + diggable = false, is_ground_content = false, paramtype = "light", @@ -334,7 +334,7 @@ function techage.explore.dec_oil_amount(posC) local oil_amount, oil_initial = techage.explore.get_oil_amount(posC) oil_amount = oil_amount - 1 M(posC):set_int("oil_amount", oil_amount) - + local idx = math.floor(oil_amount * OIL_BUBBLE_SIZE / oil_initial) idx = idx + 256 -- last level is stone, so add one level if idx <= (OIL_BUBBLE_SIZE - 256) then -- first level is stone, too diff --git a/techage/oil/gasflare.lua b/techage/oil/gasflare.lua index b8e0b0b..e8edb96 100644 --- a/techage/oil/gasflare.lua +++ b/techage/oil/gasflare.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3 Gas flare ]]-- @@ -65,7 +65,7 @@ for idx,ratio in ipairs(lRatio) do }, }, }, - + after_destruct = function(pos, oldnode) pos.y = pos.y + 1 local node = minetest.get_node(pos) @@ -73,7 +73,7 @@ for idx,ratio in ipairs(lRatio) do minetest.remove_node(pos) end end, - + use_texture_alpha = techage.BLEND, inventory_image = "techage_flame.png", paramtype = "light", @@ -93,16 +93,16 @@ end local function start_flarestack(pos, playername) if minetest.is_protected( - {x=pos.x, y=pos.y+1, z=pos.z}, + {x=pos.x, y=pos.y+1, z=pos.z}, playername) then return end local meta = minetest.get_meta(pos) flame({x=pos.x, y=pos.y+1, z=pos.z}) local handle = minetest.sound_play("gasflare", { - pos = pos, - max_hear_distance = 20, - gain = 1, + pos = pos, + max_hear_distance = 20, + gain = 1, loop = true}) --print("handle", handle) meta:set_int("handle", handle) @@ -123,7 +123,7 @@ minetest.register_node("techage:gasflare", { "techage_gasflare.png", "techage_gasflare.png^techage_appl_hole_pipe.png", }, - + after_place_node = function(pos, placer, itemstack, pointed_thing) local node = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}) if node.name ~= "air" then @@ -131,14 +131,14 @@ minetest.register_node("techage:gasflare", { end minetest.add_node({x=pos.x, y=pos.y+1, z=pos.z}, {name = "techage:gasflare2"}) end, - + on_punch = function(pos, node, puncher) local meta = minetest.get_meta(pos) local handle = meta:get_int("handle") minetest.sound_stop(handle) start_flarestack(pos, puncher:get_player_name()) end, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) --print(dump(oldmetadata)) stop_flarestack(pos, oldmetadata.fields.handle) @@ -149,7 +149,7 @@ minetest.register_node("techage:gasflare", { end, paramtype = "light", - light_source = 0, + light_source = 0, sunlight_propagates = true, paramtype2 = "facedir", groups = {cracky=2, crumbly=2, choppy=2}, @@ -163,7 +163,7 @@ minetest.register_node("techage:gasflare2", { "techage_gasflare.png^techage_appl_hole_tube.png", "techage_gasflare.png" }, - + drawtype = "nodebox", node_box = { type = "fixed", @@ -173,7 +173,7 @@ minetest.register_node("techage:gasflare2", { }, }, paramtype = "light", - light_source = 0, + light_source = 0, sunlight_propagates = true, paramtype2 = "facedir", diggable = false, diff --git a/techage/oil/pumpjack.lua b/techage/oil/pumpjack.lua index 4fbc016..7088107 100644 --- a/techage/oil/pumpjack.lua +++ b/techage/oil/pumpjack.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3 Pumpjack ]]-- @@ -69,7 +69,7 @@ local function play_sound(pos) local mem = techage.get_mem(pos) if not mem.handle or mem.handle == -1 then mem.handle = minetest.sound_play("techage_reboiler", { - pos = pos, + pos = pos, gain = 1, max_hear_distance = 15, loop = true}) @@ -123,7 +123,7 @@ local function keep_running(pos, elapsed) if techage.is_activeformspec(pos) then M(pos):set_string("formspec", formspec(crd.State, pos, nvm)) end -end +end local function on_receive_fields(pos, formname, fields, player) if minetest.is_protected(pos, player:get_player_name()) then @@ -171,7 +171,7 @@ tiles.act = { "techage_filling_ta#.png^techage_frame_ta#_top.png^techage_appl_arrow.png^[transformR90]", "techage_filling_ta#.png^techage_frame_ta#_top.png^techage_appl_arrow.png^[transformR90]", } - + local tubing = { on_recv_message = function(pos, src, topic, payload) if topic == "load" then @@ -182,7 +182,7 @@ local tubing = { return techage.power.percent(capa or 0, amount or 0), amount or 0 end end - else + else return CRD(pos).State:on_receive_message(pos, topic, payload) end end, @@ -190,11 +190,11 @@ local tubing = { CRD(pos).State:on_node_load(pos) if node.name == "techage:ta3_pumpjack_act" then play_sound(pos) - end + end end, } - -local _, node_name_ta3, _ = + +local _, node_name_ta3, _ = techage.register_consumer("pumpjack", S("Oil Pumpjack"), tiles, { cycle_time = CYCLE_TIME, standby_ticks = STANDBY_TICKS, @@ -206,7 +206,7 @@ local _, node_name_ta3, _ = if node.name == "techage:oil_drillbit2" then local info = techage.explore.get_oil_info(pos) if info then - M(pos):set_string("storage_pos", P2S(info.storage_pos)) + M(pos):set_string("storage_pos", P2S(info.storage_pos)) end end Pipe:after_place_node(pos) @@ -216,11 +216,11 @@ local _, node_name_ta3, _ = on_receive_fields = on_receive_fields, node_timer = keep_running, on_rotate = screwdriver.disallow, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) Pipe:after_dig_node(pos) end, - + groups = {choppy=2, cracky=2, crumbly=2}, is_ground_content = false, sounds = default.node_sound_wood_defaults(), @@ -239,4 +239,3 @@ minetest.register_craft({ }) liquid.register_nodes({"techage:ta3_pumpjack_pas", "techage:ta3_pumpjack_act"}, Pipe, "pump", {"U"}, {}) - diff --git a/techage/oil/reboiler.lua b/techage/oil/reboiler.lua index 816d976..51cdc41 100644 --- a/techage/oil/reboiler.lua +++ b/techage/oil/reboiler.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3 Oil Reboiler ]]-- @@ -30,7 +30,7 @@ local function play_sound(pos) local mem = techage.get_mem(pos) if not mem.handle or mem.handle == -1 then mem.handle = minetest.sound_play("techage_reboiler", { - pos = pos, + pos = pos, gain = 1, max_hear_distance = 15, loop = true}) @@ -64,13 +64,13 @@ end local function pump_cmnd(pos) local leftover = techage.transfer( - pos, + pos, "R", -- outdir "put", -- topic nil, -- payload Pipe, -- Pipe {"techage:ta3_distiller1"}) - + -- number of processed oil items return 1 - (tonumber(leftover) or 1) end @@ -86,7 +86,7 @@ end local function on_timer(pos) local nvm = techage.get_nvm(pos) nvm.oil_amount = nvm.oil_amount or 0 - + -- Power handling if nvm.state == techage.STOPPED then local consumed = power.consume_power(pos, Cable, nil, PWR_NEEDED) @@ -108,7 +108,7 @@ local function on_timer(pos) return true end end - + -- Oil handling if nvm.state == techage.RUNNING then if nvm.oil_amount >= 1 then @@ -136,7 +136,7 @@ local function on_timer(pos) end return true end - + local function after_place_node(pos) local nvm = techage.get_nvm(pos) new_state(pos, nvm, techage.STOPPED) @@ -173,7 +173,7 @@ minetest.register_node("techage:ta3_reboiler", { after_place_node = after_place_node, after_dig_node = after_dig_node, on_rightclick = on_rightclick, - + paramtype2 = "facedir", on_rotate = screwdriver.disallow, groups = {cracky=2}, @@ -213,7 +213,7 @@ minetest.register_node("techage:ta3_reboiler_on", { on_timer = on_timer, on_rightclick = on_rightclick, - + paramtype2 = "facedir", on_rotate = screwdriver.disallow, diggable = false, @@ -230,7 +230,7 @@ local liquid_def = { put = function(pos, indir, name, amount) local nvm = techage.get_nvm(pos) nvm.oil_amount = nvm.oil_amount or 0 - + if nvm.state == techage.STANDBY or nvm.state == techage.RUNNING then if name == "techage:oil_source" and amount > 0 then if nvm.state == techage.STANDBY then @@ -266,7 +266,7 @@ techage.register_node({"techage:ta3_reboiler", "techage:ta3_reboiler_on"}, { on_node_load = function(pos, node) if node.name == "techage:ta3_reboiler_on" then play_sound(pos) - end + end minetest.get_node_timer(pos):start(CYCLE_TIME) end, }) @@ -279,4 +279,3 @@ minetest.register_craft({ {"", "basic_materials:heating_element", ""}, }, }) - diff --git a/techage/oil/tower.lua b/techage/oil/tower.lua index cfade41..dfe9337 100644 --- a/techage/oil/tower.lua +++ b/techage/oil/tower.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3 Oil Tower ]]-- @@ -198,7 +198,7 @@ minetest.register_node("techage:oil_drillbit2", { local AssemblyPlan = { -- y-offs, path, facedir-offs, name - + -- level 0 { 0, {0,1}, 0, "techage:oiltower1"}, { 0, {0,3}, 0, "techage:oiltower1"}, @@ -284,4 +284,3 @@ function techage.oiltower.remove(pos, player_name) minetest.chat_send_player(player_name, S("[TA] Derrick is being removed!")) techage.assemble.remove(pos, AssemblyPlan, player_name) end - diff --git a/techage/power/drive_axle.lua b/techage/power/drive_axle.lua index 77a7058..1ea3ede 100644 --- a/techage/power/drive_axle.lua +++ b/techage/power/drive_axle.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA2 Drive Axles for the Steam Engine ]]-- @@ -24,7 +24,7 @@ local Axle = tubelib2.Tube:new({ max_tube_length = 10, show_infotext = false, tube_type = "axle", - primary_node_names = {"techage:axle", "techage:axle_on"}, + primary_node_names = {"techage:axle", "techage:axle_on"}, secondary_node_names = {}, after_place_tube = function(pos, param2, tube_type, num_tubes, state) if state == "on" then @@ -50,7 +50,7 @@ minetest.register_node("techage:axle", { "techage_axle_clutch.png", "techage_axle_clutch.png", }, - + after_place_node = function(pos, placer, itemstack, pointed_thing) if not Axle:after_place_tube(pos, placer, pointed_thing) then minetest.remove_node(pos) @@ -58,11 +58,11 @@ minetest.register_node("techage:axle", { end return false end, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) Axle:after_dig_tube(pos, oldnode, oldmetadata) end, - + paramtype2 = "facedir", -- important! drawtype = "nodebox", node_box = { @@ -144,7 +144,7 @@ minetest.register_node("techage:axle_on", { }, }, }, - + after_place_node = function(pos, placer, itemstack, pointed_thing) if not Axle:after_place_tube(pos, placer, pointed_thing) then minetest.remove_node(pos) @@ -152,11 +152,11 @@ minetest.register_node("techage:axle_on", { end return false end, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) Axle:after_dig_tube(pos, oldnode, oldmetadata) end, - + paramtype2 = "facedir", -- important! drawtype = "nodebox", node_box = { diff --git a/techage/power/electric_cable.lua b/techage/power/electric_cable.lua index 7840982..80b89cf 100644 --- a/techage/power/electric_cable.lua +++ b/techage/power/electric_cable.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3 Electric Cables (AC) ]]-- @@ -24,11 +24,11 @@ local ELE1_MAX_CABLE_LENGHT = 1000 local Cable = tubelib2.Tube:new({ dirs_to_check = {1,2,3,4,5,6}, - max_tube_length = ELE1_MAX_CABLE_LENGHT, + max_tube_length = ELE1_MAX_CABLE_LENGHT, show_infotext = false, tube_type = "ele1", primary_node_names = {"techage:electric_cableS", "techage:electric_cableA", - "techage:power_line", "techage:power_lineS", "techage:power_lineA", + "techage:power_line", "techage:power_lineS", "techage:power_lineA", "techage:power_pole2", "techage:powerswitch_box", "techage:powerswitch_box_on"}, secondary_node_names = {}, after_place_tube = function(pos, param2, tube_type, num_tubes) @@ -86,7 +86,7 @@ minetest.register_node("techage:electric_cableS", { { name = "techage_electric_cable_end.png", color = "white" }, { name = "techage_electric_cable_end.png", color = "white" }, }, - + after_place_node = function(pos, placer, itemstack, pointed_thing) if not Cable:after_place_tube(pos, placer, pointed_thing) then minetest.remove_node(pos) @@ -94,11 +94,11 @@ minetest.register_node("techage:electric_cableS", { end return false end, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) Cable:after_dig_tube(pos, oldnode, oldmetadata) end, - + paramtype2 = "colorfacedir", -- important! palette = "techage_cable_palette.png", drawtype = "nodebox", @@ -137,11 +137,11 @@ minetest.register_node("techage:electric_cableA", { "", { name = "techage_electric_cable_end.png", color = "white" }, }, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) Cable:after_dig_tube(pos, oldnode, oldmetadata) end, - + paramtype2 = "colorfacedir", -- important! palette = "techage_cable_palette.png", drawtype = "nodebox", @@ -157,7 +157,7 @@ minetest.register_node("techage:electric_cableA", { use_texture_alpha = techage.CLIP, sunlight_propagates = true, is_ground_content = false, - groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 3, + groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 3, techage_trowel = 1, not_in_creative_inventory = 1}, sounds = default.node_sound_defaults(), drop = { @@ -190,4 +190,4 @@ for idx, color in ipairs({ "white", "grey", "black", "brown", "yellow", "red", " { "techage:electric_cableS", "techage:electric_cableS", "techage:electric_cableS", }, } }) -end \ No newline at end of file +end diff --git a/techage/power/formspecs.lua b/techage/power/formspecs.lua index c413c00..985901b 100644 --- a/techage/power/formspecs.lua +++ b/techage/power/formspecs.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + Power Formspec Functions ]]-- @@ -60,9 +60,9 @@ end local function power_bar(current_power, max_power) local percent, ypos - + current_power = current_power or 0 - + if current_power == 0 then percent = 0 ypos = 2.8 @@ -75,7 +75,7 @@ local function power_bar(current_power, max_power) current_power = round(current_power) max_power = round(max_power) percent = (percent + 5) / 1.1 -- texture correction - + return "label[0.7,0.4;" .. max_power .. " ku]" .. "image[0,0.5;1,3;" .. "techage_form_level_bg.png^[lowpart:" .. percent .. @@ -87,7 +87,7 @@ local function storage_bar(current_power, max_power) local percent, ypos max_power = (max_power or 1) / CYCLES_PER_DAY current_power = (current_power or 0) / CYCLES_PER_DAY - + if current_power == 0 then percent = 0 ypos = 2.8 @@ -99,7 +99,7 @@ local function storage_bar(current_power, max_power) end current_power = round(current_power) max_power = round(max_power) - + local percent2 = (percent + 5) / 1.1 -- texture correction return "label[0.7,0.4;" .. max_power .. " kud]" .. "image[0,0.5;1,3;".. @@ -123,7 +123,7 @@ function techage.formspec_charging_bar(pos, x, y, label, data) local charging = 0 local percent = 50 local ypos = 1.6 - + if data then charging = data.provided - data.consumed if charging > 0 then @@ -135,7 +135,7 @@ function techage.formspec_charging_bar(pos, x, y, label, data) end end ypos = in_range(ypos, 0.4, 2.8) - + return "container[".. x .. "," .. y .. "]" .. "box[0,0;2.3,3.3;#395c74]" .. "label[0.2,0;" .. label .. "]" .. @@ -146,7 +146,7 @@ end function techage.formspec_storage_bar(pos, x, y, label, curr_load, max_load) curr_load = curr_load or 0 - + return "container[" .. x .. "," .. y .. "]" .. "box[0,0;2.3,3.3;#395c74]" .. "label[0.2,0;" .. label .. "]" .. @@ -206,21 +206,21 @@ function techage.generator_settings(tier, available) { type = "const", name = "available", - label = S("Maximum output [ku]"), + label = S("Maximum output [ku]"), tooltip = S("The maximum power the generator can provide"), value = available, }, { type = "output", name = "provided", - label = S("Current output [ku]"), + label = S("Current output [ku]"), tooltip = S("The current power the generator provides"), }, { type = "dropdown", choices = "0% - 20%,20% - 40%,40% - 60%,60% - 80%,80% - 100%,90% - 100%", name = "termpoint", - label = S("Charge termination"), + label = S("Charge termination"), tooltip = S("Range in which the generator reduces its power"), default = "80% - 100%", }, @@ -230,21 +230,21 @@ function techage.generator_settings(tier, available) { type = "const", name = "available", - label = S("Maximum output [ku]"), + label = S("Maximum output [ku]"), tooltip = S("The maximum power the generator can provide"), value = available, }, { type = "output", name = "provided", - label = S("Current output [ku]"), + label = S("Current output [ku]"), tooltip = S("The current power the generator provides"), }, { type = "dropdown", choices = "0% - 20%,20% - 40%,40% - 60%,60% - 80%,80% - 100%,90% - 100%", name = "termpoint", - label = S("Charge termination"), + label = S("Charge termination"), tooltip = S("Range in which the generator reduces its power"), default = "80% - 100%", }, @@ -255,22 +255,22 @@ end function techage.evaluate_charge_termination(nvm, meta) local termpoint = meta:get_string("termpoint") - if termpoint == "0% - 20%" then + if termpoint == "0% - 20%" then meta:set_string("termpoint1", 0.0) meta:set_string("termpoint2", 0.2) - elseif termpoint == "20% - 40%" then + elseif termpoint == "20% - 40%" then meta:set_string("termpoint1", 0.2) meta:set_string("termpoint2", 0.4) - elseif termpoint == "40% - 60%" then + elseif termpoint == "40% - 60%" then meta:set_string("termpoint1", 0.4) meta:set_string("termpoint2", 0.6) - elseif termpoint == "60% - 80%" then + elseif termpoint == "60% - 80%" then meta:set_string("termpoint1", 0.6) meta:set_string("termpoint2", 0.8) - elseif termpoint == "80% - 100%" then + elseif termpoint == "80% - 100%" then meta:set_string("termpoint1", 0.8) meta:set_string("termpoint2", 1.0) - elseif termpoint == "90% - 100%" then + elseif termpoint == "90% - 100%" then meta:set_string("termpoint1", 0.9) meta:set_string("termpoint2", 1.0) else @@ -289,11 +289,11 @@ techage.round = round ------------------------------------------------------------------------------- function techage.formspec_label_bar(pos, x, y, label, max_power, current_power, unit) local percent, ypos - + max_power = max_power or 1 unit = unit or "ku" current_power = current_power or 0 - + if current_power == 0 then percent = 0 ypos = 2.8 @@ -318,4 +318,3 @@ function techage.formspec_label_bar(pos, x, y, label, max_power, current_power, "container_end[]" end - diff --git a/techage/power/gearbox.lua b/techage/power/gearbox.lua index d444f24..ea03db7 100644 --- a/techage/power/gearbox.lua +++ b/techage/power/gearbox.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA2 Gearbox ]]-- @@ -70,12 +70,12 @@ local function after_dig_node(pos, oldnode) Axle:after_dig_node(pos) end -local function tubelib2_on_update2_on(pos, outdir, tlib2, node) +local function tubelib2_on_update2_on(pos, outdir, tlib2, node) power.update_network(pos, 0, tlib2, node) switch_axles(pos, true) end -local function tubelib2_on_update2_off(pos, outdir, tlib2, node) +local function tubelib2_on_update2_off(pos, outdir, tlib2, node) power.update_network(pos, 0, tlib2, node) switch_axles(pos, false) end @@ -83,14 +83,14 @@ end minetest.register_node("techage:gearbox", { description = S("TA2 Gearbox"), tiles = {"techage_filling_ta2.png^techage_axle_gearbox.png^techage_frame_ta2.png"}, - + on_timer = node_timer_off, techage_on_repair = techage_on_repair, after_place_node = after_place_node, after_dig_node = after_dig_node, tubelib2_on_update2 = tubelib2_on_update2_off, paramtype = "light", - light_source = 0, + light_source = 0, paramtype2 = "facedir", groups = {cracky=2, crumbly=2, choppy=2}, on_rotate = screwdriver.disallow, @@ -113,7 +113,7 @@ minetest.register_node("techage:gearbox_on", { }, }, }, - + on_timer = node_timer_on, techage_on_repair = techage_on_repair, after_place_node = after_place_node, @@ -129,7 +129,7 @@ minetest.register_node("techage:gearbox_on", { }) power.register_nodes({"techage:gearbox", "techage:gearbox_on"}, Axle, "junc") - + techage.register_node({"techage:gearbox", "techage:gearbox_on"}, { on_node_load = function(pos, node) minetest.get_node_timer(pos):start(CYCLE_TIME) @@ -144,4 +144,3 @@ minetest.register_craft({ {"default:wood", "techage:axle", "default:junglewood"}, }, }) - diff --git a/techage/power/junctionbox.lua b/techage/power/junctionbox.lua index 59f4be2..81e0310 100644 --- a/techage/power/junctionbox.lua +++ b/techage/power/junctionbox.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3/TA4 Junction box for electrical power distribution ]]-- diff --git a/techage/power/power_line.lua b/techage/power/power_line.lua index 4d3e9c4..39c92cc 100644 --- a/techage/power/power_line.lua +++ b/techage/power/power_line.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3/TA4 Power line for electrical landline ]]-- @@ -41,11 +41,11 @@ minetest.register_node("techage:power_line", { end return false end, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) Cable:after_dig_tube(pos, oldnode) end, - + paramtype2 = "facedir", -- important! drawtype = "nodebox", node_box = { @@ -80,11 +80,11 @@ minetest.register_node("techage:power_lineS", { end return false end, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) Cable:after_dig_tube(pos, oldnode) end, - + paramtype2 = "facedir", -- important! drawtype = "nodebox", node_box = { @@ -125,11 +125,11 @@ minetest.register_node("techage:power_lineA", { end return false end, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) Cable:after_dig_tube(pos, oldnode) end, - + paramtype2 = "facedir", -- important! drawtype = "nodebox", node_box = { @@ -175,7 +175,7 @@ minetest.register_node("techage:power_pole2", { "default_wood.png^techage_power_pole_top.png", "default_wood.png^techage_power_pole.png" }, - + paramtype2 = "facedir", -- important! drawtype = "nodebox", node_box = { @@ -187,7 +187,7 @@ minetest.register_node("techage:power_pole2", { { -2/32, -4/32, 12/32, 2/32, 4/32, 16/32}, }, }, - + after_place_node = function(pos, placer, itemstack, pointed_thing) M(pos):set_string("owner", placer:get_player_name()) if techage.is_protected(pos, placer:get_player_name()) then @@ -206,7 +206,7 @@ minetest.register_node("techage:power_pole2", { after_dig_node = function(pos, oldnode, oldmetadata, digger) Cable:after_dig_tube(pos, oldnode) end, - + on_rotate = screwdriver.disallow, -- important! paramtype = "light", use_texture_alpha = techage.CLIP, @@ -224,7 +224,7 @@ minetest.register_node("techage:power_pole", { "default_wood.png^techage_power_pole_top.png", "default_wood.png^techage_power_pole.png" }, - + paramtype2 = "facedir", -- important! drawtype = "nodebox", node_box = { @@ -239,7 +239,7 @@ minetest.register_node("techage:power_pole", { { -2/32, -4/32, 12/32, 2/32, 4/32, 16/32}, }, }, - + after_place_node = function(pos, placer, itemstack, pointed_thing) M(pos):set_string("owner", placer:get_player_name()) if techage.is_protected(pos, placer:get_player_name()) then @@ -252,7 +252,7 @@ minetest.register_node("techage:power_pole", { minetest.swap_node(pos, node) Cable:after_place_node(pos) end, - + on_rotate = screwdriver.disallow, -- important! paramtype = "light", use_texture_alpha = techage.CLIP, @@ -270,16 +270,16 @@ minetest.register_node("techage:power_pole_conn", { "default_wood.png^techage_power_pole_top.png", "default_wood.png^techage_power_pole.png" }, - + paramtype2 = "facedir", -- important! drawtype = "nodebox", node_box = { type = "connected", fixed = {{ -4/32, -16/32, -4/32, 4/32, 16/32, 4/32}}, - - connect_left = {{-16/32, -6/32, -1/32, 1/32, -4/32, 1/32}, + + connect_left = {{-16/32, -6/32, -1/32, 1/32, -4/32, 1/32}, {-16/32, -4/32, -2/32, -12/32, 4/32, 2/32}}, - connect_right = {{ -1/32, -6/32, -1/32, 16/32, -4/32, 1/32}, + connect_right = {{ -1/32, -6/32, -1/32, 16/32, -4/32, 1/32}, {12/32, -4/32, -2/32, 16/32, 4/32, 2/32}}, connect_back = {{-1/32, -6/32, -1/32, 1/32, -4/32, 16/32}, {-2/32, -4/32, 12/32, 2/32, 4/32, 16/32}}, @@ -292,7 +292,7 @@ minetest.register_node("techage:power_pole_conn", { after_dig_node = function(pos, oldnode, oldmetadata, digger) Cable:after_dig_node(pos) end, - + drop = "techage:power_pole", on_rotate = screwdriver.disallow, -- important! paramtype = "light", @@ -312,7 +312,7 @@ minetest.register_node("techage:power_pole3", { "default_wood.png", "default_wood.png" }, - + paramtype2 = "facedir", -- important! drawtype = "nodebox", node_box = { @@ -365,4 +365,3 @@ minetest.register_craft({ {"", "group:wood", ""}, }, }) - diff --git a/techage/power/power_terminal.lua b/techage/power/power_terminal.lua index 2d882ce..3602ab5 100644 --- a/techage/power/power_terminal.lua +++ b/techage/power/power_terminal.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - + TA3 Power Terminal Old ]]-- -minetest.register_alias_force("techage:power_terminal", "techage:ta3_power_terminal") \ No newline at end of file +minetest.register_alias_force("techage:power_terminal", "techage:ta3_power_terminal") diff --git a/techage/power/power_terminal2.lua b/techage/power/power_terminal2.lua index 9cb8dd4..564e2e5 100644 --- a/techage/power/power_terminal2.lua +++ b/techage/power/power_terminal2.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3 Power Terminal ]]-- @@ -35,7 +35,7 @@ con . . . . . print main consumers local function row(num, label, data) local y = 4.0 + num * 0.5 - return + return "box[0," .. y .. ";9.8,0.4;#395c74]".. "label[0.2,"..y..";" .. label .. "]" .. "label[8.5,"..y..";" .. data .. "]" @@ -47,14 +47,14 @@ local function formspec1(pos, data) local outdir = M(pos):get_int("outdir") local netw = networks.get_network_table(pos, Cable, outdir, true) or {} data = data or power.get_network_data(pos, Cable, outdir) - + mem.star = ((mem.star or 0) + 1) % 2 local star = mem.star == 1 and "*" or "" local storage_provided = math.max(data.consumed - data.available, 0) local available = math.max(data.consumed, data.available) - + return "size[10,8]".. - "tabheader[0,0;tab;status,console;1;;true]".. + "tabheader[0,0;tab;status,console;1;;true]".. default.gui_bg.. default.gui_bg_img.. default.gui_slots.. @@ -65,7 +65,7 @@ local function formspec1(pos, data) techage.formspec_power_bar(pos, 2.5, 0.7, S("Consumer"), data.consumed, available).. techage.formspec_charging_bar(pos, 5.0, 0.7, S("Charging"), data).. techage.formspec_storage_bar(pos, 7.5, 0.7, S("Storage"), data.curr_load, data.max_capa).. - + row(1, S("Number of network nodes:"), netw.num_nodes or 0) .. row(2, S("Number of generators:"), #(netw.gen or {})) .. row(3, S("Number of consumers:"), #(netw.con or {})) .. @@ -79,9 +79,9 @@ local function formspec2(pos) local command = mem.cmnd or "help" output = minetest.formspec_escape(output) output = output:gsub("\n", ",") - + return "size[10,8]".. - "tabheader[0,0;tab;status,console;2;;true]".. + "tabheader[0,0;tab;status,console;2;;true]".. default.gui_bg.. default.gui_bg_img.. default.gui_slots.. @@ -101,11 +101,11 @@ local function generators(pos) for _, item in ipairs(resp) do local name = item.type .. " (" .. item.number .. ")" if item.running then - local s = string.format("%s (%s): %s/%u ku (%s)", + local s = string.format("%s (%s): %s/%u ku (%s)", item.type, item.number, techage.round(item.provided), item.available, item.termpoint) tbl[#tbl + 1] = s else - local s = string.format("%s (%s): off", + local s = string.format("%s (%s): off", item.type, item.number) tbl[#tbl + 1] = s end @@ -121,15 +121,15 @@ local function storages(pos) for _, item in ipairs(resp) do local name = item.type .. " (" .. item.number .. ")" if item.running then - local s = string.format("%s (%s): %s/%s kud", - item.type, item.number, - techage.round(item.load / techage.CYCLES_PER_DAY), + local s = string.format("%s (%s): %s/%s kud", + item.type, item.number, + techage.round(item.load / techage.CYCLES_PER_DAY), techage.round(item.capa / techage.CYCLES_PER_DAY)) tbl[#tbl + 1] = s else - local s = string.format("%s (%s): %s/%s kud (off)", - item.type, item.number, - techage.round(item.load / techage.CYCLES_PER_DAY), + local s = string.format("%s (%s): %s/%s kud (off)", + item.type, item.number, + techage.round(item.load / techage.CYCLES_PER_DAY), techage.round(item.capa / techage.CYCLES_PER_DAY)) tbl[#tbl + 1] = s end @@ -163,12 +163,12 @@ end local function command(pos, nvm, command) local meta = M(pos) - + if command then command = command:sub(1,80) command = string.trim(command) local cmd, data = unpack(string.split(command, " ", false, 1)) - + if cmd == "cls" then meta:set_string("output", "") elseif cmd == "help" then @@ -183,7 +183,7 @@ local function command(pos, nvm, command) output(pos, command, "") end end -end +end minetest.register_node("techage:ta3_power_terminal", { description = S("TA3 Power Terminal"), @@ -203,7 +203,7 @@ minetest.register_node("techage:ta3_power_terminal", { { -8/16, -8/16, 0/16, 8/16, 8/16, 8/16}, }, }, - + after_place_node = function(pos) M(pos):set_int("outdir", networks.side_to_outdir(pos, "B")) Cable:after_place_node(pos) @@ -232,14 +232,14 @@ minetest.register_node("techage:ta3_power_terminal", { return true end end, - + on_receive_fields = function(pos, formname, fields, player) if minetest.is_protected(pos, player:get_player_name()) then return end local nvm = techage.get_nvm(pos) local mem = techage.get_mem(pos) - + if fields.key_enter_field or fields.enter then command(pos, nvm, fields.cmnd) mem.cmnd = "" @@ -258,7 +258,7 @@ minetest.register_node("techage:ta3_power_terminal", { M(pos):set_string("formspec", formspec2(pos)) end end, - + paramtype2 = "facedir", paramtype = "light", use_texture_alpha = techage.CLIP, diff --git a/techage/power/powerswitch.lua b/techage/power/powerswitch.lua index 4cf3577..ede50c3 100644 --- a/techage/power/powerswitch.lua +++ b/techage/power/powerswitch.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3 Power Switch (large and small) ]]-- @@ -54,7 +54,7 @@ local function switch_on(pos, node, clicker, name) }) local dir = Param2ToDir[node.param2] local pos2 = tubelib2.get_pos(pos, dir) - + techage.legacy_switches(pos2) power.turn_switch_on(pos2, Cable, "techage:powerswitch_box_off", "techage:powerswitch_box_on") end @@ -73,7 +73,7 @@ local function switch_off(pos, node, clicker, name) }) local dir = Param2ToDir[node.param2] local pos2 = tubelib2.get_pos(pos, dir) - + techage.legacy_switches(pos2) power.turn_switch_off(pos2, Cable, "techage:powerswitch_box_off", "techage:powerswitch_box_on") end @@ -94,7 +94,7 @@ minetest.register_node("techage:powerswitch", { { -1/6, -12/16, -1/6, 1/6, -8/16, 1/6}, }, }, - + after_place_node = function(pos, placer) local meta = M(pos) local number = techage.add_node(pos, "techage:powerswitch") @@ -137,7 +137,7 @@ minetest.register_node("techage:powerswitch_on", { { -1/6, -12/16, -1/6, 1/6, -8/16, 1/6}, }, }, - + on_rightclick = function(pos, node, clicker) switch_off(pos, node, clicker, "techage:powerswitch") end, @@ -169,7 +169,7 @@ minetest.register_node("techage:powerswitchsmall", { { -2/16, -12/16, -2/16, 2/16, -8/16, 2/16}, }, }, - + after_place_node = function(pos, placer) local meta = M(pos) local number = techage.add_node(pos, "techage:powerswitchsmall") @@ -212,7 +212,7 @@ minetest.register_node("techage:powerswitchsmall_on", { { -2/16, -12/16, -2/16, 2/16, -8/16, 2/16}, }, }, - + on_rightclick = function(pos, node, clicker) switch_off(pos, node, clicker, "techage:powerswitchsmall") end, @@ -246,7 +246,7 @@ techage.register_node({"techage:powerswitch", "techage:powerswitch_on", switch_off(pos, node, nil, "techage:powerswitchsmall") return true elseif topic == "state" then - if node.name == "techage:powerswitch_on" or + if node.name == "techage:powerswitch_on" or node.name == "techage:powerswitchsmall_on" then return "on" end @@ -255,7 +255,7 @@ techage.register_node({"techage:powerswitch", "techage:powerswitch_on", return "unsupported" end end, -}) +}) minetest.register_craft({ output = "techage:powerswitch 2", @@ -271,4 +271,3 @@ minetest.register_craft({ output = "techage:powerswitchsmall", recipe = {"techage:powerswitch"}, }) - diff --git a/techage/power/powerswitchbox.lua b/techage/power/powerswitchbox.lua index 523c294..14cde4c 100644 --- a/techage/power/powerswitchbox.lua +++ b/techage/power/powerswitchbox.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3 Power Switch Box ]]-- @@ -31,7 +31,7 @@ local node_box = { function techage.legacy_switches(pos) local meta = M(pos) local node = N(pos) - + if node.name == "techage:powerswitch_box" then if meta:get_int("netw_param2") == 0 then node.name = "techage:powerswitch_box_off" @@ -80,7 +80,7 @@ minetest.register_node("techage:powerswitch_box_on", { if M(pos):get_int("switch_sign_in") ~= 1 then if power.turn_switch_off(pos, Cable, "techage:powerswitch_box_off", "techage:powerswitch_box_on") then minetest.sound_play("doors_glass_door_open", { - pos = pos, + pos = pos, gain = 1, max_hear_distance = 5}) end @@ -117,7 +117,7 @@ minetest.register_node("techage:powerswitch_box_off", { if M(pos):get_int("switch_sign_in") ~= 1 then if power.turn_switch_on(pos, Cable, "techage:powerswitch_box_off", "techage:powerswitch_box_on") then minetest.sound_play("doors_glass_door_open", { - pos = pos, + pos = pos, gain = 1, max_hear_distance = 5}) end diff --git a/techage/power/powerswitchbox_legacy.lua b/techage/power/powerswitchbox_legacy.lua index 60dab1e..9fd27b5 100644 --- a/techage/power/powerswitchbox_legacy.lua +++ b/techage/power/powerswitchbox_legacy.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3 Old Power Switch Box ]]-- @@ -43,22 +43,22 @@ minetest.register_node("techage:powerswitch_box", { drawtype = "nodebox", node_box = node_box, - + after_place_node = function(pos, placer, itemstack, pointed_thing) local node = minetest.get_node(pos) minetest.swap_node(pos, {name = "techage:powerswitch_box_on", param2 = node.param2}) - + if not Cable:after_place_tube(pos, placer, pointed_thing) then minetest.remove_node(pos) return true end return false end, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) Cable:after_dig_tube(pos, oldnode, oldmetadata) end, - + paramtype = "light", use_texture_alpha = techage.CLIP, sunlight_propagates = true, diff --git a/techage/power/protection.lua b/techage/power/protection.lua index 2c20839..639c3af 100644 --- a/techage/power/protection.lua +++ b/techage/power/protection.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3/TA4 Power line Protection ]]-- @@ -27,7 +27,7 @@ local function powerpole_found(pos, name, range) local pos1 = {x=pos.x-range, y=pos.y-range, z=pos.z-range} local pos2 = {x=pos.x+range, y=pos.y+range, z=pos.z+range} for _,npos in ipairs(minetest.find_nodes_in_area(pos1, pos2, { - "techage:power_pole", "techage:power_pole_conn", + "techage:power_pole", "techage:power_pole_conn", "techage:power_pole2"})) do if minetest.get_meta(npos):get_string("owner") ~= name then return true @@ -69,4 +69,3 @@ techage.register_powerline_node("techage:power_line") techage.register_powerline_node("techage:power_lineS") techage.register_powerline_node("techage:power_lineA") techage.register_powerline_node("techage:power_pole3") - diff --git a/techage/power/steam_pipe.lua b/techage/power/steam_pipe.lua index 040d4f9..a46fb95 100644 --- a/techage/power/steam_pipe.lua +++ b/techage/power/steam_pipe.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA2 Steam pipes for the Steam Engine ]]-- @@ -19,11 +19,11 @@ local S = techage.S local Pipe = tubelib2.Tube:new({ dirs_to_check = {1,2,3,4,5,6}, - max_tube_length = 12, + max_tube_length = 12, show_infotext = false, force_to_use_tubes = true, tube_type = "pipe1", - primary_node_names = {"techage:steam_pipeS", "techage:steam_pipeA"}, + primary_node_names = {"techage:steam_pipeS", "techage:steam_pipeA"}, secondary_node_names = {"techage:cylinder", "techage:cylinder_on", "techage:boiler2"}, after_place_tube = function(pos, param2, tube_type, num_tubes) minetest.swap_node(pos, {name = "techage:steam_pipe"..tube_type, param2 = param2}) @@ -40,7 +40,7 @@ minetest.register_node("techage:steam_pipeS", { "techage_steam_hole.png", "techage_steam_hole.png", }, - + after_place_node = function(pos, placer, itemstack, pointed_thing) if not Pipe:after_place_tube(pos, placer, pointed_thing) then minetest.remove_node(pos) @@ -48,11 +48,11 @@ minetest.register_node("techage:steam_pipeS", { end return false end, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) Pipe:after_dig_tube(pos, oldnode, oldmetadata) end, - + paramtype2 = "facedir", -- important! drawtype = "nodebox", node_box = { @@ -80,11 +80,11 @@ minetest.register_node("techage:steam_pipeA", { "techage_steam_knee2.png", "techage_steam_hole2.png", }, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) Pipe:after_dig_tube(pos, oldnode, oldmetadata) end, - + paramtype2 = "facedir", -- important! drawtype = "nodebox", node_box = { diff --git a/techage/power/ta4_cable.lua b/techage/power/ta4_cable.lua index 6650e05..7a69915 100644 --- a/techage/power/ta4_cable.lua +++ b/techage/power/ta4_cable.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA4 Low Power Cable for solar plants ]]-- @@ -24,7 +24,7 @@ local ELE2_MAX_CABLE_LENGHT = 200 local Cable = tubelib2.Tube:new({ dirs_to_check = {1,2,3,4,5,6}, - max_tube_length = ELE2_MAX_CABLE_LENGHT, + max_tube_length = ELE2_MAX_CABLE_LENGHT, show_infotext = false, tube_type = "ele2", primary_node_names = {"techage:ta4_power_cableS", "techage:ta4_power_cableA", @@ -56,7 +56,7 @@ minetest.register_node("techage:ta4_power_cableS", { "techage_ta4_cable_end.png", "techage_ta4_cable_end.png", }, - + after_place_node = function(pos, placer, itemstack, pointed_thing) if not Cable:after_place_tube(pos, placer, pointed_thing) then minetest.remove_node(pos) @@ -64,11 +64,11 @@ minetest.register_node("techage:ta4_power_cableS", { end return false end, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) Cable:after_dig_tube(pos, oldnode) end, - + paramtype2 = "facedir", -- important! drawtype = "nodebox", node_box = { @@ -97,11 +97,11 @@ minetest.register_node("techage:ta4_power_cableA", { "techage_ta4_cable.png", "techage_ta4_cable_end.png", }, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) Cable:after_dig_tube(pos, oldnode) end, - + paramtype2 = "facedir", -- important! drawtype = "nodebox", node_box = { @@ -128,7 +128,7 @@ minetest.register_node("techage:ta4_power_box", { "techage_ta4_junctionbox_top.png", "techage_ta4_junctionbox_side.png^techage_appl_ta4_cable.png", }, - + paramtype2 = "facedir", -- important! drawtype = "nodebox", node_box = { @@ -138,13 +138,13 @@ minetest.register_node("techage:ta4_power_box", { { -1/16, -7/16, -1/16, 1/16, -4/16, 1/16}, -- post { -3/16, -8/16, -3/16, 3/16, -7/16, 3/16}, -- base }, - + connect_left = {{ -1/2, -1/16, -1/16, 0, 1/16, 1/16}}, connect_right = {{ 0, -1/16, -1/16, 1/2, 1/16, 1/16}}, connect_back = {{-1/16, -1/16, 0, 1/16, 1/16, 1/2}}, connect_front = {{-1/16, -1/16, -1/2, 1/16, 1/16, 0}}, }, - connects_to = {"techage:ta4_power_cableA", "techage:ta4_power_cableS", + connects_to = {"techage:ta4_power_cableA", "techage:ta4_power_cableS", "techage:ta4_solar_inverter", "techage:ta4_solar_carrier", "techage:ta4_solar_carrierB", "techage:ta4_cable_wall_entry"}, @@ -157,7 +157,7 @@ minetest.register_node("techage:ta4_power_box", { after_dig_node = function(pos, oldnode, oldmetadata, digger) Cable:after_dig_node(pos) end, - + on_rotate = screwdriver.disallow, -- important! paramtype = "light", use_texture_alpha = techage.CLIP, @@ -187,5 +187,3 @@ minetest.register_craft({ },}) techage.TA4_Cable = Cable - - diff --git a/techage/power/ta4_cable_wall_entry.lua b/techage/power/ta4_cable_wall_entry.lua index d83d3b7..fb96be6 100644 --- a/techage/power/ta4_cable_wall_entry.lua +++ b/techage/power/ta4_cable_wall_entry.lua @@ -35,11 +35,11 @@ minetest.register_node("techage:ta4_cable_wall_entry", { end return false end, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) TA4_Cable:after_dig_tube(pos, oldnode) end, - + paramtype2 = "facedir", -- important! on_rotate = screwdriver.disallow, -- important! groups = {crumbly = 2, cracky = 2, snappy = 2}, diff --git a/techage/recipe_checker.lua b/techage/recipe_checker.lua index 204b1fa..95558e1 100644 --- a/techage/recipe_checker.lua +++ b/techage/recipe_checker.lua @@ -29,7 +29,7 @@ minetest.after(1, function() end Recipes[key] = name end - end + end end end end diff --git a/techage/solar/inverter.lua b/techage/solar/inverter.lua index d22afc0..94c87ed 100644 --- a/techage/solar/inverter.lua +++ b/techage/solar/inverter.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information TA4 Solar Power DC/AC Inverter - + ]]-- -- for lazy programmers @@ -36,7 +36,7 @@ local function determine_power(pos, nvm) for _, power in ipairs(control.request(pos, Solar, outdir, "junc", "power")) do max_power = max_power + power end - + if num_inv == 1 then -- only one inverter is allowed nvm.max_power = math.min(PWR_PERF, max_power) else @@ -192,7 +192,7 @@ minetest.register_node("techage:ta4_solar_inverter", { State:node_init(pos, nvm, number) M(pos):set_string("formspec", formspec(State, pos, nvm)) end, - + after_dig_node = function(pos, oldnode) Cable:after_dig_node(pos) Solar:after_dig_node(pos) @@ -218,7 +218,7 @@ techage.register_node({"techage:ta4_solar_inverter"}, { return State:on_receive_message(pos, topic, payload) end end, -}) +}) control.register_nodes({"techage:ta4_solar_inverter"}, { on_receive = function(pos, tlib2, topic, payload) @@ -233,7 +233,7 @@ control.register_nodes({"techage:ta4_solar_inverter"}, { running = techage.is_running(nvm) or false, available = nvm.max_power or 0, provided = nvm.provided or 0, - termpoint = meta:get_string("termpoint"), + termpoint = meta:get_string("termpoint"), } end return false diff --git a/techage/solar/minicell.lua b/techage/solar/minicell.lua index b12fba7..1364ec1 100644 --- a/techage/solar/minicell.lua +++ b/techage/solar/minicell.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information TA4 Streetlamp Solar Cell - + ]]-- -- for lazy programmers @@ -31,7 +31,7 @@ local function node_timer(pos, elapsed) local light = minetest.get_node_light(pos) or 0 local t = minetest.get_timeofday() pos.y = pos.y - 1 - + if t > 0.25 and t < 0.75 then if nvm.providing then nvm.providing = false @@ -97,7 +97,7 @@ minetest.register_node("techage:ta4_solar_minicell", { groups = {cracky=2, crumbly=2, choppy=2}, is_ground_content = false, use_texture_alpha = techage.CLIP, - + after_place_node = after_place_node, after_dig_node = after_dig_node, on_timer = node_timer, @@ -105,7 +105,7 @@ minetest.register_node("techage:ta4_solar_minicell", { power.register_nodes({"techage:ta4_solar_minicell"}, Cable, "gen", {"D"}) -techage.register_node({"techage:ta4_solar_minicell"}, { +techage.register_node({"techage:ta4_solar_minicell"}, { on_recv_message = function(pos, src, topic, payload) local nvm = techage.get_nvm(pos) if topic == "state" then @@ -133,4 +133,3 @@ minetest.register_craft({ {"default:tin_ingot", "techage:iron_ingot", "default:copper_ingot"}, }, }) - diff --git a/techage/solar/solarcell.lua b/techage/solar/solarcell.lua index 96a94ce..c0c92fa 100644 --- a/techage/solar/solarcell.lua +++ b/techage/solar/solarcell.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information TA4 Solar Module and Carriers - + ]]-- -- for lazy programmers @@ -42,14 +42,14 @@ local function light(pos) if minetest.get_node(pos).name ~= "air" then return false end local light = minetest.get_node_light(pos) or 0 return light >= (15 - 1) -end - +end + -- check if solar module is available and has the correct orientation local function is_solar_module(base_pos, pos, side) local pos1 = techage.get_pos(pos, side) if pos1 then local node = techage.get_node_lvm(pos1) - if node and node.name == "techage:ta4_solar_module" and + if node and node.name == "techage:ta4_solar_module" and light({x = pos1.x, y = pos1.y + 1, z = pos1.z}) then if side == "L" and node.param2 == M(base_pos):get_int("left_param2") then return true @@ -89,7 +89,7 @@ local function after_dig_node(pos, oldnode) Cable:after_dig_node(pos) end -local function tubelib2_on_update2(pos, outdir, tlib2, node) +local function tubelib2_on_update2(pos, outdir, tlib2, node) power.update_network(pos, 0, tlib2, node) end @@ -151,11 +151,11 @@ minetest.register_node("techage:ta4_solar_carrier", { M(pos):set_int("left_param2", get_param2(pos, "L")) M(pos):set_int("right_param2", get_param2(pos, "R")) end, - + after_place_node = after_place_node, after_dig_node = after_dig_node, tubelib2_on_update2 = tubelib2_on_update2, - + paramtype = "light", use_texture_alpha = techage.CLIP, paramtype2 = "facedir", @@ -190,11 +190,11 @@ minetest.register_node("techage:ta4_solar_carrierB", { M(pos):set_int("right_param2", get_param2(pos, "R")) Cable:after_place_node(pos) end, - + after_place_node = after_place_node, after_dig_node = after_dig_node, tubelib2_on_update2 = tubelib2_on_update2, - + paramtype = "light", use_texture_alpha = techage.CLIP, paramtype2 = "facedir", @@ -223,7 +223,7 @@ minetest.register_node("techage:ta4_solar_carrierT", { {-3/8, 5/16, -1/2, 3/8, 7/16, 1/2}, }, }, - + paramtype = "light", use_texture_alpha = techage.CLIP, paramtype2 = "facedir", @@ -291,4 +291,3 @@ minetest.register_craft({ {"", "", ""}, }, }) - diff --git a/techage/steam_engine/boiler.lua b/techage/steam_engine/boiler.lua index 8b44a86..ce3ea79 100644 --- a/techage/steam_engine/boiler.lua +++ b/techage/steam_engine/boiler.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA2 Steam Engine Boiler ]]-- @@ -63,14 +63,14 @@ minetest.register_node("techage:boiler2", { type = "fixed", fixed = {-10/32, -48/32, -10/32, 10/32, 16/32, 10/32}, }, - + can_dig = boiler.can_dig, on_timer = node_timer, on_rightclick = boiler.on_rightclick, after_place_node = after_place_node, after_dig_node = after_dig_node, on_punch = boiler.on_punch, - + paramtype = "light", groups = {cracky=1}, on_rotate = screwdriver.disallow, @@ -135,4 +135,3 @@ minetest.register_craft({ {"techage:iron_ingot", "", "techage:iron_ingot"}, }, }) - diff --git a/techage/steam_engine/cylinder.lua b/techage/steam_engine/cylinder.lua index aad0e37..3ec4c87 100644 --- a/techage/steam_engine/cylinder.lua +++ b/techage/steam_engine/cylinder.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA2 Steam Engine Cylinder ]]-- @@ -19,7 +19,7 @@ local S = techage.S local Pipe = techage.SteamPipe local function transfer_flywheel(pos, topic, payload) - return techage.transfer(pos, "R", topic, payload, nil, + return techage.transfer(pos, "R", topic, payload, nil, {"techage:flywheel", "techage:flywheel_on"}) end @@ -36,7 +36,7 @@ local function play_sound(pos) local mem = techage.get_mem(pos) if not mem.handle or mem.handle == -1 then mem.handle = minetest.sound_play("techage_steamengine", { - pos = pos, + pos = pos, gain = 0.5, max_hear_distance = 8, loop = true}) @@ -64,7 +64,7 @@ local function after_dig_node(pos, oldnode) techage.del_mem(pos) end -local function tubelib2_on_update2(pos, outdir, tlib2, node) +local function tubelib2_on_update2(pos, outdir, tlib2, node) swap_node(pos, "techage:cylinder") stop_sound(pos) end @@ -80,11 +80,11 @@ minetest.register_node("techage:cylinder", { "techage_filling_ta2.png^techage_cylinder.png^techage_frame_ta2.png", "techage_filling_ta2.png^techage_cylinder.png^techage_frame_ta2.png", }, - + after_place_node = after_place_node, after_dig_node = after_dig_node, tubelib2_on_update2 = tubelib2_on_update2, - + paramtype2 = "facedir", groups = {cracky=2, crumbly=2, choppy=2}, on_rotate = screwdriver.disallow, @@ -121,9 +121,9 @@ minetest.register_node("techage:cylinder_on", { }, }, }, - + tubelib2_on_update2 = tubelib2_on_update2, - + paramtype2 = "facedir", groups = {not_in_creative_inventory=1}, diggable = false, @@ -162,7 +162,7 @@ techage.register_node({"techage:cylinder", "techage:cylinder_on"}, { --print("on_node_load", node.name) if node.name == "techage:cylinder_on" then play_sound(pos) - end + end end, }) @@ -174,4 +174,3 @@ minetest.register_craft({ {"default:wood", "techage:iron_ingot", "basic_materials:steel_bar"}, }, }) - diff --git a/techage/steam_engine/firebox.lua b/techage/steam_engine/firebox.lua index 2ebcb01..3d55acf 100644 --- a/techage/steam_engine/firebox.lua +++ b/techage/steam_engine/firebox.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA2 Steam Engine Firebox ]]-- @@ -26,7 +26,7 @@ local function node_timer(pos, elapsed) local nvm = techage.get_nvm(pos) if nvm.running then local power = techage.transfer( - {x=pos.x, y=pos.y+2, z=pos.z}, + {x=pos.x, y=pos.y+2, z=pos.z}, nil, -- outdir "trigger", -- topic nil, -- payload @@ -35,7 +35,7 @@ local function node_timer(pos, elapsed) ) nvm.burn_cycles = (nvm.burn_cycles or 0) - math.max((power or 0.1), 0.1) if nvm.burn_cycles <= 0 then - local taken = firebox.get_fuel(pos) + local taken = firebox.get_fuel(pos) if taken then nvm.burn_cycles = (firebox.Burntime[taken:get_name()] or 1) / CYCLE_TIME * BURN_CYCLE_FACTOR nvm.burn_cycles_total = nvm.burn_cycles @@ -75,7 +75,7 @@ minetest.register_node("techage:firebox", { allow_metadata_inventory_put = firebox.allow_metadata_inventory_put, allow_metadata_inventory_take = firebox.allow_metadata_inventory_take, on_rightclick = firebox.on_rightclick, - + on_construct = function(pos) local nvm = techage.get_nvm(pos) nvm.running = false @@ -126,7 +126,7 @@ minetest.register_node("techage:firebox_on", { is_ground_content = false, sounds = default.node_sound_stone_defaults(), drop = "techage:firebox", - + on_timer = node_timer, can_dig = firebox.can_dig, allow_metadata_inventory_put = firebox.allow_metadata_inventory_put, @@ -157,7 +157,7 @@ techage.register_node({"techage:firebox", "techage:firebox_on"}, { end return false end, -}) +}) minetest.register_lbm({ label = "[techage] Steam engine firebox", @@ -170,5 +170,3 @@ minetest.register_lbm({ minetest.get_node_timer(pos):start(CYCLE_TIME) end }) - - diff --git a/techage/steam_engine/flywheel.lua b/techage/steam_engine/flywheel.lua index 3df10cf..a4ce7b5 100644 --- a/techage/steam_engine/flywheel.lua +++ b/techage/steam_engine/flywheel.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA2 Steam Engine Flywheel ]]-- @@ -35,7 +35,7 @@ local function formspec(self, pos, nvm) end local function transfer_cylinder(pos, topic, payload) - return techage.transfer(pos, "L", topic, payload, nil, + return techage.transfer(pos, "L", topic, payload, nil, {"techage:cylinder", "techage:cylinder_on"}) end @@ -139,7 +139,7 @@ minetest.register_node("techage:flywheel", { "techage_filling_ta2.png^techage_frame_ta2.png^techage_flywheel.png", "techage_filling_ta2.png^techage_frame_ta2.png^techage_flywheel.png^[transformFX]", }, - + on_receive_fields = on_receive_fields, on_rightclick = on_rightclick, on_timer = node_timer, @@ -192,7 +192,7 @@ minetest.register_node("techage:flywheel_on", { }, }, }, - + on_receive_fields = on_receive_fields, on_rightclick = on_rightclick, on_timer = node_timer, @@ -236,5 +236,3 @@ minetest.register_craft({ {"default:wood", "techage:iron_ingot", "basic_materials:steel_bar"}, }, }) - - diff --git a/techage/ta1_watermill/mill.lua b/techage/ta1_watermill/mill.lua index 35e0450..c511ce3 100644 --- a/techage/ta1_watermill/mill.lua +++ b/techage/ta1_watermill/mill.lua @@ -49,15 +49,15 @@ minetest.register_node("techage:ta1_mill_gear", { {-1/8, -1/8, -1/2, 1/8, 1/8, 1/2}, }, }, - + after_place_node = function(pos, placer) - techage.TA1Axle:after_place_node(pos) + techage.TA1Axle:after_place_node(pos) end, after_dig_node = function(pos, oldnode, oldmetadata, digger) techage.TA1Axle:after_dig_node(pos) end, - + paramtype2 = "facedir", paramtype = "light", use_texture_alpha = techage.CLIP, @@ -98,22 +98,22 @@ minetest.register_node("techage:ta1_mill", { { 1/8, -4/8, -3/8, 3/8, 4/8, 3/8}, }, }, - + after_place_node = function(pos, placer) minetest.get_node_timer(pos):start(2) end, - + on_rightclick = function(pos, node, clicker) start_mill(pos) end, - + on_timer = function(pos, elapsed) if has_power(pos, 1) then start_mill(pos) end return true end, - + paramtype2 = "facedir", paramtype = "light", use_texture_alpha = techage.CLIP, @@ -132,10 +132,10 @@ minetest.register_entity("techage:ta1_mill_entity", { automatic_rotate = -math.pi * 0.2, pointable = false, }, - + on_step = function(self, dtime) self.dtime = (self.dtime or 0) + dtime - + if self.dtime > 2 then local pos = vector.round(self.object:get_pos()) if not has_power(pos, 1) then @@ -146,7 +146,7 @@ minetest.register_entity("techage:ta1_mill_entity", { max_hear_distance = 10}, true) end end, - + on_rightclick = function(self, clicker) local pos = vector.round(self.object:get_pos()) stop_mill(pos, self) @@ -157,7 +157,7 @@ techage.register_node({"techage:ta1_mill"}, { on_node_load = function(pos, node) minetest.get_node_timer(pos):start(2) end, -}) +}) minetest.register_craft({ output = "techage:ta1_mill_gear", diff --git a/techage/ta1_watermill/millboard.lua b/techage/ta1_watermill/millboard.lua index a50a912..445b9ce 100644 --- a/techage/ta1_watermill/millboard.lua +++ b/techage/ta1_watermill/millboard.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information TA1 mill boards - + ]]-- local M = minetest.get_meta @@ -32,7 +32,7 @@ local function register_board1(output, description, tiles, input) sunlight_propagates = true, is_ground_content = false, groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, - sounds = default.node_sound_wood_defaults(), + sounds = default.node_sound_wood_defaults(), }) minetest.register_craft({ @@ -58,14 +58,14 @@ local function register_board2(output, description, tiles, input1, input2) {-1/2, -5/16, -1/16, 1/2, -3/16, 1/16}, }, }, - + paramtype2 = "facedir", paramtype = "light", use_texture_alpha = techage.CLIP, sunlight_propagates = true, is_ground_content = false, groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, fence = 1}, - sounds = default.node_sound_wood_defaults(), + sounds = default.node_sound_wood_defaults(), }) minetest.register_craft({ diff --git a/techage/ta1_watermill/sluice.lua b/techage/ta1_watermill/sluice.lua index c5048e6..8df01e3 100644 --- a/techage/ta1_watermill/sluice.lua +++ b/techage/ta1_watermill/sluice.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information TA1 Sluice Gate - + ]]-- local S = techage.S @@ -20,27 +20,27 @@ local S2P = minetest.string_to_pos local function check_position(pos, facedir) local dir = minetest.facedir_to_dir(facedir) - local pos_ = vector.add(pos, dir) + local pos_ = vector.add(pos, dir) local node = minetest.get_node(pos_) return (node.name == "default:water_source" or node.name == "default:water_flowing"), pos_ end --- Function checks if water is avaliable and +-- Function checks if water is avaliable and -- returns the pos for the new water block, and the result (true/false). local function has_water(pos, facedir) local res1, pos1 = check_position(pos, (facedir + 1) % 4) local res2, pos2 = check_position(pos, (facedir + 3) % 4) - + if res1 and not res2 then M(pos):set_string("millrace_pos", P2S(pos2)) return pos2, true end - + if not res1 and res2 then M(pos):set_string("millrace_pos", P2S(pos1)) return pos1, true end - + local pos3 = S2P(M(pos):get_string("millrace_pos")) if pos3 then return pos3, true @@ -52,12 +52,12 @@ local function on_rightclick(pos, node, clicker, itemstack, pointed_thing) if minetest.is_protected(pos, clicker:get_player_name()) then return end - + local pos2 = vector.add(pos, {x = 0, y = -1, z = 0}) local node2 = minetest.get_node(pos2) local pos3, res = has_water(pos2, node2.param2) local node3 = minetest.get_node(pos3) - + if node2.name == "techage:ta1_sluice_closed" then minetest.swap_node(pos, {name = "techage:ta1_sluice_handle_open", param2 = node.param2}) minetest.swap_node(pos2, {name = "techage:ta1_sluice_open", param2 = node.param2}) @@ -98,7 +98,7 @@ minetest.register_node("techage:ta1_sluice_closed", { {-1/16, -5/16, -7/16, 1/16, 8/16, 7/16}, }, }, - + paramtype2 = "facedir", paramtype = "light", use_texture_alpha = techage.CLIP, @@ -120,7 +120,7 @@ minetest.register_node("techage:ta1_sluice_open", { {-8/16, -8/16, -8/16, 8/16, -5/16, 8/16}, }, }, - + paramtype2 = "facedir", paramtype = "light", use_texture_alpha = techage.CLIP, diff --git a/techage/ta1_watermill/ta1_axle.lua b/techage/ta1_watermill/ta1_axle.lua index 69c8e22..51aaa5a 100644 --- a/techage/ta1_watermill/ta1_axle.lua +++ b/techage/ta1_watermill/ta1_axle.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA1 Axles for the Watermill ]]-- @@ -22,7 +22,7 @@ local Axle = tubelib2.Tube:new({ max_tube_length = 10, show_infotext = false, tube_type = "axle1", - primary_node_names = {"techage:ta1_axle"}, + primary_node_names = {"techage:ta1_axle"}, secondary_node_names = {"techage:ta1_mill_gear", "techage:ta1_axle_bearing1", "techage:ta1_axle_bearing2"}, after_place_tube = function(pos, param2, tube_type, num_tubes, state) minetest.swap_node(pos, {name = "techage:ta1_axle", param2 = param2}) @@ -50,7 +50,7 @@ minetest.register_node("techage:ta1_axle", { {-1/8, -1/8, -4/8, 1/8, 1/8, 4/8}, }, }, - + after_place_node = function(pos, placer, itemstack, pointed_thing) if not Axle:after_place_tube(pos, placer, pointed_thing) then minetest.remove_node(pos) @@ -58,11 +58,11 @@ minetest.register_node("techage:ta1_axle", { end return false end, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) Axle:after_dig_tube(pos, oldnode, oldmetadata) end, - + paramtype2 = "facedir", -- important! on_rotate = screwdriver.disallow, -- important! paramtype = "light", @@ -88,15 +88,15 @@ minetest.register_node("techage:ta1_axle_bearing1", { {-1/8, -1/8, -1/2, 1/8, 1/8, 1/2}, }, }, - + after_place_node = function(pos, placer) - Axle:after_place_node(pos) + Axle:after_place_node(pos) end, after_dig_node = function(pos, oldnode, oldmetadata, digger) Axle:after_dig_node(pos) end, - + paramtype2 = "facedir", paramtype = "light", use_texture_alpha = techage.CLIP, @@ -116,15 +116,15 @@ minetest.register_node("techage:ta1_axle_bearing2", { "default_stone_brick.png^techage_axle_bearing_front.png", "default_stone_brick.png^techage_axle_bearing_front.png", }, - + after_place_node = function(pos, placer) - Axle:after_place_node(pos) + Axle:after_place_node(pos) end, after_dig_node = function(pos, oldnode, oldmetadata, digger) Axle:after_dig_node(pos) end, - + paramtype2 = "facedir", paramtype = "light", use_texture_alpha = techage.CLIP, @@ -136,7 +136,7 @@ minetest.register_node("techage:ta1_axle_bearing2", { techage.register_node({"techage:ta1_axle_bearing1", "techage:ta1_axle_bearing2"}, { on_transfer = function(pos, in_dir, topic, payload) return techage.transfer( - pos, + pos, in_dir, -- outdir topic, payload, diff --git a/techage/ta1_watermill/watermill.lua b/techage/ta1_watermill/watermill.lua index b029ae9..898031d 100644 --- a/techage/ta1_watermill/watermill.lua +++ b/techage/ta1_watermill/watermill.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information TA1 Watermill - + ]]-- local M = minetest.get_meta @@ -24,8 +24,8 @@ local function calc_dir(dir, facedir) return {x = -dir.z, y = dir.y, z = dir.x} end return {x = dir.x, y = dir.y, z = dir.z} -end - +end + local function add_node(pos, dir, facedir, node_name) local pos2 = vector.add(pos, calc_dir(dir, facedir)) local node = minetest.get_node(pos2) @@ -45,7 +45,7 @@ end local function water_flowing(pos, facedir, tRes) facedir = ((facedir or 0) + 1) % 4 local dir = minetest.facedir_to_dir(facedir) - + local pos2 = vector.add(pos, dir) pos2.y = pos2.y + 1 local node = minetest.get_node(pos2) @@ -53,7 +53,7 @@ local function water_flowing(pos, facedir, tRes) tRes.backward = false return true end - + pos2 = vector.subtract(pos, dir) pos2.y = pos2.y + 1 node = minetest.get_node(pos2) @@ -67,7 +67,7 @@ local function enough_space(pos, facedir) local pos1 = vector.add(pos, calc_dir({x =-1, y =-1, z = 0}, facedir)) local pos2 = vector.add(pos, calc_dir({x = 1, y = 1, z = 0}, facedir)) local _, nodes = minetest.find_nodes_in_area(pos1, pos2, {"air"}) - return nodes["air"] and nodes["air"] == 8 + return nodes["air"] and nodes["air"] == 8 end local function remove_nodes(pos, facedir) @@ -91,7 +91,7 @@ local function start_wheel(pos, facedir, backward) end local self = obj:get_luaentity() self.facedir = facedir - + add_node(pos, {x = 0, y = 1, z = 0}, facedir, "techage:water_stop") add_node(pos, {x =-1, y = 0, z = 0}, facedir, "techage:water_stop") add_node(pos, {x = 1, y = 0, z = 0}, facedir, "techage:water_stop") @@ -113,7 +113,7 @@ local function stop_wheel(pos, self) M(pos):set_int("facedir", self.facedir) minetest.get_node_timer(pos):start(2) end - + remove_nodes(pos, self.facedir) self.object:remove() end @@ -121,7 +121,7 @@ end local function trigger_consumer(pos, facedir) local outdir = facedir + 1 local resp = techage.transfer( - pos, + pos, outdir, -- outdir "trigger", -- topic nil, -- payload @@ -130,7 +130,7 @@ local function trigger_consumer(pos, facedir) if not resp then outdir = tubelib2.Turn180Deg[outdir] resp = techage.transfer( - pos, + pos, outdir, -- outdir "trigger", -- topic nil, -- payload @@ -155,12 +155,12 @@ minetest.register_node("techage:ta1_watermill", { type = "fixed", fixed = { {-1/2, -1/2, -1/2, 1/2, 1/2, 1/2}, - + {-4.5/2, -1/2, 0.8/2, 4.5/2, 1/2, 1.0/2}, {-4.5/2, -1/2, -1.0/2, 4.5/2, 1/2, -0.8/2}, {-3.8/2, -1/2, 2.1/2, 3.8/2, 1/2, 2.3/2}, {-3.8/2, -1/2, -2.3/2, 3.8/2, 1/2, -2.1/2}, - + { 0.8/2, -1/2, -4.5/2, 1.0/2, 1/2, 4.5/2}, {-1.0/2, -1/2, -4.5/2, -0.8/2, 1/2, 4.5/2}, { 2.1/2, -1/2, -3.8/2, 2.3/2, 1/2, 3.8/2}, @@ -170,7 +170,7 @@ minetest.register_node("techage:ta1_watermill", { on_rightclick = function(pos, node, clicker) start_wheel(pos, M(pos):get_int("facedir")) end, - + on_timer = function(pos, elapsed) local tRes = {} if water_flowing(pos, M(pos):get_int("facedir"), tRes) then @@ -178,7 +178,7 @@ minetest.register_node("techage:ta1_watermill", { end return true end, - + paramtype2 = "facedir", paramtype = "light", use_texture_alpha = techage.CLIP, @@ -208,19 +208,19 @@ minetest.register_node("techage:ta1_watermill_inv", { type = "fixed", fixed = { {-1/4, -1/4, -1/4, 1/4, 1/4, 1/4}, - + {-4.5/4, 0.8/4, -1/4, 4.5/4, 1.0/4, 1/4}, {-4.5/4, -1.0/4, -1/4, 4.5/4, -0.8/4, 1/4}, {-3.8/4, 2.1/4, -1/4, 3.8/4, 2.3/4, 1/4}, {-3.8/4, -2.3/4, -1/4, 3.8/4, -2.1/4, 1/4}, - + { 0.8/4, -4.5/4, -1/4, 1.0/4, 4.5/4, 1/4}, {-1.0/4, -4.5/4, -1/4, -0.8/4, 4.5/4, 1/4}, { 2.1/4, -3.8/4, -1/4, 2.3/4, 3.8/4, 1/4}, {-2.3/4, -3.8/4, -1/4, -2.1/4, 3.8/4, 1/4}, }, }, - + after_place_node = function(pos, placer) local node = minetest.get_node(pos) M(pos):set_int("facedir", node.param2) @@ -236,7 +236,7 @@ minetest.register_node("techage:ta1_watermill_inv", { return true end end, - + paramtype2 = "facedir", node_placement_prediction = "", diggable = false, @@ -246,7 +246,7 @@ techage.register_node({"techage:ta1_watermill"}, { on_node_load = function(pos, node) minetest.get_node_timer(pos):start(2) end, -}) +}) minetest.register_entity("techage:ta1_watermill_entity", { @@ -260,10 +260,10 @@ minetest.register_entity("techage:ta1_watermill_entity", { automatic_rotate = -math.pi * 0.2, pointable = false, }, - + on_step = function(self, dtime) self.dtime = (self.dtime or 0) + dtime - + if self.dtime > 2 then self.dtime = 0 local pos = vector.round(self.object:get_pos()) @@ -275,7 +275,7 @@ minetest.register_entity("techage:ta1_watermill_entity", { max_hear_distance = 10}, true) end end, - + on_rightclick = function(self, clicker) local pos = vector.round(self.object:get_pos()) stop_wheel(pos, self) @@ -284,7 +284,7 @@ minetest.register_entity("techage:ta1_watermill_entity", { on_activate = function(self, staticdata) self.facedir = tonumber(staticdata) or 0 end, - + get_staticdata = function(self) return self.facedir end, @@ -295,7 +295,7 @@ minetest.register_node("techage:water_stop", { drawtype = "glasslike_framed_optional", tiles = {"techage_invisible.png"}, inventory_image = 'techage_invisible_inv.png', - + use_texture_alpha = "blend", paramtype = "light", walkable = false, diff --git a/techage/ta2_energy_storage/ta2_rope.lua b/techage/ta2_energy_storage/ta2_rope.lua index 18ecf9e..492461e 100644 --- a/techage/ta2_energy_storage/ta2_rope.lua +++ b/techage/ta2_energy_storage/ta2_rope.lua @@ -42,7 +42,7 @@ local function add_rope(pos, pos1, pos2) pos2.y = pos2.y - 0.5 -- to local pos3 = {x = pos1.x, y = (pos1.y + pos2.y) / 2, z = pos1.z} -- mid-pos local length = math.abs(pos1.y - pos2.y) - + local rope = minetest.add_entity(pos3, "techage:ta2_rope") if rope then rope:set_properties({visual_size = {x = 0.06, y = length}, collisionbox = {x = 0.06, y = length}}) diff --git a/techage/ta2_energy_storage/ta2_weight_chest.lua b/techage/ta2_energy_storage/ta2_weight_chest.lua index f2f915f..16b97b0 100644 --- a/techage/ta2_energy_storage/ta2_weight_chest.lua +++ b/techage/ta2_energy_storage/ta2_weight_chest.lua @@ -7,9 +7,9 @@ GPL v3 See LICENSE.txt for more information - + Chest for TA2 gravity-based energy storage - + ]]-- -- for lazy programmers @@ -106,7 +106,7 @@ minetest.register_node("techage:ta2_weight_chest", { local inv = meta:get_inventory() inv:set_size('main', 10) end, - + after_place_node = function(pos) local meta = minetest.get_meta(pos) meta:set_string("formspec", formspec()) @@ -115,7 +115,7 @@ minetest.register_node("techage:ta2_weight_chest", { techage_set_numbers = function(pos, numbers, player_name) return techage.logic.set_numbers(pos, numbers, player_name, S("TA2 Weight Chest")) end, - + can_dig = can_dig, after_dig_node = after_dig_node, allow_metadata_inventory_put = allow_metadata_inventory_put, @@ -135,4 +135,3 @@ minetest.register_craft({ {"", "", ""}, }, }) - diff --git a/techage/ta2_energy_storage/ta2_winch.lua b/techage/ta2_energy_storage/ta2_winch.lua index 8a29064..19308a9 100644 --- a/techage/ta2_energy_storage/ta2_winch.lua +++ b/techage/ta2_energy_storage/ta2_winch.lua @@ -7,9 +7,9 @@ GPL v3 See LICENSE.txt for more information - + Winch for TA2 gravity-based energy storage - + ]]-- -- for lazy programmers @@ -44,7 +44,7 @@ local function chest_load(nvm, pos) end return amount end - + local function chest_full(pos) local nvm = techage.get_nvm(pos) local pos1 = chest_pos(pos) @@ -53,7 +53,7 @@ local function chest_full(pos) return chest_load(nvm, pos1) >= MIN_LOAD end end - + local function add_chest_entity(pos, nvm) local mem = techage.get_mem(pos) local length = (nvm.length or MAX_ROPE_LEN) * (1 - (nvm.load or 0) / (nvm.capa or 1)) @@ -72,8 +72,8 @@ local function add_chest(pos) if mem.obj then mem.obj:remove() mem.obj = nil - end - if nvm.capa and nvm.capa >= MIN_LOAD then + end + if nvm.capa and nvm.capa >= MIN_LOAD then local pos1 = {x = pos.x, y = pos.y - (nvm.length or 1) - 1, z = pos.z} minetest.add_node(pos1, {name = "techage:ta2_weight_chest", param2 = 0}) local ndef = minetest.registered_nodes["techage:ta2_weight_chest"] @@ -85,7 +85,7 @@ local function add_chest(pos) end end nvm.capa = 0 -end +end -- Remove chest node, add rope and chest entity instead local function remove_chest(pos) @@ -101,7 +101,7 @@ local function remove_chest(pos) techage.renew_rope(pos, nvm.length) return true end -end +end minetest.register_node("techage:ta2_winch", { description = S("TA2 Winch"), @@ -129,7 +129,7 @@ minetest.register_node("techage:ta2_winch", { local outdir = M(pos):get_int("outdir") nvm.capa = nvm.capa or 1 nvm.load = nvm.load or 0 - + if not nvm.running and power.power_available(pos, Axle, outdir) and chest_full(pos) then remove_chest(pos) nvm.running = true @@ -139,9 +139,9 @@ minetest.register_node("techage:ta2_winch", { nvm.running = false power.start_storage_calc(pos, Axle, outdir) end - + if nvm.running then - local val = power.get_storage_load(pos, Axle, outdir, nvm.capa) or 0 + local val = power.get_storage_load(pos, Axle, outdir, nvm.capa) or 0 if val > 0 then nvm.load = val add_chest_entity(pos, nvm) @@ -149,7 +149,7 @@ minetest.register_node("techage:ta2_winch", { end return true end, - + after_dig_node = function(pos, oldnode, oldmetadata) add_chest(pos) techage.del_rope(pos) @@ -158,7 +158,7 @@ minetest.register_node("techage:ta2_winch", { Axle:after_dig_node(pos, {outdir}) techage.del_mem(pos) end, - + get_storage_data = function(pos, outdir, tlib2) local nvm = techage.get_nvm(pos) nvm.capa = nvm.capa or 1 @@ -166,7 +166,7 @@ minetest.register_node("techage:ta2_winch", { return {level = (nvm.load or 0) / nvm.capa, capa = nvm.capa} end end, - + paramtype2 = "facedir", groups = {choppy=2, cracky=2, crumbly=2}, is_ground_content = false, @@ -191,4 +191,3 @@ minetest.register_craft({ {"farming:string", "farming:string", "farming:string"}, }, }) - diff --git a/techage/ta3_power/akkubox.lua b/techage/ta3_power/akkubox.lua index 0b3bb40..f856c6f 100644 --- a/techage/ta3_power/akkubox.lua +++ b/techage/ta3_power/akkubox.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3 Accu Box ]]-- @@ -28,7 +28,7 @@ local in_range = techage.in_range local function formspec(self, pos, nvm) local data - + if nvm.running then local outdir = M(pos):get_int("outdir") data = power.get_network_data(pos, Cable, outdir) @@ -69,7 +69,7 @@ local function node_timer(pos, elapsed) if techage.is_activeformspec(pos) then M(pos):set_string("formspec", formspec(State, pos, nvm)) end - return true + return true end local function on_rightclick(pos, node, clicker) @@ -129,7 +129,7 @@ end local function after_dig_node(pos, oldnode, oldmetadata, digger) local outdir = tonumber(oldmetadata.fields.outdir or 0) - Cable:after_dig_node(pos, {outdir}) + Cable:after_dig_node(pos, {outdir}) techage.remove_node(pos, oldnode, oldmetadata) techage.del_mem(pos) end diff --git a/techage/ta3_power/axle2power.lua b/techage/ta3_power/axle2power.lua index 4bc252b..39b8522 100644 --- a/techage/ta3_power/axle2power.lua +++ b/techage/ta3_power/axle2power.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information TA2 Power Generator - + ]]-- -- for lazy programmers @@ -39,11 +39,11 @@ local function node_timer_on(pos, elapsed) local nvm = techage.get_nvm(pos) local outdir = meta:get_int("outdir") nvm.buffer = nvm.buffer or 0 - + local amount = math.min(PWR_PERF * 2 - nvm.buffer, PWR_PERF) local taken = power.consume_power(pos, Axle, networks.Flip[outdir], amount) nvm.buffer = nvm.buffer + taken - 1 -- some loss - + if nvm.buffer >= PWR_PERF then local tp1 = tonumber(meta:get_string("termpoint1")) local tp2 = tonumber(meta:get_string("termpoint2")) @@ -59,11 +59,11 @@ local function node_timer_on(pos, elapsed) end return true end - + local function node_timer_off(pos, elapsed) local nvm = techage.get_nvm(pos) local outdir = M(pos):get_int("outdir") - + if power.power_available(pos, Axle, networks.Flip[outdir]) then swap_node(pos, "techage:ta2_generator_on") nvm.running = true @@ -100,16 +100,16 @@ minetest.register_node("techage:ta2_generator_off", { M(pos):set_int("outdir", networks.side_to_outdir(pos, "R")) Cable:after_place_node(pos) Axle:after_place_node(pos) - minetest.get_node_timer(pos):start(CYCLE_TIME) + minetest.get_node_timer(pos):start(CYCLE_TIME) M(pos):set_string("infotext", S("TA2 Power Generator")) end, - + after_dig_node = function(pos, oldnode) Cable:after_dig_node(pos) Axle:after_dig_node(pos) techage.del_mem(pos) end, - + on_timer = node_timer_off, get_generator_data = get_generator_data, }) @@ -180,4 +180,3 @@ minetest.register_craft({ {"default:wood", "techage:iron_ingot", "basic_materials:steel_bar"}, }, }) - diff --git a/techage/ta3_power/power2axle.lua b/techage/ta3_power/power2axle.lua index 13c7f4a..76bad03 100644 --- a/techage/ta3_power/power2axle.lua +++ b/techage/ta3_power/power2axle.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information TA3 Electric Motor - + ]]-- -- for lazy programmers @@ -44,11 +44,11 @@ local function node_timer_on(pos, elapsed) local nvm = techage.get_nvm(pos) local outdir = M(pos):get_int("outdir") nvm.buffer = nvm.buffer or 0 - + local amount = math.min(PWR_PERF * 2 - nvm.buffer, PWR_PERF) local taken = power.consume_power(pos, Cable, networks.Flip[outdir], amount) nvm.buffer = nvm.buffer + taken - 1 -- some loss - + if nvm.buffer >= PWR_PERF then nvm.provided = power.provide_power(pos, Axle, outdir, PWR_PERF) nvm.load = power.get_storage_load(pos, Axle, outdir, PWR_PERF) @@ -63,11 +63,11 @@ local function node_timer_on(pos, elapsed) end return true end - + local function node_timer_off(pos, elapsed) local nvm = techage.get_nvm(pos) local outdir = M(pos):get_int("outdir") - + if power.power_available(pos, Cable) then swap_node(pos, "techage:ta3_motor_on") switch_axles(pos, true) @@ -104,16 +104,16 @@ minetest.register_node("techage:ta3_motor_off", { M(pos):set_int("outdir", networks.side_to_outdir(pos, "R")) Cable:after_place_node(pos) Axle:after_place_node(pos) - minetest.get_node_timer(pos):start(CYCLE_TIME) + minetest.get_node_timer(pos):start(CYCLE_TIME) M(pos):set_string("infotext", S("TA3 Electric Motor")) end, - + after_dig_node = function(pos, oldnode) Cable:after_dig_node(pos) Axle:after_dig_node(pos) techage.del_mem(pos) end, - + on_timer = node_timer_off, get_generator_data = get_generator_data, }) @@ -184,4 +184,3 @@ minetest.register_craft({ {"default:wood", "techage:iron_ingot", "basic_materials:steel_bar"}, }, }) - diff --git a/techage/ta3_power/tiny_generator.lua b/techage/ta3_power/tiny_generator.lua index ee98127..3b172bd 100644 --- a/techage/ta3_power/tiny_generator.lua +++ b/techage/ta3_power/tiny_generator.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3 Tiny Power Generator ]]-- @@ -47,7 +47,7 @@ local function play_sound(pos) local mem = techage.get_mem(pos) if not mem.handle or mem.handle == -1 then mem.handle = minetest.sound_play("techage_generator", { - pos = pos, + pos = pos, gain = 1, max_hear_distance = 10, loop = true}) @@ -70,8 +70,8 @@ local function has_fuel(pos, nvm) end local function can_start(pos, nvm, state) - if has_fuel(pos, nvm) then - return true + if has_fuel(pos, nvm) then + return true end return S("no fuel") end @@ -106,7 +106,7 @@ local State = techage.NodeStates:new({ local function burning(pos, nvm) local ratio = math.max((nvm.provided or PWR_PERF) / PWR_PERF, 0.02) - + nvm.liquid = nvm.liquid or {} nvm.liquid.amount = nvm.liquid.amount or 0 nvm.burn_cycles = (nvm.burn_cycles or 0) - ratio @@ -116,7 +116,7 @@ local function burning(pos, nvm) nvm.burn_cycles = fuel.burntime(nvm.liquid.name) * EFFICIENCY / CYCLE_TIME nvm.burn_cycles_total = nvm.burn_cycles else - nvm.liquid.name = nil + nvm.liquid.name = nil end end end @@ -211,7 +211,7 @@ minetest.register_node("techage:tiny_generator", { Pipe:after_place_node(pos) Cable:after_place_node(pos) end, - + after_dig_node = function(pos, oldnode) Pipe:after_dig_node(pos) Cable:after_dig_node(pos) @@ -232,7 +232,7 @@ minetest.register_node("techage:tiny_generator", { end, get_generator_data = get_generator_data, - ta3_formspec = techage.generator_settings("ta3", PWR_PERF), + ta3_formspec = techage.generator_settings("ta3", PWR_PERF), on_receive_fields = on_receive_fields, on_rightclick = on_rightclick, on_punch = fuel.on_punch, @@ -268,7 +268,7 @@ minetest.register_node("techage:tiny_generator_on", { }, }, }, - + paramtype = "light", paramtype2 = "facedir", groups = {not_in_creative_inventory=1}, @@ -278,7 +278,7 @@ minetest.register_node("techage:tiny_generator_on", { is_ground_content = false, get_generator_data = get_generator_data, - ta3_formspec = techage.generator_settings("ta3", PWR_PERF), + ta3_formspec = techage.generator_settings("ta3", PWR_PERF), on_receive_fields = on_receive_fields, on_rightclick = on_rightclick, on_punch = fuel.on_punch, @@ -352,9 +352,9 @@ techage.register_node({"techage:tiny_generator", "techage:tiny_generator_on"}, { nvm.liquid.amount = (nvm.liquid.amount or 0) + count nvm.liquid.name = "techage:gasoline" inv:set_stack("fuel", 1, nil) - end + end end, -}) +}) minetest.register_craft({ output = "techage:tiny_generator", @@ -364,4 +364,3 @@ minetest.register_craft({ {'default:steel_ingot', 'techage:vacuum_tube', 'default:steel_ingot'}, }, }) - diff --git a/techage/ta4_power/electricmeter.lua b/techage/ta4_power/electricmeter.lua index f6ce2c1..75c149b 100644 --- a/techage/ta4_power/electricmeter.lua +++ b/techage/ta4_power/electricmeter.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA4 Electric Meter (to separate networks) ]]-- @@ -28,7 +28,7 @@ local control = networks.control local function formspec(self, pos, nvm, power) local units = (nvm.units or 0) / techage.CYCLES_PER_DAY power = power or 0 - + return "size[5,4]" .. default.gui_bg .. default.gui_bg_img .. @@ -81,7 +81,7 @@ local function node_timer(pos, elapsed) if techage.is_activeformspec(pos) then M(pos):set_string("formspec", formspec(State, pos, nvm, nvm.moved)) end - return true + return true end local function on_rightclick(pos, node, clicker) @@ -109,7 +109,7 @@ end local function after_dig_node(pos, oldnode, oldmetadata, digger) local outdir = tonumber(oldmetadata.fields.outdir or 0) - Cable:after_dig_node(pos, {outdir, networks.Flip[outdir]}) + Cable:after_dig_node(pos, {outdir, networks.Flip[outdir]}) techage.del_mem(pos) end @@ -175,7 +175,7 @@ control.register_nodes({"techage:ta4_electricmeter"}, { running = techage.is_running(nvm) or false, available = PWR_PERF, provided = nvm.moved or 0, - termpoint = "-", + termpoint = "-", } end return false diff --git a/techage/ta4_power/laser.lua b/techage/ta4_power/laser.lua index 779c768..9391d2d 100644 --- a/techage/ta4_power/laser.lua +++ b/techage/ta4_power/laser.lua @@ -7,9 +7,9 @@ GPL v3 See LICENSE.txt for more information - - TA4 Laser beam emitter and receiver - + + TA4 Laser beam emitter and receiver + ]]-- -- for lazy programmers @@ -46,8 +46,8 @@ minetest.register_node("techage:ta4_laser_emitter", { Cable:pairing(pos2, "laser") Cable:pairing(pos, "laser") else - minetest.chat_send_player(placer:get_player_name(), - S("Valid destination positions:") .. " " .. + minetest.chat_send_player(placer:get_player_name(), + S("Valid destination positions:") .. " " .. P2S(pos1) .. " " .. S("to") .. " " .. P2S(pos2)) end else @@ -82,14 +82,14 @@ minetest.register_node("techage:ta4_laser_emitter", { end return true end, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) techage.del_laser(pos) Cable:stop_pairing(pos, oldmetadata, "") local tube_dir = tonumber(oldmetadata.fields.tube_dir or 0) Cable:after_dig_node(pos, {tube_dir}) end, - + paramtype2 = "facedir", groups = {choppy=2, cracky=2, crumbly=2}, is_ground_content = false, @@ -119,7 +119,7 @@ minetest.register_node("techage:ta4_laser_receiver", { local tube_dir = tonumber(oldmetadata.fields.tube_dir or 0) Cable:after_dig_node(pos, {tube_dir}) end, - + paramtype2 = "facedir", groups = {choppy=2, cracky=2, crumbly=2}, is_ground_content = false, @@ -156,4 +156,3 @@ minetest.register_craft({ {"default:steel_ingot", "techage:ta4_wlanchip", "default:steel_ingot"}, }, }) - diff --git a/techage/ta4_power/transformer.lua b/techage/ta4_power/transformer.lua index 374bce6..225df2c 100644 --- a/techage/ta4_power/transformer.lua +++ b/techage/ta4_power/transformer.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA4 Isolation Transformer (to separate networks) ]]-- @@ -79,7 +79,7 @@ local function node_timer(pos, elapsed) if techage.is_activeformspec(pos) then M(pos):set_string("formspec", formspec(State, pos, nvm, data)) end - return true + return true end local function on_rightclick(pos, node, clicker) @@ -107,7 +107,7 @@ end local function after_dig_node(pos, oldnode, oldmetadata, digger) local outdir = tonumber(oldmetadata.fields.outdir or 0) - Cable:after_dig_node(pos, {outdir, networks.Flip[outdir]}) + Cable:after_dig_node(pos, {outdir, networks.Flip[outdir]}) techage.del_mem(pos) end @@ -165,7 +165,7 @@ control.register_nodes({"techage:ta4_transformer"}, { running = techage.is_running(nvm) or false, available = PWR_PERF, provided = nvm.moved or 0, - termpoint = "-", + termpoint = "-", } end return false diff --git a/techage/teleport/teleport_pipe.lua b/techage/teleport/teleport_pipe.lua index 0fd5aa7..10b0454 100644 --- a/techage/teleport/teleport_pipe.lua +++ b/techage/teleport/teleport_pipe.lua @@ -95,7 +95,7 @@ minetest.register_node("techage:ta5_tele_pipe", { Cable:after_place_node(pos) teleport.prepare_pairing(pos, "ta5_tele_pipe") end, - + on_receive_fields = function(pos, formname, fields, player) if minetest.is_protected(pos, player:get_player_name()) then return @@ -115,9 +115,9 @@ minetest.register_node("techage:ta5_tele_pipe", { M(pos):set_string("formspec", formspec(State, pos, nvm)) else M(pos):set_string("formspec", teleport.formspec(pos)) - end + end end, - + on_timer = function(pos, elapsed) local nvm = techage.get_nvm(pos) consume_power(pos, nvm) @@ -125,7 +125,7 @@ minetest.register_node("techage:ta5_tele_pipe", { State:idle(pos, nvm) return State:is_active(nvm) end, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) techage.remove_node(pos, oldnode, oldmetadata) teleport.stop_pairing(pos, oldmetadata) @@ -188,4 +188,3 @@ techage.register_node({"techage:ta5_tele_pipe"}, { power.register_nodes({"techage:ta5_tele_pipe"}, Cable, "con", {"B", "R", "F", "D", "U"}) Pipe:set_valid_sides("techage:ta5_tele_pipe", {"L"}) - diff --git a/techage/teleport/teleport_tube.lua b/techage/teleport/teleport_tube.lua index ce6d0c9..747a018 100644 --- a/techage/teleport/teleport_tube.lua +++ b/techage/teleport/teleport_tube.lua @@ -94,7 +94,7 @@ minetest.register_node("techage:ta5_tele_tube", { Cable:after_place_node(pos) teleport.prepare_pairing(pos, "ta5_tele_tube") end, - + on_receive_fields = function(pos, formname, fields, player) if minetest.is_protected(pos, player:get_player_name()) then return @@ -114,9 +114,9 @@ minetest.register_node("techage:ta5_tele_tube", { M(pos):set_string("formspec", formspec(State, pos, nvm)) else M(pos):set_string("formspec", teleport.formspec(pos)) - end + end end, - + on_timer = function(pos, elapsed) local nvm = techage.get_nvm(pos) consume_power(pos, nvm) @@ -124,7 +124,7 @@ minetest.register_node("techage:ta5_tele_tube", { State:idle(pos, nvm) return State:is_active(nvm) end, - + after_dig_node = function(pos, oldnode, oldmetadata, digger) techage.remove_node(pos, oldnode, oldmetadata) teleport.stop_pairing(pos, oldmetadata) @@ -177,4 +177,3 @@ techage.register_node({"techage:ta5_tele_tube"}, { power.register_nodes({"techage:ta5_tele_tube"}, Cable, "con", {"B", "R", "F", "D", "U"}) Tube:set_valid_sides("techage:ta5_tele_tube", {"L"}) - diff --git a/techage/tools/pipe_wrench.lua b/techage/tools/pipe_wrench.lua index 78f67e8..27182df 100644 --- a/techage/tools/pipe_wrench.lua +++ b/techage/tools/pipe_wrench.lua @@ -7,18 +7,18 @@ local function remove_pipe(itemstack, user, pointed_thing) return itemstack end end - + if(pos ~= nil) then local node = minetest.get_node(pos) if(node.name == "techage:oil_drillbit2") then minetest.set_node(pos, {name = "air"}) itemstack:add_wear(65636/200) return itemstack - + end -- if(node.name - + end -- if(pos ~= nil) - + end -- remove_pipe diff --git a/techage/tools/repairkit.lua b/techage/tools/repairkit.lua index 7778ac0..eef67cd 100644 --- a/techage/tools/repairkit.lua +++ b/techage/tools/repairkit.lua @@ -34,7 +34,7 @@ local function network_check(start_pos, Cable, player_name) -- techage.mark_position(player_name, pos, state, "#ff0000", 6) -- end -- end) -end +end local function read_state(itemstack, user, pointed_thing) local pos = pointed_thing.under @@ -43,24 +43,24 @@ local function read_state(itemstack, user, pointed_thing) local hours = math.floor(time / 6) local mins = (time % 6) * 10 if mins < 10 then mins = "00" end - + local number = techage.get_node_number(pos) local node = minetest.get_node(pos) local ndef = minetest.registered_nodes[node.name] - + if node.name == "default:water_source" then local player_name = user:get_player_name() techage.valid_place_for_windturbine(pos, player_name, 0) return itemstack end - + minetest.chat_send_player(user:get_player_name(), S("Time")..": "..hours..":"..mins.." ") local data = minetest.get_biome_data(pos) if data then local name = minetest.get_biome_name(data.biome) minetest.chat_send_player(user:get_player_name(), S("Biome")..": "..name..", "..S("Position temperature")..": "..math.floor(data.heat).." ") end - + if ndef and ndef.networks then local player_name = user:get_player_name() if ndef.networks.ele1 then @@ -71,7 +71,7 @@ local function read_state(itemstack, user, pointed_thing) network_check(pos, Pipe2, player_name) end end - + if number then if ndef and ndef.description then local info = techage.send_single("0", number, "info", nil) @@ -150,12 +150,12 @@ local function settings_menu(pos, playername) if access == "private" and playername ~= owner then return end - + local number = techage.get_node_number(pos) local node = minetest.get_node(pos) local ndef = minetest.registered_nodes[node.name] local form_def - + if ndef then if ndef.ta3_formspec or ndef.ta4_formspec then form_def = ndef.ta3_formspec or ndef.ta4_formspec @@ -166,10 +166,10 @@ local function settings_menu(pos, playername) end end end - + context[playername] = pos if form_def then - minetest.show_formspec(playername, "techage:ta_formspec", + minetest.show_formspec(playername, "techage:ta_formspec", menu.generate_formspec(pos, ndef, form_def, playername)) end end @@ -178,7 +178,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) if formname ~= "techage:ta_formspec" then return false end - + local playername = player:get_player_name() local pos = context[playername] if pos then @@ -187,12 +187,12 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) local node = minetest.get_node(pos) local ndef = minetest.registered_nodes[node.name] local form_def = ndef and (ndef.ta3_formspec or ndef.ta4_formspec or ndef.ta5_formspec.menu) - + if form_def then if menu.eval_input(pos, form_def, fields, playername) then --context[playername] = pos minetest.after(0.2, function() - minetest.show_formspec(playername, "techage:ta_formspec", + minetest.show_formspec(playername, "techage:ta_formspec", menu.generate_formspec(pos, ndef, form_def, playername)) end) if ndef.ta_after_formspec then @@ -247,4 +247,3 @@ minetest.register_craft({ {"default:steel_ingot", "", ""}, }, }) - diff --git a/techage/tools/trowel.lua b/techage/tools/trowel.lua index 2fa697d..bffeb91 100644 --- a/techage/tools/trowel.lua +++ b/techage/tools/trowel.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + Trowel tool to hide/open cable/pipe/tube nodes ]]-- @@ -36,7 +36,7 @@ local function replace_node(itemstack, placer, pointed_thing) end if res then minetest.sound_play("default_dig_snappy", { - pos = pos, + pos = pos, gain = 1, max_hear_distance = 5}) elseif placer and placer.get_player_name then diff --git a/techage/wind_turbine/pillar.lua b/techage/wind_turbine/pillar.lua index cf75f7f..11551d2 100644 --- a/techage/wind_turbine/pillar.lua +++ b/techage/wind_turbine/pillar.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - + pillar - + ]]-- local S = techage.S diff --git a/techage/wind_turbine/rotor.lua b/techage/wind_turbine/rotor.lua index 97a6b26..5be96d2 100644 --- a/techage/wind_turbine/rotor.lua +++ b/techage/wind_turbine/rotor.lua @@ -9,12 +9,12 @@ See LICENSE.txt for more information TA4 Power Wind Turbine Rotor - + Code by Joachim Stolberg, derived from DS-Minetest [1] Rotor model and texture designed by DS-Minetest [1] (CC-0) - + [1] https://github.com/DS-Minetest/wind_turbine - + ]]-- -- for lazy programmers @@ -28,7 +28,7 @@ local COUNTDOWN_TICKS = 2 local Cable = techage.ElectricCable local power = networks.power -local control = networks.control +local control = networks.control local Rotors = {} @@ -60,20 +60,20 @@ local function check_rotor(pos, nvm) nvm.error = err return false end - + local npos = techage.get_pos(pos, "F") local node = techage.get_node_lvm(npos) if node.name ~= "techage:ta4_wind_turbine_nacelle" then nvm.error = S("Nacelle is missing") return false end - + local own_num = M(pos):get_string("node_number") or "" M(pos):set_string("infotext", S("TA4 Wind Turbine")..": "..own_num) nvm.error = false return true end - + local function formspec(self, pos, nvm) return techage.generator_formspec(self, pos, nvm, S("TA4 Wind Turbine"), nvm.provided, PWR_PERF) end @@ -91,7 +91,7 @@ local function add_rotor(pos, nvm, force) obj:set_rotation(yaw) Rotors[hash] = obj end -end +end local function start_rotor(pos, nvm, state) if not nvm.error then @@ -216,7 +216,7 @@ minetest.register_node("techage:ta4_wind_turbine", { "techage_rotor.png", "techage_rotor.png^techage_appl_open.png", }, - + after_place_node = after_place_node, after_dig_node = after_dig_node, get_generator_data = get_generator_data, @@ -245,7 +245,7 @@ control.register_nodes({"techage:ta4_wind_turbine"}, { running = techage.is_running(nvm) or false, available = PWR_PERF, provided = nvm.provided or 0, - termpoint = meta:get_string("termpoint"), + termpoint = meta:get_string("termpoint"), } end return false @@ -280,7 +280,7 @@ minetest.register_entity("techage:rotor_ent", {initial_properties = { static_save = false, }}) -techage.register_node({"techage:ta4_wind_turbine"}, { +techage.register_node({"techage:ta4_wind_turbine"}, { on_recv_message = function(pos, src, topic, payload) local nvm = techage.get_nvm(pos) if topic == "state" then @@ -355,8 +355,8 @@ minetest.register_craft({ }) techage.furnace.register_recipe({ - output = "techage:ta4_carbon_fiber", - recipe = {"default:papyrus", "default:stick", "default:papyrus", "default:stick"}, + output = "techage:ta4_carbon_fiber", + recipe = {"default:papyrus", "default:stick", "default:papyrus", "default:stick"}, heat = 4, time = 3, }) diff --git a/techage/wind_turbine/signallamp.lua b/techage/wind_turbine/signallamp.lua index a1be480..e4884e4 100644 --- a/techage/wind_turbine/signallamp.lua +++ b/techage/wind_turbine/signallamp.lua @@ -9,7 +9,7 @@ See LICENSE.txt for more information Colored Signal Lamp (requires unifieddyes) - + ]]-- -- for lazy programmers @@ -24,12 +24,12 @@ local COLORED = minetest.get_modpath("unifieddyes") and minetest.global_exists(" local function switch_on(pos, node) node.name = "techage:signal_lamp_on" minetest.swap_node(pos, node) -end +end local function switch_off(pos, node) node.name = "techage:signal_lamp_off" minetest.swap_node(pos, node) -end +end minetest.register_node("techage:rotor_signal_lamp_off", { description = S("TA4 Wind Turbine Signal Lamp"), @@ -76,7 +76,7 @@ minetest.register_node("techage:rotor_signal_lamp_on", { minetest.swap_node(pos, {name = "techage:rotor_signal_lamp_off"}) return true end, - + paramtype = "light", use_texture_alpha = techage.CLIP, light_source = 8, @@ -107,4 +107,3 @@ minetest.register_craft({ {"", "default:glass", ""}, }, }) -