diff --git a/.test/sink.lua b/.test/sink.lua index ec32e83..d9def94 100644 --- a/.test/sink.lua +++ b/.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 = "", @@ -109,4 +109,4 @@ minetest.register_node("techage:sink_on", { sounds = default.node_sound_wood_defaults(), }) -power.register_nodes({"techage:sink", "techage:sink_on"}, Cable, "con") +power.register_nodes({"techage:sink", "techage:sink_on"}, Cable, "con") \ No newline at end of file diff --git a/basic_machines/autocrafter.lua b/basic_machines/autocrafter.lua index 5a0e733..3d73cb3 100644 --- a/basic_machines/autocrafter.lua +++ b/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, @@ -511,4 +511,4 @@ local power = networks.power techage.register_node_for_v1_transition({"techage:ta3_autocrafter_pas", "techage:ta4_autocrafter_pas"}, function(pos, node) power.update_network(pos, nil, Cable) -end) +end) \ No newline at end of file diff --git a/basic_machines/blackhole.lua b/basic_machines/blackhole.lua index 3deb033..bed8e11 100644 --- a/basic_machines/blackhole.lua +++ b/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 @@ -86,4 +86,4 @@ liquid.register_nodes({"techage:blackhole"}, put = put_liquid, take = take_liquid, } -) +) \ No newline at end of file diff --git a/basic_machines/chest.lua b/basic_machines/chest.lua index 5d66ffa..ea42799 100644 --- a/basic_machines/chest.lua +++ b/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", @@ -442,4 +442,4 @@ minetest.register_craft({ type = "shapeless", output = "techage:chest_ta4", recipe = {"techage:chest_ta3", "default:chest"} -}) +}) \ No newline at end of file diff --git a/basic_machines/concentrator.lua b/basic_machines/concentrator.lua index eed6f43..a240fc8 100644 --- a/basic_machines/concentrator.lua +++ b/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({ @@ -123,4 +123,4 @@ minetest.register_craft({ {"techage:ta4_tubeS", "", "techage:ta4_tubeS"}, {"", "techage:ta4_tubeS", ""}, }, -}) +}) \ No newline at end of file diff --git a/basic_machines/consumer.lua b/basic_machines/consumer.lua index f745a59..8dd1cb4 100644 --- a/basic_machines/consumer.lua +++ b/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)) @@ -300,4 +300,4 @@ function techage.register_consumer(base_name, inv_name, tiles, tNode, validState end end return names[1], names[2], names[3], names[4] -end +end \ No newline at end of file diff --git a/basic_machines/distributor.lua b/basic_machines/distributor.lua index b5ac378..eed6ba9 100644 --- a/basic_machines/distributor.lua +++ b/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, @@ -599,4 +599,4 @@ minetest.register_craft({ {node_name_ta4, "default:copper_ingot"}, {"default:mese_crystal_fragment", node_name_ta4}, }, -}) +}) \ No newline at end of file diff --git a/basic_machines/electronic_fab.lua b/basic_machines/electronic_fab.lua index 96a875b..6487412 100644 --- a/basic_machines/electronic_fab.lua +++ b/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/basic_machines/forceload.lua b/basic_machines/forceload.lua index fdbde0c..7c1636c 100644 --- a/basic_machines/forceload.lua +++ b/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 + 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 {} @@ -202,10 +202,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 +236,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(), @@ -304,4 +304,4 @@ minetest.register_chatcommand("forceload", { return false, S("Priv missing") end end, -}) +}) \ No newline at end of file diff --git a/basic_machines/foreign_nodes.lua b/basic_machines/foreign_nodes.lua index b87ebf3..13faa36 100644 --- a/basic_machines/foreign_nodes.lua +++ b/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, -}) +}) \ No newline at end of file diff --git a/basic_machines/gravelrinser.lua b/basic_machines/gravelrinser.lua index 3df776f..cff4611 100644 --- a/basic_machines/gravelrinser.lua +++ b/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/basic_machines/gravelsieve.lua b/basic_machines/gravelsieve.lua index 3152d3c..2513567 100644 --- a/basic_machines/gravelsieve.lua +++ b/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", -}) +}) \ No newline at end of file diff --git a/basic_machines/grinder.lua b/basic_machines/grinder.lua index ec20d1a..7e413ac 100644 --- a/basic_machines/grinder.lua +++ b/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"}) @@ -422,4 +422,4 @@ if minetest.global_exists("farming") then techage.add_grinder_recipe({input="farming:seed_rice 6", output="farming:rice_flour"}, true) techage.add_grinder_recipe({input="farming:oat 3", output="farming:flour"}, true) techage.add_grinder_recipe({input="farming:seed_oat 6", output="farming:flour"}, true) -end +end \ No newline at end of file diff --git a/basic_machines/itemsource.lua b/basic_machines/itemsource.lua index ac908d7..c034d05 100644 --- a/basic_machines/itemsource.lua +++ b/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, -}) +}) \ No newline at end of file diff --git a/basic_machines/liquidsampler.lua b/basic_machines/liquidsampler.lua index ab4d695..0a4ca84 100644 --- a/basic_machines/liquidsampler.lua +++ b/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/basic_machines/mods_support.lua b/basic_machines/mods_support.lua index bebf06b..43c1137 100644 --- a/basic_machines/mods_support.lua +++ b/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,5 @@ techage.register_node({"protector:chest"}, { local inv = meta:get_inventory() return techage.put_items(inv, "main", stack) end, -}) - +}) diff --git a/basic_machines/pusher.lua b/basic_machines/pusher.lua index 9da7d43..9568d8a 100644 --- a/basic_machines/pusher.lua +++ b/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/basic_machines/quarry.lua b/basic_machines/quarry.lua index d87200a..8b89d1e 100644 --- a/basic_machines/quarry.lua +++ b/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, @@ -425,4 +425,4 @@ minetest.register_craft({ {"", node_name_ta3, ""}, {"", "techage:ta4_wlanchip", ""}, }, -}) +}) \ No newline at end of file diff --git a/basic_machines/recipeblock.lua b/basic_machines/recipeblock.lua index 3e34cc5..37f39b4 100644 --- a/basic_machines/recipeblock.lua +++ b/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/basic_machines/recycler.lua b/basic_machines/recycler.lua index f2adfc2..900568a 100644 --- a/basic_machines/recycler.lua +++ b/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 @@ -349,4 +349,4 @@ local function collect_recipes() end end -minetest.after(2, collect_recipes) +minetest.after(2, collect_recipes) \ No newline at end of file diff --git a/basic_machines/source.lua b/basic_machines/source.lua index 14eefa2..0c12fb8 100644 --- a/basic_machines/source.lua +++ b/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/basic_machines/ta4_chest.lua b/basic_machines/ta4_chest.lua index 62b0551..90483cb 100644 --- a/basic_machines/ta4_chest.lua +++ b/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", @@ -647,4 +647,4 @@ minetest.register_craft({ type = "shapeless", output = "techage:chest_ta4", recipe = {"techage:ta4_chest"} -}) +}) \ No newline at end of file diff --git a/basic_machines/ta4_injector.lua b/basic_machines/ta4_injector.lua index 15e6a02..30d158b 100644 --- a/basic_machines/ta4_injector.lua +++ b/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(), @@ -294,4 +294,4 @@ minetest.register_craft({ {"", "techage:ta4_pusher_pas", ""}, {"", "basic_materials:ic", ""}, }, -}) +}) \ No newline at end of file diff --git a/basic_machines/ta5_chest.lua b/basic_machines/ta5_chest.lua index 222525d..65da8f8 100644 --- a/basic_machines/ta5_chest.lua +++ b/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,11 +175,11 @@ techage.register_node({"techage:ta5_hl_chest"}, { return "unsupported" end end, -}) +}) minetest.register_craft({ type = "shapeless", output = "techage:ta5_hl_chest", recipe = {"techage:chest_ta4", "techage:ta5_aichip"} -}) +}) \ No newline at end of file diff --git a/basis/assemble.lua b/basis/assemble.lua index b176495..daafa81 100644 --- a/basis/assemble.lua +++ b/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,10 +232,10 @@ 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} -- 0 = forward, 1 = right, 2 = backward, 3 = left -- techage.assemble.get_pos(pos, param2, route, y_offs) -techage.assemble.get_pos = dest_pos +techage.assemble.get_pos = dest_pos \ No newline at end of file diff --git a/basis/boiler_lib.lua b/basis/boiler_lib.lua index 0b805aa..bd7c566 100644 --- a/basis/boiler_lib.lua +++ b/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/basis/command.lua b/basis/command.lua index 1cd93fb..9eb90d2 100644 --- a/basis/command.lua +++ b/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 @@ -624,4 +624,4 @@ minetest.register_chatcommand("my_expoints", { end end end -}) +}) \ No newline at end of file diff --git a/basis/conf_inv.lua b/basis/conf_inv.lua index 88aa4f3..65aa23d 100644 --- a/basis/conf_inv.lua +++ b/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 diff --git a/basis/counting.lua b/basis/counting.lua index 33db84d..dd00a5e 100644 --- a/basis/counting.lua +++ b/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/basis/fake_player.lua b/basis/fake_player.lua index 40c9371..3526762 100644 --- a/basis/fake_player.lua +++ b/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/basis/firebox_lib.lua b/basis/firebox_lib.lua index 28e6807..0767080 100644 --- a/basis/firebox_lib.lua +++ b/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/basis/fly_lib.lua b/basis/fly_lib.lua index 8cc8d19..b5ec939 100644 --- a/basis/fly_lib.lua +++ b/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 @@ -730,4 +730,4 @@ minetest.register_on_dieplayer(function(player) end end) -return flylib +return flylib \ No newline at end of file diff --git a/basis/formspec_update.lua b/basis/formspec_update.lua index b42b173..2256f55 100644 --- a/basis/formspec_update.lua +++ b/basis/formspec_update.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + Keep only one formspec active per player ]]-- @@ -49,4 +49,4 @@ minetest.register_on_leaveplayer(function(player) ActiveFormspecs[ActivePlayer[name]] = nil ActivePlayer[name] = nil end -end) +end) \ No newline at end of file diff --git a/basis/fuel_lib.lua b/basis/fuel_lib.lua index d7fb569..605caca 100644 --- a/basis/fuel_lib.lua +++ b/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 diff --git a/basis/gravel_lib.lua b/basis/gravel_lib.lua index 53b21f2..4a16150 100644 --- a/basis/gravel_lib.lua +++ b/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) @@ -93,4 +93,4 @@ function techage.gravelsieve_get_random_basalt_ore() else return ItemStack("techage:sieved_basalt_gravel") end -end +end \ No newline at end of file diff --git a/basis/hyperloop.lua b/basis/hyperloop.lua index d5e1c64..a694e32 100644 --- a/basis/hyperloop.lua +++ b/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/basis/laser_lib.lua b/basis/laser_lib.lua index 135fe61..5126af6 100644 --- a/basis/laser_lib.lua +++ b/basis/laser_lib.lua @@ -143,4 +143,4 @@ function techage.add_laser(pos, pos1, pos2) end -- techage.del_laser(pos) -techage.del_laser = del_laser +techage.del_laser = del_laser \ No newline at end of file diff --git a/basis/legacy.lua b/basis/legacy.lua index 1578262..90c40d7 100644 --- a/basis/legacy.lua +++ b/basis/legacy.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + For the transition from v0.26 to v1.0 ]]-- @@ -22,4 +22,4 @@ function techage.register_node_for_v1_transition(nodenames, on_node_load) on_node_load(pos, node) end }) -end +end \ No newline at end of file diff --git a/basis/lib.lua b/basis/lib.lua index 6b83c27..33043dc 100644 --- a/basis/lib.lua +++ b/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 @@ -546,4 +546,4 @@ function techage.set_expoints(player, ex_points) return true end end -end +end \ No newline at end of file diff --git a/basis/liquid_lib.lua b/basis/liquid_lib.lua index 967f560..205e755 100644 --- a/basis/liquid_lib.lua +++ b/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) @@ -254,4 +254,4 @@ techage.liquid.get_full_container = get_full_container techage.liquid.fill_container = fill_container techage.liquid.empty_container = empty_container techage.liquid.fill_on_punch = fill_on_punch -techage.liquid.empty_on_punch = empty_on_punch +techage.liquid.empty_on_punch = empty_on_punch \ No newline at end of file diff --git a/basis/manual.lua b/basis/manual.lua index c70e0a6..29b0446 100644 --- a/basis/manual.lua +++ b/basis/manual.lua @@ -90,4 +90,3 @@ techage.manual_DE.aPlanTable = { "", } - diff --git a/basis/mark.lua b/basis/mark.lua index 538bae7..8058b1f 100644 --- a/basis/mark.lua +++ b/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/basis/mark2.lua b/basis/mark2.lua index 7ea7e12..ab1124e 100644 --- a/basis/mark2.lua +++ b/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/basis/mark_lib.lua b/basis/mark_lib.lua index 8cc52ce..1894f29 100644 --- a/basis/mark_lib.lua +++ b/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) diff --git a/basis/node_states.lua b/basis/node_states.lua index ea4a29d..7dfa900 100644 --- a/basis/node_states.lua +++ b/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) @@ -503,4 +503,4 @@ minetest.register_node("techage:defect_dummy", { drop = "", groups = {cracky=2, crumbly=2, choppy=2, not_in_creative_inventory=1}, is_ground_content = false, -}) +}) \ No newline at end of file diff --git a/basis/node_store.lua b/basis/node_store.lua index 23c1438..935734f 100644 --- a/basis/node_store.lua +++ b/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,9 +161,9 @@ 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 backend.store_mapblock_data(key1, NvmStore[key1]) -end +end \ No newline at end of file diff --git a/basis/nodedata_meta.lua b/basis/nodedata_meta.lua index e179e7e..485bc69 100644 --- a/basis/nodedata_meta.lua +++ b/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 @@ -99,4 +99,4 @@ function api.restore_at_startup() return {} end -return api +return api \ No newline at end of file diff --git a/basis/nodedata_sqlite.lua b/basis/nodedata_sqlite.lua index f241c5b..2ba0efd 100644 --- a/basis/nodedata_sqlite.lua +++ b/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") @@ -116,4 +116,4 @@ function api.restore_at_startup() return {} end -return api +return api \ No newline at end of file diff --git a/basis/numbers_sqlite.lua b/basis/numbers_sqlite.lua index c4cf717..9447aa0 100644 --- a/basis/numbers_sqlite.lua +++ b/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 +return api \ No newline at end of file diff --git a/basis/numbers_storage.lua b/basis/numbers_storage.lua index 8e42d58..8b35b04 100644 --- a/basis/numbers_storage.lua +++ b/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 +return backend \ No newline at end of file diff --git a/basis/oggfiles.lua b/basis/oggfiles.lua index ffe7c82..7fe17ea 100644 --- a/basis/oggfiles.lua +++ b/basis/oggfiles.lua @@ -100,4 +100,4 @@ techage.OggFileList = { "default_wood_footstep", -- ./games/minetest_game/mods/default/sounds "default_furnace_active", -- ./games/minetest_game/mods/default/sounds "default_item_smoke", -- ./games/minetest_game/mods/default/sounds -} +} \ No newline at end of file diff --git a/basis/recipe_lib.lua b/basis/recipe_lib.lua index 76306d3..e545c5d 100644 --- a/basis/recipe_lib.lua +++ b/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") @@ -276,4 +276,4 @@ techage.recipes.register_craft = function(def) } unified_inventory.register_craft(ui_def) end -end +end \ No newline at end of file diff --git a/basis/shared_inv.lua b/basis/shared_inv.lua index 3f375af..4169d3e 100644 --- a/basis/shared_inv.lua +++ b/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/basis/shared_tank.lua b/basis/shared_tank.lua index 5d0b1fe..bdd0fdd 100644 --- a/basis/shared_tank.lua +++ b/basis/shared_tank.lua @@ -39,7 +39,7 @@ function techage.shared_tank.node_timer(pos) if techage.is_activeformspec(pos) then M(pos):set_string("formspec", formspec(pos)) return true - end + end return false end @@ -47,10 +47,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 @@ -74,7 +74,7 @@ function techage.shared_tank.take_liquid(pos, indir, name, amount) end return amount, name end - + function techage.shared_tank.put_liquid(pos, indir, name, amount) pos = remote_pos(pos) -- check if it is not powder diff --git a/basis/submenu.lua b/basis/submenu.lua index f7011db..a5ebfeb 100644 --- a/basis/submenu.lua +++ b/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 -end + return fields.refresh or fields.save or fields.key_enter_field +end \ No newline at end of file diff --git a/basis/teleport.lua b/basis/teleport.lua index 4184c33..4628975 100644 --- a/basis/teleport.lua +++ b/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) @@ -164,4 +164,4 @@ function techage.teleport.after_formspec(pos, player, fields, max_dist, ex_point M(pos):set_string("status", S("Ex-points missing (@1 < @2)", techage.get_expoints(player), ex_points)) M(pos):set_string("formspec", techage.teleport.formspec(pos)) end -end +end \ No newline at end of file diff --git a/basis/tube_wall_entry.lua b/basis/tube_wall_entry.lua index 9c66b06..3ada768 100644 --- a/basis/tube_wall_entry.lua +++ b/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}, @@ -54,4 +54,4 @@ minetest.register_craft({ {"", "basic_materials:concrete_block", ""}, {"", "",""}, }, -}) +}) \ No newline at end of file diff --git a/basis/tubes.lua b/basis/tubes.lua index 5f3d440..315f30c 100644 --- a/basis/tubes.lua +++ b/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 = { @@ -145,4 +145,4 @@ minetest.register_craft({ {"", "group:wood", ""}, {"group:wood", "", "default:tin_ingot"}, }, -}) +}) \ No newline at end of file diff --git a/basis/tubes_ta4.lua b/basis/tubes_ta4.lua index 0902a31..71a5f60 100644 --- a/basis/tubes_ta4.lua +++ b/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 = { @@ -117,4 +117,4 @@ minetest.register_craft({ techage.TA4tubes = { ["techage:ta4_tubeS"] = true, ["techage:ta4_tubeA"] = true, -} +} \ No newline at end of file diff --git a/basis/windturbine_lib.lua b/basis/windturbine_lib.lua index 5299bd6..db9fe02 100644 --- a/basis/windturbine_lib.lua +++ b/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,10 +71,10 @@ 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!")) end return true, "ok" -end +end \ No newline at end of file diff --git a/carts/chest_cart.lua b/carts/chest_cart.lua index 64361ce..7d8f78c 100644 --- a/carts/chest_cart.lua +++ b/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"}) @@ -169,4 +169,4 @@ minetest.register_craft({ {"default:junglewood", "default:chest_locked", "default:junglewood"}, {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"}, }, -}) +}) \ No newline at end of file diff --git a/carts/tank_cart.lua b/carts/tank_cart.lua index d3654ac..4f88007 100644 --- a/carts/tank_cart.lua +++ b/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"}, { @@ -173,4 +173,4 @@ minetest.register_craft({ {"default:junglewood", "techage:ta3_tank", "default:junglewood"}, {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"}, }, -}) +}) \ No newline at end of file diff --git a/chemistry/ta4_doser.lua b/chemistry/ta4_doser.lua index 886e8b3..9ac813e 100644 --- a/chemistry/ta4_doser.lua +++ b/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, @@ -376,4 +376,4 @@ minetest.register_craft({ {"techage:ta3_pipeS", "techage:t4_pump", "techage:ta3_pipeS"}, {"", "techage:ta4_wlanchip", ""}, }, -}) +}) \ No newline at end of file diff --git a/chemistry/ta4_liquid_filter.lua b/chemistry/ta4_liquid_filter.lua index de85e61..0fd81dc 100644 --- a/chemistry/ta4_liquid_filter.lua +++ b/chemistry/ta4_liquid_filter.lua @@ -8,7 +8,7 @@ AGPL v3 See LICENSE.txt for more information - + TA4 Liquid Filter ]]-- @@ -206,4 +206,4 @@ minetest.register_craft({ {'basic_materials:concrete_block', 'techage:ta3_pipeS', 'techage:ta3_pipeS'}, {'basic_materials:concrete_block', 'basic_materials:concrete_block', 'basic_materials:concrete_block'}, } -}) +}) \ No newline at end of file diff --git a/chemistry/ta4_reactor.lua b/chemistry/ta4_reactor.lua index 3377aca..154b5f5 100644 --- a/chemistry/ta4_reactor.lua +++ b/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, @@ -201,4 +201,4 @@ minetest.register_lbm({ inv:set_size('main', 1) M(pos):set_string("formspec", formspec()) end, -}) +}) \ No newline at end of file diff --git a/chemistry/ta4_stand.lua b/chemistry/ta4_stand.lua index 77db92f..043ee96 100644 --- a/chemistry/ta4_stand.lua +++ b/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}, @@ -206,4 +206,4 @@ minetest.register_craft({ {'techage:ta3_pipeS', '', ''}, {'', '', ''}, } -}) +}) \ No newline at end of file diff --git a/coal_power_station/boiler_base.lua b/coal_power_station/boiler_base.lua index a2b39e5..73c37d5 100644 --- a/coal_power_station/boiler_base.lua +++ b/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/coal_power_station/boiler_top.lua b/coal_power_station/boiler_top.lua index 050b61a..9ec177f 100644 --- a/coal_power_station/boiler_top.lua +++ b/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/coal_power_station/cooler.lua b/coal_power_station/cooler.lua index 148cfb3..3cb2aae 100644 --- a/coal_power_station/cooler.lua +++ b/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/coal_power_station/firebox.lua b/coal_power_station/firebox.lua index bdb7c4c..3129d04 100644 --- a/coal_power_station/firebox.lua +++ b/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") @@ -216,4 +216,4 @@ minetest.register_craft({ {'default:steel_ingot', '', 'default:steel_ingot'}, {'default:stone', 'default:stone', 'default:stone'}, }, -}) +}) \ No newline at end of file diff --git a/coal_power_station/generator.lua b/coal_power_station/generator.lua index fc875ef..3f62e11 100644 --- a/coal_power_station/generator.lua +++ b/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 @@ -262,4 +262,4 @@ minetest.register_craft({ {"", "basic_materials:gear_steel", "techage:electric_cableS"}, {"default:wood", "techage:iron_ingot", "basic_materials:steel_bar"}, }, -}) +}) \ No newline at end of file diff --git a/coal_power_station/oilfirebox.lua b/coal_power_station/oilfirebox.lua index eff5593..b1f1922 100644 --- a/coal_power_station/oilfirebox.lua +++ b/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, @@ -143,4 +143,3 @@ minetest.register_craft({ }, }) - diff --git a/coal_power_station/turbine.lua b/coal_power_station/turbine.lua index 479d489..5d825e4 100644 --- a/coal_power_station/turbine.lua +++ b/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/collider/cooler.lua b/collider/cooler.lua index 4161b08..e5f1871 100644 --- a/collider/cooler.lua +++ b/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/collider/detector.lua b/collider/detector.lua index 6a38a27..c7af236 100644 --- a/collider/detector.lua +++ b/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,7 +144,7 @@ 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 @@ -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/collider/inlets.lua b/collider/inlets.lua index 10bd185..c64feba 100644 --- a/collider/inlets.lua +++ b/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", @@ -361,4 +361,4 @@ minetest.register_craft({ {'techage:electric_cableS', 'techage:ta4_colliderblock', ''}, {'', '', ''}, }, -}) +}) \ No newline at end of file diff --git a/collider/magnet.lua b/collider/magnet.lua index b7314f3..19dedb8 100644 --- a/collider/magnet.lua +++ b/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"), diff --git a/collider/terminal.lua b/collider/terminal.lua index 3d1c7ea..43aa0f7 100644 --- a/collider/terminal.lua +++ b/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, @@ -205,4 +205,4 @@ techage.register_node({"techage:ta4_terminal"}, { return true end end, -}) +}) \ No newline at end of file diff --git a/collider/vacuumtube.lua b/collider/vacuumtube.lua index ad5b2be..e099a7a 100644 --- a/collider/vacuumtube.lua +++ b/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", @@ -127,4 +127,4 @@ minetest.register_craft({ {'techage:aluminum', 'dye:blue', 'techage:aluminum'}, {'', 'default:steel_ingot', ''}, }, -}) +}) \ No newline at end of file diff --git a/collider/worker.lua b/collider/worker.lua index dba2139..bc04421 100644 --- a/collider/worker.lua +++ b/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/digtron/battery.lua b/digtron/battery.lua index 515c314..74f2d80 100644 --- a/digtron/battery.lua +++ b/digtron/battery.lua @@ -172,4 +172,4 @@ minetest.register_craft({ {"techage:electric_cableS", "default:tin_ingot", "digtron:digtron_core"}, {"group:wood", "default:copper_ingot", "group:wood"}, }, -}) +}) \ No newline at end of file diff --git a/doc/guide.lua b/doc/guide.lua index b65e121..b46f540 100644 --- a/doc/guide.lua +++ b/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, @@ -230,4 +230,4 @@ minetest.register_craft({ type = "shapeless", output = "techage:construction_board", recipe = {"techage:construction_board_EN"}, -}) +}) \ No newline at end of file diff --git a/doc/items.lua b/doc/items.lua index dfd00cc..8c6bbdf 100644 --- a/doc/items.lua +++ b/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", diff --git a/doc/manual_DE.lua b/doc/manual_DE.lua index 42350d4..1bc55ac 100644 --- a/doc/manual_DE.lua +++ b/doc/manual_DE.lua @@ -2555,4 +2555,3 @@ techage.manual_DE.aPlanTable = { "", "", } - diff --git a/doc/manual_EN.lua b/doc/manual_EN.lua index 92db02d..04b29e4 100644 --- a/doc/manual_EN.lua +++ b/doc/manual_EN.lua @@ -2548,4 +2548,3 @@ techage.manual_EN.aPlanTable = { "", "", } - diff --git a/doc/manual_api.lua b/doc/manual_api.lua index d133de3..5a814a0 100644 --- a/doc/manual_api.lua +++ b/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 @@ -38,4 +38,3 @@ function techage.add_to_manual(language, titles, texts, items, plans) end end - diff --git a/doc/plans.lua b/doc/plans.lua index b2c50f4..679969b 100644 --- a/doc/plans.lua +++ b/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"} @@ -497,4 +497,4 @@ function techage.add_manual_plans(table_with_plans) for name, tbl in pairs(table_with_plans) do techage.ConstructionPlans[name] = tbl end -end +end \ No newline at end of file diff --git a/energy_storage/generator.lua b/energy_storage/generator.lua index ef0c30c..ff88d5b 100644 --- a/energy_storage/generator.lua +++ b/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}, @@ -129,4 +129,3 @@ minetest.register_craft({ }, }) - diff --git a/energy_storage/heatexchanger1.lua b/energy_storage/heatexchanger1.lua index 198f587..6efc2bb 100644 --- a/energy_storage/heatexchanger1.lua +++ b/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/energy_storage/heatexchanger2.lua b/energy_storage/heatexchanger2.lua index d914355..cf9a91e 100644 --- a/energy_storage/heatexchanger2.lua +++ b/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, @@ -397,4 +397,4 @@ minetest.register_craft({ {"", "techage:ta4_wlanchip", ""}, {"", "techage:baborium_ingot", ""}, }, -}) +}) \ No newline at end of file diff --git a/energy_storage/heatexchanger3.lua b/energy_storage/heatexchanger3.lua index 70f3713..b2f863b 100644 --- a/energy_storage/heatexchanger3.lua +++ b/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 = {}, }, @@ -99,4 +99,4 @@ minetest.register_craft({ }, }) -techage.orientate_node = orientate_node +techage.orientate_node = orientate_node \ No newline at end of file diff --git a/energy_storage/inlet.lua b/energy_storage/inlet.lua index c9632b8..42a8c11 100644 --- a/energy_storage/inlet.lua +++ b/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") @@ -171,4 +171,4 @@ minetest.register_craft({ type = 'shapeless', output = "techage:ta4_pipe_inlet", recipe = {"basic_materials:concrete_block", "techage:ta4_pipeS"}, -}) +}) \ No newline at end of file diff --git a/energy_storage/nodes.lua b/energy_storage/nodes.lua index dcb0f8d..e23b834 100644 --- a/energy_storage/nodes.lua +++ b/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/energy_storage/turbine.lua b/energy_storage/turbine.lua index 69e248f..3231639 100644 --- a/energy_storage/turbine.lua +++ b/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/fermenter/gasflare.lua b/fermenter/gasflare.lua index 191d57d..f41ceee 100644 --- a/fermenter/gasflare.lua +++ b/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,10 +173,10 @@ minetest.register_node("techage:gasflare2", { }, }, paramtype = "light", - light_source = 0, + light_source = 0, sunlight_propagates = true, paramtype2 = "facedir", diggable = false, is_ground_content = false, sounds = default.node_sound_stone_defaults(), -}) +}) \ No newline at end of file diff --git a/furnace/booster.lua b/furnace/booster.lua index 8e8be01..123a442 100644 --- a/furnace/booster.lua +++ b/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/furnace/cooking.lua b/furnace/cooking.lua index 8e07c09..3624206 100644 --- a/furnace/cooking.lua +++ b/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 diff --git a/furnace/firebox.lua b/furnace/firebox.lua index 813a78b..e10ce91 100644 --- a/furnace/firebox.lua +++ b/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)) + Pipe, "tank", nil, fuel.get_liquid_table(fuel.BT_OIL, fuel.CAPACITY, start_firebox)) \ No newline at end of file diff --git a/furnace/furnace_top.lua b/furnace/furnace_top.lua index 52e7642..e49e748 100644 --- a/furnace/furnace_top.lua +++ b/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/furnace/heater.lua b/furnace/heater.lua index e7a4be6..be0bf84 100644 --- a/furnace/heater.lua +++ b/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", @@ -133,4 +133,4 @@ minetest.register_craft({ {'techage:basalt_stone', 'basic_materials:heating_element', 'techage:basalt_stone'}, {'techage:aluminum', 'techage:ta4_furnace_ceramic', 'techage:aluminum'}, }, -}) +}) \ No newline at end of file diff --git a/furnace/recipes.lua b/furnace/recipes.lua index b853ea2..7788420 100644 --- a/furnace/recipes.lua +++ b/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'}, @@ -167,4 +167,4 @@ if minetest.global_exists("moreores") then time = 5, }) -end +end \ No newline at end of file diff --git a/hydrogen/electrolyzer.lua b/hydrogen/electrolyzer.lua index fb96019..c3cc336 100644 --- a/hydrogen/electrolyzer.lua +++ b/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/hydrogen/fuelcell.lua b/hydrogen/fuelcell.lua index 6fabbab..6721d59 100644 --- a/hydrogen/fuelcell.lua +++ b/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 @@ -334,4 +334,4 @@ minetest.register_craft({ {'techage:ta3_pipeS', 'techage:ta4_fuelcellstack', 'techage:electric_cableS'}, {'default:steel_ingot', "techage:ta4_wlanchip", 'default:steel_ingot'}, }, -}) +}) \ No newline at end of file diff --git a/hydrogen/fuelcellstack.lua b/hydrogen/fuelcellstack.lua index 237c6be..6bc14f7 100644 --- a/hydrogen/fuelcellstack.lua +++ b/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/icta_controller/action.lua b/icta_controller/action.lua index be315cb..89ee53b 100644 --- a/icta_controller/action.lua +++ b/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/icta_controller/battery.lua b/icta_controller/battery.lua index 2d84c7d..aa75a41 100644 --- a/icta_controller/battery.lua +++ b/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) @@ -176,4 +176,4 @@ techage.register_node({"techage:ta4_battery"}, { return "unsupported" end end, -}) +}) \ No newline at end of file diff --git a/icta_controller/commands.lua b/icta_controller/commands.lua index 74354c6..09d1b47 100644 --- a/icta_controller/commands.lua +++ b/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/icta_controller/condition.lua b/icta_controller/condition.lua index 9cb64e0..b407d74 100644 --- a/icta_controller/condition.lua +++ b/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/icta_controller/controller.lua b/icta_controller/controller.lua index 998ed82..7c3292e 100644 --- a/icta_controller/controller.lua +++ b/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/icta_controller/display.lua b/icta_controller/display.lua index fa01b42..e2a182d 100644 --- a/icta_controller/display.lua +++ b/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/icta_controller/edit.lua b/icta_controller/edit.lua index 7e8e7a7..b113855 100644 --- a/icta_controller/edit.lua +++ b/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 @@ -37,4 +37,4 @@ function techage.edit_command(fs_data, text) return "row "..pos1.." deleted" end return "Invalid command '"..text.."'" -end +end \ No newline at end of file diff --git a/icta_controller/formspec.lua b/icta_controller/formspec.lua index 09bd4b7..aa24986 100644 --- a/icta_controller/formspec.lua +++ b/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) @@ -240,4 +240,4 @@ function techage.formspecHelp(offs) "label[0,"..(-offs/50)..";"..sHELP.."]".. --"label[0.2,0;test]".. "scrollbar[12,1;0.5,7;vertical;sb_help;"..offs.."]" -end +end \ No newline at end of file diff --git a/icta_controller/signaltower.lua b/icta_controller/signaltower.lua index cf3f723..35f74e8 100644 --- a/icta_controller/signaltower.lua +++ b/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, -}) +}) \ No newline at end of file diff --git a/icta_controller/submenu.lua b/icta_controller/submenu.lua index b865c0b..4f2f272 100644 --- a/icta_controller/submenu.lua +++ b/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 @@ -34,7 +34,7 @@ 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 tbl[#tbl+1] = "field[0.3,"..(offs+0.2)..";8,1;"..elem.name..";;"..val.."]" @@ -58,7 +58,7 @@ local function default_data(kvDefinition, kvSelect) 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 @@ -67,47 +67,47 @@ 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 + 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 @@ -132,33 +132,33 @@ 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 + 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 +184,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 +195,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 +212,3 @@ function techage.submenu_eval_input(kvDefinition, lKeys, lChoice, kvSelect, fiel end return kvSelect end - diff --git a/init.lua b/init.lua index 61dfbd1..b88a121 100644 --- a/init.lua +++ b/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") @@ -402,4 +402,4 @@ dofile(MP.."/teleport/teleport_pipe.lua") techage.IE = nil -function techage.icta_register_condition(key, tData) end +function techage.icta_register_condition(key, tData) end \ No newline at end of file diff --git a/iron_age/charcoalpile.lua b/iron_age/charcoalpile.lua index abd7422..f344069 100644 --- a/iron_age/charcoalpile.lua +++ b/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/iron_age/coalburner.lua b/iron_age/coalburner.lua index bd2db0d..f9d6a07 100644 --- a/iron_age/coalburner.lua +++ b/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 @@ -247,4 +247,3 @@ function techage.stop_burner(pos) meta:set_int("burn_time", 0) end - diff --git a/iron_age/gravelsieve.lua b/iron_age/gravelsieve.lua index e2b6fc7..2ef5446 100644 --- a/iron_age/gravelsieve.lua +++ b/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/iron_age/hammer.lua b/iron_age/hammer.lua index 5c5a360..058bfbd 100644 --- a/iron_age/hammer.lua +++ b/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/iron_age/hopper.lua b/iron_age/hopper.lua index 374eb0f..442a07e 100644 --- a/iron_age/hopper.lua +++ b/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", }, } @@ -89,4 +89,4 @@ minecart.register_inventory( listname = "dst", }, } -) +) \ No newline at end of file diff --git a/iron_age/lighter.lua b/iron_age/lighter.lua index abfc009..8885f0d 100644 --- a/iron_age/lighter.lua +++ b/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/iron_age/main.lua b/iron_age/main.lua index cd5bab5..eb2d59f 100644 --- a/iron_age/main.lua +++ b/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/iron_age/meltingpot.lua b/iron_age/meltingpot.lua index 5a286e6..0d3a406 100644 --- a/iron_age/meltingpot.lua +++ b/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/iron_age/meridium.lua b/iron_age/meridium.lua index 292502b..e456444 100644 --- a/iron_age/meridium.lua +++ b/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/iron_age/recipes.lua b/iron_age/recipes.lua index c00e7ea..4169811 100644 --- a/iron_age/recipes.lua +++ b/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/iron_age/tools.lua b/iron_age/tools.lua index c0db0bb..3316ebc 100644 --- a/iron_age/tools.lua +++ b/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/items/aluminium.lua b/items/aluminium.lua index 0cab2d1..cc07392 100644 --- a/items/aluminium.lua +++ b/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, - -}) + +}) \ No newline at end of file diff --git a/items/baborium.lua b/items/baborium.lua index 47f80b4..52c2223 100644 --- a/items/baborium.lua +++ b/items/baborium.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - + Baborium - + ]]-- local S = techage.S diff --git a/items/barrel.lua b/items/barrel.lua index bf7e961..bca6933 100644 --- a/items/barrel.lua +++ b/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", { @@ -111,4 +111,4 @@ techage.register_liquid("bucket:bucket_river_water", "bucket:bucket_empty", 1, " techage.register_liquid("techage:barrel_water", "techage:ta3_barrel_empty", 10, "techage:water") techage.register_liquid("techage:barrel_river_water", "techage:ta3_barrel_empty", 10, "techage:river_water") -techage.register_liquid("bucket:bucket_lava", "bucket:bucket_empty", 1, "default:lava_source") +techage.register_liquid("bucket:bucket_lava", "bucket:bucket_empty", 1, "default:lava_source") \ No newline at end of file diff --git a/items/basalt.lua b/items/basalt.lua index 8a771d5..1a494aa 100644 --- a/items/basalt.lua +++ b/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 @@ -200,4 +200,4 @@ minetest.register_craft({ techage.add_grinder_recipe({input="techage:basalt_stone", output="techage:basalt_gravel"}) techage.add_grinder_recipe({input="techage:basalt_cobble", output="techage:basalt_gravel"}) techage.add_grinder_recipe({input="techage:basalt_gravel", output="default:clay"}) -techage.add_grinder_recipe({input="techage:sieved_basalt_gravel", output="default:clay"}) +techage.add_grinder_recipe({input="techage:sieved_basalt_gravel", output="default:clay"}) \ No newline at end of file diff --git a/items/bauxit.lua b/items/bauxit.lua index 730bb6d..49ad719 100644 --- a/items/bauxit.lua +++ b/items/bauxit.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - + Bauxite - + ]]-- local S = techage.S @@ -65,4 +65,4 @@ minetest.register_ore({ }) techage.add_grinder_recipe({input="techage:bauxite_cobble", output="techage:bauxite_gravel"}) -techage.add_grinder_recipe({input="techage:bauxite_gravel", output="techage:bauxite_powder"}) +techage.add_grinder_recipe({input="techage:bauxite_gravel", output="techage:bauxite_powder"}) \ No newline at end of file diff --git a/items/cement.lua b/items/cement.lua index 899678d..ccb8b6f 100644 --- a/items/cement.lua +++ b/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/items/ceramic.lua b/items/ceramic.lua index 357fb00..3db98b0 100644 --- a/items/ceramic.lua +++ b/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, }) diff --git a/items/cracking.lua b/items/cracking.lua index 3555de7..6225b91 100644 --- a/items/cracking.lua +++ b/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. ]]-- @@ -89,4 +89,4 @@ techage.recipes.add("ta4_doser", { "techage:hydrogen 1", }, catalyst = "techage:iron_powder", -}) +}) \ No newline at end of file diff --git a/items/electronic.lua b/items/electronic.lua index 49f7a33..f364547 100644 --- a/items/electronic.lua +++ b/items/electronic.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - + Bauxite - + ]]-- local S = techage.S @@ -83,4 +83,4 @@ techage.recipes.add("ta4_electronic_fab", { output = "techage:ta5_aichip 2", input = {"techage:ta4_leds 8", "basic_materials:copper_wire 1", "basic_materials:gold_wire 1", "techage:ta4_silicon_wafer 1"}, ex_points = 10, -}) +}) \ No newline at end of file diff --git a/items/epoxy.lua b/items/epoxy.lua index 21a7efd..ef0e376 100644 --- a/items/epoxy.lua +++ b/items/epoxy.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - - Epoxy - + + Epoxy + ]]-- local S = techage.S diff --git a/items/filling.lua b/items/filling.lua index 55fb0ac..248c718 100644 --- a/items/filling.lua +++ b/items/filling.lua @@ -11,4 +11,4 @@ minetest.register_on_mods_loaded(function() end end networks.register_filling_items(fillings) -end) +end) \ No newline at end of file diff --git a/items/hydrogen.lua b/items/hydrogen.lua index 24b70bd..6cfbc4d 100644 --- a/items/hydrogen.lua +++ b/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", { diff --git a/items/lye.lua b/items/lye.lua index 52cff7d..6ccaefd 100644 --- a/items/lye.lua +++ b/items/lye.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - + Lye - + ]]-- local S = techage.S @@ -41,4 +41,4 @@ techage.recipes.add("ta4_doser", { }) techage.register_liquid("techage:barrel_lye", "techage:ta3_barrel_empty", 10, "techage:lye") -techage.register_liquid("techage:canister_lye", "techage:ta3_canister_empty", 1, "techage:lye") +techage.register_liquid("techage:canister_lye", "techage:ta3_canister_empty", 1, "techage:lye") \ No newline at end of file diff --git a/items/moreblocks.lua b/items/moreblocks.lua index 63a14ba..cb74230 100644 --- a/items/moreblocks.lua +++ b/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", @@ -87,4 +87,4 @@ else register_alias(subname) end end -end +end \ No newline at end of file diff --git a/items/oil.lua b/items/oil.lua index aff256e..40a339e 100644 --- a/items/oil.lua +++ b/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", { @@ -133,4 +133,4 @@ minetest.register_craftitem("techage:ta3_canister_oil", { techage.register_liquid("techage:bucket_oil", "bucket:bucket_empty", 1, "techage:oil_source") techage.register_liquid("techage:ta3_barrel_oil", "techage:ta3_barrel_empty", 10, "techage:oil_source") -techage.register_liquid("techage:ta3_canister_oil", "techage:ta3_canister_empty", 1, "techage:oil_source") +techage.register_liquid("techage:ta3_canister_oil", "techage:ta3_canister_empty", 1, "techage:oil_source") \ No newline at end of file diff --git a/items/petroleum.lua b/items/petroleum.lua index ba82b95..fe9b53f 100644 --- a/items/petroleum.lua +++ b/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/items/plastic.lua b/items/plastic.lua index b7d5bbb..3fddfae 100644 --- a/items/plastic.lua +++ b/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/items/powder.lua b/items/powder.lua index c53cfa6..128d5e7 100644 --- a/items/powder.lua +++ b/items/powder.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - - Powder - + + Powder + ]]-- local S = techage.S @@ -64,4 +64,3 @@ techage.add_grinder_recipe({input="techage:aluminum", output="techage:aluminum_p techage.add_grinder_recipe({input="default:silver_sandstone", output="techage:silver_sandstone_powder"}) - diff --git a/items/redstone.lua b/items/redstone.lua index d1d2950..2008c0f 100644 --- a/items/redstone.lua +++ b/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/items/registered_nodes.lua b/items/registered_nodes.lua index deccdeb..71322c0 100644 --- a/items/registered_nodes.lua +++ b/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 diff --git a/items/silicon.lua b/items/silicon.lua index e426e20..5265a95 100644 --- a/items/silicon.lua +++ b/items/silicon.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - + TA4 Silicon Wafer - + ]]-- local S = techage.S @@ -22,9 +22,9 @@ 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, diff --git a/items/steelmat.lua b/items/steelmat.lua index c54fc93..9a4cba3 100644 --- a/items/steelmat.lua +++ b/items/steelmat.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - + pillar - + ]]-- local S = techage.S diff --git a/items/usmium.lua b/items/usmium.lua index 17d3373..3eb9f52 100644 --- a/items/usmium.lua +++ b/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"}) +techage.add_grinder_recipe({input="techage:usmium_nuggets", output="techage:usmium_powder"}) \ No newline at end of file diff --git a/lamps/ceilinglamp.lua b/lamps/ceilinglamp.lua index b7e79be..d19170a 100644 --- a/lamps/ceilinglamp.lua +++ b/lamps/ceilinglamp.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3/TA4 Ceiling Lamp ]]-- @@ -63,4 +63,4 @@ minetest.register_craft({ type = "shapeless", output = "techage:ceilinglamp_off 3", recipe = {"techage:simplelamp_off", "default:wood", "default:glass"}, -}) +}) \ No newline at end of file diff --git a/lamps/growlight.lua b/lamps/growlight.lua index 9165875..02c4f7d 100644 --- a/lamps/growlight.lua +++ b/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}, @@ -201,4 +201,4 @@ minetest.after(1, function() end end end -end) +end) \ No newline at end of file diff --git a/lamps/industriallamp1.lua b/lamps/industriallamp1.lua index 0475bb4..7766c7c 100644 --- a/lamps/industriallamp1.lua +++ b/lamps/industriallamp1.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3/TA4 Industrial Lamp 1 ]]-- @@ -63,4 +63,4 @@ minetest.register_craft({ {"default:glass", "techage:simplelamp_off", "dye:grey"}, {"basic_materials:plastic_strip", "default:copper_ingot", "basic_materials:plastic_strip"}, }, -}) +}) \ No newline at end of file diff --git a/lamps/industriallamp2.lua b/lamps/industriallamp2.lua index d6ee575..dbfcc2b 100644 --- a/lamps/industriallamp2.lua +++ b/lamps/industriallamp2.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3/TA4 Industrial Lamp 2 ]]-- @@ -65,4 +65,4 @@ minetest.register_craft({ {"techage:simplelamp_off", "dye:black", ""}, {"basic_materials:steel_bar", "basic_materials:steel_bar", ""}, }, -}) +}) \ No newline at end of file diff --git a/lamps/industriallamp3.lua b/lamps/industriallamp3.lua index 5340ddc..b35383d 100644 --- a/lamps/industriallamp3.lua +++ b/lamps/industriallamp3.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3/TA4 Industrial Lamp 3 ]]-- @@ -61,4 +61,4 @@ minetest.register_craft({ {"techage:simplelamp_off", "dye:red", ""}, {"basic_materials:steel_bar", "basic_materials:steel_bar", ""}, }, -}) +}) \ No newline at end of file diff --git a/lamps/industriallamp4.lua b/lamps/industriallamp4.lua index c56404a..d58358c 100644 --- a/lamps/industriallamp4.lua +++ b/lamps/industriallamp4.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA4 Industrial Lamp 4 ]]-- @@ -61,4 +61,4 @@ minetest.register_craft({ {"techage:ta4_leds", "techage:ta4_leds", "techage:ta4_leds"}, {"techage:ta4_leds", "techage:basalt_glass_thin", "techage:ta4_leds"}, }, -}) +}) \ No newline at end of file diff --git a/lamps/lampholder.lua b/lamps/lampholder.lua index 3150018..964b3a0 100644 --- a/lamps/lampholder.lua +++ b/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", @@ -112,4 +112,4 @@ minetest.register_craft({ {"", "default:gold_ingot", ""}, {"basic_materials:steel_bar", "", "basic_materials:steel_bar"}, }, -}) +}) \ No newline at end of file diff --git a/lamps/lib.lua b/lamps/lib.lua index 2d30149..4ef7676 100644 --- a/lamps/lib.lua +++ b/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/lamps/lightblock.lua b/lamps/lightblock.lua index 195727d..32022c3 100644 --- a/lamps/lightblock.lua +++ b/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}, @@ -62,4 +62,4 @@ function techage.light_ring(center_pos, on, large) end minetest.fix_light(pos1, pos2) end -end +end \ No newline at end of file diff --git a/lamps/simplelamp.lua b/lamps/simplelamp.lua index b0db9bf..627ea09 100644 --- a/lamps/simplelamp.lua +++ b/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", @@ -50,4 +50,4 @@ minetest.register_craft({ {"", "default:glass", ""}, {"", "basic_materials:heating_element", ""}, }, -}) +}) \ No newline at end of file diff --git a/lamps/streetlamp.lua b/lamps/streetlamp.lua index 8a55771..c27982c 100644 --- a/lamps/streetlamp.lua +++ b/lamps/streetlamp.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3/TA4 Street Lamp ]]-- @@ -67,4 +67,4 @@ minetest.register_craft({ type = "shapeless", output = "techage:streetlamp_off 2", recipe = {"techage:simplelamp_off", "default:steel_ingot", "default:glass"}, -}) +}) \ No newline at end of file diff --git a/lamps/streetlamp2.lua b/lamps/streetlamp2.lua index 07ae388..e07aa73 100644 --- a/lamps/streetlamp2.lua +++ b/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/liquids/filler.lua b/liquids/filler.lua index 2ff3aca..0556d6f 100644 --- a/liquids/filler.lua +++ b/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({ @@ -154,4 +154,4 @@ minetest.register_craft({ {"techage:tubeS", "", "techage:tubeS"}, {"default:steel_ingot", "group:wood", "default:steel_ingot"}, }, -}) +}) \ No newline at end of file diff --git a/liquids/liquid_pipe.lua b/liquids/liquid_pipe.lua index 9f485ce..40a366f 100644 --- a/liquids/liquid_pipe.lua +++ b/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/liquids/pipe_wall_entry.lua b/liquids/pipe_wall_entry.lua index 9263186..7acf030 100644 --- a/liquids/pipe_wall_entry.lua +++ b/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}, @@ -54,4 +54,4 @@ minetest.register_craft({ {"", "basic_materials:concrete_block", ""}, {"", "",""}, }, -}) +}) \ No newline at end of file diff --git a/liquids/pump.lua b/liquids/pump.lua index 9f25800..a259304 100644 --- a/liquids/pump.lua +++ b/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) @@ -308,4 +308,4 @@ minetest.register_craft({ {"", "techage:t3_pump", ""}, {"", "", ""}, }, -}) +}) \ No newline at end of file diff --git a/liquids/silo.lua b/liquids/silo.lua index f570f78..4f3bfa0 100644 --- a/liquids/silo.lua +++ b/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) @@ -336,4 +336,4 @@ minetest.register_craft({ {"", "techage:ta3_silo", ""}, {"", "", ""}, }, -}) +}) \ No newline at end of file diff --git a/liquids/ta5_tank.lua b/liquids/ta5_tank.lua index 6f64416..3d10660 100644 --- a/liquids/ta5_tank.lua +++ b/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", @@ -102,4 +102,4 @@ minetest.register_craft({ {"", "techage:ta4_tank", ""}, {"", "", ""}, }, -}) +}) \ No newline at end of file diff --git a/liquids/tank.lua b/liquids/tank.lua index fbd149b..6c4ba97 100644 --- a/liquids/tank.lua +++ b/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", @@ -295,4 +295,4 @@ minetest.register_lbm({ --tubelib2.del_mem(pos) end end, -}) +}) \ No newline at end of file diff --git a/liquids/valve.lua b/liquids/valve.lua index 40406aa..ecb3f96 100644 --- a/liquids/valve.lua +++ b/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", @@ -150,4 +150,4 @@ minetest.register_craft({ {"techage:ta3_pipeS", "basic_materials:steel_bar", "techage:ta3_pipeS"}, {"", "techage:vacuum_tube", ""}, }, -}) +}) \ No newline at end of file diff --git a/liquids/waterinlet.lua b/liquids/waterinlet.lua index 10f210b..afb29c0 100644 --- a/liquids/waterinlet.lua +++ b/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/liquids/waterpump.lua b/liquids/waterpump.lua index 8e8858a..c95900d 100644 --- a/liquids/waterpump.lua +++ b/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, -}) +}) \ No newline at end of file diff --git a/logic/button.lua b/logic/button.lua index 7840d8c..9778e6d 100644 --- a/logic/button.lua +++ b/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/logic/button_2x.lua b/logic/button_2x.lua index 3d46904..e698816 100644 --- a/logic/button_2x.lua +++ b/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 @@ -249,4 +249,4 @@ minetest.register_craft({ {"", "techage:ta4_button_off", "techage:ta4_button_off"}, {"", "", ""}, }, -}) +}) \ No newline at end of file diff --git a/logic/button_4x.lua b/logic/button_4x.lua index 7377265..0568372 100644 --- a/logic/button_4x.lua +++ b/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 @@ -303,4 +303,4 @@ minetest.register_craft({ {"", "techage:ta4_button_off", "techage:ta4_button_off"}, {"", "", ""}, }, -}) +}) \ No newline at end of file diff --git a/logic/cart_detector.lua b/logic/cart_detector.lua index 4457374..2d046c7 100644 --- a/logic/cart_detector.lua +++ b/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 diff --git a/logic/collector.lua b/logic/collector.lua index 414b491..b7ccef6 100644 --- a/logic/collector.lua +++ b/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, -}) +}) \ No newline at end of file diff --git a/logic/detector.lua b/logic/detector.lua index b89816e..b0e709b 100644 --- a/logic/detector.lua +++ b/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/logic/lib.lua b/logic/lib.lua index 1d21911..abcff02 100644 --- a/logic/lib.lua +++ b/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) @@ -102,4 +102,4 @@ function techage.logic.set_numbers(pos, numbers, player_name, descr) return true end return false -end +end \ No newline at end of file diff --git a/logic/logic_block.lua b/logic/logic_block.lua index 4f91d0c..1d132f7 100644 --- a/logic/logic_block.lua +++ b/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,11 @@ 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/logic/lua_logic.lua b/logic/lua_logic.lua index f8b0ab7..1587be4 100644 --- a/logic/lua_logic.lua +++ b/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,7 @@ techage.register_node({"techage:ta3_logic"}, { minetest.get_node_timer(pos):start(0.1) end, on_node_load = function(pos) - + end, -}) - +}) diff --git a/logic/mba_detector.lua b/logic/mba_detector.lua index 8947676..96cdd17 100644 --- a/logic/mba_detector.lua +++ b/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/logic/mesecons_converter.lua b/logic/mesecons_converter.lua index f1ccab4..811b602 100644 --- a/logic/mesecons_converter.lua +++ b/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, -}) +}) \ No newline at end of file diff --git a/logic/node_detector.lua b/logic/node_detector.lua index eed6d7f..7d3c89c 100644 --- a/logic/node_detector.lua +++ b/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/logic/player_detector.lua b/logic/player_detector.lua index 71566e7..791eb8d 100644 --- a/logic/player_detector.lua +++ b/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/logic/programmer.lua b/logic/programmer.lua index efe2b09..c119720 100644 --- a/logic/programmer.lua +++ b/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/logic/repeater.lua b/logic/repeater.lua index 8de4e50..24a2d8b 100644 --- a/logic/repeater.lua +++ b/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/logic/sequencer.lua b/logic/sequencer.lua index 2784c11..e2c6005 100644 --- a/logic/sequencer.lua +++ b/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/logic/sequencer2.lua b/logic/sequencer2.lua index fe407fe..e051ab9 100644 --- a/logic/sequencer2.lua +++ b/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/logic/signallamp.lua b/logic/signallamp.lua index 2338faa..0a7ae1c 100644 --- a/logic/signallamp.lua +++ b/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/logic/signallamp_2x.lua b/logic/signallamp_2x.lua index 58ef893..745c213 100644 --- a/logic/signallamp_2x.lua +++ b/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", @@ -148,4 +148,4 @@ minetest.register_craft({ {"", "default:glass", "techage:ta4_wlanchip"}, {"", "techage:ta4_leds", "techage:ta4_leds"}, }, -}) +}) \ No newline at end of file diff --git a/logic/signallamp_4x.lua b/logic/signallamp_4x.lua index 8edf379..0983f1d 100644 --- a/logic/signallamp_4x.lua +++ b/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", @@ -179,4 +179,4 @@ minetest.register_craft({ {"", "techage:ta4_signallamp_2x", ""}, {"", "", ""}, }, -}) +}) \ No newline at end of file diff --git a/logic/terminal.lua b/logic/terminal.lua index cf63084..b988677 100644 --- a/logic/terminal.lua +++ b/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, @@ -437,4 +437,4 @@ techage.register_node({"techage:terminal3"}, { end return true end, -}) +}) \ No newline at end of file diff --git a/logic/timer.lua b/logic/timer.lua index 5794262..2e55613 100644 --- a/logic/timer.lua +++ b/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/lua_controller/commands.lua b/lua_controller/commands.lua index ef3bd0e..c59d1f5 100644 --- a/lua_controller/commands.lua +++ b/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..")") @@ -225,4 +225,4 @@ techage.lua_ctlr.register_function("item_description", { -- function not_protected(owner, number(s)) -techage.lua_ctlr.not_protected = not_protected +techage.lua_ctlr.not_protected = not_protected \ No newline at end of file diff --git a/lua_controller/controller.lua b/lua_controller/controller.lua index 6857b1e..be987ad 100644 --- a/lua_controller/controller.lua +++ b/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, -}) +}) \ No newline at end of file diff --git a/lua_controller/sensorchest.lua b/lua_controller/sensorchest.lua index 3ec47df..5a483b9 100644 --- a/lua_controller/sensorchest.lua +++ b/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/lua_controller/server.lua b/lua_controller/server.lua index eeff021..523f694 100644 --- a/lua_controller/server.lua +++ b/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 @@ -324,4 +324,3 @@ techage.lua_ctlr.register_action("server_write", { ' example: res = $server_write("123", "state", state)' }) - diff --git a/lua_controller/terminal.lua b/lua_controller/terminal.lua index 26bc63b..78d5824 100644 --- a/lua_controller/terminal.lua +++ b/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/move_controller/doorblock.lua b/move_controller/doorblock.lua index 5dcee0b..b4acfb5 100644 --- a/move_controller/doorblock.lua +++ b/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, @@ -105,4 +105,4 @@ minetest.register_craft({ {"default:mese_crystal_fragment", "",""}, {"group:wood", "", ""}, }, -}) +}) \ No newline at end of file diff --git a/move_controller/doorcontroller.lua b/move_controller/doorcontroller.lua index 1ace3a0..f859290 100644 --- a/move_controller/doorcontroller.lua +++ b/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/move_controller/doorcontroller2.lua b/move_controller/doorcontroller2.lua index 2ab46ef..047721c 100644 --- a/move_controller/doorcontroller2.lua +++ b/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 @@ -428,4 +428,4 @@ for _, name in ipairs(ProtectorDoors) do end end -logic.SimpleNodes = RegisteredNodes +logic.SimpleNodes = RegisteredNodes \ No newline at end of file diff --git a/move_controller/flycontroller.lua b/move_controller/flycontroller.lua index a1db0fd..2bf931d 100644 --- a/move_controller/flycontroller.lua +++ b/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", @@ -238,4 +238,4 @@ minetest.register_craft({ {"techage:aluminum", "techage:ta5_aichip", "techage:aluminum"}, {"group:wood", "basic_materials:gear_steel", "group:wood"}, }, -}) +}) \ No newline at end of file diff --git a/move_controller/gateblock.lua b/move_controller/gateblock.lua index c93955e..e0a764c 100644 --- a/move_controller/gateblock.lua +++ b/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/move_controller/movecontroller.lua b/move_controller/movecontroller.lua index e72d918..b0e9188 100644 --- a/move_controller/movecontroller.lua +++ b/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", @@ -213,4 +213,4 @@ minetest.register_craft({ {"default:mese_crystal_fragment", "techage:ta4_wlanchip", "default:mese_crystal_fragment"}, {"group:wood", "basic_materials:gear_steel", "group:wood"}, }, -}) +}) \ No newline at end of file diff --git a/move_controller/soundblock.lua b/move_controller/soundblock.lua index 87982bc..24ab6fd 100644 --- a/move_controller/soundblock.lua +++ b/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/move_controller/turncontroller.lua b/move_controller/turncontroller.lua index fa89f07..4113e45 100644 --- a/move_controller/turncontroller.lua +++ b/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", @@ -161,4 +161,4 @@ minetest.register_craft({ {"techage:aluminum", "techage:baborium_ingot", "techage:aluminum"}, {"group:wood", "basic_materials:gear_steel", "group:wood"}, }, -}) +}) \ No newline at end of file diff --git a/oil/distiller.lua b/oil/distiller.lua index ac57644..c4f9b38 100644 --- a/oil/distiller.lua +++ b/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") @@ -266,4 +266,4 @@ minetest.register_craft({ {'', 'techage:ta3_pipeS', 'techage:ta3_pipeS'}, {'basic_materials:concrete_block', '', 'basic_materials:concrete_block'}, } -}) +}) \ No newline at end of file diff --git a/oil/drillbox.lua b/oil/drillbox.lua index bcc4466..fcf8a22 100644 --- a/oil/drillbox.lua +++ b/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, @@ -310,4 +310,4 @@ minetest.register_craft({ {"techage:tubeS", "basic_materials:gear_steel", "techage:tubeS"}, {"default:steel_ingot", "techage:vacuum_tube", "default:steel_ingot"}, }, -}) +}) \ No newline at end of file diff --git a/oil/explore.lua b/oil/explore.lua index afddfca..1aa7a28 100644 --- a/oil/explore.lua +++ b/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 @@ -345,4 +345,4 @@ function techage.explore.dec_oil_amount(posC) end end return oil_amount -end +end \ No newline at end of file diff --git a/oil/gasflare.lua b/oil/gasflare.lua index b8e0b0b..d7fe9a6 100644 --- a/oil/gasflare.lua +++ b/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,10 +173,10 @@ minetest.register_node("techage:gasflare2", { }, }, paramtype = "light", - light_source = 0, + light_source = 0, sunlight_propagates = true, paramtype2 = "facedir", diggable = false, is_ground_content = false, sounds = default.node_sound_stone_defaults(), -}) +}) \ No newline at end of file diff --git a/oil/pumpjack.lua b/oil/pumpjack.lua index 4fbc016..7088107 100644 --- a/oil/pumpjack.lua +++ b/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/oil/reboiler.lua b/oil/reboiler.lua index 816d976..51cdc41 100644 --- a/oil/reboiler.lua +++ b/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/oil/tower.lua b/oil/tower.lua index cfade41..dfe9337 100644 --- a/oil/tower.lua +++ b/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/power/drive_axle.lua b/power/drive_axle.lua index 77a7058..2b40afd 100644 --- a/power/drive_axle.lua +++ b/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 = { @@ -185,4 +185,4 @@ minetest.register_craft({ }) -techage.Axle = Axle +techage.Axle = Axle \ No newline at end of file diff --git a/power/electric_cable.lua b/power/electric_cable.lua index 7840982..223e1e4 100644 --- a/power/electric_cable.lua +++ b/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 = { diff --git a/power/formspecs.lua b/power/formspecs.lua index c413c00..985901b 100644 --- a/power/formspecs.lua +++ b/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/power/gearbox.lua b/power/gearbox.lua index d444f24..ea03db7 100644 --- a/power/gearbox.lua +++ b/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/power/junctionbox.lua b/power/junctionbox.lua index 59f4be2..c2744f9 100644 --- a/power/junctionbox.lua +++ b/power/junctionbox.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3/TA4 Junction box for electrical power distribution ]]-- @@ -63,4 +63,4 @@ minetest.register_craft({ {"basic_materials:plastic_sheet", "default:copper_ingot", "basic_materials:plastic_sheet"}, {"", "basic_materials:plastic_sheet", ""}, }, -}) +}) \ No newline at end of file diff --git a/power/power_line.lua b/power/power_line.lua index 4d3e9c4..39c92cc 100644 --- a/power/power_line.lua +++ b/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/power/power_terminal.lua b/power/power_terminal.lua index 2d882ce..c1a44c3 100644 --- a/power/power_terminal.lua +++ b/power/power_terminal.lua @@ -7,7 +7,7 @@ AGPL v3 See LICENSE.txt for more information - + TA3 Power Terminal Old ]]-- diff --git a/power/power_terminal2.lua b/power/power_terminal2.lua index 9cb8dd4..aa2ae3b 100644 --- a/power/power_terminal2.lua +++ b/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, @@ -278,4 +278,4 @@ minetest.register_craft({ {"", "techage:basalt_glass_thin", "default:copper_ingot"}, {"", "techage:vacuum_tube", "default:steel_ingot"}, }, -}) +}) \ No newline at end of file diff --git a/power/powerswitch.lua b/power/powerswitch.lua index 4cf3577..ede50c3 100644 --- a/power/powerswitch.lua +++ b/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/power/powerswitchbox.lua b/power/powerswitchbox.lua index 523c294..91a7089 100644 --- a/power/powerswitchbox.lua +++ b/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 @@ -145,4 +145,4 @@ minetest.register_craft({ {"techage:electric_cableS", "basic_materials:copper_wire", "techage:electric_cableS"}, {"", "basic_materials:plastic_sheet", ""}, }, -}) +}) \ No newline at end of file diff --git a/power/powerswitchbox_legacy.lua b/power/powerswitchbox_legacy.lua index 60dab1e..c0aa2f0 100644 --- a/power/powerswitchbox_legacy.lua +++ b/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, @@ -68,4 +68,4 @@ minetest.register_node("techage:powerswitch_box", { groups = {choppy=2, cracky=2, crumbly=2, techage_trowel = 1, not_in_creative_inventory = 1}, is_ground_content = false, sounds = default.node_sound_wood_defaults(), -}) +}) \ No newline at end of file diff --git a/power/protection.lua b/power/protection.lua index 2c20839..639c3af 100644 --- a/power/protection.lua +++ b/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/power/steam_pipe.lua b/power/steam_pipe.lua index 040d4f9..6eaa83b 100644 --- a/power/steam_pipe.lua +++ b/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 = { @@ -113,4 +113,4 @@ minetest.register_craft({ }, }) -techage.SteamPipe = Pipe +techage.SteamPipe = Pipe \ No newline at end of file diff --git a/power/ta4_cable.lua b/power/ta4_cable.lua index 6650e05..cd1a10b 100644 --- a/power/ta4_cable.lua +++ b/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, @@ -188,4 +188,3 @@ minetest.register_craft({ techage.TA4_Cable = Cable - diff --git a/power/ta4_cable_wall_entry.lua b/power/ta4_cable_wall_entry.lua index d83d3b7..4c57dd3 100644 --- a/power/ta4_cable_wall_entry.lua +++ b/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}, @@ -54,4 +54,4 @@ minetest.register_craft({ {"", "basic_materials:concrete_block", ""}, {"", "",""}, }, -}) +}) \ No newline at end of file diff --git a/recipe_checker.lua b/recipe_checker.lua index 204b1fa..b8f9f29 100644 --- a/recipe_checker.lua +++ b/recipe_checker.lua @@ -29,8 +29,8 @@ minetest.after(1, function() end Recipes[key] = name end - end + end end end end -end) +end) \ No newline at end of file diff --git a/solar/inverter.lua b/solar/inverter.lua index d22afc0..e7fd6f8 100644 --- a/solar/inverter.lua +++ b/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 @@ -252,4 +252,4 @@ minetest.register_craft({ techage.register_node_for_v1_transition({"techage:ta4_solar_inverter"}, function(pos, node) power.update_network(pos, nil, Solar) -end) +end) \ No newline at end of file diff --git a/solar/minicell.lua b/solar/minicell.lua index b12fba7..1364ec1 100644 --- a/solar/minicell.lua +++ b/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/solar/solarcell.lua b/solar/solarcell.lua index 96a94ce..c0c92fa 100644 --- a/solar/solarcell.lua +++ b/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/steam_engine/boiler.lua b/steam_engine/boiler.lua index 8b44a86..ce3ea79 100644 --- a/steam_engine/boiler.lua +++ b/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/steam_engine/cylinder.lua b/steam_engine/cylinder.lua index aad0e37..3ec4c87 100644 --- a/steam_engine/cylinder.lua +++ b/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/steam_engine/firebox.lua b/steam_engine/firebox.lua index 2ebcb01..1bdc8aa 100644 --- a/steam_engine/firebox.lua +++ b/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", @@ -171,4 +171,3 @@ minetest.register_lbm({ end }) - diff --git a/steam_engine/flywheel.lua b/steam_engine/flywheel.lua index 3df10cf..9adc21e 100644 --- a/steam_engine/flywheel.lua +++ b/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, @@ -237,4 +237,3 @@ minetest.register_craft({ }, }) - diff --git a/ta1_watermill/mill.lua b/ta1_watermill/mill.lua index 35e0450..c09e830 100644 --- a/ta1_watermill/mill.lua +++ b/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", @@ -175,4 +175,4 @@ minetest.register_craft({ {"stairs:slab_stone", "techage:iron_ingot", "stairs:slab_stone"}, {"", "", ""}, }, -}) +}) \ No newline at end of file diff --git a/ta1_watermill/millboard.lua b/ta1_watermill/millboard.lua index a50a912..4079f95 100644 --- a/ta1_watermill/millboard.lua +++ b/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({ @@ -88,4 +88,4 @@ register_board2("techage:ta1_board2_apple", S("TA1 Apple Millrace Board"), {"d register_board2("techage:ta1_board2_jungle", S("TA1 Jungle Millrace Board"), {"default_junglewood.png"}, "techage:ta1_board1_jungle", "default:fence_rail_junglewood") register_board2("techage:ta1_board2_pine", S("TA1 Pine Millrace Board"), {"default_pine_wood.png"}, "techage:ta1_board1_pine", "default:fence_rail_pine_wood") register_board2("techage:ta1_board2_acacia", S("TA1 Acacia Millrace Board"), {"default_acacia_wood.png"}, "techage:ta1_board1_acacia", "default:fence_rail_acacia_wood") -register_board2("techage:ta1_board2_aspen", S("TA1 Aspen Millrace Board"), {"default_aspen_wood.png"}, "techage:ta1_board1_aspen", "default:fence_rail_aspen_wood") +register_board2("techage:ta1_board2_aspen", S("TA1 Aspen Millrace Board"), {"default_aspen_wood.png"}, "techage:ta1_board1_aspen", "default:fence_rail_aspen_wood") \ No newline at end of file diff --git a/ta1_watermill/sluice.lua b/ta1_watermill/sluice.lua index c5048e6..3a60d29 100644 --- a/ta1_watermill/sluice.lua +++ b/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, @@ -192,4 +192,4 @@ minetest.register_craft({ {"", "default:stick", ""}, {"", "stairs:slab_wood", ""}, }, -}) +}) \ No newline at end of file diff --git a/ta1_watermill/ta1_axle.lua b/ta1_watermill/ta1_axle.lua index 69c8e22..d2588ec 100644 --- a/ta1_watermill/ta1_axle.lua +++ b/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, @@ -173,4 +173,4 @@ minetest.register_craft({ }, }) -techage.TA1Axle = Axle +techage.TA1Axle = Axle \ No newline at end of file diff --git a/ta1_watermill/watermill.lua b/ta1_watermill/watermill.lua index b029ae9..fa87753 100644 --- a/ta1_watermill/watermill.lua +++ b/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, @@ -316,4 +316,4 @@ minetest.register_craft({ {"techage:ta1_board1_apple", "default:wood", "techage:ta1_board1_apple"}, {"techage:ta1_board1_apple", "techage:ta1_board1_apple", "techage:ta1_board1_apple"}, }, -}) +}) \ No newline at end of file diff --git a/ta2_energy_storage/ta2_rope.lua b/ta2_energy_storage/ta2_rope.lua index 18ecf9e..b1512bc 100644 --- a/ta2_energy_storage/ta2_rope.lua +++ b/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}}) @@ -82,4 +82,4 @@ function techage.renew_rope(pos, length, force) end end -techage.del_rope = del_rope +techage.del_rope = del_rope \ No newline at end of file diff --git a/ta2_energy_storage/ta2_weight_chest.lua b/ta2_energy_storage/ta2_weight_chest.lua index f2f915f..16b97b0 100644 --- a/ta2_energy_storage/ta2_weight_chest.lua +++ b/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/ta2_energy_storage/ta2_winch.lua b/ta2_energy_storage/ta2_winch.lua index 8a29064..19308a9 100644 --- a/ta2_energy_storage/ta2_winch.lua +++ b/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/ta3_power/akkubox.lua b/ta3_power/akkubox.lua index 0b3bb40..0f811c8 100644 --- a/ta3_power/akkubox.lua +++ b/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 @@ -200,4 +200,4 @@ minetest.register_craft({ {"default:copper_ingot", "default:copper_ingot", "techage:electric_cableS"}, {"techage:iron_ingot", "techage:iron_ingot", "default:wood"}, }, -}) +}) \ No newline at end of file diff --git a/ta3_power/axle2power.lua b/ta3_power/axle2power.lua index 4bc252b..39b8522 100644 --- a/ta3_power/axle2power.lua +++ b/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/ta3_power/power2axle.lua b/ta3_power/power2axle.lua index 13c7f4a..76bad03 100644 --- a/ta3_power/power2axle.lua +++ b/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/ta3_power/tiny_generator.lua b/ta3_power/tiny_generator.lua index ee98127..3b172bd 100644 --- a/ta3_power/tiny_generator.lua +++ b/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/ta4_power/electricmeter.lua b/ta4_power/electricmeter.lua index f6ce2c1..1a81e60 100644 --- a/ta4_power/electricmeter.lua +++ b/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 @@ -190,4 +190,4 @@ minetest.register_craft({ {"techage:electric_cableS", "basic_materials:gold_wire", "techage:electric_cableS"}, {"default:steel_ingot", "techage:ta4_wlanchip", "default:steel_ingot"}, }, -}) +}) \ No newline at end of file diff --git a/ta4_power/laser.lua b/ta4_power/laser.lua index 779c768..9391d2d 100644 --- a/ta4_power/laser.lua +++ b/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/ta4_power/transformer.lua b/ta4_power/transformer.lua index 374bce6..319f4e1 100644 --- a/ta4_power/transformer.lua +++ b/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 @@ -180,4 +180,4 @@ minetest.register_craft({ {"techage:electric_cableS", "basic_materials:copper_wire", "techage:electric_cableS"}, {"default:steel_ingot", "techage:ta4_wlanchip", "default:steel_ingot"}, }, -}) +}) \ No newline at end of file diff --git a/teleport/teleport_pipe.lua b/teleport/teleport_pipe.lua index 0fd5aa7..10b0454 100644 --- a/teleport/teleport_pipe.lua +++ b/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/teleport/teleport_tube.lua b/teleport/teleport_tube.lua index ce6d0c9..747a018 100644 --- a/teleport/teleport_tube.lua +++ b/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/tools/pipe_wrench.lua b/tools/pipe_wrench.lua index 78f67e8..a33e169 100644 --- a/tools/pipe_wrench.lua +++ b/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 @@ -38,4 +38,4 @@ minetest.register_craft({ {"dye:red", "default:steel_ingot", "dye:red"}, {"default:steel_ingot", "", "default:steel_ingot"}, }, -}) +}) \ No newline at end of file diff --git a/tools/repairkit.lua b/tools/repairkit.lua index 7778ac0..eef67cd 100644 --- a/tools/repairkit.lua +++ b/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/tools/trowel.lua b/tools/trowel.lua index 2fa697d..5abf599 100644 --- a/tools/trowel.lua +++ b/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 @@ -65,4 +65,4 @@ minetest.register_craft({ {"basic_materials:steel_bar", "default:stick", ""}, {"", "", "default:stick"}, }, -}) +}) \ No newline at end of file diff --git a/wind_turbine/pillar.lua b/wind_turbine/pillar.lua index cf75f7f..7ea90de 100644 --- a/wind_turbine/pillar.lua +++ b/wind_turbine/pillar.lua @@ -7,9 +7,9 @@ AGPL v3 See LICENSE.txt for more information - + pillar - + ]]-- local S = techage.S @@ -37,4 +37,4 @@ minetest.register_craft({ type = "shapeless", output = "techage:pillar", recipe = {"basic_materials:concrete_block"}, -}) +}) \ No newline at end of file diff --git a/wind_turbine/rotor.lua b/wind_turbine/rotor.lua index 97a6b26..7131ef2 100644 --- a/wind_turbine/rotor.lua +++ b/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, -}) +}) \ No newline at end of file diff --git a/wind_turbine/signallamp.lua b/wind_turbine/signallamp.lua index a1be480..e4884e4 100644 --- a/wind_turbine/signallamp.lua +++ b/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", ""}, }, }) -