built on 04/01/2022 19:43:30

This commit is contained in:
Joachim Stolberg 2022-01-04 19:43:30 +01:00
parent 793888ed80
commit d9710a8213
260 changed files with 2513 additions and 2566 deletions

View File

@ -7,7 +7,7 @@
GPL v3 GPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
Demo for a electrical power consuming node Demo for a electrical power consuming node
]]-- ]]--
@ -62,7 +62,7 @@ end
minetest.register_node("techage:sink", { minetest.register_node("techage:sink", {
description = "Sink", description = "Sink",
tiles = {'techage_electric_button.png^[colorize:#000000:50'}, tiles = {'techage_electric_button.png^[colorize:#000000:50'},
on_timer = function(pos, elapsed) on_timer = function(pos, elapsed)
local consumed = power.consume_power(pos, Cable, nil, PWR_NEEDED) local consumed = power.consume_power(pos, Cable, nil, PWR_NEEDED)
if consumed == PWR_NEEDED then if consumed == PWR_NEEDED then
@ -76,7 +76,7 @@ minetest.register_node("techage:sink", {
after_dig_node = after_dig_node, after_dig_node = after_dig_node,
paramtype = "light", paramtype = "light",
light_source = 0, light_source = 0,
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {choppy = 2, cracky = 2, crumbly = 2}, groups = {choppy = 2, cracky = 2, crumbly = 2},
is_ground_content = false, is_ground_content = false,
@ -100,7 +100,7 @@ minetest.register_node("techage:sink_on", {
after_dig_node = after_dig_node, after_dig_node = after_dig_node,
paramtype = "light", paramtype = "light",
light_source = minetest.LIGHT_MAX, light_source = minetest.LIGHT_MAX,
paramtype2 = "facedir", paramtype2 = "facedir",
diggable = false, diggable = false,
drop = "", drop = "",

View File

@ -8,11 +8,11 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
The autocrafter is derived from pipeworks: The autocrafter is derived from pipeworks:
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net> WTFPL Copyright (C) 2004 Sam Hocevar <sam@hocevar.net> WTFPL
TA2/TA3/TA4 Autocrafter TA2/TA3/TA4 Autocrafter
]]-- ]]--
-- for lazy programmers -- for lazy programmers
@ -69,7 +69,7 @@ local function count_index(invlist)
end end
-- caches some recipe data -- caches some recipe data
local autocrafterCache = {} local autocrafterCache = {}
local function get_craft(pos, inventory, hash) local function get_craft(pos, inventory, hash)
hash = hash or minetest.hash_node_position(pos) 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 recipe = inventory:get_list("recipe")
local output, decremented_input = minetest.get_craft_result( local output, decremented_input = minetest.get_craft_result(
{method = "normal", width = 3, items = recipe}) {method = "normal", width = 3, items = recipe})
-- check if registered item -- check if registered item
if UncraftableItems[output.item:get_name()] then if UncraftableItems[output.item:get_name()] then
output.item = ItemStack() output.item = ItemStack()
end end
craft = {recipe = recipe, consumption = count_index(recipe), craft = {recipe = recipe, consumption = count_index(recipe),
output = output, decremented_input = decremented_input} output = output, decremented_input = decremented_input}
autocrafterCache[hash] = craft autocrafterCache[hash] = craft
end end
@ -93,18 +93,18 @@ end
local function autocraft(pos, crd, nvm, inv) local function autocraft(pos, crd, nvm, inv)
local craft = get_craft(pos, inv) local craft = get_craft(pos, inv)
if not craft then if not craft then
crd.State:idle(pos, nvm) crd.State:idle(pos, nvm)
return return
end end
local output_item = craft.output.item local output_item = craft.output.item
if output_item:get_name() == "" then if output_item:get_name() == "" then
crd.State:idle(pos, nvm) crd.State:idle(pos, nvm)
return return
end end
-- check if we have enough room in dst -- 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) crd.State:blocked(pos, nvm)
return return
end end
@ -112,9 +112,9 @@ local function autocraft(pos, crd, nvm, inv)
local inv_index = count_index(inv:get_list("src")) local inv_index = count_index(inv:get_list("src"))
-- check if we have enough material available -- check if we have enough material available
for itemname, number in pairs(consumption) do 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) crd.State:idle(pos, nvm)
return return
end end
end end
-- consume material -- consume material
@ -129,7 +129,7 @@ local function autocraft(pos, crd, nvm, inv)
for i = 1, 9 do for i = 1, 9 do
inv:add_item("dst", craft.decremented_input.items[i]) inv:add_item("dst", craft.decremented_input.items[i])
end end
crd.State:keep_running(pos, nvm, COUNTDOWN_TICKS) crd.State:keep_running(pos, nvm, COUNTDOWN_TICKS)
end end
@ -230,7 +230,7 @@ local function determine_recipe_items(pos, input)
if num and idx then if num and idx then
input = get_input_from_recipeblock(pos, num, idx) input = get_input_from_recipeblock(pos, num, idx)
end end
if input then if input then
-- "<item>,<item>,..." input -- "<item>,<item>,..." input
local items = string.split(input, ",", true, 8) local items = string.split(input, ",", true, 8)
@ -452,7 +452,7 @@ 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("autocrafter", S("Autocrafter"), tiles, { techage.register_consumer("autocrafter", S("Autocrafter"), tiles, {
drawtype = "normal", drawtype = "normal",
cycle_time = CYCLE_TIME, cycle_time = CYCLE_TIME,

View File

@ -9,7 +9,7 @@
See LICENSE.txt for more information See LICENSE.txt for more information
All items and liquids disappear. All items and liquids disappear.
]]-- ]]--
local S = techage.S local S = techage.S
@ -70,7 +70,7 @@ minetest.register_craft({
techage.register_node({"techage:blackhole"}, { techage.register_node({"techage:blackhole"}, {
on_pull_item = nil, -- not needed on_pull_item = nil, -- not needed
on_unpull_item = nil, -- not needed on_unpull_item = nil, -- not needed
on_push_item = function(pos, in_dir, stack) on_push_item = function(pos, in_dir, stack)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if meta:get_int("push_dir") == in_dir then if meta:get_int("push_dir") == in_dir then

View File

@ -7,9 +7,9 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
TA2/TA3/TA4 Chest TA2/TA3/TA4 Chest
]]-- ]]--
-- for lazy programmers -- for lazy programmers
@ -76,7 +76,7 @@ minetest.register_node("techage:chest_ta2", {
local inv = meta:get_inventory() local inv = meta:get_inventory()
inv:set_size('main', 32) inv:set_size('main', 32)
end, end,
after_place_node = function(pos, placer) after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("owner", placer:get_player_name()) 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) techage_set_numbers = function(pos, numbers, player_name)
return techage.logic.set_numbers(pos, numbers, player_name, S("TA2 Protected Chest")) return techage.logic.set_numbers(pos, numbers, player_name, S("TA2 Protected Chest"))
end, end,
can_dig = can_dig, can_dig = can_dig,
after_dig_node = after_dig_node, after_dig_node = after_dig_node,
allow_metadata_inventory_put = allow_metadata_inventory_put, allow_metadata_inventory_put = allow_metadata_inventory_put,
@ -126,7 +126,7 @@ minetest.register_node("techage:chest_ta3", {
local inv = meta:get_inventory() local inv = meta:get_inventory()
inv:set_size('main', 40) inv:set_size('main', 40)
end, end,
after_place_node = function(pos, placer) after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local number = techage.add_node(pos, "techage:chest_ta3") 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) techage_set_numbers = function(pos, numbers, player_name)
return techage.logic.set_numbers(pos, numbers, player_name, S("TA3 Protected Chest")) return techage.logic.set_numbers(pos, numbers, player_name, S("TA3 Protected Chest"))
end, end,
can_dig = can_dig, can_dig = can_dig,
after_dig_node = after_dig_node, after_dig_node = after_dig_node,
allow_metadata_inventory_put = allow_metadata_inventory_put, allow_metadata_inventory_put = allow_metadata_inventory_put,
@ -180,7 +180,7 @@ techage.register_node({"techage:chest_ta2", "techage:chest_ta3"}, {
return "unsupported" return "unsupported"
end end
end, end,
}) })
local function formspec4(pos) 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 if not public and minetest.is_protected(pos, player:get_player_name()) then
return 0 return 0
end end
if listname == "main" then if listname == "main" then
return stack:get_count() return stack:get_count()
else 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 if not public and minetest.is_protected(pos, player:get_player_name()) then
return 0 return 0
end end
if listname == "main" then if listname == "main" then
return stack:get_count() return stack:get_count()
else 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 if not public and minetest.is_protected(pos, player:get_player_name()) then
return 0 return 0
end end
if from_list == "main" then if from_list == "main" then
return count return count
else else
@ -279,7 +279,7 @@ minetest.register_node("techage:chest_ta4", {
inv:set_size('main', 50) inv:set_size('main', 50)
inv:set_size('conf', 50) inv:set_size('conf', 50)
end, end,
after_place_node = function(pos, placer) after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local number = techage.add_node(pos, "techage:chest_ta4") 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 if minetest.is_protected(pos, player:get_player_name()) then
return return
end end
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local mem = techage.get_mem(pos) local mem = techage.get_mem(pos)
if fields.tab == "1" then if fields.tab == "1" then
@ -320,11 +320,11 @@ minetest.register_node("techage:chest_ta4", {
meta:set_string("formspec", formspec4_cfg(pos)) meta:set_string("formspec", formspec4_cfg(pos))
end end
end, end,
techage_set_numbers = function(pos, numbers, player_name) techage_set_numbers = function(pos, numbers, player_name)
return techage.logic.set_numbers(pos, numbers, player_name, S("TA4 Protected Chest")) return techage.logic.set_numbers(pos, numbers, player_name, S("TA4 Protected Chest"))
end, end,
can_dig = can_dig, can_dig = can_dig,
after_dig_node = after_dig_node, after_dig_node = after_dig_node,
allow_metadata_inventory_put = ta4_allow_metadata_inventory_put, 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 meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
local mem = techage.get_mem(pos) local mem = techage.get_mem(pos)
mem.filter = mem.filter or mConf.item_filter(pos, TA4_INV_SIZE) mem.filter = mem.filter or mConf.item_filter(pos, TA4_INV_SIZE)
mem.chest_configured = mem.chest_configured or not inv:is_empty("conf") mem.chest_configured = mem.chest_configured or not inv:is_empty("conf")
if inv:is_empty("main") then if inv:is_empty("main") then
return nil return nil
end end
if item_name then if item_name then
if mem.filter[item_name] or not mem.chest_configured then if mem.filter[item_name] or not mem.chest_configured then
local taken = inv:remove_item("main", {name = item_name, count = num}) 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 meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
local mem = techage.get_mem(pos) local mem = techage.get_mem(pos)
mem.filter = mem.filter or mConf.item_filter(pos, TA4_INV_SIZE) mem.filter = mem.filter or mConf.item_filter(pos, TA4_INV_SIZE)
mem.chest_configured = mem.chest_configured or not inv:is_empty("conf") mem.chest_configured = mem.chest_configured or not inv:is_empty("conf")
if mem.chest_configured then if mem.chest_configured then
local name = item:get_name() local name = item:get_name()
local stacks = mem.filter[name] or mem.filter["unconfigured"] 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 meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
local mem = techage.get_mem(pos) local mem = techage.get_mem(pos)
mem.filter = mem.filter or mConf.item_filter(pos, TA4_INV_SIZE) mem.filter = mem.filter or mConf.item_filter(pos, TA4_INV_SIZE)
mem.chest_configured = mem.chest_configured or not inv:is_empty("conf") mem.chest_configured = mem.chest_configured or not inv:is_empty("conf")
if mem.chest_configured then if mem.chest_configured then
local name = item:get_name() local name = item:get_name()
local stacks = mem.filter[name] or mem.filter["unconfigured"] 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) return techage.put_items(inv, "main", item)
end end
end, end,
on_recv_message = function(pos, src, topic, payload) on_recv_message = function(pos, src, topic, payload)
if topic == "state" then if topic == "state" then
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
@ -412,7 +412,7 @@ techage.register_node({"techage:chest_ta4"}, {
return "unsupported" return "unsupported"
end end
end, end,
}) })
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",

View File

@ -65,7 +65,7 @@ techage.register_node(names, {
return techage.safe_push_items(pos, push_dir, stack) return techage.safe_push_items(pos, push_dir, stack)
end, end,
is_pusher = true, -- is a pulling/pushing node is_pusher = true, -- is a pulling/pushing node
}) })
names = networks.register_junction("techage:ta4_concentrator", 2/8, Boxes, Tube, { names = networks.register_junction("techage:ta4_concentrator", 2/8, Boxes, Tube, {
description = S("TA4 Tube Concentrator"), description = S("TA4 Tube Concentrator"),
@ -104,7 +104,7 @@ techage.register_node(names, {
return techage.safe_push_items(pos, push_dir, stack) return techage.safe_push_items(pos, push_dir, stack)
end, end,
is_pusher = true, -- is a pulling/pushing node is_pusher = true, -- is a pulling/pushing node
}) })
minetest.register_craft({ minetest.register_craft({

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
Consumer node basis functionality. Consumer node basis functionality.
It handles: It handles:
- up to 4 stages of nodes (TA2/TA3/TA4/TA5) - up to 4 stages of nodes (TA2/TA3/TA4/TA5)
@ -54,7 +54,7 @@ end
local function node_timer_pas(pos, elapsed) local function node_timer_pas(pos, elapsed)
local crd = CRD(pos) local crd = CRD(pos)
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
-- handle power consumption -- handle power consumption
if crd.power_netw and techage.needs_power(nvm) then if crd.power_netw and techage.needs_power(nvm) then
local consumed = power.consume_power(pos, crd.power_netw, nil, crd.power_consumption) 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) crd.State:start(pos, nvm)
end end
end end
-- call the node timer routine -- call the node timer routine
if techage.is_operational(nvm) then if techage.is_operational(nvm) then
nvm.node_timer_call_cyle = (nvm.node_timer_call_cyle or 0) + 1 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 function node_timer_act(pos, elapsed)
local crd = CRD(pos) local crd = CRD(pos)
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
-- handle power consumption -- handle power consumption
if crd.power_netw and techage.needs_power(nvm) then if crd.power_netw and techage.needs_power(nvm) then
local consumed = power.consume_power(pos, crd.power_netw, nil, crd.power_consumption) 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) crd.State:nopower(pos, nvm)
end end
end end
-- call the node timer routine -- call the node timer routine
if techage.is_operational(nvm) then if techage.is_operational(nvm) then
nvm.node_timer_call_cyle = (nvm.node_timer_call_cyle or 0) + 1 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 return tbl
end 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} -- only one TA2 node {false, true, false, false}
function techage.register_consumer(base_name, inv_name, tiles, tNode, validStates, node_name_prefix) function techage.register_consumer(base_name, inv_name, tiles, tNode, validStates, node_name_prefix)
local names = {} local names = {}
@ -163,7 +163,7 @@ function techage.register_consumer(base_name, inv_name, tiles, tNode, validState
State = tState, State = tState,
-- number of items to be processed per cycle -- number of items to be processed per cycle
num_items = tNode.num_items and tNode.num_items[stage], 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, tNode.power_consumption[stage] or 0,
node_timer = tNode.node_timer, node_timer = tNode.node_timer,
cycle_time = tNode.cycle_time, 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.remove_node(pos, oldnode, oldmetadata)
techage.del_mem(pos) techage.del_mem(pos)
end end
tNode.groups.not_in_creative_inventory = 0 tNode.groups.not_in_creative_inventory = 0
local def_pas = { local def_pas = {
@ -285,14 +285,14 @@ function techage.register_consumer(base_name, inv_name, tiles, tNode, validState
def_act[k] = v def_act[k] = v
end end
end end
minetest.register_node(name_act, def_act) minetest.register_node(name_act, def_act)
if power_used then if power_used then
power.register_nodes({name_pas, name_act}, power_network, "con", sides) power.register_nodes({name_pas, name_act}, power_network, "con", sides)
end end
techage.register_node({name_pas, name_act}, tNode.tubing) techage.register_node({name_pas, name_act}, tNode.tubing)
if tNode.tube_sides then if tNode.tube_sides then
Tube:set_valid_sides(name_pas, get_keys(tNode.tube_sides)) Tube:set_valid_sides(name_pas, get_keys(tNode.tube_sides))
Tube:set_valid_sides(name_act, get_keys(tNode.tube_sides)) Tube:set_valid_sides(name_act, get_keys(tNode.tube_sides))

View File

@ -9,7 +9,7 @@
See LICENSE.txt for more information See LICENSE.txt for more information
TA2/TA3/TA4 Distributor TA2/TA3/TA4 Distributor
]]-- ]]--
-- for lazy programmers -- 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 Side2Color = {B="red", L="green", F="blue", R="yellow"}
local SlotColors = {"red", "green", "blue", "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 FilterCache = {} -- local cache for filter settings
local function filter_settings(pos) local function filter_settings(pos)
@ -72,9 +72,9 @@ local function filter_settings(pos)
end end
end end
end end
FilterCache[minetest.hash_node_position(pos)] = { FilterCache[minetest.hash_node_position(pos)] = {
ItemFilter = ItemFilter, ItemFilter = ItemFilter,
OpenPorts = OpenPorts, OpenPorts = OpenPorts,
} }
end end
@ -88,7 +88,7 @@ local function get_filter_settings(pos)
-- } -- }
-- local OpenPorts = {3} -- local OpenPorts = {3}
-- return ItemFilter, OpenPorts -- return ItemFilter, OpenPorts
local hash = minetest.hash_node_position(pos) local hash = minetest.hash_node_position(pos)
if FilterCache[hash] == nil then if FilterCache[hash] == nil then
filter_settings(pos) filter_settings(pos)
@ -111,8 +111,8 @@ local function blocking_checkbox(pos, filter, is_hp)
M(pos):set_int("blocking", 0) -- disable blocking M(pos):set_int("blocking", 0) -- disable blocking
end end
return "" return ""
end end
local function formspec(self, pos, nvm) local function formspec(self, pos, nvm)
local filter = minetest.deserialize(M(pos):get_string("filter")) or {false,false,false,false} local filter = minetest.deserialize(M(pos):get_string("filter")) or {false,false,false,false}
local is_hp = nvm.high_performance == true local is_hp = nvm.high_performance == true
@ -185,7 +185,7 @@ end
local function allow_metadata_inventory_put(pos, listname, index, stack, player) local function allow_metadata_inventory_put(pos, listname, index, stack, player)
local inv = M(pos):get_inventory() local inv = M(pos):get_inventory()
local list = inv:get_list(listname) local list = inv:get_list(listname)
if minetest.is_protected(pos, player:get_player_name()) then if minetest.is_protected(pos, player:get_player_name()) then
return 0 return 0
end 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] is_ta4_tube = is_ta4_tube and techage.TA4tubes[node.name]
end end
end end
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
local crd = CRD(pos) local crd = CRD(pos)
if CRD(pos).stage == 4 and not is_ta4_tube then 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 sum_num_pushed = 0
local num_pushed = 0 local num_pushed = 0
local blocking_mode = M(pos):get_int("blocking") == 1 local blocking_mode = M(pos):get_int("blocking") == 1
-- start searching after last position -- start searching after last position
local offs = nvm.last_index or 1 local offs = nvm.last_index or 1
for i = 1, SRC_INV_SIZE do for i = 1, SRC_INV_SIZE do
local idx = ((i + offs - 1) % 8) + 1 local idx = ((i + offs - 1) % 8) + 1
local stack = inv:get_stack("src", idx) 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 stack_to_push = stack:peek_item(num_to_push)
local filter = item_filter[item_name] local filter = item_filter[item_name]
num_pushed = 0 num_pushed = 0
if filter and #filter > 0 then if filter and #filter > 0 then
-- Push items based on filter -- Push items based on filter
num_pushed = push_item(pos, filter, stack_to_push, num_to_push, nvm) 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 -- Push items based on open ports
num_pushed = push_item(pos, open_ports, stack_to_push, num_to_push, nvm) num_pushed = push_item(pos, open_ports, stack_to_push, num_to_push, nvm)
end end
sum_num_pushed = sum_num_pushed + num_pushed sum_num_pushed = sum_num_pushed + num_pushed
stack:take_item(num_pushed) stack:take_item(num_pushed)
inv:set_stack("src", idx, stack) 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 nvm.last_index = idx
break break
end end
end end
if sum_num_pushed == 0 then if sum_num_pushed == 0 then
crd.State:blocked(pos, nvm) crd.State:blocked(pos, nvm)
else 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) meta:set_int("blocking", fields.blocking == "true" and 1 or 0)
end end
meta:set_string("filter", minetest.serialize(filter)) meta:set_string("filter", minetest.serialize(filter))
filter_settings(pos) filter_settings(pos)
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
if fields.state_button ~= nil then if fields.state_button ~= nil then
crd.State:state_button_event(pos, nvm, fields) crd.State:state_button_event(pos, nvm, fields)
@ -391,9 +391,9 @@ local function change_filter_settings(pos, slot, val)
filter[num] = val == "on" filter[num] = val == "on"
end end
meta:set_string("filter", minetest.serialize(filter)) meta:set_string("filter", minetest.serialize(filter))
filter_settings(pos) filter_settings(pos)
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
meta:set_string("formspec", formspec(CRD(pos).State, pos, nvm)) meta:set_string("formspec", formspec(CRD(pos).State, pos, nvm))
return true return true
@ -474,7 +474,7 @@ local tubing = {
else else
return change_filter_settings(pos, slot, val) return change_filter_settings(pos, slot, val)
end end
else else
return CRD(pos).State:on_receive_message(pos, topic, payload) return CRD(pos).State:on_receive_message(pos, topic, payload)
end end
end, end,

View File

@ -9,7 +9,7 @@
See LICENSE.txt for more information See LICENSE.txt for more information
TA2/TA3/TA4 Electronic Fab TA2/TA3/TA4 Electronic Fab
]]-- ]]--
-- for lazy programmers -- 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 if minetest.is_protected(pos, player:get_player_name()) then
return return
end end
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
local crd = CRD(pos) local crd = CRD(pos)
if not nvm.running then if not nvm.running then
recipes.on_receive_fields(pos, formname, fields, player) recipes.on_receive_fields(pos, formname, fields, player)
end end
crd.State:state_button_event(pos, nvm, fields) crd.State:state_button_event(pos, nvm, fields)
M(pos):set_string("formspec", formspec(crd.State, pos, nvm)) M(pos):set_string("formspec", formspec(crd.State, pos, nvm))
end end
@ -207,7 +207,7 @@ 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("electronic_fab", S("Electronic Fab"), tiles, { techage.register_consumer("electronic_fab", S("Electronic Fab"), tiles, {
drawtype = "normal", drawtype = "normal",
cycle_time = CYCLE_TIME, cycle_time = CYCLE_TIME,
@ -277,4 +277,3 @@ techage.recipes.register_craft_type("ta4_electronic_fab", {
width = 2, width = 2,
height = 2, height = 2,
}) })

View File

@ -9,7 +9,7 @@
See LICENSE.txt for more information See LICENSE.txt for more information
Forceload block Forceload block
]]-- ]]--
-- for lazy programmers -- for lazy programmers
@ -38,7 +38,7 @@ end
local function remove_list_elem(list, x) local function remove_list_elem(list, x)
local n = nil local n = nil
for idx, v in ipairs(list) do for idx, v in ipairs(list) do
if vector.equals(v, x) then if vector.equals(v, x) then
n = idx n = idx
break break
end end
@ -59,12 +59,12 @@ local function postload_area(pos)
minetest.after(60, postload_area, pos) minetest.after(60, postload_area, pos)
end end
end end
local function add_pos(pos, player) local function add_pos(pos, player)
local meta = player:get_meta() local meta = player:get_meta()
local lPos = minetest.deserialize(meta:get_string("techage_forceload_blocks")) or {} 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 if not in_list(lPos, pos) and (#lPos < techage.max_num_forceload_blocks or
creative and creative.is_enabled_for and minetest.global_exists("creative") and creative.is_enabled_for and
creative.is_enabled_for(player:get_player_name())) then creative.is_enabled_for(player:get_player_name())) then
lPos[#lPos+1] = pos lPos[#lPos+1] = pos
local meta = player:get_meta() local meta = player:get_meta()
@ -73,7 +73,7 @@ local function add_pos(pos, player)
end end
return false return false
end end
local function del_pos(pos, player) local function del_pos(pos, player)
local meta = player:get_meta() local meta = player:get_meta()
local lPos = minetest.deserialize(meta:get_string("techage_forceload_blocks")) or {} local lPos = minetest.deserialize(meta:get_string("techage_forceload_blocks")) or {}
@ -116,7 +116,6 @@ local function formspec(name)
local tRes = {} local tRes = {}
for idx,pos in ipairs(lPos) do for idx,pos in ipairs(lPos) do
local pos1, pos2 = calc_area(pos) local pos1, pos2 = calc_area(pos)
local ypos = 0.2 + idx * 0.4
tRes[#tRes+1] = idx tRes[#tRes+1] = idx
tRes[#tRes+1] = minetest.formspec_escape(P2S(pos1)) tRes[#tRes+1] = minetest.formspec_escape(P2S(pos1))
tRes[#tRes+1] = "to" tRes[#tRes+1] = "to"
@ -202,10 +201,10 @@ minetest.register_node("techage:forceload", {
after_dig_node = after_dig_node, after_dig_node = after_dig_node,
on_rightclick = on_rightclick, on_rightclick = on_rightclick,
on_punch = on_punch, on_punch = on_punch,
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
groups = {choppy=2, cracky=2, crumbly=2, groups = {choppy=2, cracky=2, crumbly=2,
digtron_protected = 1, digtron_protected = 1,
not_in_creative_inventory = techage.max_num_forceload_blocks == 0 and 1 or 0}, not_in_creative_inventory = techage.max_num_forceload_blocks == 0 and 1 or 0},
is_ground_content = false, is_ground_content = false,
@ -236,17 +235,17 @@ minetest.register_node("techage:forceloadtile", {
{-4/16, -8/16, -4/16, 4/16, -15/32, 4/16}, {-4/16, -8/16, -4/16, 4/16, -15/32, 4/16},
}, },
}, },
on_place = on_place, on_place = on_place,
after_place_node = after_place_node, after_place_node = after_place_node,
after_dig_node = after_dig_node, after_dig_node = after_dig_node,
on_rightclick = on_rightclick, on_rightclick = on_rightclick,
on_punch = on_punch, on_punch = on_punch,
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
sunlight_propagates = true, 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}, not_in_creative_inventory = techage.max_num_forceload_blocks == 0 and 1 or 0},
is_ground_content = false, is_ground_content = false,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),

View File

@ -7,16 +7,16 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
Tube support for default chests and furnace Tube support for default chests and furnace
]]-- ]]--
local OwnerCache = { local OwnerCache = {
} }
-- Check if the chest is in the protected area of the owner -- 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 owner = meta:get_string("owner")
local key = minetest.hash_node_position(pos) local key = minetest.hash_node_position(pos)
-- If successfull, store info in cache -- If successfull, store info in cache
@ -27,7 +27,7 @@ local function is_owner(pos, meta)
end end
return OwnerCache[key] == owner return OwnerCache[key] == owner
end end
techage.register_node({"default:chest", "default:chest_open"}, { techage.register_node({"default:chest", "default:chest_open"}, {
on_inv_request = function(pos, in_dir, access_type) 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() local inv = meta:get_inventory()
return techage.put_items(inv, "main", stack) return techage.put_items(inv, "main", stack)
end, end,
}) })
techage.register_node({"default:chest_locked", "default:chest_locked_open"}, { techage.register_node({"default:chest_locked", "default:chest_locked_open"}, {
on_inv_request = function(pos, in_dir, access_type) 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() local inv = meta:get_inventory()
return techage.put_items(inv, "main", stack) return techage.put_items(inv, "main", stack)
end, end,
}) })
techage.register_node({"shop:shop"}, { techage.register_node({"shop:shop"}, {
on_inv_request = function(pos, in_dir, access_type) on_inv_request = function(pos, in_dir, access_type)
@ -101,7 +101,7 @@ techage.register_node({"shop:shop"}, {
local inv = meta:get_inventory() local inv = meta:get_inventory()
return techage.put_items(inv, "register", stack) return techage.put_items(inv, "register", stack)
end, end,
}) })
techage.register_node({"default:furnace", "default:furnace_active"}, { techage.register_node({"default:furnace", "default:furnace_active"}, {
on_pull_item = function(pos, in_dir, num) 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() local inv = meta:get_inventory()
return techage.put_items(inv, "dst", stack) return techage.put_items(inv, "dst", stack)
end, end,
}) })
techage.register_node({"mobs:beehive"}, { techage.register_node({"mobs:beehive"}, {
on_pull_item = function(pos, in_dir, num) on_pull_item = function(pos, in_dir, num)
@ -137,7 +137,7 @@ techage.register_node({"mobs:beehive"}, {
local inv = meta:get_inventory() local inv = meta:get_inventory()
return techage.put_items(inv, "beehive", stack) return techage.put_items(inv, "beehive", stack)
end, end,
}) })
techage.register_node({"xdecor:hive"}, { techage.register_node({"xdecor:hive"}, {
on_pull_item = function(pos, in_dir, num) on_pull_item = function(pos, in_dir, num)
@ -150,4 +150,4 @@ techage.register_node({"xdecor:hive"}, {
local inv = meta:get_inventory() local inv = meta:get_inventory()
return techage.put_items(inv, "honey", stack) return techage.put_items(inv, "honey", stack)
end, end,
}) })

View File

@ -7,9 +7,9 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
TA2 Gravel Rinser, washing sieved gravel to find more ores TA2 Gravel Rinser, washing sieved gravel to find more ores
]]-- ]]--
-- for lazy programmers -- for lazy programmers
@ -146,7 +146,7 @@ local function washing(pos, crd, nvm, inv)
crd.State:keep_running(pos, nvm, COUNTDOWN_TICKS) crd.State:keep_running(pos, nvm, COUNTDOWN_TICKS)
return return
end end
local src = ItemStack("techage:sieved_gravel") local src = ItemStack("techage:sieved_gravel")
local dst = ItemStack("default:sand") local dst = ItemStack("default:sand")
if inv:contains_item("src", src) then if inv:contains_item("src", src) then
@ -255,7 +255,7 @@ 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("rinser", S("Gravel Rinser"), tiles, { techage.register_consumer("rinser", S("Gravel Rinser"), tiles, {
drawtype = "nodebox", drawtype = "nodebox",
paramtype = "light", paramtype = "light",
@ -329,8 +329,7 @@ function techage.add_rinser_recipe(recipe)
recipe.items = {recipe.input} recipe.items = {recipe.input}
recipe.type = "rinsing" recipe.type = "rinsing"
techage.recipes.register_craft(recipe) 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="techage:usmium_nuggets", probability=30})
techage.add_rinser_recipe({input="techage:sieved_gravel", output="default:copper_lump", probability=15}) techage.add_rinser_recipe({input="techage:sieved_gravel", output="default:copper_lump", probability=15})

View File

@ -7,9 +7,9 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
TA2/TA3/TA4 Gravel Sieve, sieving gravel to find ores TA2/TA3/TA4 Gravel Sieve, sieving gravel to find ores
]]-- ]]--
-- for lazy programmers -- for lazy programmers
@ -179,7 +179,7 @@ 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("gravelsieve", S("Gravel Sieve"), tiles, { techage.register_consumer("gravelsieve", S("Gravel Sieve"), tiles, {
drawtype = "nodebox", drawtype = "nodebox",
paramtype = "light", paramtype = "light",
@ -265,17 +265,17 @@ techage.recipes.register_craft_type("ta4_gravelsieve", {
height = 1, height = 1,
}) })
techage.recipes.register_craft({ techage.recipes.register_craft({
output = "techage:sieved_basalt_gravel", output = "techage:sieved_basalt_gravel",
items = {"techage:basalt_gravel"}, items = {"techage:basalt_gravel"},
type = "ta2_gravelsieve", type = "ta2_gravelsieve",
}) })
techage.recipes.register_craft({ techage.recipes.register_craft({
output = "techage:sieved_basalt_gravel", output = "techage:sieved_basalt_gravel",
items = {"techage:basalt_gravel"}, items = {"techage:basalt_gravel"},
type = "ta3_gravelsieve", type = "ta3_gravelsieve",
}) })
techage.recipes.register_craft({ techage.recipes.register_craft({
output = "techage:sieved_basalt_gravel", output = "techage:sieved_basalt_gravel",
items = {"techage:basalt_gravel"}, items = {"techage:basalt_gravel"},
type = "ta4_gravelsieve", type = "ta4_gravelsieve",
}) })

View File

@ -7,9 +7,9 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
TA2/TA3/TA4 Grinder, grinding Cobble/Basalt to Gravel TA2/TA3/TA4 Grinder, grinding Cobble/Basalt to Gravel
]]-- ]]--
-- for lazy programmers -- for lazy programmers
@ -98,7 +98,7 @@ local function src_to_dst(src_stack, idx, src_name, num_items, inp_num, inv, dst
end end
return false return false
end end
local function grinding(pos, crd, nvm, inv) local function grinding(pos, crd, nvm, inv)
local blocked = false -- idle local blocked = false -- idle
for idx,stack in ipairs(inv:get_list("src")) do for idx,stack in ipairs(inv:get_list("src")) do
@ -211,7 +211,7 @@ 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("grinder", S("Grinder"), tiles, { techage.register_consumer("grinder", S("Grinder"), tiles, {
drawtype = "nodebox", drawtype = "nodebox",
paramtype = "light", paramtype = "light",
@ -313,7 +313,7 @@ techage.register_node({"techage:ta1_mill_base"}, {
on_node_load = function(pos, node) on_node_load = function(pos, node)
minetest.get_node_timer(pos):start(4) minetest.get_node_timer(pos):start(4)
end, end,
}) })
minetest.register_craft({ minetest.register_craft({
output = "techage:ta1_mill_base", output = "techage:ta1_mill_base",
@ -369,19 +369,19 @@ function techage.add_grinder_recipe(recipe, ta1_permitted)
if minetest.registered_items[name] then if minetest.registered_items[name] then
if ta1_permitted then if ta1_permitted then
RecipesTa1[name] = {input = name,inp_num = tonumber(num) or 1, output = recipe.output} RecipesTa1[name] = {input = name,inp_num = tonumber(num) or 1, output = recipe.output}
recipe.items = {recipe.input} recipe.items = {recipe.input}
recipe.type = "milling" recipe.type = "milling"
techage.recipes.register_craft(table.copy(recipe)) techage.recipes.register_craft(table.copy(recipe))
end end
Recipes[name] = {input = name,inp_num = tonumber(num) or 1, output = recipe.output} Recipes[name] = {input = name,inp_num = tonumber(num) or 1, output = recipe.output}
recipe.items = {recipe.input} recipe.items = {recipe.input}
recipe.type = "grinding" recipe.type = "grinding"
techage.recipes.register_craft(recipe) techage.recipes.register_craft(recipe)
end end
end end
techage.add_grinder_recipe({input="default:cobble", output="default:gravel"}) techage.add_grinder_recipe({input="default:cobble", output="default:gravel"})

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
Item Source Block Item Source Block
]]-- ]]--
@ -16,7 +16,7 @@ local M = minetest.get_meta
local S = techage.S local S = techage.S
local CYCLE_TIME = 30 local CYCLE_TIME = 30
local function formspec() local function formspec()
return "size[8,7.2]".. return "size[8,7.2]"..
default.gui_bg.. 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 if minetest.is_protected(pos, player:get_player_name()) then
return 0 return 0
end end
return stack:get_count() return stack:get_count()
end 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 if minetest.is_protected(pos, player:get_player_name()) then
return 0 return 0
end end
return stack:get_count() return stack:get_count()
end end
@ -81,7 +81,7 @@ minetest.register_node("techage:itemsource", {
end end
return true return true
end, end,
allow_metadata_inventory_put = allow_metadata_inventory_put, allow_metadata_inventory_put = allow_metadata_inventory_put,
allow_metadata_inventory_take = allow_metadata_inventory_take, allow_metadata_inventory_take = allow_metadata_inventory_take,
@ -97,4 +97,4 @@ techage.register_node({"techage:itemsource"}, {
on_node_load = function(pos) on_node_load = function(pos)
minetest.get_node_timer(pos):start(CYCLE_TIME) minetest.get_node_timer(pos):start(CYCLE_TIME)
end, end,
}) })

View File

@ -7,9 +7,9 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
TA2/TA3 Bucket based Liquid Sampler TA2/TA3 Bucket based Liquid Sampler
]]-- ]]--
-- for lazy programmers -- for lazy programmers
@ -96,7 +96,7 @@ end
local function keep_running(pos, elapsed) local function keep_running(pos, elapsed)
--if tubelib.data_not_corrupted(pos) then --if tubelib.data_not_corrupted(pos) then
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
local crd = CRD(pos) local crd = CRD(pos)
local inv = M(pos):get_inventory() local inv = M(pos):get_inventory()
sample_liquid(pos, crd, nvm, inv) sample_liquid(pos, crd, nvm, inv)
end end
@ -175,7 +175,7 @@ local tubing = {
end, end,
} }
local node_name_ta2, node_name_ta3, _ = local node_name_ta2, node_name_ta3, _ =
techage.register_consumer("liquidsampler", S("Liquid Sampler"), tiles, { techage.register_consumer("liquidsampler", S("Liquid Sampler"), tiles, {
cycle_time = CYCLE_TIME, cycle_time = CYCLE_TIME,
standby_ticks = STANDBY_TICKS, standby_ticks = STANDBY_TICKS,
@ -220,4 +220,3 @@ minetest.register_craft({
{"", "techage:vacuum_tube", ""}, {"", "techage:vacuum_tube", ""},
}, },
}) })

View File

@ -7,9 +7,9 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
Tube support for digtron and protector chests Tube support for digtron and protector chests
]]-- ]]--
@ -20,7 +20,7 @@ local CacheForFuelNodeNames = {}
local function is_fuel(stack) local function is_fuel(stack)
local name = stack:get_name() local name = stack:get_name()
if CacheForFuelNodeNames[name] then if CacheForFuelNodeNames[name] then
return true return true
end end
if minetest.get_craft_result({method="fuel", width=1, items={stack}}).time ~= 0 then 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() local inv = meta:get_inventory()
return techage.put_items(inv, "main", stack) return techage.put_items(inv, "main", stack)
end, end,
}) })
techage.register_node({"digtron:fuelstore"}, { techage.register_node({"digtron:fuelstore"}, {
on_inv_request = function(pos, in_dir, access_type) on_inv_request = function(pos, in_dir, access_type)
@ -75,7 +75,7 @@ techage.register_node({"digtron:fuelstore"}, {
local inv = meta:get_inventory() local inv = meta:get_inventory()
return techage.put_items(inv, "fuel", stack) return techage.put_items(inv, "fuel", stack)
end, end,
}) })
techage.register_node({"digtron:combined_storage"}, { techage.register_node({"digtron:combined_storage"}, {
on_inv_request = function(pos, in_dir, access_type) on_inv_request = function(pos, in_dir, access_type)
@ -102,7 +102,7 @@ techage.register_node({"digtron:combined_storage"}, {
local inv = meta:get_inventory() local inv = meta:get_inventory()
return techage.put_items(inv, "main", stack) return techage.put_items(inv, "main", stack)
end, end,
}) })
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
-- protector -- protector
@ -128,6 +128,4 @@ techage.register_node({"protector:chest"}, {
local inv = meta:get_inventory() local inv = meta:get_inventory()
return techage.put_items(inv, "main", stack) return techage.put_items(inv, "main", stack)
end, end,
}) })

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
TA2/TA3/TA4 Pusher TA2/TA3/TA4 Pusher
Nodes for push/pull operation of StackItems from chests or other Nodes for push/pull operation of StackItems from chests or other
inventory/server nodes to tubes or other inventory/server nodes. inventory/server nodes to tubes or other inventory/server nodes.
@ -33,7 +33,7 @@ local Tube = techage.Tube
local STANDBY_TICKS = 2 local STANDBY_TICKS = 2
local COUNTDOWN_TICKS = 4 local COUNTDOWN_TICKS = 4
local CYCLE_TIME = 2 local CYCLE_TIME = 2
local function ta4_formspec(self, pos, nvm) local function ta4_formspec(self, pos, nvm)
if CRD(pos).stage == 4 then -- TA4 node? if CRD(pos).stage == 4 then -- TA4 node?
return "size[8,7.2]".. 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 if minetest.is_protected(pos, player:get_player_name()) then
return 0 return 0
end end
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
if CRD(pos).State:get_state(nvm) ~= techage.STOPPED then if CRD(pos).State:get_state(nvm) ~= techage.STOPPED then
return 0 return 0
end end
local inv = M(pos):get_inventory() local inv = M(pos):get_inventory()
local list = inv:get_list(listname) local list = inv:get_list(listname)
if list[index]:get_count() == 0 then 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 if minetest.is_protected(pos, player:get_player_name()) then
return 0 return 0
end end
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
if CRD(pos).State:get_state(nvm) ~= techage.STOPPED then if CRD(pos).State:get_state(nvm) ~= techage.STOPPED then
return 0 return 0
end end
local inv = M(pos):get_inventory() local inv = M(pos):get_inventory()
inv:set_stack(listname, index, nil) inv:set_stack(listname, index, nil)
return 0 return 0
@ -118,7 +118,7 @@ local function keep_running(pos, elapsed)
local crd = CRD(pos) local crd = CRD(pos)
pushing(pos, crd, M(pos), nvm) pushing(pos, crd, M(pos), nvm)
crd.State:is_active(nvm) crd.State:is_active(nvm)
end end
local function on_rightclick(pos, node, clicker) local function on_rightclick(pos, node, clicker)
if CRD(pos).stage ~= 4 then -- Not TA4 node? 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 pull_dir = M(pos):get_int("pull_dir")
local push_dir = M(pos):get_int("push_dir") local push_dir = M(pos):get_int("push_dir")
local is_ta4_tube = true local is_ta4_tube = true
for i, pos, node in Tube:get_tube_line(pos, pull_dir) do for i, pos, node in Tube:get_tube_line(pos, pull_dir) do
is_ta4_tube = is_ta4_tube and techage.TA4tubes[node.name] is_ta4_tube = is_ta4_tube and techage.TA4tubes[node.name]
end end
for i, pos, node in Tube:get_tube_line(pos, push_dir) do for i, pos, node in Tube:get_tube_line(pos, push_dir) do
is_ta4_tube = is_ta4_tube and techage.TA4tubes[node.name] is_ta4_tube = is_ta4_tube and techage.TA4tubes[node.name]
end end
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
local crd = CRD(pos) local crd = CRD(pos)
if CRD(pos).stage == 4 and not is_ta4_tube then if CRD(pos).stage == 4 and not is_ta4_tube then
@ -182,7 +182,7 @@ end
local function config_item(pos, payload) local function config_item(pos, payload)
local name, count = unpack(payload:split(" ")) 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 or minetest.registered_craftitems[name]) then
count = tonumber(count) or 1 count = tonumber(count) or 1
local inv = M(pos):get_inventory() local inv = M(pos):get_inventory()
@ -230,14 +230,14 @@ tiles.act = {
}, },
}, },
} }
local tubing = { local tubing = {
-- push item through the pusher in opposit direction -- push item through the pusher in opposit direction
on_push_item = function(pos, in_dir, stack) 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) return in_dir == M(pos):get_int("pull_dir") and techage.safe_push_items(pos, in_dir, stack)
end, end,
is_pusher = true, -- is a pulling/pushing node is_pusher = true, -- is a pulling/pushing node
on_recv_message = function(pos, src, topic, payload) on_recv_message = function(pos, src, topic, payload)
if topic == "pull" then if topic == "pull" then
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
@ -257,8 +257,8 @@ local tubing = {
end end
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, { techage.register_consumer("pusher", S("Pusher"), tiles, {
cycle_time = CYCLE_TIME, cycle_time = CYCLE_TIME,
standby_ticks = STANDBY_TICKS, standby_ticks = STANDBY_TICKS,
@ -285,7 +285,7 @@ local node_name_ta2, node_name_ta3, node_name_ta4 =
node_timer = keep_running, node_timer = keep_running,
on_rotate = screwdriver.disallow, on_rotate = screwdriver.disallow,
tubelib2_on_update2 = tubelib2_on_update2, tubelib2_on_update2 = tubelib2_on_update2,
groups = {choppy=2, cracky=2, crumbly=2}, groups = {choppy=2, cracky=2, crumbly=2},
is_ground_content = false, is_ground_content = false,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
@ -319,4 +319,3 @@ minetest.register_craft({
{"", "techage:ta4_wlanchip", ""}, {"", "techage:ta4_wlanchip", ""},
}, },
}) })

View File

@ -7,9 +7,9 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
Quarry machine to dig stones and other ground blocks. Quarry machine to dig stones and other ground blocks.
The Quarry digs a hole (default) 5x5 blocks large and up to 80 blocks deep. 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, 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. 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 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 Holesize2Idx = {["3x3"] = 1, ["5x5"] = 2, ["7x7"] = 3, ["9x9"] = 4, ["11x11"] = 5}
local Holesize2Diameter = {["3x3"] = 3, ["5x5"] = 5, ["7x7"] = 7, ["9x9"] = 9, ["11x11"] = 11} 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} [-5]=7, [-10]=8, [-15]=9, [-20]=10}
local function formspec(self, pos, nvm) local function formspec(self, pos, nvm)
@ -53,7 +53,7 @@ local function formspec(self, pos, nvm)
elseif CRD(pos).stage == 2 then elseif CRD(pos).stage == 2 then
depth_list = "1,2,3,5,10,15,20" depth_list = "1,2,3,5,10,15,20"
end end
return "size[8,8]".. return "size[8,8]"..
default.gui_bg.. default.gui_bg..
default.gui_bg_img.. default.gui_bg_img..
@ -61,11 +61,11 @@ local function formspec(self, pos, nvm)
"box[0,-0.1;7.8,0.5;#c6e8ff]".. "box[0,-0.1;7.8,0.5;#c6e8ff]"..
"label[3.5,-0.1;"..minetest.colorize( "#000000", S("Quarry")).."]".. "label[3.5,-0.1;"..minetest.colorize( "#000000", S("Quarry")).."]"..
techage.question_mark_help(8, tooltip).. 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").."]".. "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..")]".. "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").."]".. "label[1.6,2.9;"..S("Hole size").."]"..
"list[context;main;5,0.8;3,3;]".. "list[context;main;5,0.8;3,3;]"..
"image[4,0.8;1,1;"..techage.get_power_image(pos, nvm).."]".. "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) local mem = techage.get_mem(pos)
if not mem.handle or mem.handle == -1 then if not mem.handle or mem.handle == -1 then
mem.handle = minetest.sound_play("techage_quarry", { mem.handle = minetest.sound_play("techage_quarry", {
pos = pos, pos = pos,
gain = 1.5, gain = 1.5,
max_hear_distance = 15, max_hear_distance = 15,
loop = true}) loop = true})
@ -114,7 +114,7 @@ local function get_pos(pos, facedir, side, steps)
facedir = (facedir + Side2Facedir[side]) % 4 facedir = (facedir + Side2Facedir[side]) % 4
local dir = vector.multiply(minetest.facedir_to_dir(facedir), steps or 1) local dir = vector.multiply(minetest.facedir_to_dir(facedir), steps or 1)
return vector.add(pos, dir) return vector.add(pos, dir)
end end
local function allow_metadata_inventory_put(pos, listname, index, stack, player) local function allow_metadata_inventory_put(pos, listname, index, stack, player)
if minetest.is_protected(pos, player:get_player_name()) then 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 return pos1, pos2
end 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 return #minetest.find_nodes_in_area(pos1, pos2, {"air"}) == hole_diameter * hole_diameter
end end
@ -189,7 +189,7 @@ local function quarry_task(pos, crd, nvm)
end end
return at_least_one_added return at_least_one_added
end end
local pos1, pos2 = get_corner_positions(pos, facedir, nvm.hole_diameter) local pos1, pos2 = get_corner_positions(pos, facedir, nvm.hole_diameter)
nvm.level = 1 nvm.level = 1
for y_curr = y_first, y_last, -1 do for y_curr = y_first, y_last, -1 do
@ -197,16 +197,16 @@ local function quarry_task(pos, crd, nvm)
pos2.y = y_curr pos2.y = y_curr
nvm.level = y_first - y_curr nvm.level = y_first - y_curr
if minetest.is_area_protected(pos1, pos2, owner, 5) then if minetest.is_area_protected(pos1, pos2, owner, 5) then
crd.State:fault(pos, nvm, S("area is protected")) crd.State:fault(pos, nvm, S("area is protected"))
return return
end end
if not is_air_level(pos1, pos2, nvm.hole_diameter) then if not is_air_level(pos1, pos2, nvm.hole_diameter) then
mark_area(pos1, pos2, owner) mark_area(pos1, pos2, owner)
coroutine.yield() coroutine.yield()
for zoffs = 1, nvm.hole_diameter do for zoffs = 1, nvm.hole_diameter do
for xoffs = 1, nvm.hole_diameter do for xoffs = 1, nvm.hole_diameter do
local qpos = get_quarry_pos(pos1, xoffs, zoffs) local qpos = get_quarry_pos(pos1, xoffs, zoffs)
@ -226,20 +226,20 @@ local function quarry_task(pos, crd, nvm)
end end
crd.State:stop(pos, nvm, S("finished")) crd.State:stop(pos, nvm, S("finished"))
end end
local function keep_running(pos, elapsed) local function keep_running(pos, elapsed)
local mem = techage.get_mem(pos) local mem = techage.get_mem(pos)
if not mem.co then if not mem.co then
mem.co = coroutine.create(quarry_task) mem.co = coroutine.create(quarry_task)
end end
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
local crd = CRD(pos) local crd = CRD(pos)
local _, err = coroutine.resume(mem.co, pos, crd, nvm) local _, err = coroutine.resume(mem.co, pos, crd, nvm)
if err then if err then
minetest.log("error", "[TA4 Quarry Coroutine Error]" .. err) minetest.log("error", "[TA4 Quarry Coroutine Error]" .. err)
end end
if techage.is_activeformspec(pos) then if techage.is_activeformspec(pos) then
M(pos):set_string("formspec", formspec(crd.State, pos, nvm)) M(pos):set_string("formspec", formspec(crd.State, pos, nvm))
end end
@ -268,7 +268,7 @@ local function on_receive_fields(pos, formname, fields, player)
end end
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
local mem = techage.get_mem(pos) local mem = techage.get_mem(pos)
if fields.depth then if fields.depth then
if tonumber(fields.depth) ~= nvm.quarry_depth then if tonumber(fields.depth) ~= nvm.quarry_depth then
nvm.quarry_depth = tonumber(fields.depth) 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) CRD(pos).State:stop(pos, nvm)
end end
end end
if fields.level then if fields.level then
if tonumber(fields.level) ~= nvm.start_level then if tonumber(fields.level) ~= nvm.start_level then
nvm.start_level = tonumber(fields.level) nvm.start_level = tonumber(fields.level)
@ -373,7 +373,7 @@ 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("quarry", S("Quarry"), tiles, { techage.register_consumer("quarry", S("Quarry"), tiles, {
drawtype = "normal", drawtype = "normal",
cycle_time = CYCLE_TIME, cycle_time = CYCLE_TIME,

View File

@ -91,7 +91,7 @@ local function get_recipe(inv)
local input = table.concat(items, ",", 1, last_idx) local input = table.concat(items, ",", 1, last_idx)
local stack = inv:get_stack("output", 1) local stack = inv:get_stack("output", 1)
return { return {
input = input, input = input,
output = stack:get_name() .. " " .. stack:get_count() output = stack:get_name() .. " " .. stack:get_count()
} }
end 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 if minetest.is_protected(pos, player:get_player_name()) then
return 0 return 0
end end
local inv = M(pos):get_inventory() local inv = M(pos):get_inventory()
local list = inv:get_list(listname) local list = inv:get_list(listname)
stack:set_count(1) 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 if minetest.is_protected(pos, player:get_player_name()) then
return 0 return 0
end end
local inv = M(pos):get_inventory() local inv = M(pos):get_inventory()
inv:set_stack(listname, index, nil) inv:set_stack(listname, index, nil)
after_recipe_change(pos, inv, listname) 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 if minetest.is_protected(pos, player:get_player_name()) then
return 0 return 0
end end
local inv = M(pos):get_inventory() local inv = M(pos):get_inventory()
if from_list == to_list then if from_list == to_list then
minetest.after(0.1, after_recipe_change, pos, inv, from_list) 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('input', 9)
inv:set_size('output', 1) inv:set_size('output', 1)
end, end,
after_place_node = function(pos, placer, itemstack) after_place_node = function(pos, placer, itemstack)
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
local number = techage.add_node(pos, "techage:ta4_chest") 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 if minetest.is_protected(pos, player:get_player_name()) then
return return
end end
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
nvm.recipe_idx = nvm.recipe_idx or 1 nvm.recipe_idx = nvm.recipe_idx or 1
if fields.next == ">>" then if fields.next == ">>" then
@ -202,7 +202,7 @@ minetest.register_node("techage:ta4_recipeblock", {
update_inventor(pos, inv, nvm.recipe_idx or 1) update_inventor(pos, inv, nvm.recipe_idx or 1)
M(pos):set_string("formspec", formspec(pos, nvm)) M(pos):set_string("formspec", formspec(pos, nvm))
end, end,
after_dig_node = function(pos, oldnode, oldmetadata, digger) after_dig_node = function(pos, oldnode, oldmetadata, digger)
techage.remove_node(pos, oldnode, oldmetadata) techage.remove_node(pos, oldnode, oldmetadata)
techage.del_mem(pos) 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_put = allow_metadata_inventory_put,
allow_metadata_inventory_take = allow_metadata_inventory_take, allow_metadata_inventory_take = allow_metadata_inventory_take,
allow_metadata_inventory_move = allow_metadata_inventory_move, allow_metadata_inventory_move = allow_metadata_inventory_move,
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {choppy=2, cracky=2, crumbly=2}, groups = {choppy=2, cracky=2, crumbly=2},
is_ground_content = false, is_ground_content = false,
@ -241,4 +241,3 @@ minetest.register_craft({
{"default:steel_ingot", "techage:ta4_wlanchip", "default:steel_ingot"}, {"default:steel_ingot", "techage:ta4_wlanchip", "default:steel_ingot"},
}, },
}) })

View File

@ -7,9 +7,9 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
TA4 Recycler, recycling techage machines TA4 Recycler, recycling techage machines
]]-- ]]--
-- for lazy programmers -- for lazy programmers
@ -112,9 +112,9 @@ local function allow_metadata_inventory_take(pos, listname, index, stack, player
return stack:get_count() return stack:get_count()
end end
local function cook_reverse(stack, inv, idx, recipe) local function cook_reverse(stack, inv, idx, recipe)
-- check space -- 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 if not inv:room_for_item("dst", stack) then
return false return false
end end
@ -122,7 +122,7 @@ local function cook_reverse(stack, inv, idx, recipe)
-- take item -- take item
inv:remove_item("src", ItemStack(recipe.output)) inv:remove_item("src", ItemStack(recipe.output))
-- add items -- add items
for _,item in ipairs(recipe.items) do for _,item in ipairs(recipe.items) do
inv:add_item("dst", item) inv:add_item("dst", item)
end end
return true return true
@ -240,7 +240,7 @@ local tubing = {
end, end,
} }
local _, _, node_name_ta4 = local _, _, node_name_ta4 =
techage.register_consumer("recycler", S("Recycler"), tiles, { techage.register_consumer("recycler", S("Recycler"), tiles, {
drawtype = "nodebox", drawtype = "nodebox",
paramtype = "light", paramtype = "light",
@ -292,13 +292,13 @@ minetest.register_craft({
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
-- Prepare recipes -- Prepare recipes
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
-- Nodes from mods that can be recycled -- Nodes from mods that can be recycled
local ModNames = { local ModNames = {
techage = true, techage = true,
hyperloop = true, hyperloop = true,
} }
local function get_item_list(inputs) local function get_item_list(inputs)
local lst = {} local lst = {}
for _,input in pairs(inputs or {}) do for _,input in pairs(inputs or {}) do
if SpecialItems[input] then if SpecialItems[input] then
@ -317,7 +317,7 @@ local function get_special_recipe(name)
if SpecialItems[name] then if SpecialItems[name] then
return { return {
output = name, output = name,
items = {SpecialItems[name]} items = {SpecialItems[name]}
} }
end end
end end
@ -325,22 +325,22 @@ end
local function collect_recipes() local function collect_recipes()
local add = function(name, ndef) local add = function(name, ndef)
local _, _, mod, _ = string.find(name, "([%w_]+):([%w_]+)") local _, _, mod, _ = string.find(name, "([%w_]+):([%w_]+)")
local recipe = get_special_recipe(name) or local recipe = get_special_recipe(name) or
techage.recipes.get_recipe(name) or techage.recipes.get_recipe(name) or
minetest.get_craft_recipe(name) minetest.get_craft_recipe(name)
local items = get_item_list(recipe.items) local items = get_item_list(recipe.items)
if ModNames[mod] if ModNames[mod]
and ndef.groups.not_in_creative_inventory ~= 1 and ndef.groups.not_in_creative_inventory ~= 1
and not ndef.tool_capabilities and not ndef.tool_capabilities
and recipe.output and recipe.output
and next(items) then and next(items) then
local s = table.concat(items, ", ") local s = table.concat(items, ", ")
--print(string.format("%-36s {%s}", recipe.output, s)) --print(string.format("%-36s {%s}", recipe.output, s))
Recipes[name] = {output = recipe.output, items = items} Recipes[name] = {output = recipe.output, items = items}
end end
end end
for name, ndef in pairs(minetest.registered_nodes) do for name, ndef in pairs(minetest.registered_nodes) do
add(name, ndef) add(name, ndef)
end end

View File

@ -9,7 +9,7 @@
See LICENSE.txt for more information See LICENSE.txt for more information
TA2/TA3 Power Test Source TA2/TA3 Power Test Source
]]-- ]]--
-- for lazy programmers -- for lazy programmers
@ -55,7 +55,7 @@ local function stop_node2(pos, nvm, state)
end end
local function start_node3(pos, nvm, state) local function start_node3(pos, nvm, state)
local meta = M(pos) local meta = M(pos)
nvm.running = true nvm.running = true
nvm.provided = 0 nvm.provided = 0
techage.evaluate_charge_termination(nvm, meta) techage.evaluate_charge_termination(nvm, meta)
@ -241,7 +241,7 @@ techage.register_node({"techage:t4_source"}, {
return State3:on_receive_message(pos, topic, payload) return State3:on_receive_message(pos, topic, payload)
end end
end, end,
}) })
control.register_nodes({"techage:t4_source"}, { control.register_nodes({"techage:t4_source"}, {
on_receive = function(pos, tlib2, topic, payload) on_receive = function(pos, tlib2, topic, payload)
@ -256,11 +256,10 @@ control.register_nodes({"techage:t4_source"}, {
running = nvm.running or false, running = nvm.running or false,
available = PWR_PERF, available = PWR_PERF,
provided = nvm.provided or 0, provided = nvm.provided or 0,
termpoint = meta:get_string("termpoint"), termpoint = meta:get_string("termpoint"),
} }
end end
return false return false
end, end,
} }
) )

View File

@ -7,9 +7,9 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
TA4 8x2000 Chest TA4 8x2000 Chest
]]-- ]]--
-- for lazy programmers -- for lazy programmers
@ -36,7 +36,7 @@ local function repair_inv(nvm)
nvm.inventory = nvm.inventory or {} nvm.inventory = nvm.inventory or {}
for i = 1,8 do for i = 1,8 do
local item = nvm.inventory[i] 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.name or type(item.name) ~= "string" or item.name == ""
or not item.count or type(item.count) ~= "number" or item.count < 1 or not item.count or type(item.count) ~= "number" or item.count < 1
then then
@ -102,8 +102,8 @@ end
local function get_stacksize(pos) local function get_stacksize(pos)
local size = M(pos):get_int("stacksize") local size = M(pos):get_int("stacksize")
if size == 0 then if size == 0 then
return STACK_SIZE return STACK_SIZE
end end
return size return size
end end
@ -362,15 +362,15 @@ local function get_front_chest_pos(pos)
if nvm.front_chest_pos then if nvm.front_chest_pos then
return nvm.front_chest_pos return nvm.front_chest_pos
end end
local node = techage.get_node_lvm(pos) local node = techage.get_node_lvm(pos)
if search_chest_in_front(pos, node) then if search_chest_in_front(pos, node) then
return nvm.front_chest_pos return nvm.front_chest_pos
end end
return pos return pos
end end
local function convert_to_chest_again(pos, node, player) local function convert_to_chest_again(pos, node, player)
local dir = techage.side_to_outdir("B", node.param2) local dir = techage.side_to_outdir("B", node.param2)
local pos1 = tubelib2.get_pos(pos, dir) 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("formspec", formspec(pos1))
M(pos1):set_string("infotext", DESCRIPTION.." "..number) M(pos1):set_string("infotext", DESCRIPTION.." "..number)
end end
end end
local function unlock_chests(pos, player) local function unlock_chests(pos, player)
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
for idx = 1,8 do 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 if minetest.is_protected(pos, player:get_player_name()) then
return return
end end
for i = 1,8 do for i = 1,8 do
if fields["get"..i] ~= nil then if fields["get"..i] ~= nil then
inv_take_from_chest(pos, i) inv_take_from_chest(pos, i)
@ -469,7 +469,7 @@ local function on_receive_fields(pos, formname, fields, player)
if fields.priority then if fields.priority then
M(pos):set_int("priority", fields.priority == "true" and 1 or 0) M(pos):set_int("priority", fields.priority == "true" and 1 or 0)
end end
M(pos):set_string("formspec", formspec(pos)) M(pos):set_string("formspec", formspec(pos))
end end
@ -511,7 +511,7 @@ minetest.register_node("techage:ta4_chest", {
local inv = M(pos):get_inventory() local inv = M(pos):get_inventory()
inv:set_size('main', 8) inv:set_size('main', 8)
end, end,
after_place_node = function(pos, placer) after_place_node = function(pos, placer)
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
if search_chest_in_front(pos, node) then 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) techage_set_numbers = function(pos, numbers, player_name)
return techage.logic.set_numbers(pos, numbers, player_name, DESCRIPTION) return techage.logic.set_numbers(pos, numbers, player_name, DESCRIPTION)
end, end,
on_rotate = on_rotate, on_rotate = on_rotate,
on_rightclick = on_rightclick, on_rightclick = on_rightclick,
on_receive_fields = on_receive_fields, on_receive_fields = on_receive_fields,
@ -538,7 +538,7 @@ minetest.register_node("techage:ta4_chest", {
after_dig_node = after_dig_node, after_dig_node = after_dig_node,
allow_metadata_inventory_put = allow_metadata_inventory_put, allow_metadata_inventory_put = allow_metadata_inventory_put,
allow_metadata_inventory_take = allow_metadata_inventory_take, allow_metadata_inventory_take = allow_metadata_inventory_take,
on_metadata_inventory_put = on_metadata_inventory_put, on_metadata_inventory_put = on_metadata_inventory_put,
on_metadata_inventory_move = on_metadata_inventory_move, on_metadata_inventory_move = on_metadata_inventory_move,
on_metadata_inventory_take = on_metadata_inventory_take, on_metadata_inventory_take = on_metadata_inventory_take,
@ -593,7 +593,7 @@ techage.register_node({"techage:ta4_chest"}, {
end end
return res return res
end, end,
on_recv_message = function(pos, src, topic, payload) on_recv_message = function(pos, src, topic, payload)
if topic == "count" then if topic == "count" then
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
@ -608,7 +608,7 @@ techage.register_node({"techage:ta4_chest"}, {
return "unsupported" return "unsupported"
end end
end, end,
}) })
techage.register_node({"techage:ta4_chest_dummy"}, { techage.register_node({"techage:ta4_chest_dummy"}, {
on_pull_item = function(pos, in_dir, num, item_name) on_pull_item = function(pos, in_dir, num, item_name)
@ -635,7 +635,7 @@ techage.register_node({"techage:ta4_chest_dummy"}, {
end end
return res return res
end end
}) })
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
TA4 Injector 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 if minetest.is_protected(pos, player:get_player_name()) then
return 0 return 0
end end
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
if CRD(pos).State:get_state(nvm) ~= techage.STOPPED then if CRD(pos).State:get_state(nvm) ~= techage.STOPPED then
return 0 return 0
end end
local inv = M(pos):get_inventory() local inv = M(pos):get_inventory()
local list = inv:get_list(listname) local list = inv:get_list(listname)
local cdr = CRD(pos) 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 if minetest.is_protected(pos, player:get_player_name()) then
return 0 return 0
end end
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
if CRD(pos).State:get_state(nvm) ~= techage.STOPPED then if CRD(pos).State:get_state(nvm) ~= techage.STOPPED then
return 0 return 0
end end
local inv = M(pos):get_inventory() local inv = M(pos):get_inventory()
inv:set_stack(listname, index, nil) inv:set_stack(listname, index, nil)
return 0 return 0
@ -148,7 +148,7 @@ local function pushing(pos, crd, meta, nvm)
local filter = inv:get_list("filter") local filter = inv:get_list("filter")
local pushed = false local pushed = false
local pulled = false local pulled = false
for idx, item in ipairs(filter) do for idx, item in ipairs(filter) do
local name = item:get_name() local name = item:get_name()
local num = math.min(item:get_count(), crd.num_items) local num = math.min(item:get_count(), crd.num_items)
@ -165,7 +165,7 @@ local function pushing(pos, crd, meta, nvm)
end end
end end
end end
if not pulled then if not pulled then
crd.State:idle(pos, nvm) crd.State:idle(pos, nvm)
elseif not pushed then elseif not pushed then
@ -179,7 +179,7 @@ local function node_timer(pos, elapsed)
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
local crd = CRD(pos) local crd = CRD(pos)
pushing(pos, crd, M(pos), nvm) pushing(pos, crd, M(pos), nvm)
end end
local function on_receive_fields(pos, formname, fields, player) local function on_receive_fields(pos, formname, fields, player)
if minetest.is_protected(pos, player:get_player_name()) then 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) local nvm = techage.get_nvm(pos)
if fields.pull_mode then if fields.pull_mode then
nvm.pull_mode = fields.pull_mode == "true" nvm.pull_mode = fields.pull_mode == "true"
end end
CRD(pos).State:state_button_event(pos, nvm, fields) CRD(pos).State:state_button_event(pos, nvm, fields)
M(pos):set_string("formspec", formspec(CRD(pos).State, pos, nvm)) M(pos):set_string("formspec", formspec(CRD(pos).State, pos, nvm))
end end
@ -231,14 +231,14 @@ tiles.act = {
}, },
}, },
} }
local tubing = { local tubing = {
-- push item through the injector in opposit direction -- push item through the injector in opposit direction
on_push_item = function(pos, in_dir, stack) 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) return in_dir == M(pos):get_int("pull_dir") and techage.safe_push_items(pos, in_dir, stack)
end, end,
is_pusher = true, -- is a pulling/pushing node is_pusher = true, -- is a pulling/pushing node
on_recv_message = function(pos, src, topic, payload) on_recv_message = function(pos, src, topic, payload)
return CRD(pos).State:on_receive_message(pos, topic, payload) return CRD(pos).State:on_receive_message(pos, topic, payload)
end, end,
@ -246,8 +246,8 @@ local tubing = {
CRD(pos).State:on_node_load(pos) CRD(pos).State:on_node_load(pos)
end, end,
} }
local _, node_name_ta3, node_name_ta4 = local _, node_name_ta3, node_name_ta4 =
techage.register_consumer("injector", S("Injector"), tiles, { techage.register_consumer("injector", S("Injector"), tiles, {
cycle_time = CYCLE_TIME, cycle_time = CYCLE_TIME,
standby_ticks = STANDBY_TICKS, standby_ticks = STANDBY_TICKS,
@ -271,7 +271,7 @@ local _, node_name_ta3, node_name_ta4 =
on_receive_fields = on_receive_fields, on_receive_fields = on_receive_fields,
node_timer = node_timer, node_timer = node_timer,
on_rotate = screwdriver.disallow, on_rotate = screwdriver.disallow,
groups = {choppy=2, cracky=2, crumbly=2}, groups = {choppy=2, cracky=2, crumbly=2},
is_ground_content = false, is_ground_content = false,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),

View File

@ -7,9 +7,9 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
TA5 Hyperloop Chest TA5 Hyperloop Chest
]]-- ]]--
-- for lazy programmers -- for lazy programmers
@ -33,7 +33,7 @@ local function formspec(pos)
local title = ndef.description .. " " .. status local title = ndef.description .. " " .. status
return "size[8,9]".. return "size[8,9]"..
"box[0,-0.1;7.8,0.5;#c6e8ff]" .. "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[context;main;0,1;8,4;]"..
"list[current_player;main;0,5.3;8,4;]".. "list[current_player;main;0,5.3;8,4;]"..
"listring[context;main]".. "listring[context;main]"..
@ -175,7 +175,7 @@ techage.register_node({"techage:ta5_hl_chest"}, {
return "unsupported" return "unsupported"
end end
end, end,
}) })
minetest.register_craft({ minetest.register_craft({

View File

@ -9,7 +9,7 @@
See LICENSE.txt for more information See LICENSE.txt for more information
Assemble routines Assemble routines
]]-- ]]--
-- for lazy programmers -- for lazy programmers
@ -28,7 +28,7 @@ local Face2Dir = {[0]=
{x=0, y=1, z=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} -- param2, and a route table like : {0,3}
-- 0 = forward, 1 = right, 2 = backward, 3 = left -- 0 = forward, 1 = right, 2 = backward, 3 = left
local function dest_pos(pos, param2, route, y_offs) 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) local nvm = techage.get_nvm(pos)
nvm.assemble_locked = false nvm.assemble_locked = false
end end
end end
-- timer based function -- timer based function
local function remove(pos, param2, AssemblyPlan, idx) local function remove(pos, param2, AssemblyPlan, idx)
local item = AssemblyPlan[idx] local item = AssemblyPlan[idx]
@ -68,7 +68,7 @@ local function remove(pos, param2, AssemblyPlan, idx)
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
nvm.assemble_locked = false nvm.assemble_locked = false
end end
end end
local function check_space(pos, param2, AssemblyPlan, player_name) local function check_space(pos, param2, AssemblyPlan, player_name)
for _,item in ipairs(AssemblyPlan) do 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!")) minetest.chat_send_player(player_name, S("[TA] Area is protected!"))
return false return false
end end
local node = techage.get_node_lvm(pos1) local node = techage.get_node_lvm(pos1)
local ndef = minetest.registered_nodes[node.name] local ndef = minetest.registered_nodes[node.name]
if not ndef or not ndef.buildable_to and node.name ~= node_name then 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 -- check protection
if minetest.is_protected(pos, player_name) then if minetest.is_protected(pos, player_name) then
return return
end end
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
if nvm.assemble_locked then if nvm.assemble_locked then
return return
@ -114,7 +114,7 @@ function techage.assemble.remove(pos, AssemblyPlan, player_name)
-- check protection -- check protection
if minetest.is_protected(pos, player_name) then if minetest.is_protected(pos, player_name) then
return return
end end
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
if nvm.assemble_locked then if nvm.assemble_locked then
return return
@ -130,7 +130,7 @@ end
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
local function play_sound(pos, sound) local function play_sound(pos, sound)
minetest.sound_play(sound, { minetest.sound_play(sound, {
pos = pos, pos = pos,
gain = 1, gain = 1,
max_hear_distance = 10, max_hear_distance = 10,
}) })
@ -232,7 +232,7 @@ function techage.assemble.count_items(AssemblyPlan)
end end
end end
return t return t
end end
-- Determine the destination position based on the given route -- Determine the destination position based on the given route
-- param2, and a route table like : {0,3} -- param2, and a route table like : {0,3}

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
Boiler common functions Boiler common functions
]]-- ]]--
@ -74,7 +74,7 @@ function techage.boiler.water_temperature(pos, nvm)
nvm.temperature = math.max(nvm.temperature - HEAT_STEP, 20) nvm.temperature = math.max(nvm.temperature - HEAT_STEP, 20)
end end
nvm.fire_trigger = false nvm.fire_trigger = false
if nvm.water_level == 0 then if nvm.water_level == 0 then
if nvm.num_water > 0 then if nvm.num_water > 0 then
nvm.num_water = nvm.num_water - 1 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 if mem.blocking_time > techage.SystemTime then
return return
end end
nvm.num_water = nvm.num_water or 0 nvm.num_water = nvm.num_water or 0
local wielded_item = puncher:get_wielded_item():get_name() local wielded_item = puncher:get_wielded_item():get_name()
local item_count = puncher:get_wielded_item():get_count() 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)) M(pos):set_string("formspec", techage.boiler.formspec(pos, nvm))
end end
end end

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
Basis functions for inter-node communication Basis functions for inter-node communication
]]-- ]]--
@ -59,7 +59,7 @@ local function delete_nodeinfo_entry(number)
return number return number
end end
-- Keep the cache size small by deleting entries randomly -- Keep the cache size small by deleting entries randomly
local function keep_small(number) local function keep_small(number)
number = delete_nodeinfo_entry(number) number = delete_nodeinfo_entry(number)
minetest.after(10, keep_small, number) minetest.after(10, keep_small, number)
@ -82,13 +82,13 @@ end
-- Determine position related node number for addressing purposes -- Determine position related node number for addressing purposes
local function get_number(pos, new) local function get_number(pos, new)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if meta:contains("node_number") then if meta:contains("node_number") then
return meta:get_string("node_number") return meta:get_string("node_number")
end end
-- generate new number -- generate new number
if new then if new then
local num = backend.add_nodepos(pos) local num = backend.add_nodepos(pos)
meta:set_string("node_number", num) meta:set_string("node_number", num)
return num return num
end end
end end
@ -141,15 +141,15 @@ end
local function get_next_node(pos, out_dir) local function get_next_node(pos, out_dir)
local res, npos, node = Tube:compatible_node(pos, out_dir) local res, npos, node = Tube:compatible_node(pos, out_dir)
local in_dir = tubelib2.Turn180Deg[out_dir] local in_dir = tubelib2.Turn180Deg[out_dir]
return res, npos, in_dir, node.name return res, npos, in_dir, node.name
end end
local function get_dest_node(pos, out_dir) local function get_dest_node(pos, out_dir)
local spos, in_dir = Tube:get_connected_node_pos(pos, out_dir) local spos, in_dir = Tube:get_connected_node_pos(pos, out_dir)
local _,node = Tube:get_node(spos) local _,node = Tube:get_node(spos)
return spos, in_dir, node.name return spos, in_dir, node.name
end end
local function item_handling_node(name) local function item_handling_node(name)
local node_def = name and NodeDef[name] local node_def = name and NodeDef[name]
if node_def then if node_def then
@ -181,17 +181,17 @@ end)
------------------------------------------------------------------- -------------------------------------------------------------------
-- API helper functions -- API helper functions
------------------------------------------------------------------- -------------------------------------------------------------------
-- Function returns { pos, name } for the node referenced by number -- Function returns { pos, name } for the node referenced by number
function techage.get_node_info(dest_num) function techage.get_node_info(dest_num)
return NodeInfoCache[dest_num] or update_nodeinfo(dest_num) return NodeInfoCache[dest_num] or update_nodeinfo(dest_num)
end end
-- Function returns the node number from the given position or -- Function returns the node number from the given position or
-- nil, if no node number for this position is assigned. -- nil, if no node number for this position is assigned.
function techage.get_node_number(pos) function techage.get_node_number(pos)
return get_number(pos) return get_number(pos)
end end
function techage.get_pos(pos, side) function techage.get_pos(pos, side)
local node = techage.get_node_lvm(pos) local node = techage.get_node_lvm(pos)
@ -200,11 +200,11 @@ function techage.get_pos(pos, side)
dir = side_to_dir(side, node.param2) dir = side_to_dir(side, node.param2)
end end
return tubelib2.get_pos(pos, dir) return tubelib2.get_pos(pos, dir)
end end
-- Function is used for available nodes with lost numbers, only. -- Function is used for available nodes with lost numbers, only.
function techage.get_new_number(pos, name) function techage.get_new_number(pos, name)
-- store position -- store position
return get_number(pos, true) return get_number(pos, true)
end end
@ -217,7 +217,7 @@ end
------------------------------------------------------------------- -------------------------------------------------------------------
-- Node construction/destruction functions -- Node construction/destruction functions
------------------------------------------------------------------- -------------------------------------------------------------------
-- Add node to the techage lists. -- Add node to the techage lists.
-- Function determines and returns the node position number, -- Function determines and returns the node position number,
-- needed for message communication. -- needed for message communication.
@ -227,7 +227,7 @@ function techage.add_node(pos, name, is_ta2)
if item_handling_node(name) then if item_handling_node(name) then
Tube:after_place_node(pos) Tube:after_place_node(pos)
end end
if is_ta2 then if is_ta2 then
return "-" return "-"
end end
local key = minetest.hash_node_position(pos) local key = minetest.hash_node_position(pos)
@ -307,10 +307,10 @@ function techage.register_node(names, node_definition)
for _,n in ipairs(names) do for _,n in ipairs(names) do
NodeDef[n] = node_definition NodeDef[n] = node_definition
end 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 node_definition.is_pusher then
Tube:add_secondary_node_names(names) Tube:add_secondary_node_names(names)
for _,n in ipairs(names) do for _,n in ipairs(names) do
techage.KnownNodes[n] = true techage.KnownNodes[n] = true
end end
@ -346,7 +346,7 @@ function techage.check_numbers(numbers, placer_name)
return true return true
end end
return false return false
end end
function techage.send_multi(src, numbers, topic, payload) function techage.send_multi(src, numbers, topic, payload)
--print("send_multi", src, numbers, topic) --print("send_multi", src, numbers, topic)
@ -360,7 +360,7 @@ function techage.send_multi(src, numbers, topic, payload)
end end
end end
end end
end end
function techage.send_single(src, number, topic, payload) function techage.send_single(src, number, topic, payload)
--print("send_single", src, number, topic) --print("send_single", src, number, topic)
@ -373,7 +373,7 @@ function techage.send_single(src, number, topic, payload)
end end
end end
return false return false
end end
-- The destination node location is either: -- The destination node location is either:
-- A) a destination position, specified by pos -- 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) return ndef.on_transfer(dpos, indir, topic, payload)
end end
return false return false
end end
------------------------------------------------------------------- -------------------------------------------------------------------
-- Client side Push/Pull item functions -- Client side Push/Pull item functions
@ -430,10 +430,10 @@ end
function techage.push_items(pos, out_dir, stack, idx) function techage.push_items(pos, out_dir, stack, idx)
local npos, in_dir, name = get_dest_node(pos, out_dir) local npos, in_dir, name = get_dest_node(pos, out_dir)
if npos and NodeDef[name] and NodeDef[name].on_push_item then 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 elseif is_air_like(name) or is_cart_available(npos) then
minetest.add_item(npos, stack) minetest.add_item(npos, stack)
return true return true
end end
return false return false
end end
@ -470,9 +470,9 @@ function techage.unpull_items(pos, out_dir, stack)
end end
return false return false
end 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) -- (nodes with no tube support)
------------------------------------------------------------------- -------------------------------------------------------------------
@ -486,10 +486,10 @@ end
function techage.neighbour_push_items(pos, out_dir, stack) function techage.neighbour_push_items(pos, out_dir, stack)
local res, npos, in_dir, name = get_next_node(pos, out_dir) local res, npos, in_dir, name = get_next_node(pos, out_dir)
if res and NodeDef[name] and NodeDef[name].on_push_item then 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 elseif name == "air" then
minetest.add_item(npos, stack) minetest.add_item(npos, stack)
return true return true
end end
return false return false
end end

View File

@ -7,10 +7,10 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
Configured inventory lib Configured inventory lib
Assuming the inventory has the name "conf" Assuming the inventory has the name "conf"
]]-- ]]--
-- for lazy programmers -- for lazy programmers
@ -38,7 +38,7 @@ function inv_lib.item_filter(pos, size)
for idx = 1, size do for idx = 1, size do
local item_name = inv:get_stack("conf", idx):get_name() local item_name = inv:get_stack("conf", idx):get_name()
if item_name == "" then item_name = "unconfigured" end if item_name == "" then item_name = "unconfigured" end
if not filter[item_name] then if not filter[item_name] then
filter[item_name] = {} filter[item_name] = {}
end end
table.insert(filter[item_name], idx) table.insert(filter[item_name], idx)
@ -49,7 +49,7 @@ end
function inv_lib.allow_conf_inv_put(pos, listname, index, stack, player) function inv_lib.allow_conf_inv_put(pos, listname, index, stack, player)
local inv = M(pos):get_inventory() local inv = M(pos):get_inventory()
local list = inv:get_list(listname) local list = inv:get_list(listname)
if list[index]:get_count() == 0 then if list[index]:get_count() == 0 then
stack:set_count(1) stack:set_count(1)
inv:set_stack(listname, index, stack) inv:set_stack(listname, index, stack)
@ -104,6 +104,6 @@ function inv_lib.take_item(pos, inv, listname, num, stacks)
end end
end end
end end
return inv_lib
return inv_lib

View File

@ -9,7 +9,7 @@
See LICENSE.txt for more information See LICENSE.txt for more information
Count techage commands player related Count techage commands player related
]]-- ]]--
local PlayerName local PlayerName
@ -43,10 +43,10 @@ local function output()
if val > MAX_POINTS then if val > MAX_POINTS then
local obj = minetest.get_player_by_name(name) local obj = minetest.get_player_by_name(name)
if obj then 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.") .. S("[techage] The limit for 'number of commands per minute' has been exceeded.") ..
" " .. string.format(MAX_POINTS .. " " .. S("is allowed. Current value is") .. " " .. val)); " " .. 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) " exceeds the limit for commands per minute. value = " .. val)
local factor = 100 / (obj:get_armor_groups().fleshy or 100) 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}}) 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", description = "Get your current techage command limit value",
func = function(name) func = function(name)
local num = LastPlayerPoints[name] or 0 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") MAX_POINTS .. " " .. S("is allowed")
end end
}) })

View File

@ -10,7 +10,7 @@
See LICENSE.txt for more information See LICENSE.txt for more information
Fake Player Fake Player
]]-- ]]--
-- Map method names to their return values -- Map method names to their return values
@ -115,4 +115,3 @@ for method_name, return_value in pairs(methods) do
return return_value return return_value
end end
end end

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
Firebox basic functions Firebox basic functions
]]-- ]]--
@ -43,7 +43,7 @@ local function determine_burntimes()
local fuel,_ = minetest.get_craft_result({method = "fuel", width = 1, items = {k}}) local fuel,_ = minetest.get_craft_result({method = "fuel", width = 1, items = {k}})
techage.firebox.Burntime[k] = fuel.time techage.firebox.Burntime[k] = fuel.time
end end
end end
minetest.after(1, determine_burntimes) minetest.after(1, determine_burntimes)
function techage.firebox.formspec(nvm) function techage.firebox.formspec(nvm)
@ -147,5 +147,4 @@ function techage.firebox.set_firehole(pos, on)
minetest.swap_node(pos2, {name="air"}) minetest.swap_node(pos2, {name="air"})
end end
end end
end end

View File

@ -9,7 +9,7 @@
See LICENSE.txt for more information See LICENSE.txt for more information
Block fly/move library Block fly/move library
]]-- ]]--
-- for lazy programmers -- for lazy programmers
@ -22,7 +22,7 @@ local flylib = {}
local function lvect_add_vec(lvect1, offs) local function lvect_add_vec(lvect1, offs)
if not lvect1 or not offs then return end if not lvect1 or not offs then return end
local lvect2 = {} local lvect2 = {}
for _, v in ipairs(lvect1) do for _, v in ipairs(lvect1) do
lvect2[#lvect2 + 1] = vector.add(v, offs) lvect2[#lvect2 + 1] = vector.add(v, offs)
@ -32,7 +32,7 @@ end
local function lvect_add(lvect1, lvect2) local function lvect_add(lvect1, lvect2)
if not lvect1 or not lvect2 then return end if not lvect1 or not lvect2 then return end
local lvect3 = {} local lvect3 = {}
for i, v in ipairs(lvect1) do for i, v in ipairs(lvect1) do
lvect3[#lvect3 + 1] = vector.add(v, lvect2[i]) lvect3[#lvect3 + 1] = vector.add(v, lvect2[i])
@ -42,7 +42,7 @@ end
local function lvect_subtract(lvect1, lvect2) local function lvect_subtract(lvect1, lvect2)
if not lvect1 or not lvect2 then return end if not lvect1 or not lvect2 then return end
local lvect3 = {} local lvect3 = {}
for i, v in ipairs(lvect1) do for i, v in ipairs(lvect1) do
lvect3[#lvect3 + 1] = vector.subtract(v, lvect2[i]) lvect3[#lvect3 + 1] = vector.subtract(v, lvect2[i])
@ -58,7 +58,7 @@ local function rotate(v, yaw)
end end
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
-- to_path function for the fly/move path -- to_path function for the fly/move path
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
local function strsplit(text) local function strsplit(text)
@ -79,9 +79,9 @@ function flylib.to_vector(s)
local x,y,z = unpack(string.split(s, ",")) local x,y,z = unpack(string.split(s, ","))
if x and y and z then if x and y and z then
return { return {
x=tonumber(x) or 0, x=tonumber(x) or 0,
y=tonumber(y) or 0, y=tonumber(y) or 0,
z=tonumber(z) or 0, z=tonumber(z) or 0,
} }
end end
end end
@ -89,7 +89,7 @@ end
function flylib.to_path(s, max_dist) function flylib.to_path(s, max_dist)
local tPath local tPath
local dist = 0 local dist = 0
for _, line in ipairs(strsplit(s)) do for _, line in ipairs(strsplit(s)) do
line = trim(line) line = trim(line)
line = string.split(line, "--", true, 1)[1] or "" line = string.split(line, "--", true, 1)[1] or ""
@ -125,7 +125,7 @@ local function reverse_path(lpath)
end end
return lres return lres
end end
local function dest_offset(lpath) local function dest_offset(lpath)
local offs = {x=0, y=0, z=0} local offs = {x=0, y=0, z=0}
for i = 1,#lpath do for i = 1,#lpath do
@ -133,9 +133,9 @@ local function dest_offset(lpath)
end end
return offs return offs
end end
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
-- Entity / Move / Attach / Detach -- Entity / Move / Attach / Detach
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
local MIN_SPEED = 0.4 local MIN_SPEED = 0.4
local MAX_SPEED = 8 local MAX_SPEED = 8
@ -167,7 +167,7 @@ end
-- Check access conflicts with other mods -- Check access conflicts with other mods
local function lock_player(player) local function lock_player(player)
local meta = player:get_meta() 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_int("player_physics_locked", 1)
meta:set_string("player_physics_locked_by", "ta_flylib") meta:set_string("player_physics_locked_by", "ta_flylib")
return true return true
@ -177,7 +177,7 @@ end
local function unlock_player(player) local function unlock_player(player)
local meta = player:get_meta() 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 if meta:get_string("player_physics_locked_by") == "ta_flylib" then
meta:set_int("player_physics_locked", 0) meta:set_int("player_physics_locked", 0)
meta:set_string("player_physics_locked_by", "") meta:set_string("player_physics_locked_by", "")
@ -294,7 +294,7 @@ local function entity_to_node(pos, obj)
nvm.running = nil nvm.running = nil
end end
obj:remove() obj:remove()
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
local ndef1 = minetest.registered_nodes[name] local ndef1 = minetest.registered_nodes[name]
local ndef2 = minetest.registered_nodes[node.name] local ndef2 = minetest.registered_nodes[node.name]
@ -321,7 +321,7 @@ end
local function node_to_entity(start_pos) local function node_to_entity(start_pos)
local meta = M(start_pos) local meta = M(start_pos)
local node, metadata local node, metadata
if meta:contains("ta_move_block") then if meta:contains("ta_move_block") then
-- Move-block stored as metadata -- Move-block stored as metadata
node = minetest.deserialize(meta:get_string("ta_move_block")) node = minetest.deserialize(meta:get_string("ta_move_block"))
@ -335,17 +335,17 @@ local function node_to_entity(start_pos)
end end
local obj = minetest.add_entity(start_pos, "techage:move_item") local obj = minetest.add_entity(start_pos, "techage:move_item")
if obj then if obj then
local self = obj:get_luaentity() local self = obj:get_luaentity()
local rot = techage.facedir_to_rotation(node.param2) local rot = techage.facedir_to_rotation(node.param2)
obj:set_rotation(rot) obj:set_rotation(rot)
obj:set_properties({wield_item=node.name}) obj:set_properties({wield_item=node.name})
obj:set_armor_groups({immortal=1}) obj:set_armor_groups({immortal=1})
-- To be able to revert to node -- To be able to revert to node
self.item_name = node.name self.item_name = node.name
self.param2 = node.param2 self.param2 = node.param2
self.metadata = metadata or {} self.metadata = metadata or {}
-- Prepare for attachments -- Prepare for attachments
self.players = {} self.players = {}
self.entities = {} self.entities = {}
@ -412,7 +412,7 @@ local function handover_to(obj, self, pos1)
nvm.lpos1 = nvm.lpos1 or {} nvm.lpos1 = nvm.lpos1 or {}
if self.move2to1 then if self.move2to1 then
nvm.lpos1[self.pos1_idx] = pos2 nvm.lpos1[self.pos1_idx] = pos2
else else
nvm.lpos1[self.pos1_idx] = pos1 nvm.lpos1[self.pos1_idx] = pos1
end end
@ -435,7 +435,7 @@ minetest.register_entity("techage:move_item", {
visual_size = {x=0.67, y=0.67, z=0.67}, visual_size = {x=0.67, y=0.67, z=0.67},
selectionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, selectionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
}, },
get_staticdata = function(self) get_staticdata = function(self)
return minetest.serialize({ return minetest.serialize({
item_name = self.item_name, item_name = self.item_name,
@ -454,7 +454,7 @@ minetest.register_entity("techage:move_item", {
respawn = true, respawn = true,
}) })
end, end,
on_activate = function(self, staticdata) on_activate = function(self, staticdata)
if staticdata then if staticdata then
local tbl = minetest.deserialize(staticdata) or {} local tbl = minetest.deserialize(staticdata) or {}
@ -478,7 +478,7 @@ minetest.register_entity("techage:move_item", {
end end
end end
end, end,
on_step = function(self, dtime, moveresult) on_step = function(self, dtime, moveresult)
local stop_obj = function(obj, self) local stop_obj = function(obj, self)
local dest_pos = self.dest_pos local dest_pos = self.dest_pos
@ -490,14 +490,14 @@ minetest.register_entity("techage:move_item", {
self.ttl = 2 self.ttl = 2
return dest_pos return dest_pos
end end
if self.dest_pos then if self.dest_pos then
local obj = self.object local obj = self.object
local pos = obj:get_pos() local pos = obj:get_pos()
local dist = vector.distance(pos, self.dest_pos) local dist = vector.distance(pos, self.dest_pos)
local speed = calc_speed(obj:get_velocity()) local speed = calc_speed(obj:get_velocity())
self.old_dist = self.old_dist or dist self.old_dist = self.old_dist or dist
-- Landing -- Landing
if self.lpath and self.lpath[self.path_idx] then if self.lpath and self.lpath[self.path_idx] then
if dist < 1 or dist > self.old_dist then if dist < 1 or dist > self.old_dist then
@ -520,26 +520,26 @@ minetest.register_entity("techage:move_item", {
return return
end end
end end
self.old_dist = dist self.old_dist = dist
-- Braking or limit max speed -- Braking or limit max speed
if self.handover then if self.handover then
if speed > (dist * 4) or speed > self.max_speed 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) local vel = vector.multiply(self.dir,speed)
obj:set_velocity(vel) obj:set_velocity(vel)
obj:set_acceleration({x=0, y=0, z=0}) obj:set_acceleration({x=0, y=0, z=0})
end end
else else
if speed > (dist * 2) or speed > self.max_speed then 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) local vel = vector.multiply(self.dir,speed)
obj:set_velocity(vel) obj:set_velocity(vel)
obj:set_acceleration({x=0, y=0, z=0}) obj:set_acceleration({x=0, y=0, z=0})
end end
end end
elseif self.ttl then elseif self.ttl then
self.ttl = self.ttl - dtime self.ttl = self.ttl - dtime
if self.ttl < 0 then if self.ttl < 0 then
@ -566,19 +566,19 @@ end
local function is_simple_node(pos) local function is_simple_node(pos)
-- special handling -- special handling
local name = minetest.get_node(pos).name local name = minetest.get_node(pos).name
if SimpleNodes[name] ~= nil then if SimpleNodes[name] ~= nil then
return SimpleNodes[name] return SimpleNodes[name]
end end
local ndef = minetest.registered_nodes[name] local ndef = minetest.registered_nodes[name]
if not ndef or name == "air" or name == "ignore" then return false end if not ndef or name == "air" or name == "ignore" then return false end
-- don't remove nodes with some intelligence or undiggable nodes -- don't remove nodes with some intelligence or undiggable nodes
if ndef.drop == "" then return false end if ndef.drop == "" then return false end
if ndef.diggable == false then return false end if ndef.diggable == false then return false end
if ndef.after_dig_node then return false end if ndef.after_dig_node then return false end
return true return true
end end
local function move_node(pos, pos1_idx, start_pos, lpath, max_speed, height, move2to1, handover, cpos) 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) 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) --print("move_nodes", dump(nvm), dump(lpath), max_speed, height, move2to1, handover)
local owner = meta:get_string("owner") local owner = meta:get_string("owner")
techage.counting_add(owner, #nvm.lpos1 * #lpath) techage.counting_add(owner, #nvm.lpos1 * #lpath)
for idx = 1, #nvm.lpos1 do for idx = 1, #nvm.lpos1 do
local pos1 = nvm.lpos1[idx] local pos1 = nvm.lpos1[idx]
local pos2 = nvm.lpos2[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 return true
end end
function flylib.move_to_other_pos(pos, move2to1) function flylib.move_to_other_pos(pos, move2to1)
local meta = M(pos) local meta = M(pos)
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
local lpath, err = flylib.to_path(meta:get_string("path")) or {} 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 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 height = meta:contains("height") and meta:get_float("height") or 1
local handover local handover
if err then return false end if err then return false end
height = techage.in_range(height, 0, 1) height = techage.in_range(height, 0, 1)
max_speed = techage.in_range(max_speed, MIN_SPEED, MAX_SPEED) max_speed = techage.in_range(max_speed, MIN_SPEED, MAX_SPEED)
nvm.lpos1 = nvm.lpos1 or {} nvm.lpos1 = nvm.lpos1 or {}
local offs = dest_offset(lpath) local offs = dest_offset(lpath)
if move2to1 then if move2to1 then
lpath = reverse_path(lpath) lpath = reverse_path(lpath)
end end
-- calc destination positions -- calc destination positions
nvm.lpos2 = lvect_add_vec(nvm.lpos1, offs) nvm.lpos2 = lvect_add_vec(nvm.lpos1, offs)
if move2to1 then if move2to1 then
handover = meta:contains("handoverA") and meta:get_string("handoverA") handover = meta:contains("handoverA") and meta:get_string("handoverA")
else else
@ -688,9 +688,9 @@ function flylib.rotate_nodes(pos, posses1, rot)
local posses2 = techage.rotate_around_center(posses1, rot, cpos) local posses2 = techage.rotate_around_center(posses1, rot, cpos)
local param2 local param2
local nodes2 = {} local nodes2 = {}
techage.counting_add(owner, #posses1 * 2) techage.counting_add(owner, #posses1 * 2)
for i, pos1 in ipairs(posses1) do for i, pos1 in ipairs(posses1) do
local node = techage.get_node_lvm(pos1) local node = techage.get_node_lvm(pos1)
if rot == "l" then if rot == "l" then

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
Keep only one formspec active per player Keep only one formspec active per player
]]-- ]]--

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
Oil fuel burning lib Oil fuel burning lib
]]-- ]]--
@ -51,7 +51,7 @@ function techage.fuel.fuel_container(x, y, nvm)
fuel_percent..":default_furnace_fire_fg.png]".. fuel_percent..":default_furnace_fire_fg.png]"..
techage.item_image(0.1, 1.1, itemname).. techage.item_image(0.1, 1.1, itemname)..
"container_end[]" "container_end[]"
end end
local function help(x, y) local function help(x, y)
local tooltip = S("To add fuel punch\nthis block\nwith a fuel container") 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 if mem.blocking_time > techage.SystemTime then
return return
end end
local wielded_item = puncher:get_wielded_item():get_name() local wielded_item = puncher:get_wielded_item():get_name()
local item_count = puncher:get_wielded_item():get_count() 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 if new_item then
puncher:set_wielded_item(new_item) puncher:set_wielded_item(new_item)
M(pos):set_string("formspec", techage.fuel.formspec(pos, nvm)) M(pos):set_string("formspec", techage.fuel.formspec(pos, nvm))
mem.blocking_time = techage.SystemTime + BLOCKING_TIME mem.blocking_time = techage.SystemTime + BLOCKING_TIME
return return
end end
local ldef = techage.liquid.get_liquid_def(wielded_item) local ldef = techage.liquid.get_liquid_def(wielded_item)
if ldef and ValidOilFuels[ldef.inv_item] then if ldef and ValidOilFuels[ldef.inv_item] then
local lqd = (minetest.registered_nodes[node.name] or {}).liquid 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 nvm.liquid.amount = nvm.liquid.amount - 1
return nvm.liquid.name return nvm.liquid.name
end end
nvm.liquid.name = nil nvm.liquid.name = nil
end end
return nil return nil
end end
@ -194,4 +194,4 @@ function techage.fuel.get_liquid_table(valid_fuel, capacity, start_firebox)
return leftover return leftover
end end
} }
end end

View File

@ -7,9 +7,9 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
Gravel Sieve basis functions Gravel Sieve basis functions
]]-- ]]--
-- Increase the probability over the natural occurrence -- Increase the probability over the natural occurrence
@ -36,12 +36,12 @@ local function add_ores()
and drop ~= "" and drop ~= ""
and item.ore_type == "scatter" and item.ore_type == "scatter"
and item.wherein == "default:stone" and item.wherein == "default:stone"
and item.clust_scarcity ~= nil and item.clust_scarcity > 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.clust_num_ores ~= nil and item.clust_num_ores > 0
and item.y_max ~= nil and item.y_min ~= nil then and item.y_max ~= nil and item.y_min ~= nil then
local factor = 0.5 local factor = 0.5
if item.y_max < -250 then if item.y_max < -250 then
factor = -250 / item.y_max factor = -250 / item.y_max
end end
local probability = (techage.ore_rarity / PROBABILITY_FACTOR) * item.clust_scarcity / local probability = (techage.ore_rarity / PROBABILITY_FACTOR) * item.clust_scarcity /
(item.clust_num_ores * factor) (item.clust_num_ores * factor)
@ -64,7 +64,7 @@ local function add_ores()
overall_probability = overall_probability + 1.0/probability overall_probability = overall_probability + 1.0/probability
end end
minetest.log("info", string.format("[techage] Overall probability %g", overall_probability)) minetest.log("info", string.format("[techage] Overall probability %g", overall_probability))
end end
minetest.after(1, add_ores) minetest.after(1, add_ores)

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
For chests and tanks with hyperloop support 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 function update_node_data(pos, state, conn_name, remote_name, rmt_pos)
local meta = M(pos) local meta = M(pos)
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
if state == "server_connected" then if state == "server_connected" then
Stations:update(pos, {conn_name=conn_name, single="nil"}) Stations:update(pos, {conn_name=conn_name, single="nil"})
meta:set_string("status", "server") meta:set_string("status", "server")
@ -138,7 +138,7 @@ techage.hyperloop.SUBMENU = {
choices = "", choices = "",
on_dropdown = on_dropdown, on_dropdown = on_dropdown,
name = "remote_name", name = "remote_name",
label = S("Remote name"), label = S("Remote name"),
tooltip = S("Connection name of the remote block"), tooltip = S("Connection name of the remote block"),
}, },
} }
@ -153,7 +153,7 @@ function techage.hyperloop.is_client(pos)
end end
end end
end end
function techage.hyperloop.is_server(pos) function techage.hyperloop.is_server(pos)
if HYPERLOOP then if HYPERLOOP then
if M(pos):get_string("status") == "server" then if M(pos):get_string("status") == "server" then
@ -184,28 +184,28 @@ function techage.hyperloop.remote_pos(pos)
end end
return pos return pos
end end
function techage.hyperloop.after_place_node(pos, placer, node_type) function techage.hyperloop.after_place_node(pos, placer, node_type)
if HYPERLOOP then if HYPERLOOP then
Stations:set(pos, node_type, {owner=placer:get_player_name()}) Stations:set(pos, node_type, {owner=placer:get_player_name()})
M(pos):set_string("node_type", node_type) M(pos):set_string("node_type", node_type)
Tube:after_place_node(pos) Tube:after_place_node(pos)
end end
end end
function techage.hyperloop.after_dig_node(pos, oldnode, oldmetadata, digger) function techage.hyperloop.after_dig_node(pos, oldnode, oldmetadata, digger)
if HYPERLOOP then if HYPERLOOP then
local conn_name = oldmetadata.fields.conn_name local conn_name = oldmetadata.fields.conn_name
local remote_name = oldmetadata.fields.remote_name local remote_name = oldmetadata.fields.remote_name
local loc_pos, rmt_pos = pos, techage.get_nvm(pos).rmt_pos local loc_pos, rmt_pos = pos, techage.get_nvm(pos).rmt_pos
-- Close connections -- Close connections
if remote_name and rmt_pos then -- Connected client if remote_name and rmt_pos then -- Connected client
update_node_data(rmt_pos, "server_not_connected", remote_name, "") update_node_data(rmt_pos, "server_not_connected", remote_name, "")
elseif conn_name and rmt_pos then -- Connected server elseif conn_name and rmt_pos then -- Connected server
update_node_data(rmt_pos, "client_not_connected", "", conn_name) update_node_data(rmt_pos, "client_not_connected", "", conn_name)
end end
Tube:after_dig_node(pos) Tube:after_dig_node(pos)
Stations:delete(pos) Stations:delete(pos)
end end
@ -218,7 +218,7 @@ function techage.hyperloop.after_formspec(pos, fields)
local remote_name = meta:get_string("remote_name") local remote_name = meta:get_string("remote_name")
local status = meta:contains("status") and meta:get_string("status") or "not connected" 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 local loc_pos, rmt_pos = pos, techage.get_nvm(pos).rmt_pos
if status == "not connected" then if status == "not connected" then
if fields.remote_name ~= "" then -- Client if fields.remote_name ~= "" then -- Client
local rmt_pos = get_remote_pos(pos, fields.remote_name) local rmt_pos = get_remote_pos(pos, fields.remote_name)
@ -232,4 +232,3 @@ function techage.hyperloop.after_formspec(pos, fields)
end end
end end
end end

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
For the transition from v0.26 to v1.0 For the transition from v0.26 to v1.0
]]-- ]]--

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
Helper functions Helper functions
]]-- ]]--
@ -69,8 +69,8 @@ local RotationViaYAxis = {}
for _,row in ipairs(ROTATION) do for _,row in ipairs(ROTATION) do
for i = 1,4 do for i = 1,4 do
local val = row[i] local val = row[i]
local left = row[i == 1 and 4 or i - 1] local left = row[i == 1 and 4 or i - 1]
local right = row[i == 4 and 1 or i + 1] local right = row[i == 4 and 1 or i + 1]
RotationViaYAxis[val] = {left, right} RotationViaYAxis[val] = {left, right}
end end
end end
@ -250,8 +250,8 @@ end
-- returns true, if node can be dug, otherwise false -- returns true, if node can be dug, otherwise false
function techage.can_node_dig(node, ndef) function techage.can_node_dig(node, ndef)
if RegisteredNodesToBeDug[node.name] then if RegisteredNodesToBeDug[node.name] then
return true return true
end end
if not ndef then return false end if not ndef then return false end
if node.name == "ignore" 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) return handle_drop(ndef.drop)
end end
return ndef.drop or node.name return ndef.drop or node.name
end end
-- needed for windmill plants -- needed for windmill plants
local function determine_ocean_ids() local function determine_ocean_ids()
@ -375,7 +375,7 @@ function techage.item_image(x, y, itemname, count)
end end
label = "label["..(x + offs)..","..(y + 0.45)..";"..tostring(size).."]" label = "label["..(x + offs)..","..(y + 0.45)..";"..tostring(size).."]"
end end
return "box["..x..","..y..";0.85,0.9;#808080]".. return "box["..x..","..y..";0.85,0.9;#808080]"..
"item_image["..x..","..y..";1,1;"..itemname.."]".. "item_image["..x..","..y..";1,1;"..itemname.."]"..
tooltip.. tooltip..
@ -386,12 +386,12 @@ function techage.item_image_small(x, y, itemname, tooltip_prefix)
local name = unpack(string.split(itemname, " ")) local name = unpack(string.split(itemname, " "))
local tooltip = "" local tooltip = ""
local ndef = minetest.registered_nodes[name] or minetest.registered_items[name] or minetest.registered_craftitems[name] local ndef = minetest.registered_nodes[name] or minetest.registered_items[name] or minetest.registered_craftitems[name]
if ndef and ndef.description then if ndef and ndef.description then
local text = minetest.formspec_escape(ndef.description) local text = minetest.formspec_escape(ndef.description)
tooltip = "tooltip["..x..","..y..";0.8,0.8;"..tooltip_prefix..": "..text..";#0C3D32;#FFFFFF]" tooltip = "tooltip["..x..","..y..";0.8,0.8;"..tooltip_prefix..": "..text..";#0C3D32;#FFFFFF]"
end end
return "box["..x..","..y..";0.65,0.7;#808080]".. return "box["..x..","..y..";0.65,0.7;#808080]"..
"item_image["..x..","..y..";0.8,0.8;"..name.."]".. "item_image["..x..","..y..";0.8,0.8;"..name.."]"..
tooltip tooltip
@ -470,7 +470,7 @@ local BUFFER_DEPTH = 10
function techage.historybuffer_add(pos, s) function techage.historybuffer_add(pos, s)
local mem = techage.get_mem(pos) local mem = techage.get_mem(pos)
mem.hisbuf = mem.hisbuf or {} mem.hisbuf = mem.hisbuf or {}
if #s > 2 then if #s > 2 then
table.insert(mem.hisbuf, s) table.insert(mem.hisbuf, s)
if #mem.hisbuf > BUFFER_DEPTH then if #mem.hisbuf > BUFFER_DEPTH then
@ -484,7 +484,7 @@ function techage.historybuffer_priv(pos)
local mem = techage.get_mem(pos) local mem = techage.get_mem(pos)
mem.hisbuf = mem.hisbuf or {} mem.hisbuf = mem.hisbuf or {}
mem.hisbuf_idx = mem.hisbuf_idx or 1 mem.hisbuf_idx = mem.hisbuf_idx or 1
mem.hisbuf_idx = math.max(1, mem.hisbuf_idx - 1) mem.hisbuf_idx = math.max(1, mem.hisbuf_idx - 1)
return mem.hisbuf[mem.hisbuf_idx] return mem.hisbuf[mem.hisbuf_idx]
end end
@ -493,7 +493,7 @@ function techage.historybuffer_next(pos)
local mem = techage.get_mem(pos) local mem = techage.get_mem(pos)
mem.hisbuf = mem.hisbuf or {} mem.hisbuf = mem.hisbuf or {}
mem.hisbuf_idx = mem.hisbuf_idx or 1 mem.hisbuf_idx = mem.hisbuf_idx or 1
mem.hisbuf_idx = math.min(#mem.hisbuf, mem.hisbuf_idx + 1) mem.hisbuf_idx = math.min(#mem.hisbuf, mem.hisbuf_idx + 1)
return mem.hisbuf[mem.hisbuf_idx] return mem.hisbuf[mem.hisbuf_idx]
end end

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
Liquid lib Liquid lib
]]-- ]]--
@ -55,7 +55,7 @@ function techage.liquid.formspec(pos, nvm, title)
help(7.4, -0.1).. help(7.4, -0.1)..
techage.item_image(3.5, 1, itemname) techage.item_image(3.5, 1, itemname)
end end
end end
function techage.liquid.is_empty(pos) function techage.liquid.is_empty(pos)
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
@ -75,7 +75,7 @@ techage.liquid.recv_message = {
return "unsupported" return "unsupported"
end end
end, end,
} }
-- like: register_liquid("techage:ta3_barrel_oil", "techage:ta3_barrel_empty", 10, "techage:oil") -- 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) function techage.register_liquid(full_container, empty_container, container_size, inv_item)
@ -88,7 +88,7 @@ end
local function get_liquid_def(full_container) local function get_liquid_def(full_container)
return LiquidDef[full_container] return LiquidDef[full_container]
end end
local function get_container_def(container_name) local function get_container_def(container_name)
return ContainerDef[container_name] return ContainerDef[container_name]
end end
@ -109,7 +109,7 @@ local function fill_container(pos, inv, empty_container)
local full_container = get_full_container(empty_container, nvm.liquid.name) local full_container = get_full_container(empty_container, nvm.liquid.name)
if empty_container and full_container then if empty_container and full_container then
local ldef = get_liquid_def(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 inv:room_for_item("dst", {name = full_container}) then if inv:room_for_item("dst", {name = full_container}) then
inv:add_item("dst", {name = full_container}) inv:add_item("dst", {name = full_container})
nvm.liquid.amount = nvm.liquid.amount - ldef.size 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 tank_size = (ndef_lqd and ndef_lqd.capa) or 0
local ldef = get_liquid_def(full_container) local ldef = get_liquid_def(full_container)
if ldef and (not nvm.liquid.name or ldef.inv_item == nvm.liquid.name) then 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 if inv:room_for_item("dst", {name = ldef.container}) then
inv:add_item("dst", {name = ldef.container}) inv:add_item("dst", {name = ldef.container})
nvm.liquid.amount = nvm.liquid.amount + ldef.size 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 if empty_container and full_container then
local item = {name = full_container} local item = {name = full_container}
local ldef = get_liquid_def(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? if item_count > 1 then -- can't be simply replaced?
-- check for extra free space -- check for extra free space
local inv = puncher:get_inventory() local inv = puncher:get_inventory()
if inv:room_for_item("main", {name = full_container}) then if inv:room_for_item("main", {name = full_container}) then
-- add full container and return -- add full container and return
-- the empty once - 1 -- 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} item = {name = empty_container, count = item_count - 1}
else else
return -- no free space return -- no free space
end end
end end
nvm.liquid.amount = nvm.liquid.amount - ldef.size nvm.liquid.amount = nvm.liquid.amount - ldef.size
if nvm.liquid.amount == 0 then if nvm.liquid.amount == 0 then
nvm.liquid.name = nil nvm.liquid.name = nil
end end
return item -- to be added to the players inv. return item -- to be added to the players inv.
end 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 count = math.max(nvm.liquid.amount, 99)
local name = nvm.liquid.name local name = nvm.liquid.name
nvm.liquid.amount = nvm.liquid.amount - count nvm.liquid.amount = nvm.liquid.amount - count
if nvm.liquid.amount == 0 then if nvm.liquid.amount == 0 then
nvm.liquid.name = nil nvm.liquid.name = nil
end end
return {name = name, count = count} return {name = name, count = count}
end end
@ -195,7 +195,7 @@ local function legacy_items(full_container, item_count)
elseif full_container == "techage:oil_source" then elseif full_container == "techage:oil_source" then
return {container = "", size = item_count, inv_item = full_container} return {container = "", size = item_count, inv_item = full_container}
end end
end end
-- check if the wielded full container can be emptied into the tank -- check if the wielded full container can be emptied into the tank
local function empty_on_punch(pos, nvm, full_container, item_count) 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 nvm.liquid.amount = nvm.liquid.amount or 0
local lqd_def = get_liquid_def(full_container) or legacy_items(full_container, item_count) local lqd_def = get_liquid_def(full_container) or legacy_items(full_container, item_count)
local ndef_lqd = LQD(pos) 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 local tank_size = ndef_lqd.capa or 0
if not nvm.liquid.name or lqd_def.inv_item == nvm.liquid.name then 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.amount = nvm.liquid.amount + lqd_def.size
nvm.liquid.name = lqd_def.inv_item nvm.liquid.name = lqd_def.inv_item
return {name = lqd_def.container} 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 if mem.blocking_time > techage.SystemTime then
return return
end end
local wielded_item = puncher:get_wielded_item():get_name() local wielded_item = puncher:get_wielded_item():get_name()
local item_count = puncher:get_wielded_item():get_count() 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) or empty_on_punch(pos, nvm, wielded_item, item_count)
if new_item then if new_item then
puncher:set_wielded_item(new_item) puncher:set_wielded_item(new_item)

View File

@ -89,5 +89,3 @@ techage.manual_DE.aPlanTable = {
"", "",
"", "",
} }

View File

@ -9,7 +9,7 @@
See LICENSE.txt for more information See LICENSE.txt for more information
mark.lua: mark.lua:
]]-- ]]--
local marker_region = {} local marker_region = {}
@ -27,9 +27,9 @@ end
function techage.mark_region(name, pos1, pos2, owner, secs) function techage.mark_region(name, pos1, pos2, owner, secs)
if not name or not pos1 or not pos2 then return end if not name or not pos1 or not pos2 then return end
techage.unmark_region(name) techage.unmark_region(name)
local thickness = 0.2 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 sizex, sizey, sizez = (1 + pos2.x - pos1.x) / 2, (1 + pos2.y - pos1.y) / 2, (1 + pos2.z - pos1.z) / 2
local markers = {} local markers = {}
@ -96,4 +96,3 @@ minetest.register_entity(":techage:region_cube", {
techage.unmark_region(self.player_name) techage.unmark_region(self.player_name)
end, end,
}) })

View File

@ -9,7 +9,7 @@
See LICENSE.txt for more information See LICENSE.txt for more information
mark.lua: mark.lua:
]]-- ]]--
local marker_region = {} 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_x = math.abs(pos1.x - pos2.x) + 1
local size_y = math.abs(pos1.y - pos2.y) + 1 local size_y = math.abs(pos1.y - pos2.y) + 1
local size_z = math.abs(pos1.z - pos2.z) + 1 local size_z = math.abs(pos1.z - pos2.z) + 1
local marker = minetest.add_entity( local marker = minetest.add_entity(
{x = new_x, y = new_y, z = new_z}, "techage:position_cube") {x = new_x, y = new_y, z = new_z}, "techage:position_cube")
if marker ~= nil then if marker ~= nil then
@ -126,4 +126,3 @@ minetest.register_entity(":techage:position_side", {
techage.unmark_position(self.player_name) techage.unmark_position(self.player_name)
end, end,
}) })

View File

@ -9,12 +9,12 @@
See LICENSE.txt for more information See LICENSE.txt for more information
Block marker lib for door/move/fly controller Block marker lib for door/move/fly controller
]]-- ]]--
local marker = {} local marker = {}
local MarkedNodes = {} -- t[player] = {{entity, pos},...} local MarkedNodes = {} -- t[player] = {{entity, pos},...}
local MaxNumber = {} local MaxNumber = {}
local CurrentPos -- to mark punched entities local CurrentPos -- to mark punched entities
@ -67,11 +67,11 @@ end
minetest.register_on_punchnode(function(pos, node, puncher, pointed_thing) minetest.register_on_punchnode(function(pos, node, puncher, pointed_thing)
if puncher and puncher:is_player() then if puncher and puncher:is_player() then
local name = puncher:get_player_name() local name = puncher:get_player_name()
if not MarkedNodes[name] then if not MarkedNodes[name] then
return return
end end
mark_position(name, pointed_thing.under) mark_position(name, pointed_thing.under)
end end
end) end)
@ -119,4 +119,4 @@ minetest.register_entity(":techage:block_marker", {
end, end,
}) })
return marker return marker

View File

@ -13,33 +13,33 @@
]]-- ]]--
--[[ --[[
Node states: Node states:
+-----------------------------------+ +------------+ +-----------------------------------+ +------------+
| | | | | | | |
| V V | | V V |
| +---------+ | | +---------+ |
| | | | | | | |
| +---------| STOPPED | | | +---------| STOPPED | |
| | | | | | | | | |
| button | +---------+ | | button | +---------+ |
| | ^ | | | ^ |
button | V | button | button | V | button |
| +---------+ | | button | +---------+ | | button
| +--------->| |---------+ | | +--------->| |---------+ |
| | power | RUNNING | | | | power | RUNNING | |
| | +------| |---------+ | | | +------| |---------+ |
| | | +---------+ | | | | | +---------+ | |
| | | ^ | | | | | | ^ | | |
| | | | | | | | | | | | | |
| | V | V V | | | V | V V |
| +---------+ +----------+ +---------+ | | +---------+ +----------+ +---------+ |
| | | | | | | | | | | | | | | |
+---| NOPOWER | | STANDBY/ | | FAULT |----------+ +---| NOPOWER | | STANDBY/ | | FAULT |----------+
| | | BLOCKED | | | | | | BLOCKED | | |
+---------+ +----------+ +---------+ +---------+ +----------+ +---------+
| cycle time operational needs power | 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.STOPPED = 6 -- not operational/turned off
techage.StatesImg = { techage.StatesImg = {
"techage_inv_button_on.png", "techage_inv_button_on.png",
"techage_inv_button_warning.png", "techage_inv_button_warning.png",
"techage_inv_button_standby.png", "techage_inv_button_standby.png",
"techage_inv_button_nopower.png", "techage_inv_button_nopower.png",
"techage_inv_button_error.png", "techage_inv_button_error.png",
"techage_inv_button_off.png", "techage_inv_button_off.png",
} }
local function error(pos, msg) local function error(pos, msg)
@ -176,7 +176,7 @@ function NodeStates:new(attr)
-- optional -- optional
countdown_ticks = attr.countdown_ticks or 1, countdown_ticks = attr.countdown_ticks or 1,
node_name_passive = attr.node_name_passive, 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, infotext_name = attr.infotext_name,
has_power = attr.has_power or has_power, has_power = attr.has_power or has_power,
can_start = attr.can_start or can_start, can_start = attr.can_start or can_start,
@ -274,7 +274,7 @@ function NodeStates:start(pos, nvm)
self.on_state_change(pos, state, RUNNING) self.on_state_change(pos, state, RUNNING)
end end
start_timer_delayed(pos, self.cycle_time) start_timer_delayed(pos, self.cycle_time)
if self.quick_start and state == STOPPED then if self.quick_start and state == STOPPED then
self.quick_start(pos, 0) self.quick_start(pos, 0)
end end
@ -305,7 +305,7 @@ function NodeStates:standby(pos, nvm, err_string)
return true return true
end end
return false return false
end end
-- special case of standby for pushing nodes -- special case of standby for pushing nodes
function NodeStates:blocked(pos, nvm, err_string) function NodeStates:blocked(pos, nvm, err_string)
@ -330,7 +330,7 @@ function NodeStates:blocked(pos, nvm, err_string)
return true return true
end end
return false return false
end end
function NodeStates:nopower(pos, nvm, err_string) function NodeStates:nopower(pos, nvm, err_string)
local state = nvm.techage_state or RUNNING local state = nvm.techage_state or RUNNING
@ -354,7 +354,7 @@ function NodeStates:nopower(pos, nvm, err_string)
return true return true
end end
return false return false
end end
function NodeStates:fault(pos, nvm, err_string) function NodeStates:fault(pos, nvm, err_string)
local state = nvm.techage_state or STOPPED local state = nvm.techage_state or STOPPED
@ -379,7 +379,7 @@ function NodeStates:fault(pos, nvm, err_string)
return true return true
end end
return false return false
end end
function NodeStates:get_state(nvm) function NodeStates:get_state(nvm)
return nvm.techage_state or techage.STOPPED 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 state == STOPPED or state == STANDBY or state == BLOCKED then
if not self:start(pos, nvm) and (state == STANDBY or state == BLOCKED) then if not self:start(pos, nvm) and (state == STANDBY or state == BLOCKED) then
self:stop(pos, nvm) self:stop(pos, nvm)
end end
elseif state == RUNNING or state == FAULT or state == NOPOWER then elseif state == RUNNING or state == FAULT or state == NOPOWER then
self:stop(pos, nvm) self:stop(pos, nvm)
end end
@ -478,7 +478,7 @@ function NodeStates:on_receive_message(pos, topic, payload)
return "unsupported" return "unsupported"
end end
end end
-- restart timer -- restart timer
function NodeStates:on_node_load(pos) function NodeStates:on_node_load(pos)
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
Data storage system for node related volatile and non-volatile data. Data storage system for node related volatile and non-volatile data.
Non-volatile data is stored from time to time and at shutdown. Non-volatile data is stored from time to time and at shutdown.
Volatile data is lost at every shutdown. Volatile data is lost at every shutdown.
@ -41,14 +41,14 @@ local function get_keys(pos)
end end
local function pos_from_key(key1, key2) local function pos_from_key(key1, key2)
local x1 = (math.floor(key1 / (4096 * 4096)) - 2048) * 16 local x1 = (math.floor(key1 / (4096 * 4096)) - 2048) * 16
local y1 = ((math.floor(key1 / 4096) % 4096) - 2048) * 16 local y1 = ((math.floor(key1 / 4096) % 4096) - 2048) * 16
local z1 = ((key1 % 4096) - 2048) * 16 local z1 = ((key1 % 4096) - 2048) * 16
local x2 = math.floor(key2 / (16 * 16)) local x2 = math.floor(key2 / (16 * 16))
local y2 = math.floor(key2 / 16) % 16 local y2 = math.floor(key2 / 16) % 16
local z2 = key2 % 16 local z2 = key2 % 16
return {x = x1 + x2, y = y1 + y2, z = z1 + z2} return {x = x1 + x2, y = y1 + y2, z = z1 + z2}
end end
@ -66,8 +66,8 @@ local function debug(key1, item)
end end
print("mapblock", string.format("%09X", key1), cnt.." nodes") print("mapblock", string.format("%09X", key1), cnt.." nodes")
end end
------------------------------------------------------------------- -------------------------------------------------------------------
-- Storage scheduler -- Storage scheduler
------------------------------------------------------------------- -------------------------------------------------------------------
@ -137,12 +137,12 @@ end
-- Returns non-volatile node data as table -- Returns non-volatile node data as table
function techage.get_nvm(pos) function techage.get_nvm(pos)
local key1, key2 = get_keys(pos) local key1, key2 = get_keys(pos)
if not NvmStore[key1] then if not NvmStore[key1] then
NvmStore[key1] = backend.get_mapblock_data(key1) NvmStore[key1] = backend.get_mapblock_data(key1)
push(key1) push(key1)
end end
local block = NvmStore[key1] local block = NvmStore[key1]
block.in_use = true block.in_use = true
if not block[key2] then if not block[key2] then
@ -161,7 +161,7 @@ end
function techage.del_mem(pos) function techage.del_mem(pos)
local hash = minetest.hash_node_position(pos) local hash = minetest.hash_node_position(pos)
MemStore[hash] = nil MemStore[hash] = nil
local key1, key2 = get_keys(pos) local key1, key2 = get_keys(pos)
NvmStore[key1] = NvmStore[key1] or backend.get_mapblock_data(key1) NvmStore[key1] = NvmStore[key1] or backend.get_mapblock_data(key1)
NvmStore[key1][key2] = nil NvmStore[key1][key2] = nil

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
Storage backend for node related data as node metadata Storage backend for node related data as node metadata
]]-- ]]--
@ -35,7 +35,7 @@ if use_marshal then
if not marshal then if not marshal then
error("Please install marshal via 'luarocks install lua-marshal'") error("Please install marshal via 'luarocks install lua-marshal'")
end end
serialize = marshal.encode serialize = marshal.encode
deserialize = function(s) deserialize = function(s)
@ -76,12 +76,12 @@ end
function api.get_node_data(pos) function api.get_node_data(pos)
local tbl = {} local tbl = {}
local s = M(pos):get_string("ta_data") local s = M(pos):get_string("ta_data")
if s ~= "" then if s ~= "" then
tbl = deserialize(s) or {} tbl = deserialize(s) or {}
end end
tbl._POS_ = table.copy(pos) tbl._POS_ = table.copy(pos)
return tbl return tbl
end end

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
Storage backend for node related data via sqlite database Storage backend for node related data via sqlite database
]]-- ]]--
@ -44,7 +44,7 @@ if sqlite3 then sqlite3 = nil end
db:exec[[ db:exec[[
CREATE TABLE mapblocks(id INTEGER PRIMARY KEY, key INTEGER, data BLOB); 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, ?, ?);") local set = db:prepare("INSERT or REPLACE INTO mapblocks VALUES(NULL, ?, ?);")
@ -54,7 +54,7 @@ local function set_block(key, data)
set:reset() set:reset()
set:bind(1, key) set:bind(1, key)
set:bind_blob(2, data) set:bind_blob(2, data)
set:step() set:step()
return true return true
end end
@ -76,8 +76,8 @@ function api.store_mapblock_data(key, mapblock_data)
--local s = marshal.encode(mapblock_data) --local s = marshal.encode(mapblock_data)
local s = minetest.serialize(mapblock_data) local s = minetest.serialize(mapblock_data)
return set_block(key, s) return set_block(key, s)
end end
function api.get_mapblock_data(key) function api.get_mapblock_data(key)
local s = get_block(key) local s = get_block(key)
if s then if s then
@ -89,8 +89,8 @@ function api.get_mapblock_data(key)
end end
api.store_mapblock_data(key, {}) api.store_mapblock_data(key, {})
return {} return {}
end end
function api.get_node_data(pos) function api.get_node_data(pos)
-- legacy data available? -- legacy data available?
local s = M(pos):get_string("ta_data") local s = M(pos):get_string("ta_data")

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
Storage backend for node number mapping via sqlite database Storage backend for node number mapping via sqlite database
]]-- ]]--
@ -46,7 +46,7 @@ if sqlite3 then sqlite3 = nil end
db:exec[[ db:exec[[
CREATE TABLE numbers(id INTEGER PRIMARY KEY, number INTEGER, x INTEGER, y INTEGER, z INTEGER); 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, ?, ?, ?, ?);") 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(2, pos.x)
set:bind(3, pos.y) set:bind(3, pos.y)
set:bind(4, pos.z) set:bind(4, pos.z)
set:step() set:step()
return true return true
end end
@ -94,7 +94,7 @@ if Version == 3 then
storage:set_string(number, "") storage:set_string(number, "")
end end
end end
elseif Version == 4 then elseif Version == 4 then
NextNumber = storage:get_int("NextNumber") NextNumber = storage:get_int("NextNumber")
else else
error("[] Invalid version number for 'number to pos mapping' table!") error("[] Invalid version number for 'number to pos mapping' table!")
@ -108,28 +108,28 @@ local api = {}
function api.get_nodepos(number) function api.get_nodepos(number)
return get_block(number) return get_block(number)
end end
function api.set_nodepos(number, pos) function api.set_nodepos(number, pos)
set_block(number, pos) set_block(number, pos)
end end
function api.add_nodepos(pos) function api.add_nodepos(pos)
local num = tostring(NextNumber) local num = tostring(NextNumber)
NextNumber = NextNumber + 1 NextNumber = NextNumber + 1
storage:set_int("NextNumber", NextNumber) storage:set_int("NextNumber", NextNumber)
set_block(num, pos) set_block(num, pos)
return num return num
end end
function api.del_nodepos(number) function api.del_nodepos(number)
del_block(number) del_block(number)
end end
-- delete invalid entries -- delete invalid entries
function api.delete_invalid_entries(node_def) function api.delete_invalid_entries(node_def)
minetest.log("info", "[TechAge] Data maintenance started") 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 pos = {x = x, y = y, z = z}
local name = techage.get_node_lvm(pos).name local name = techage.get_node_lvm(pos).name
if not node_def[name] then if not node_def[name] then
@ -137,6 +137,6 @@ function api.delete_invalid_entries(node_def)
end end
end end
minetest.log("info", "[TechAge] Data maintenance finished") minetest.log("info", "[TechAge] Data maintenance finished")
end end
return api return api

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
Storage backend for node number mapping via mod storage Storage backend for node number mapping via mod storage
]]-- ]]--
@ -59,23 +59,23 @@ storage:set_int("Version", Version)
------------------------------------------------------------------- -------------------------------------------------------------------
function backend.get_nodepos(number) function backend.get_nodepos(number)
return minetest.string_to_pos(storage:get_string(number)) return minetest.string_to_pos(storage:get_string(number))
end end
function backend.set_nodepos(number, pos) function backend.set_nodepos(number, pos)
storage:set_string(number, minetest.pos_to_string(pos)) storage:set_string(number, minetest.pos_to_string(pos))
end end
function backend.add_nodepos(pos) function backend.add_nodepos(pos)
local num = tostring(NextNumber) local num = tostring(NextNumber)
NextNumber = NextNumber + 1 NextNumber = NextNumber + 1
storage:set_int("NextNumber", NextNumber) storage:set_int("NextNumber", NextNumber)
storage:set_string(num, minetest.pos_to_string(pos)) storage:set_string(num, minetest.pos_to_string(pos))
return num return num
end end
function backend.del_nodepos(number) function backend.del_nodepos(number)
storage:set_string(number, "") storage:set_string(number, "")
end end
-- delete invalid entries -- delete invalid entries
function backend.delete_invalid_entries(node_def) function backend.delete_invalid_entries(node_def)
@ -88,11 +88,11 @@ function backend.delete_invalid_entries(node_def)
if not node_def[name] then if not node_def[name] then
backend.del_nodepos(number) backend.del_nodepos(number)
else else
minetest.get_meta(pos):set_string("node_number", number) minetest.get_meta(pos):set_string("node_number", number)
end end
end end
end end
minetest.log("info", "[TechAge] Data maintenance finished") minetest.log("info", "[TechAge] Data maintenance finished")
end end
return backend return backend

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
Recipe lib for formspecs Recipe lib for formspecs
]]-- ]]--
@ -38,7 +38,7 @@ local GROUP_ITEMS = {
local RECIPE = { local RECIPE = {
output = {name = "", num = 0}, output = {name = "", num = 0},
waste = {name = "", num = 0}, waste = {name = "", num = 0},
input = { input = {
{name = "", num =0}, {name = "", num =0},
{name = "", num =0}, {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) local player = minetest.get_player_by_name(owner)
ex_points = techage.get_expoints(player) or 0 ex_points = techage.get_expoints(player) or 0
end end
local tbl = {} local tbl = {}
for _,item in ipairs(recipes) do for _,item in ipairs(recipes) do
if ex_points >= (item.ex_points or 0) then if ex_points >= (item.ex_points or 0) then
@ -78,7 +78,7 @@ function techage.recipes.get(nvm, rtype)
local recipes = Recipes[rtype] or {} local recipes = Recipes[rtype] or {}
return recipes[nvm.recipe_idx or 1] return recipes[nvm.recipe_idx or 1]
end end
-- Add 4 input/output/waste recipe -- Add 4 input/output/waste recipe
-- { -- {
-- output = "<item-name> <units>", -- units = 1..n -- output = "<item-name> <units>", -- units = 1..n
@ -92,7 +92,7 @@ function techage.recipes.add(rtype, recipe)
if not Recipes[rtype] then if not Recipes[rtype] then
Recipes[rtype] = {} Recipes[rtype] = {}
end end
local name, num, output local name, num, output
local item = {input = {}} local item = {input = {}}
for idx = 1,4 do for idx = 1,4 do
@ -100,7 +100,7 @@ function techage.recipes.add(rtype, recipe)
name, num = unpack(string.split(inp, " ")) name, num = unpack(string.split(inp, " "))
item.input[idx] = {name = name or "", num = tonumber(num) or 0} item.input[idx] = {name = name or "", num = tonumber(num) or 0}
end end
if recipe.waste then if recipe.waste then
name, num = unpack(string.split(recipe.waste, " ")) name, num = unpack(string.split(recipe.waste, " "))
else else
name, num = "", "0" name, num = "", "0"
@ -114,12 +114,12 @@ function techage.recipes.add(rtype, recipe)
output = name output = name
techage.recipes.register_craft({ techage.recipes.register_craft({
output = recipe.output, output = recipe.output,
items = recipe.input, items = recipe.input,
type = rtype, type = rtype,
}) })
NormalizedRecipes[output] = { NormalizedRecipes[output] = {
output = recipe.output, output = recipe.output,
items = recipe.input, items = recipe.input,
} }
end end
@ -151,9 +151,9 @@ function techage.recipes.on_receive_fields(pos, formname, fields, player)
return return
end end
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
nvm.recipe_idx = nvm.recipe_idx or 1 nvm.recipe_idx = nvm.recipe_idx or 1
if not nvm.running then if not nvm.running then
if fields.next == ">>" then if fields.next == ">>" then
nvm.recipe_idx = nvm.recipe_idx + 1 nvm.recipe_idx = nvm.recipe_idx + 1
elseif fields.priv == "<<" then elseif fields.priv == "<<" then
@ -165,8 +165,8 @@ end
function techage.recipes.get_recipe(name) function techage.recipes.get_recipe(name)
return NormalizedRecipes[name] return NormalizedRecipes[name]
end end
function techage.recipes.get_default_group_item_name(item_name) function techage.recipes.get_default_group_item_name(item_name)
if item_name and item_name:sub(1, 6) == "group:" then if item_name and item_name:sub(1, 6) == "group:" then
local default_name = GROUP_ITEMS[item_name:sub(7)] local default_name = GROUP_ITEMS[item_name:sub(7)]
@ -182,7 +182,7 @@ function techage.recipes.add_group_item(group, default_item_name)
end end
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
-- Borrowed from ghaydn -- Borrowed from ghaydn
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
local has_i3 = minetest.get_modpath("i3") local has_i3 = minetest.get_modpath("i3")
local has_ui = minetest.get_modpath("unified_inventory") local has_ui = minetest.get_modpath("unified_inventory")

View File

@ -34,7 +34,7 @@ function techage.shared_inv.node_timer(pos, elapsed)
if techage.is_activeformspec(pos) then if techage.is_activeformspec(pos) then
copy_inventory_list(rmt_pos, pos, "main") copy_inventory_list(rmt_pos, pos, "main")
return true return true
end end
return false return false
end end
@ -64,6 +64,5 @@ function techage.shared_inv.on_rightclick(pos, clicker, listname)
copy_inventory_list(rmt_pos, pos, listname) copy_inventory_list(rmt_pos, pos, listname)
techage.set_activeformspec(pos, clicker) techage.set_activeformspec(pos, clicker)
minetest.get_node_timer(pos):start(2) minetest.get_node_timer(pos):start(2)
end end
end end

View File

@ -21,6 +21,7 @@ techage.shared_tank = {}
local liquid = networks.liquid local liquid = networks.liquid
local hyperloop = techage.hyperloop local hyperloop = techage.hyperloop
local remote_pos = techage.hyperloop.remote_pos local remote_pos = techage.hyperloop.remote_pos
local is_paired = techage.hyperloop.is_paired
local menu = techage.menu local menu = techage.menu
local function formspec(pos) local function formspec(pos)
@ -36,10 +37,10 @@ local function formspec(pos)
end end
function techage.shared_tank.node_timer(pos) function techage.shared_tank.node_timer(pos)
if techage.is_activeformspec(pos) then if techage.is_activeformspec(pos) and is_paired(pos) then
M(pos):set_string("formspec", formspec(pos)) M(pos):set_string("formspec", formspec(pos))
return true return true
end end
return false return false
end end
@ -47,10 +48,10 @@ function techage.shared_tank.on_rightclick(pos, node, clicker)
--if hyperloop.is_client(pos) then --if hyperloop.is_client(pos) then
techage.set_activeformspec(pos, clicker) techage.set_activeformspec(pos, clicker)
minetest.get_node_timer(pos):start(2) minetest.get_node_timer(pos):start(2)
--end --end
M(pos):set_string("formspec", formspec(pos)) M(pos):set_string("formspec", formspec(pos))
end end
function techage.shared_tank.can_dig(pos, player) function techage.shared_tank.can_dig(pos, player)
if minetest.is_protected(pos, player:get_player_name()) then if minetest.is_protected(pos, player:get_player_name()) then
return false return false
@ -60,26 +61,47 @@ function techage.shared_tank.can_dig(pos, player)
end end
function techage.shared_tank.peek_liquid(pos, indir) function techage.shared_tank.peek_liquid(pos, indir)
pos = remote_pos(pos) if is_paired(pos) then
local nvm = techage.get_nvm(pos) pos = remote_pos(pos)
return liquid.srv_peek(nvm) local nvm = techage.get_nvm(pos)
return liquid.srv_peek(nvm)
end
end end
function techage.shared_tank.take_liquid(pos, indir, name, amount) function techage.shared_tank.take_liquid(pos, indir, name, amount)
pos = remote_pos(pos) if is_paired(pos) then
local nvm = techage.get_nvm(pos) pos = remote_pos(pos)
amount, name = liquid.srv_take(nvm, name, amount) local nvm = techage.get_nvm(pos)
if techage.is_activeformspec(pos) then amount, name = liquid.srv_take(nvm, name, amount)
M(pos):set_string("formspec", formspec(pos)) if techage.is_activeformspec(pos) then
M(pos):set_string("formspec", formspec(pos))
end
return amount, name
end end
return amount, name return 0, name
end end
function techage.shared_tank.put_liquid(pos, indir, name, amount) function techage.shared_tank.put_liquid(pos, indir, name, amount)
pos = remote_pos(pos) if is_paired(pos) then
-- check if it is not powder pos = remote_pos(pos)
local ndef = minetest.registered_craftitems[name] or {} -- check if it is not powder
if not ndef.groups or ndef.groups.powder ~= 1 then local ndef = minetest.registered_craftitems[name] or {}
if not ndef.groups or ndef.groups.powder ~= 1 then
local nvm = techage.get_nvm(pos)
local ndef = NDEF(pos)
local leftover = liquid.srv_put(nvm, name, amount, ndef.liquid.capa)
if techage.is_activeformspec(pos) then
M(pos):set_string("formspec", formspec(pos))
end
return leftover
end
end
return amount
end
function techage.shared_tank.untake_liquid(pos, indir, name, amount)
if is_paired(pos) then
pos = remote_pos(pos)
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
local ndef = NDEF(pos) local ndef = NDEF(pos)
local leftover = liquid.srv_put(nvm, name, amount, ndef.liquid.capa) local leftover = liquid.srv_put(nvm, name, amount, ndef.liquid.capa)
@ -91,15 +113,4 @@ function techage.shared_tank.put_liquid(pos, indir, name, amount)
return amount return amount
end end
function techage.shared_tank.untake_liquid(pos, indir, name, amount) techage.shared_tank.formspec = formspec
pos = remote_pos(pos)
local nvm = techage.get_nvm(pos)
local ndef = NDEF(pos)
local leftover = liquid.srv_put(nvm, name, amount, ndef.liquid.capa)
if techage.is_activeformspec(pos) then
M(pos):set_string("formspec", formspec(pos))
end
return leftover
end
techage.shared_tank.formspec = formspec

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
A formspec control to generate formspec strings for machine settings and monitoring 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 local player_inv_needed = false
if meta and form_def then if meta and form_def then
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
for i,elem in ipairs(form_def) do for i,elem in ipairs(form_def) do
local offs = (i - 1) * 0.9 - 0.2 local offs = (i - 1) * 0.9 - 0.2
tbl[#tbl+1] = "label[0," .. offs .. ";" .. minetest.formspec_escape(elem.label) .. ":]" 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!") .. "]" tbl[#tbl+1] = "label[0," .. offs .. ";" .. S("Note: You can't change any values while the block is running!") .. "]"
end end
end end
return player_inv_needed, table.concat(tbl, "") return player_inv_needed, table.concat(tbl, "")
end end
@ -143,23 +143,23 @@ local function value_check(elem, value)
end end
return value ~= nil return value ~= nil
end end
local function evaluate_data(pos, meta, form_def, fields, player_name) local function evaluate_data(pos, meta, form_def, fields, player_name)
local res = true local res = true
if meta and form_def then if meta and form_def then
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
if nvm.running or techage.is_running(nvm) then if nvm.running or techage.is_running(nvm) then
return res return res
end end
for idx,elem in ipairs(form_def) do 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 if fields[elem.name] == "" then
meta:set_string(elem.name, "") meta:set_string(elem.name, "")
elseif fields[elem.name]:find("^[%d ]+$") then elseif fields[elem.name]:find("^[%d ]+$") then
local val = tonumber(fields[elem.name]) local val = tonumber(fields[elem.name])
if value_check(elem, val) then if value_check(elem, val) then
meta:set_int(elem.name, val) meta:set_int(elem.name, val)
--print("set_int", elem.name, val) --print("set_int", elem.name, val)
else else
@ -169,11 +169,11 @@ local function evaluate_data(pos, meta, form_def, fields, player_name)
res = false res = false
end end
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 if fields[elem.name] == "" then
meta:set_string(elem.name, "") 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]) meta:set_string(elem.name, fields[elem.name])
else else
res = false res = false
@ -184,13 +184,13 @@ local function evaluate_data(pos, meta, form_def, fields, player_name)
meta:set_string(elem.name, "") meta:set_string(elem.name, "")
elseif fields[elem.name] then elseif fields[elem.name] then
local val = tonumber(fields[elem.name]) 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) meta:set_string(elem.name, val)
else else
res = false res = false
end end
end end
elseif elem.type == "ascii" then elseif elem.type == "ascii" then
if fields[elem.name] == ""then if fields[elem.name] == ""then
meta:set_string(elem.name, "") meta:set_string(elem.name, "")
elseif fields[elem.name] then elseif fields[elem.name] then
@ -200,11 +200,11 @@ local function evaluate_data(pos, meta, form_def, fields, player_name)
res = false res = false
end end
end end
elseif elem.type == "dropdown" then elseif elem.type == "dropdown" then
if fields[elem.name] ~= nil then if fields[elem.name] ~= nil then
meta:set_string(elem.name, fields[elem.name]) meta:set_string(elem.name, fields[elem.name])
end 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 inv_name = minetest.formspec_escape(player_name) .. "_techage_wrench_menu"
local dinv = minetest.get_inventory({type = "detached", name = inv_name}) local dinv = minetest.get_inventory({type = "detached", name = inv_name})
local ninv = minetest.get_inventory({type = "node", pos = pos}) 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}) allow_take = allow_take})
local dinv = minetest.get_inventory({type = "detached", name = inv_name}) local dinv = minetest.get_inventory({type = "detached", name = inv_name})
local ninv = minetest.get_inventory({type = "node", pos = pos}) 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")) dinv:set_size('cfg', ninv:get_size("cfg"))
for i = 1, ninv:get_size("cfg") do for i = 1, ninv:get_size("cfg") do
dinv:set_stack("cfg", i, ninv:get_stack("cfg", i)) 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 title = ndef.description .. " (" .. number .. ")"
local player_inv_needed, text = generate_formspec_substring(pos, meta, form_def, player_name) local player_inv_needed, text = generate_formspec_substring(pos, meta, form_def, player_name)
local buttons local buttons
if player_inv_needed then if player_inv_needed then
buttons = "button[0.5,6.2;3,1;refresh;" .. S("Refresh") .. "]" .. buttons = "button[0.5,6.2;3,1;refresh;" .. S("Refresh") .. "]" ..
"button_exit[3.5,6.2;3,1;cancel;" .. S("Cancel") .. "]" .. "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_exit[3.5,8.4;3,1;cancel;" .. S("Cancel") .. "]" ..
"button[6.5,8.4;3,1;save;" .. S("Save") .. "]" "button[6.5,8.4;3,1;save;" .. S("Save") .. "]"
end end
if #form_def > 8 then if #form_def > 8 then
local size = (#form_def * 10) - 60 local size = (#form_def * 10) - 60
return "size[10,9]" .. return "size[10,9]" ..
@ -287,10 +287,10 @@ function techage.menu.generate_formspec(pos, ndef, form_def, player_name)
return "" return ""
end 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 if fields.save or fields.key_enter_field then
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
evaluate_data(pos, meta, form_def, fields, player_name) evaluate_data(pos, meta, form_def, fields, player_name)
end end
return fields.refresh or fields.save or fields.key_enter_field return fields.refresh or fields.save or fields.key_enter_field
end end

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
For tupe/pipe blocks with teleport support For tupe/pipe blocks with teleport support
]]-- ]]--
@ -67,7 +67,7 @@ local TELE_MENU = {
choices = "", choices = "",
on_dropdown = get_free_server_list, on_dropdown = get_free_server_list,
name = "remote_name", name = "remote_name",
label = S("Remote name"), label = S("Remote name"),
tooltip = S("Connection name of the remote block"), tooltip = S("Connection name of the remote block"),
}, },
{ {
@ -83,7 +83,7 @@ function techage.teleport.formspec(pos)
local ndef = NDEF(pos) local ndef = NDEF(pos)
return menu.generate_formspec(pos, ndef, TELE_MENU) return menu.generate_formspec(pos, ndef, TELE_MENU)
end end
local function store_connection(pos, peer_pos) local function store_connection(pos, peer_pos)
local meta = M(pos) local meta = M(pos)
local status = S("connected to") .. " " .. P2S(peer_pos) local status = S("connected to") .. " " .. P2S(peer_pos)

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
Tube wall entry 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",
"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) after_place_node = function(pos, placer, itemstack, pointed_thing)
if not Tube:after_place_tube(pos, placer, pointed_thing) then if not Tube:after_place_tube(pos, placer, pointed_thing) then
minetest.remove_node(pos) minetest.remove_node(pos)
@ -35,11 +35,11 @@ minetest.register_node("techage:tube_wall_entry", {
end end
return false return false
end, end,
after_dig_node = function(pos, oldnode, oldmetadata, digger) after_dig_node = function(pos, oldnode, oldmetadata, digger)
Tube:after_dig_tube(pos, oldnode, oldmetadata) Tube:after_dig_tube(pos, oldnode, oldmetadata)
end, end,
paramtype2 = "facedir", -- important! paramtype2 = "facedir", -- important!
on_rotate = screwdriver.disallow, -- important! on_rotate = screwdriver.disallow, -- important!
groups = {crumbly = 2, cracky = 2, snappy = 2}, groups = {crumbly = 2, cracky = 2, snappy = 2},

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
Tubes based on tubelib2 Tubes based on tubelib2
]]-- ]]--
@ -27,13 +27,13 @@ techage.KnownNodes = {
local Tube = tubelib2.Tube:new({ local Tube = tubelib2.Tube:new({
-- North, East, South, West, Down, Up -- North, East, South, West, Down, Up
dirs_to_check = {1,2,3,4,5,6}, dirs_to_check = {1,2,3,4,5,6},
max_tube_length = 200, max_tube_length = 200,
show_infotext = false, show_infotext = false,
primary_node_names = { primary_node_names = {
"techage:tubeS", "techage:tubeA", "techage:tubeS", "techage:tubeA",
"techage:ta4_tubeS", "techage:ta4_tubeA", "techage:ta4_tubeS", "techage:ta4_tubeA",
"techage:tube_wall_entry", "techage:tube_wall_entry",
}, },
after_place_tube = function(pos, param2, tube_type, num_tubes, tbl) after_place_tube = function(pos, param2, tube_type, num_tubes, tbl)
local name = minetest.get_node(pos).name local name = minetest.get_node(pos).name
if name == "techage:tubeS" or name == "techage:tubeA" then 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",
"techage_tube_hole.png", "techage_tube_hole.png",
}, },
after_place_node = function(pos, placer, itemstack, pointed_thing) after_place_node = function(pos, placer, itemstack, pointed_thing)
if not Tube:after_place_tube(pos, placer, pointed_thing) then if not Tube:after_place_tube(pos, placer, pointed_thing) then
minetest.remove_node(pos) minetest.remove_node(pos)
@ -66,11 +66,11 @@ minetest.register_node("techage:tubeS", {
end end
return false return false
end, end,
after_dig_node = function(pos, oldnode, oldmetadata, digger) after_dig_node = function(pos, oldnode, oldmetadata, digger)
Tube:after_dig_tube(pos, oldnode, oldmetadata) Tube:after_dig_tube(pos, oldnode, oldmetadata)
end, end,
paramtype2 = "facedir", paramtype2 = "facedir",
drawtype = "nodebox", drawtype = "nodebox",
node_box = { node_box = {
@ -106,11 +106,11 @@ minetest.register_node("techage:tubeA", {
"techage_tube_knee2.png", "techage_tube_knee2.png",
"techage_tube_hole2.png", "techage_tube_hole2.png",
}, },
after_dig_node = function(pos, oldnode, oldmetadata, digger) after_dig_node = function(pos, oldnode, oldmetadata, digger)
Tube:after_dig_tube(pos, oldnode, oldmetadata) Tube:after_dig_tube(pos, oldnode, oldmetadata)
end, end,
paramtype2 = "facedir", paramtype2 = "facedir",
drawtype = "nodebox", drawtype = "nodebox",
node_box = { node_box = {

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
Tubes in TA4 design based on tubelib2 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",
"techage_tube_hole.png", "techage_tube_hole.png",
}, },
after_place_node = function(pos, placer, itemstack, pointed_thing) after_place_node = function(pos, placer, itemstack, pointed_thing)
if not Tube:after_place_tube(pos, placer, pointed_thing) then if not Tube:after_place_tube(pos, placer, pointed_thing) then
minetest.remove_node(pos) minetest.remove_node(pos)
@ -33,11 +33,11 @@ minetest.register_node("techage:ta4_tubeS", {
end end
return false return false
end, end,
after_dig_node = function(pos, oldnode, oldmetadata, digger) after_dig_node = function(pos, oldnode, oldmetadata, digger)
Tube:after_dig_tube(pos, oldnode, oldmetadata) Tube:after_dig_tube(pos, oldnode, oldmetadata)
end, end,
paramtype2 = "facedir", paramtype2 = "facedir",
drawtype = "nodebox", drawtype = "nodebox",
node_box = { node_box = {
@ -73,11 +73,11 @@ minetest.register_node("techage:ta4_tubeA", {
"techage_tubeta4_knee2.png", "techage_tubeta4_knee2.png",
"techage_tubeta4_hole2.png", "techage_tubeta4_hole2.png",
}, },
after_dig_node = function(pos, oldnode, oldmetadata, digger) after_dig_node = function(pos, oldnode, oldmetadata, digger)
Tube:after_dig_tube(pos, oldnode, oldmetadata) Tube:after_dig_tube(pos, oldnode, oldmetadata)
end, end,
paramtype2 = "facedir", paramtype2 = "facedir",
drawtype = "nodebox", drawtype = "nodebox",
node_box = { node_box = {

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
Wind turbine helper function 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"}) num = #minetest.find_nodes_in_area(pos1, pos2, {"air", "ignore"})
if num < (41 * 41 * 21 * 0.9) then if num < (41 * 41 * 21 * 0.9) then
techage.mark_region(player_name, pos1, pos2, "") 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)!")) S("Here is not enough wind\n(A free air space of 41x41x21 m is necessary)!"))
end end
-- Check for water surface (occean) -- Check for water surface (occean)
pos1 = {x=pos.x-20, y=1, z=pos.z-20} pos1 = {x=pos.x-20, y=1, z=pos.z-20}
pos2 = {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"}) {"default:water_source", "default:water_flowing", "ignore"})
if num < (41*41 * 0.8) then if num < (41*41 * 0.8) then
techage.mark_region(player_name, pos1, pos2, "") techage.mark_region(player_name, pos1, pos2, "")
return chat_message(player_name, S("Here is not enough water (41x41 m)!")) return chat_message(player_name, S("Here is not enough water (41x41 m)!"))
@ -71,7 +71,7 @@ function techage.valid_place_for_windturbine(pos, player_name, num_turbines)
techage.mark_region(player_name, pos1, pos2, "") techage.mark_region(player_name, pos1, pos2, "")
return chat_message(player_name, S("The next wind turbines is too close!")) return chat_message(player_name, S("The next wind turbines is too close!"))
end end
if num_turbines == 0 then if num_turbines == 0 then
chat_message(player_name, minetest.pos_to_string(pos).." ".. chat_message(player_name, minetest.pos_to_string(pos).." "..
S("is a suitable place for a wind turbine!")) S("is a suitable place for a wind turbine!"))

View File

@ -9,7 +9,7 @@
See LICENSE.txt for more information See LICENSE.txt for more information
TA3 Chest Cart TA3 Chest Cart
]]-- ]]--
-- for lazy programmers -- for lazy programmers
@ -59,7 +59,7 @@ end
minetest.register_node("techage:chest_cart", { minetest.register_node("techage:chest_cart", {
description = S("TA Chest Cart"), description = S("TA Chest Cart"),
tiles = { tiles = {
-- up, down, right, left, back, front -- up, down, right, left, back, front
"techage_chest_cart_top.png", "techage_chest_cart_top.png",
"techage_chest_cart_bottom.png", "techage_chest_cart_bottom.png",
"techage_chest_cart_side.png", "techage_chest_cart_side.png",
@ -83,13 +83,13 @@ minetest.register_node("techage:chest_cart", {
groups = {cracky = 2, crumbly = 2, choppy = 2}, groups = {cracky = 2, crumbly = 2, choppy = 2},
node_placement_prediction = "", node_placement_prediction = "",
diggable = false, diggable = false,
on_place = minecart.on_nodecart_place, on_place = minecart.on_nodecart_place,
on_punch = minecart.on_nodecart_punch, on_punch = minecart.on_nodecart_punch,
allow_metadata_inventory_put = allow_metadata_inventory_put, allow_metadata_inventory_put = allow_metadata_inventory_put,
allow_metadata_inventory_take = allow_metadata_inventory_take, allow_metadata_inventory_take = allow_metadata_inventory_take,
on_rightclick = on_rightclick, on_rightclick = on_rightclick,
after_place_node = function(pos, placer) after_place_node = function(pos, placer)
local inv = M(pos):get_inventory() local inv = M(pos):get_inventory()
inv:set_size('main', 4) inv:set_size('main', 4)
@ -99,14 +99,14 @@ minetest.register_node("techage:chest_cart", {
M(pos):set_string("formspec", formspec()) M(pos):set_string("formspec", formspec())
end end
end, end,
set_cargo = function(pos, data) set_cargo = function(pos, data)
local inv = M(pos):get_inventory() local inv = M(pos):get_inventory()
for idx, stack in ipairs(data) do for idx, stack in ipairs(data) do
inv:set_stack("main", idx, stack) inv:set_stack("main", idx, stack)
end end
end, end,
get_cargo = function(pos) get_cargo = function(pos)
local inv = M(pos):get_inventory() local inv = M(pos):get_inventory()
local data = {} local data = {}
@ -159,7 +159,7 @@ techage.register_node({"techage:chest_cart"}, {
return "unsupported" return "unsupported"
end end
end, end,
}) })
Tube:set_valid_sides("techage:chest_cart", {"L", "R", "F", "B"}) Tube:set_valid_sides("techage:chest_cart", {"L", "R", "F", "B"})

View File

@ -9,7 +9,7 @@
See LICENSE.txt for more information See LICENSE.txt for more information
TA3 Tank Cart TA3 Tank Cart
]]-- ]]--
-- for lazy programmers -- for lazy programmers
@ -20,7 +20,7 @@ local S2P = minetest.string_to_pos
local Pipe = techage.LiquidPipe local Pipe = techage.LiquidPipe
local MP = minetest.get_modpath("minecart") local MP = minetest.get_modpath("minecart")
local liquid = networks.liquid local liquid = networks.liquid
local CAPACITY = 100 local CAPACITY = 100
local function on_rightclick(pos, node, clicker) local function on_rightclick(pos, node, clicker)
@ -41,7 +41,7 @@ local function node_timer(pos, elapsed)
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
M(pos):set_string("formspec", techage.liquid.formspec(pos, nvm)) M(pos):set_string("formspec", techage.liquid.formspec(pos, nvm))
return true return true
end end
return false return false
end end
@ -58,7 +58,7 @@ local function take_liquid(pos, indir, name, amount)
end end
return amount, name return amount, name
end end
local function put_liquid(pos, indir, name, amount) local function put_liquid(pos, indir, name, amount)
-- check if it is not powder -- check if it is not powder
local ndef = minetest.registered_craftitems[name] or {} local ndef = minetest.registered_craftitems[name] or {}
@ -85,7 +85,7 @@ end
minetest.register_node("techage:tank_cart", { minetest.register_node("techage:tank_cart", {
description = S("TA Tank Cart"), description = S("TA Tank Cart"),
tiles = { tiles = {
-- up, down, right, left, back, front -- up, down, right, left, back, front
"techage_tank_cart_top.png", "techage_tank_cart_top.png",
"techage_tank_cart_bottom.png", "techage_tank_cart_bottom.png",
"techage_tank_cart_side.png", "techage_tank_cart_side.png",
@ -110,7 +110,7 @@ minetest.register_node("techage:tank_cart", {
groups = {cracky = 2, crumbly = 2, choppy = 2}, groups = {cracky = 2, crumbly = 2, choppy = 2},
node_placement_prediction = "", node_placement_prediction = "",
diggable = false, diggable = false,
on_place = minecart.on_nodecart_place, on_place = minecart.on_nodecart_place,
on_punch = minecart.on_nodecart_punch, on_punch = minecart.on_nodecart_punch,
@ -119,31 +119,31 @@ minetest.register_node("techage:tank_cart", {
nvm.liquid = nvm.liquid or {} nvm.liquid = nvm.liquid or {}
M(pos):set_string("formspec", techage.liquid.formspec(pos, nvm)) M(pos):set_string("formspec", techage.liquid.formspec(pos, nvm))
-- Delete the network between pump and cart -- Delete the network between pump and cart
Pipe:after_dig_node(pos) Pipe:after_dig_node(pos)
Pipe:after_place_node(pos) Pipe:after_place_node(pos)
end, end,
set_cargo = function(pos, data) set_cargo = function(pos, data)
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
nvm.liquid = data nvm.liquid = data
end, end,
get_cargo = function(pos) get_cargo = function(pos)
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
local data = nvm.liquid local data = nvm.liquid
nvm.liquid = {} nvm.liquid = {}
return data return data
end, end,
has_cargo = function(pos) has_cargo = function(pos)
return not techage.liquid.is_empty(pos) return not techage.liquid.is_empty(pos)
end, end,
on_timer = node_timer, on_timer = node_timer,
on_rightclick = on_rightclick, 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"}, liquid.register_nodes({"techage:tank_cart"},
Pipe, "tank", {"U"}, { Pipe, "tank", {"U"}, {

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
TA4 Doser TA4 Doser
]]-- ]]--
@ -54,14 +54,14 @@ local function get_liquids(pos)
Liquids[hash] = tbl Liquids[hash] = tbl
return Liquids[hash] return Liquids[hash]
end end
local function del_liquids(pos) local function del_liquids(pos)
local hash = minetest.hash_node_position(pos) local hash = minetest.hash_node_position(pos)
Liquids[hash] = nil Liquids[hash] = nil
end end
-- if liquids are missing, update the cached liquid table -- 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) local hash = minetest.hash_node_position(pos)
-- determine the available input liquids -- determine the available input liquids
local tbl = {} local tbl = {}
@ -73,11 +73,11 @@ local function reload_liquids(pos)
end end
Liquids[hash] = tbl Liquids[hash] = tbl
return Liquids[hash] return Liquids[hash]
end end
local function reactor_cmnd(pos, cmnd, payload) local function reactor_cmnd(pos, cmnd, payload)
return techage.transfer( return techage.transfer(
pos, pos,
6, -- outdir 6, -- outdir
cmnd, -- topic cmnd, -- topic
payload, -- payload payload, -- payload
@ -136,7 +136,7 @@ local function untake(pos, taken)
for _,item in pairs(taken) do for _,item in pairs(taken) do
liquid.untake(pos, Pipe, item.outdir, item.name, item.num) liquid.untake(pos, Pipe, item.outdir, item.name, item.num)
end end
end end
local function dosing(pos, nvm, elapsed) local function dosing(pos, nvm, elapsed)
-- trigger reactor (power) -- trigger reactor (power)
@ -177,13 +177,13 @@ local function dosing(pos, nvm, elapsed)
end end
end end
end end
-- check leftover -- check leftover
local leftover local leftover
local mem = techage.get_mem(pos) local mem = techage.get_mem(pos)
if mem.waste_leftover then if mem.waste_leftover then
leftover = reactor_cmnd(pos, "waste", { 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 amount = mem.waste_leftover.num}) or mem.waste_leftover.num
if leftover > 0 then if leftover > 0 then
mem.waste_leftover.num = leftover mem.waste_leftover.num = leftover
@ -194,7 +194,7 @@ local function dosing(pos, nvm, elapsed)
end end
if mem.output_leftover then if mem.output_leftover then
leftover = reactor_cmnd(pos, "output", { 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 amount = mem.output_leftover.num}) or mem.output_leftover.num
if leftover > 0 then if leftover > 0 then
mem.output_leftover.num = leftover mem.output_leftover.num = leftover
@ -203,11 +203,11 @@ local function dosing(pos, nvm, elapsed)
end end
mem.output_leftover = nil mem.output_leftover = nil
end end
-- inputs -- inputs
local taken = {} local taken = {}
mem.dbg_cycles = (mem.dbg_cycles or 0) - 1 mem.dbg_cycles = (mem.dbg_cycles or 0) - 1
for _,item in pairs(recipe.input) do for _,item in pairs(recipe.input) do
if item.name ~= "" then if item.name ~= "" then
local outdir = liquids[item.name] or reload_liquids(pos)[item.name] local outdir = liquids[item.name] or reload_liquids(pos)[item.name]
@ -231,7 +231,7 @@ local function dosing(pos, nvm, elapsed)
-- waste -- waste
if recipe.waste.name ~= "" then if recipe.waste.name ~= "" then
leftover = reactor_cmnd(pos, "waste", { leftover = reactor_cmnd(pos, "waste", {
name = recipe.waste.name, name = recipe.waste.name,
amount = recipe.waste.num}) or recipe.waste.num amount = recipe.waste.num}) or recipe.waste.num
if leftover > 0 then if leftover > 0 then
mem.waste_leftover = {name = recipe.waste.name, num = leftover} mem.waste_leftover = {name = recipe.waste.name, num = leftover}
@ -243,7 +243,7 @@ local function dosing(pos, nvm, elapsed)
end end
-- output -- output
leftover = reactor_cmnd(pos, "output", { leftover = reactor_cmnd(pos, "output", {
name = recipe.output.name, name = recipe.output.name,
amount = recipe.output.num}) or recipe.output.num amount = recipe.output.num}) or recipe.output.num
if leftover > 0 then if leftover > 0 then
mem.output_leftover = {name = recipe.output.name, num = leftover} mem.output_leftover = {name = recipe.output.name, num = leftover}
@ -252,13 +252,13 @@ local function dosing(pos, nvm, elapsed)
return return
end end
State:keep_running(pos, nvm, COUNTDOWN_TICKS) State:keep_running(pos, nvm, COUNTDOWN_TICKS)
end end
local function node_timer(pos, elapsed) local function node_timer(pos, elapsed)
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
dosing(pos, nvm, elapsed) dosing(pos, nvm, elapsed)
return State:is_active(nvm) return State:is_active(nvm)
end end
local function on_rightclick(pos) local function on_rightclick(pos)
local nvm = techage.get_nvm(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 if minetest.is_protected(pos, player:get_player_name()) then
return return
end end
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
if not nvm.running then if not nvm.running then
recipes.on_receive_fields(pos, formname, fields, player) recipes.on_receive_fields(pos, formname, fields, player)
end end
local mem = techage.get_mem(pos) local mem = techage.get_mem(pos)
@ -345,7 +345,7 @@ minetest.register_node("techage:ta4_doser_on", {
on_receive_fields = on_receive_fields, on_receive_fields = on_receive_fields,
on_rightclick = on_rightclick, on_rightclick = on_rightclick,
on_timer = node_timer, on_timer = node_timer,
paramtype2 = "facedir", paramtype2 = "facedir",
on_rotate = screwdriver.disallow, on_rotate = screwdriver.disallow,
diggable = false, diggable = false,

View File

@ -8,7 +8,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
TA4 Liquid Filter TA4 Liquid Filter
]]-- ]]--

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
TA4 Reactor TA4 Reactor
]]-- ]]--
@ -51,10 +51,10 @@ minetest.register_node("techage:ta4_reactor_fillerpipe", {
after_dig_node = function(pos, oldnode, oldmetadata, digger) after_dig_node = function(pos, oldnode, oldmetadata, digger)
Pipe:after_dig_node(pos) Pipe:after_dig_node(pos)
end, end,
paramtype = "light", paramtype = "light",
use_texture_alpha = techage.CLIP, use_texture_alpha = techage.CLIP,
sunlight_propagates = true, sunlight_propagates = true,
paramtype2 = "facedir", paramtype2 = "facedir",
on_rotate = screwdriver.disallow, on_rotate = screwdriver.disallow,
groups = {cracky=2}, groups = {cracky=2},
@ -64,7 +64,7 @@ minetest.register_node("techage:ta4_reactor_fillerpipe", {
local function stand_cmnd(pos, cmnd, payload) local function stand_cmnd(pos, cmnd, payload)
return techage.transfer( 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 5, -- outdir
cmnd, -- topic cmnd, -- topic
payload, -- payload payload, -- payload
@ -83,11 +83,11 @@ techage.register_node({"techage:ta4_reactor_fillerpipe"}, {
on_transfer = function(pos, in_dir, topic, payload) on_transfer = function(pos, in_dir, topic, payload)
if topic == "check" then if topic == "check" then
local pos2,node = Pipe:get_node(pos, 5) 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 return false
end end
pos2,node = Pipe:get_node(pos2, 5) 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 return false
end end
return true return true
@ -95,7 +95,7 @@ techage.register_node({"techage:ta4_reactor_fillerpipe"}, {
return base_waste(pos, payload or {}) return base_waste(pos, payload or {})
elseif topic == "catalyst" then elseif topic == "catalyst" then
local pos2,node = Pipe:get_node(pos, 5) 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 return
end end
local inv = M(pos2):get_inventory() local inv = M(pos2):get_inventory()
@ -158,7 +158,7 @@ minetest.register_node("techage:ta4_reactor", {
end, end,
allow_metadata_inventory_put = allow_metadata_inventory_put, allow_metadata_inventory_put = allow_metadata_inventory_put,
allow_metadata_inventory_take = allow_metadata_inventory_take, allow_metadata_inventory_take = allow_metadata_inventory_take,
paramtype = "light", paramtype = "light",
use_texture_alpha = techage.CLIP, use_texture_alpha = techage.CLIP,
paramtype2 = "facedir", paramtype2 = "facedir",
@ -191,7 +191,7 @@ minetest.register_lbm({
name = "techage:update_reactor", name = "techage:update_reactor",
nodenames = { nodenames = {
"techage:ta4_reactor", "techage:ta4_reactor",
}, },
run_at_every_load = true, run_at_every_load = true,

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
TA4 Reactor Stand and Base TA4 Reactor Stand and Base
]]-- ]]--
@ -26,7 +26,7 @@ local function play_sound(pos)
local mem = techage.get_mem(pos) local mem = techage.get_mem(pos)
if not mem.handle or mem.handle == -1 then if not mem.handle or mem.handle == -1 then
mem.handle = minetest.sound_play("techage_reactor", { mem.handle = minetest.sound_play("techage_reactor", {
pos = pos, pos = pos,
gain = 0.5, gain = 0.5,
max_hear_distance = 10, max_hear_distance = 10,
loop = true}) loop = true})
@ -58,8 +58,8 @@ local function on_nopower(pos)
nvm.running = false nvm.running = false
end end
local function is_running(pos, nvm) local function is_running(pos, nvm)
return nvm.running return nvm.running
end end
minetest.register_node("techage:ta4_reactor_stand", { minetest.register_node("techage:ta4_reactor_stand", {
@ -76,14 +76,14 @@ minetest.register_node("techage:ta4_reactor_stand", {
drawtype = "nodebox", drawtype = "nodebox",
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{ -8/16, 2/16, -8/16, 8/16, 4/16, 8/16 }, { -8/16, 2/16, -8/16, 8/16, 4/16, 8/16 },
{ -8/16, -8/16, -8/16, -6/16, 8/16, -6/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 }, { 6/16, -8/16, -8/16, 8/16, 8/16, -6/16 },
{ -8/16, -8/16, 6/16, -6/16, 8/16, 8/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 }, { 6/16, -8/16, 6/16, 8/16, 8/16, 8/16 },
{-1/8, -4/8, -1/8, 1/8, 4/8, 1/8}, {-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, -1/8, 4/8, 1/8, 1/8},
{-4/8, -1/8, -3/8, -3/8, 1/8, 3/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", type = "fixed",
fixed = {-1/2, -1/2, -1/2, 1/2, 1/2, 1/2}, fixed = {-1/2, -1/2, -1/2, 1/2, 1/2, 1/2},
}, },
after_place_node = function(pos, placer) after_place_node = function(pos, placer)
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
M(pos):set_string("infotext", S("off")) M(pos):set_string("infotext", S("off"))
@ -117,7 +117,7 @@ minetest.register_node("techage:ta4_reactor_stand", {
Cable:after_dig_node(pos) Cable:after_dig_node(pos)
techage.del_mem(pos) techage.del_mem(pos)
end, end,
paramtype = "light", paramtype = "light",
use_texture_alpha = techage.CLIP, use_texture_alpha = techage.CLIP,
paramtype2 = "facedir", paramtype2 = "facedir",
@ -155,7 +155,7 @@ techage.register_node({"techage:ta4_reactor_stand"}, {
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
if nvm.has_power then if nvm.has_power then
play_sound(pos) play_sound(pos)
end end
end, end,
}) })
@ -170,7 +170,7 @@ minetest.register_node("techage:ta4_reactor_base", {
"techage_concrete.png", "techage_concrete.png",
"techage_concrete.png", "techage_concrete.png",
}, },
after_place_node = function(pos, placer) after_place_node = function(pos, placer)
M(pos):set_int("outdir", networks.side_to_outdir(pos, "R")) M(pos):set_int("outdir", networks.side_to_outdir(pos, "R"))
Pipe:after_place_node(pos) Pipe:after_place_node(pos)
@ -178,7 +178,7 @@ minetest.register_node("techage:ta4_reactor_base", {
after_dig_node = function(pos, oldnode, oldmetadata, digger) after_dig_node = function(pos, oldnode, oldmetadata, digger)
Pipe:after_dig_node(pos) Pipe:after_dig_node(pos)
end, end,
paramtype2 = "facedir", paramtype2 = "facedir",
on_rotate = screwdriver.disallow, on_rotate = screwdriver.disallow,
groups = {cracky=2}, groups = {cracky=2},

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
TA3 Coal Power Station Boiler Base TA3 Coal Power Station Boiler Base
]]-- ]]--
@ -39,7 +39,7 @@ minetest.register_node("techage:coalboiler_base", {
after_place_node = after_place_node, after_place_node = after_place_node,
after_dig_node = after_dig_node, after_dig_node = after_dig_node,
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
on_rotate = screwdriver.disallow, on_rotate = screwdriver.disallow,
@ -49,7 +49,7 @@ minetest.register_node("techage:coalboiler_base", {
}) })
Pipe:add_secondary_node_names({"techage:coalboiler_base"}) Pipe:add_secondary_node_names({"techage:coalboiler_base"})
-- for logical communication -- for logical communication
techage.register_node({"techage:coalboiler_base"}, { techage.register_node({"techage:coalboiler_base"}, {
on_transfer = function(pos, in_dir, topic, payload) on_transfer = function(pos, in_dir, topic, payload)
@ -65,4 +65,3 @@ minetest.register_craft({
{"default:stone", "default:stone", "default:stone"}, {"default:stone", "default:stone", "default:stone"},
}, },
}) })

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
TA3 Coal Power Station Boiler Top TA3 Coal Power Station Boiler Top
]]-- ]]--
@ -62,14 +62,14 @@ minetest.register_node("techage:coalboiler_top", {
type = "fixed", type = "fixed",
fixed = {-13/32, -48/32, -13/32, 13/32, 16/32, 13/32}, fixed = {-13/32, -48/32, -13/32, 13/32, 16/32, 13/32},
}, },
can_dig = boiler.can_dig, can_dig = boiler.can_dig,
on_timer = node_timer, on_timer = node_timer,
on_rightclick = boiler.on_rightclick, on_rightclick = boiler.on_rightclick,
after_place_node = after_place_node, after_place_node = after_place_node,
after_dig_node = after_dig_node, after_dig_node = after_dig_node,
on_punch = boiler.on_punch, on_punch = boiler.on_punch,
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {cracky=1}, groups = {cracky=1},
@ -108,4 +108,3 @@ minetest.register_craft({
{"default:stone", "", "default:stone"}, {"default:stone", "", "default:stone"},
}, },
}) })

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
TA3 Cooler TA3 Cooler
]]-- ]]--
@ -19,7 +19,7 @@ local S = techage.S
local Pipe = techage.SteamPipe local Pipe = techage.SteamPipe
local function transfer(pos, in_dir, topic, payload) 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"}) {"techage:coalboiler_base"})
end 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",
"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_place_node = after_place_node,
after_dig_node = after_dig_node, after_dig_node = after_dig_node,
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {cracky=2, crumbly=2, choppy=2}, groups = {cracky=2, crumbly=2, choppy=2},
on_rotate = screwdriver.disallow, 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",
"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_place_node = after_place_node,
after_dig_node = after_dig_node, after_dig_node = after_dig_node,
paramtype2 = "facedir", paramtype2 = "facedir",
drop = "techage:cooler", drop = "techage:cooler",
groups = {cracky=2, crumbly=2, choppy=2, not_in_creative_inventory=1}, 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"}, {"basic_materials:steel_bar", "default:wood", "basic_materials:steel_bar"},
}, },
}) })

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
TA3 Coal Power Station Firebox TA3 Coal Power Station Firebox
]]-- ]]--
@ -25,7 +25,7 @@ local BURN_CYCLE_FACTOR = 0.5
local function node_timer(pos, elapsed) local function node_timer(pos, elapsed)
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
local power = techage.transfer( 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 nil, -- outdir
"trigger", -- topic "trigger", -- topic
nil, -- payload 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) nvm.burn_cycles = (nvm.burn_cycles or 0) - math.max((power or 0.02), 0.02)
if nvm.burn_cycles <= 0 then if nvm.burn_cycles <= 0 then
local taken = firebox.get_fuel(pos) local taken = firebox.get_fuel(pos)
if taken then if taken then
nvm.burn_cycles = (firebox.Burntime[taken:get_name()] or 1) / CYCLE_TIME * BURN_CYCLE_FACTOR nvm.burn_cycles = (firebox.Burntime[taken:get_name()] or 1) / CYCLE_TIME * BURN_CYCLE_FACTOR
nvm.burn_cycles_total = nvm.burn_cycles 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_put = firebox.allow_metadata_inventory_put,
allow_metadata_inventory_take = firebox.allow_metadata_inventory_take, allow_metadata_inventory_take = firebox.allow_metadata_inventory_take,
on_rightclick = firebox.on_rightclick, on_rightclick = firebox.on_rightclick,
after_place_node = function(pos, placer) after_place_node = function(pos, placer)
if firebox.is_free_position(pos, placer:get_player_name()) then if firebox.is_free_position(pos, placer:get_player_name()) then
techage.add_node(pos, "techage:coalfirebox") techage.add_node(pos, "techage:coalfirebox")

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
TA3 Power Station Generator TA3 Power Station Generator
]]-- ]]--
@ -30,7 +30,7 @@ local function formspec(self, pos, nvm)
end end
local function transfer_turbine(pos, topic, payload) 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"}) {"techage:turbine", "techage:turbine_on"})
end 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",
"techage_filling_ta3.png^techage_frame_ta3.png^techage_appl_generator.png^[transformFX]", "techage_filling_ta3.png^techage_frame_ta3.png^techage_appl_generator.png^[transformFX]",
}, },
on_receive_fields = on_receive_fields, on_receive_fields = on_receive_fields,
on_rightclick = on_rightclick, on_rightclick = on_rightclick,
on_timer = node_timer, on_timer = node_timer,
@ -190,7 +190,7 @@ minetest.register_node("techage:generator_on", {
}, },
}, },
}, },
on_receive_fields = on_receive_fields, on_receive_fields = on_receive_fields,
on_rightclick = on_rightclick, on_rightclick = on_rightclick,
on_timer = node_timer, on_timer = node_timer,
@ -247,7 +247,7 @@ control.register_nodes({"techage:generator", "techage:generator_on"}, {
running = techage.is_running(nvm) or false, running = techage.is_running(nvm) or false,
available = PWR_PERF, available = PWR_PERF,
provided = nvm.provided or 0, provided = nvm.provided or 0,
termpoint = meta:get_string("termpoint"), termpoint = meta:get_string("termpoint"),
} }
end end
return false return false

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
TA3 Coal Power Station Firebox TA3 Coal Power Station Firebox
]]-- ]]--
@ -28,7 +28,7 @@ local BURN_CYCLE_FACTOR = 0.5
local function node_timer(pos, elapsed) local function node_timer(pos, elapsed)
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
local power = techage.transfer( 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 nil, -- outdir
"trigger", -- topic "trigger", -- topic
nil, -- payload nil, -- payload
@ -85,7 +85,7 @@ minetest.register_node("techage:oilfirebox", {
can_dig = fuel.can_dig, can_dig = fuel.can_dig,
on_rightclick = fuel.on_rightclick, on_rightclick = fuel.on_rightclick,
on_receive_fields = fuel.on_receive_fields, on_receive_fields = fuel.on_receive_fields,
after_place_node = function(pos, placer) after_place_node = function(pos, placer)
if firebox.is_free_position(pos, placer:get_player_name()) then if firebox.is_free_position(pos, placer:get_player_name()) then
techage.add_node(pos, "techage:oilfirebox") techage.add_node(pos, "techage:oilfirebox")
@ -103,7 +103,7 @@ minetest.register_node("techage:oilfirebox", {
return true return true
end end
end, end,
on_destruct = function(pos) on_destruct = function(pos)
firebox.set_firehole(pos, nil) firebox.set_firehole(pos, nil)
end, end,
@ -142,5 +142,3 @@ minetest.register_craft({
{'', '', ''}, {'', '', ''},
}, },
}) })

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
TA3 Power Station Turbine TA3 Power Station Turbine
]]-- ]]--
@ -19,12 +19,12 @@ local S = techage.S
local Pipe = techage.SteamPipe local Pipe = techage.SteamPipe
local function transfer_cooler(pos, topic, payload) 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"}) {"techage:cooler", "techage:cooler_on"})
end end
local function transfer_generator(pos, topic, payload) 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"}) {"techage:generator", "techage:generator_on"})
end end
@ -41,7 +41,7 @@ local function play_sound(pos)
local mem = techage.get_mem(pos) local mem = techage.get_mem(pos)
if not mem.handle or mem.handle == -1 then if not mem.handle or mem.handle == -1 then
mem.handle = minetest.sound_play("techage_turbine", { mem.handle = minetest.sound_play("techage_turbine", {
pos = pos, pos = pos,
gain = 1, gain = 1,
max_hear_distance = 15, max_hear_distance = 15,
loop = true}) loop = true})
@ -69,7 +69,7 @@ local function after_dig_node(pos, oldnode)
techage.del_mem(pos) techage.del_mem(pos)
end end
local function tubelib2_on_update2(pos, outdir, tlib2, node) local function tubelib2_on_update2(pos, outdir, tlib2, node)
swap_node(pos, "techage:turbine") swap_node(pos, "techage:turbine")
stop_sound(pos) stop_sound(pos)
end 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",
"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_place_node = after_place_node,
after_dig_node = after_dig_node, after_dig_node = after_dig_node,
tubelib2_on_update2 = tubelib2_on_update2, tubelib2_on_update2 = tubelib2_on_update2,
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {cracky=2, crumbly=2, choppy=2}, groups = {cracky=2, crumbly=2, choppy=2},
on_rotate = screwdriver.disallow, on_rotate = screwdriver.disallow,
@ -125,9 +125,9 @@ minetest.register_node("techage:turbine_on", {
}, },
}, },
}, },
tubelib2_on_update2 = tubelib2_on_update2, tubelib2_on_update2 = tubelib2_on_update2,
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {not_in_creative_inventory=1}, groups = {not_in_creative_inventory=1},
diggable = false, diggable = false,
@ -168,7 +168,7 @@ techage.register_node({"techage:turbine", "techage:turbine_on"}, {
on_node_load = function(pos, node) on_node_load = function(pos, node)
if node.name == "techage:turbine_on" then if node.name == "techage:turbine_on" then
play_sound(pos) play_sound(pos)
end end
end, end,
}) })
@ -180,4 +180,3 @@ minetest.register_craft({
{"default:wood", "techage:iron_ingot", "basic_materials:steel_bar"}, {"default:wood", "techage:iron_ingot", "basic_materials:steel_bar"},
}, },
}) })

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
TA4 Cooler as part of the Collider 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) after_place_node = function(pos, placer, itemstack)
Pipe:after_place_node(pos) Pipe:after_place_node(pos)
end, end,
after_dig_node = function(pos, oldnode) after_dig_node = function(pos, oldnode)
Pipe:after_dig_node(pos) Pipe:after_dig_node(pos)
techage.del_mem(pos) techage.del_mem(pos)
@ -78,7 +78,7 @@ techage.register_node({"techage:ta4_collider_cooler"}, {
return false return false
end end
end, end,
}) })
minetest.register_craft({ minetest.register_craft({
output = "techage:ta4_collider_cooler", output = "techage:ta4_collider_cooler",
@ -88,4 +88,3 @@ minetest.register_craft({
{'', 'techage:aluminum', ''}, {'', 'techage:aluminum', ''},
}, },
}) })

View File

@ -43,7 +43,7 @@ local Schedule = {[0] =
local function play_sound(pos) local function play_sound(pos)
minetest.sound_play("techage_hum", { minetest.sound_play("techage_hum", {
pos = pos, pos = pos,
gain = 0.5, gain = 0.5,
max_hear_distance = 10, max_hear_distance = 10,
}) })
@ -52,12 +52,12 @@ end
local function terminal_message(pos, msg) local function terminal_message(pos, msg)
local term_num = M(pos):contains("term_num") and M(pos):get_string("term_num") local term_num = M(pos):contains("term_num") and M(pos):get_string("term_num")
local own_num = M(pos):get_string("node_number") local own_num = M(pos):get_string("node_number")
if term_num and own_num then if term_num and own_num then
techage.send_single(own_num, term_num, "text", msg) techage.send_single(own_num, term_num, "text", msg)
end end
end end
local function experience_points(pos) local function experience_points(pos)
if math.random(PROBABILITY) == 1 then if math.random(PROBABILITY) == 1 then
local owner = M(pos):get_string("owner") local owner = M(pos):get_string("owner")
@ -92,11 +92,11 @@ local function check_state(pos)
nvm.ticks = (nvm.ticks or 0) + 1 nvm.ticks = (nvm.ticks or 0) + 1
local idx = nvm.ticks % TIME_SLOTS local idx = nvm.ticks % TIME_SLOTS
local item = Schedule[idx] local item = Schedule[idx]
if idx == 1 then if idx == 1 then
nvm.result = true nvm.result = true
end end
if item then if item then
if item.name == "shell" then if item.name == "shell" then
local res, err = check_shell(pos, param2) local res, err = check_shell(pos, param2)
@ -130,7 +130,7 @@ local function check_state(pos)
return nvm.result return nvm.result
end end
end end
local function add_laser(pos) local function add_laser(pos)
local param2 = minetest.get_node(pos).param2 local param2 = minetest.get_node(pos).param2
local pos1 = getpos(pos, param2, {3,3}, 1) local pos1 = getpos(pos, param2, {3,3}, 1)
@ -144,14 +144,14 @@ local function create_task(pos, task)
if not mem.co then if not mem.co then
mem.co = coroutine.create(task) mem.co = coroutine.create(task)
end end
local _, err = coroutine.resume(mem.co, pos) local _, err = coroutine.resume(mem.co, pos)
if err then if err then
mem.co = nil mem.co = nil
--print(err) --print(err)
return return
end end
minetest.after(0.4, create_task, pos) minetest.after(0.4, create_task, pos, task)
end end
-- Call on_cyclic_check of all magents so that the magnets don't need a FLB. -- Call on_cyclic_check of all magents so that the magnets don't need a FLB.
@ -227,10 +227,10 @@ minetest.register_node("techage:ta4_detector_core", {
end end
return true return true
end, end,
after_dig_node = function(pos, oldnode, oldmetadata, digger) after_dig_node = function(pos, oldnode, oldmetadata, digger)
techage.on_remove_collider(digger) techage.on_remove_collider(digger)
techage.remove_node(pos, oldnode, oldmetadata) techage.remove_node(pos, oldnode, oldmetadata)
techage.del_mem(pos) techage.del_mem(pos)
end, end,
}) })
@ -247,7 +247,7 @@ local function start_task(pos)
local own_num = M(pos):get_string("node_number") local own_num = M(pos):get_string("node_number")
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
nvm.magnet_positions = {} nvm.magnet_positions = {}
if term_num and param2 and pos2 then if term_num and param2 and pos2 then
techage.send_single(own_num, term_num, "text", "#### Start ####") techage.send_single(own_num, term_num, "text", "#### Start ####")
@ -267,7 +267,7 @@ local function start_task(pos)
return return
end end
techage.send_single(own_num, term_num, "append", "ok") techage.send_single(own_num, term_num, "append", "ok")
coroutine.yield() coroutine.yield()
techage.send_single(own_num, term_num, "text", "- Start magnets...") techage.send_single(own_num, term_num, "text", "- Start magnets...")
local t = {} local t = {}
@ -285,7 +285,7 @@ local function start_task(pos)
end end
nvm.magnet_positions = t nvm.magnet_positions = t
techage.send_single(own_num, term_num, "append", "ok") techage.send_single(own_num, term_num, "append", "ok")
coroutine.yield() coroutine.yield()
techage.send_single(own_num, term_num, "text", "- Check magnets...") techage.send_single(own_num, term_num, "text", "- Check magnets...")
-- The check will be performed by the timer, so wait 5 sec. -- The check will be performed by the timer, so wait 5 sec.
@ -298,7 +298,7 @@ local function start_task(pos)
nvm.locked = false nvm.locked = false
return return
end end
coroutine.yield() coroutine.yield()
techage.send_single(own_num, term_num, "text", "- Check detector...") techage.send_single(own_num, term_num, "text", "- Check detector...")
for _,item in ipairs(Schedule)do for _,item in ipairs(Schedule)do
@ -333,14 +333,14 @@ local function start_task(pos)
end end
end end
techage.send_single(own_num, term_num, "append", "ok") techage.send_single(own_num, term_num, "append", "ok")
coroutine.yield() coroutine.yield()
techage.send_single(own_num, term_num, "text", "Collider started.") techage.send_single(own_num, term_num, "text", "Collider started.")
nvm.ticks = 0 nvm.ticks = 0
nvm.running = true nvm.running = true
end end
end end
local function test_magnet(pos, payload) local function test_magnet(pos, payload)
local term_num = M(pos):contains("term_num") and M(pos):get_string("term_num") local term_num = M(pos):contains("term_num") and M(pos):get_string("term_num")
local param2 = minetest.get_node(pos).param2 local param2 = minetest.get_node(pos).param2
@ -363,7 +363,7 @@ techage.register_node({"techage:ta4_detector_core"}, {
return true return true
elseif topic == "start" then elseif topic == "start" then
-- Worker block -- Worker block
nvm.locked = true nvm.locked = true
create_task(pos, start_task) create_task(pos, start_task)
return true return true
elseif topic == "stop" then elseif topic == "stop" then
@ -381,7 +381,7 @@ techage.register_node({"techage:ta4_detector_core"}, {
end end
elseif topic == "test"then elseif topic == "test"then
if payload and tonumber(payload) then if payload and tonumber(payload) then
test_magnet(pos, payload) test_magnet(pos, payload)
return true return true
else else
return "Invalid magnet number" return "Invalid magnet number"
@ -400,7 +400,7 @@ techage.register_node({"techage:ta4_detector_core"}, {
on_node_load = function(pos) on_node_load = function(pos)
minetest.get_node_timer(pos):start(CYCLE_TIME) minetest.get_node_timer(pos):start(CYCLE_TIME)
end, end,
}) })
minetest.register_craft({ minetest.register_craft({
@ -411,4 +411,3 @@ minetest.register_craft({
{'default:steel_ingot', '', 'techage:aluminum'}, {'default:steel_ingot', '', 'techage:aluminum'},
}, },
}) })

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
TA4 Tube/Pipe Inputs/Outputs as part of the Collider 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) after_place_node = function(pos, placer, itemstack)
VTube:after_place_node(pos) VTube:after_place_node(pos)
end, end,
after_dig_node = function(pos, oldnode) after_dig_node = function(pos, oldnode)
VTube:after_dig_node(pos) VTube:after_dig_node(pos)
techage.del_mem(pos) techage.del_mem(pos)
@ -87,10 +87,10 @@ techage.register_node({"techage:ta4_collider_tube_inlet"}, {
return true return true
end end
end, end,
}) })
-- Used by the detector to check the tube connection -- 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 if command == "distance" then
local pos2 = techage.transfer(pos, "F", command, payload, VTube, {"techage:ta4_magnet"}) local pos2 = techage.transfer(pos, "F", command, payload, VTube, {"techage:ta4_magnet"})
if type(pos2) == "table" then if type(pos2) == "table" then
@ -144,7 +144,7 @@ minetest.register_node("techage:ta4_collider_pipe_inlet", {
Pipe:after_place_node(pos) Pipe:after_place_node(pos)
nvm.liquid = {} nvm.liquid = {}
end, end,
after_dig_node = function(pos, oldnode) after_dig_node = function(pos, oldnode)
Pipe:after_dig_node(pos) Pipe:after_dig_node(pos)
techage.del_mem(pos) techage.del_mem(pos)
@ -180,10 +180,10 @@ techage.register_node({"techage:ta4_collider_pipe_inlet"}, {
return true return true
end end
end, end,
}) })
-- Used by the detector to check for gas pressure -- 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 {} nvm.liquid = nvm.liquid or {}
if nvm.liquid.amount == GAS_CAPA and nvm.liquid.name == "techage:isobutane" then if nvm.liquid.amount == GAS_CAPA and nvm.liquid.name == "techage:isobutane" then
return true return true
@ -192,7 +192,7 @@ function techage.gas_inlet_check(pos, node, meta, nvm)
end end
-- Used by the detector to check for cooler connection -- 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 if nvm.detector_received then
nvm.detector_received = nil nvm.detector_received = nil
return true return true
@ -247,7 +247,7 @@ minetest.register_node("techage:ta4_collider_pipe_outlet", {
init_air(nvm) init_air(nvm)
Pipe:after_place_node(pos) Pipe:after_place_node(pos)
end, end,
after_dig_node = function(pos, oldnode) after_dig_node = function(pos, oldnode)
Pipe:after_dig_node(pos) Pipe:after_dig_node(pos)
techage.del_mem(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 -- 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 {} nvm.liquid = nvm.liquid or {}
if nvm.liquid.amount == 0 then if nvm.liquid.amount == 0 then
return true return true
@ -283,7 +283,7 @@ function techage.air_outlet_check(pos, node, meta, nvm)
return false, "no vacuum" return false, "no vacuum"
end end
function techage.air_outlet_reset(pos) function techage.air_outlet_reset(pos)
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
init_air(nvm) init_air(nvm)
end end
@ -325,13 +325,13 @@ minetest.register_node("techage:ta4_collider_cable_inlet", {
Cable:after_place_node(pos) Cable:after_place_node(pos)
minetest.get_node_timer(pos):start(CYCLE_TIME) minetest.get_node_timer(pos):start(CYCLE_TIME)
end, end,
on_timer = function(pos, elapsed) on_timer = function(pos, elapsed)
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
nvm.consumed = power.consume_power(pos, Cable, nil, PWR_NEEDED) nvm.consumed = power.consume_power(pos, Cable, nil, PWR_NEEDED)
return true return true
end, end,
after_dig_node = function(pos, oldnode) after_dig_node = function(pos, oldnode)
Cable:after_dig_node(pos) Cable:after_dig_node(pos)
techage.del_mem(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 -- 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 if nvm.consumed == PWR_NEEDED then
return true return true
end end
@ -352,7 +352,7 @@ techage.register_node({"techage:ta4_collider_cable_inlet"}, {
on_node_load = function(pos) on_node_load = function(pos)
minetest.get_node_timer(pos):start(CYCLE_TIME) minetest.get_node_timer(pos):start(CYCLE_TIME)
end, end,
}) })
minetest.register_craft({ minetest.register_craft({
output = "techage:ta4_collider_cable_inlet", output = "techage:ta4_collider_cable_inlet",

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
TA4 Magnet as part of the Collider TA4 Magnet as part of the Collider
]]-- ]]--
@ -60,9 +60,9 @@ minetest.register_node("techage:ta4_detector_magnet", {
minetest.register_node("techage:ta4_magnet", { minetest.register_node("techage:ta4_magnet", {
description = S("TA4 Collider Magnet"), description = S("TA4 Collider Magnet"),
inventory_image = minetest.inventorycube( 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_appl_hole_pipe.png",
"techage_collider_magnet.png^techage_collider_magnet_tube.png"), "techage_collider_magnet.png^techage_collider_magnet_tube.png"),
tiles = { tiles = {
-- up, down, right, left, back, front -- up, down, right, left, back, front
"techage_collider_magnet.png^techage_appl_hole_electric.png", "techage_collider_magnet.png^techage_appl_hole_electric.png",
@ -111,7 +111,7 @@ minetest.register_node("techage:ta4_magnet", {
VTube:after_place_node(pos) VTube:after_place_node(pos)
M(pos):set_string("infotext", S("TA4 Collider Magnet") .. " #0") M(pos):set_string("infotext", S("TA4 Collider Magnet") .. " #0")
end, end,
-- To be called by the detector -- To be called by the detector
on_cyclic_check = function(pos) on_cyclic_check = function(pos)
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
@ -120,15 +120,15 @@ minetest.register_node("techage:ta4_magnet", {
if nvm.tube_damage then if nvm.tube_damage then
nvm.tube_damage = nil nvm.tube_damage = nil
return -1 return -1
elseif nvm.liquid.amount == CAPACITY and elseif nvm.liquid.amount == CAPACITY and
nvm.liquid.name == "techage:isobutane" and nvm.liquid.name == "techage:isobutane" and
nvm.consumed == PWR_NEEDED then nvm.consumed == PWR_NEEDED then
return 0 return 0
end end
return -2 return -2
end, end,
tubelib2_on_update2 = function(pos, outdir, tlib2, node) tubelib2_on_update2 = function(pos, outdir, tlib2, node)
if tlib2.tube_type == "vtube" then if tlib2.tube_type == "vtube" then
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
nvm.tube_damage = true nvm.tube_damage = true
@ -138,7 +138,7 @@ minetest.register_node("techage:ta4_magnet", {
nvm.liquid.amount = 0 nvm.liquid.amount = 0
end end
end, end,
after_dig_node = function(pos, oldnode) after_dig_node = function(pos, oldnode)
Pipe:after_dig_node(pos) Pipe:after_dig_node(pos)
Cable: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"}) VTube:set_valid_sides("techage:ta4_magnet", {"R", "L"})
local function send_to_next(pos, in_dir, topic, payload) 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"}) {"techage:ta4_magnet", "techage:ta4_collider_tube_inlet"})
end end
--[[ --[[
Commands Commands
-------- --------
distance : Check distance between all magnets. distance : Check distance between all magnets.
Returns pos of next magnet or the number of the defect magnet. Returns pos of next magnet or the number of the defect magnet.
enumerate : Give each magnet a unique number (1...n) enumerate : Give each magnet a unique number (1...n)
@ -231,7 +231,7 @@ techage.register_node({"techage:ta4_magnet"}, {
end end
end end
end, end,
}) })
minetest.register_node("techage:ta4_magnet_base", { minetest.register_node("techage:ta4_magnet_base", {
description = S("TA4 Collider Magnet Base"), description = S("TA4 Collider Magnet Base"),
@ -302,4 +302,4 @@ minetest.register_lbm({
nvm.liquid.name = "techage:isobutane" nvm.liquid.name = "techage:isobutane"
end end
end, end,
}) })

View File

@ -9,7 +9,7 @@
See LICENSE.txt for more information See LICENSE.txt for more information
TA4 Terminal TA4 Terminal
]]-- ]]--
local M = minetest.get_meta local M = minetest.get_meta
@ -25,7 +25,7 @@ machine.
Commands can have up to 80 characters. Commands can have up to 80 characters.
Local commands: Local commands:
- clear = clear screen - clear = clear screen
- help = this message - help = this message
- pub = switch to public use - pub = switch to public use
- priv = switch to private use - priv = switch to private use
- connect <num> = connect the machine - connect <num> = connect the machine
@ -77,7 +77,7 @@ end
local function command(pos, mem, player) local function command(pos, mem, player)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local owner = meta:get_string("owner") local owner = meta:get_string("owner")
if mem.command == "clear" then if mem.command == "clear" then
mem.output = "" mem.output = ""
mem.command = "" mem.command = ""
@ -103,12 +103,12 @@ local function command(pos, mem, player)
output(pos, "Switched to private use!") output(pos, "Switched to private use!")
elseif meta:get_int("public") == 1 or owner == player then elseif meta:get_int("public") == 1 or owner == player then
if mem.command == "clear" then if mem.command == "clear" then
mem.output = mem.output =
mem.command = "" mem.command = ""
meta:set_string("formspec", formspec2(mem)) meta:set_string("formspec", formspec2(mem))
end end
end end
end end
minetest.register_node("techage:ta4_terminal", { minetest.register_node("techage:ta4_terminal", {
description = "TA4 Collider 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}, {-12/32, -14/32, 12/32, 12/32, 6/32, 14/32},
}, },
}, },
after_place_node = function(pos, placer) after_place_node = function(pos, placer)
local number = techage.add_node(pos, minetest.get_node(pos).name) local number = techage.add_node(pos, minetest.get_node(pos).name)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
@ -169,11 +169,11 @@ minetest.register_node("techage:ta4_terminal", {
meta:set_string("formspec", formspec2(mem)) meta:set_string("formspec", formspec2(mem))
end end
end, end,
after_dig_node = function(pos, oldnode, oldmetadata) after_dig_node = function(pos, oldnode, oldmetadata)
techage.remove_node(pos, oldnode, oldmetadata) techage.remove_node(pos, oldnode, oldmetadata)
end, end,
paramtype = "light", paramtype = "light",
use_texture_alpha = techage.CLIP, use_texture_alpha = techage.CLIP,
sunlight_propagates = true, sunlight_propagates = true,

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
TA4 Vacuum Tube as part of the Collider TA4 Vacuum Tube as part of the Collider
]]-- ]]--
@ -18,10 +18,10 @@ local S = techage.S
local VTube = tubelib2.Tube:new({ local VTube = tubelib2.Tube:new({
dirs_to_check = {1,2,3,4}, dirs_to_check = {1,2,3,4},
max_tube_length = 5, max_tube_length = 5,
tube_type = "vtube", tube_type = "vtube",
show_infotext = false, 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"}, secondary_node_names = {"techage:ta4_magnet"},
after_place_tube = function(pos, param2, tube_type, num_tubes) after_place_tube = function(pos, param2, tube_type, num_tubes)
minetest.swap_node(pos, {name = "techage:ta4_vtube"..tube_type, param2 = param2}) minetest.swap_node(pos, {name = "techage:ta4_vtube"..tube_type, param2 = param2})
@ -63,11 +63,11 @@ minetest.register_node("techage:ta4_vtubeS", {
end end
return false return false
end, end,
after_dig_node = function(pos, oldnode, oldmetadata, digger) after_dig_node = function(pos, oldnode, oldmetadata, digger)
VTube:after_dig_tube(pos, oldnode, oldmetadata) VTube:after_dig_tube(pos, oldnode, oldmetadata)
end, end,
paramtype2 = "facedir", -- important! paramtype2 = "facedir", -- important!
on_rotate = screwdriver.disallow, -- important! on_rotate = screwdriver.disallow, -- important!
paramtype = "light", paramtype = "light",
@ -108,7 +108,7 @@ minetest.register_node("techage:ta4_vtubeA", {
after_dig_node = function(pos, oldnode, oldmetadata, digger) after_dig_node = function(pos, oldnode, oldmetadata, digger)
VTube:after_dig_tube(pos, oldnode, oldmetadata) VTube:after_dig_tube(pos, oldnode, oldmetadata)
end, end,
paramtype2 = "facedir", -- important! paramtype2 = "facedir", -- important!
on_rotate = screwdriver.disallow, -- important! on_rotate = screwdriver.disallow, -- important!
paramtype = "light", paramtype = "light",

View File

@ -19,7 +19,7 @@ local S = techage.S
local AssemblyPlan = { local AssemblyPlan = {
-- y-offs, path, facedir-offs, name -- y-offs, path, facedir-offs, name
-- 0 = forward, 1 = right, 2 = backward, 3 = left -- 0 = forward, 1 = right, 2 = backward, 3 = left
-- level 1 -- level 1
-- left/right -- left/right
{ 1, {3,3,3,2}, 0, "techage:ta4_colliderblock"}, { 1, {3,3,3,2}, 0, "techage:ta4_colliderblock"},
@ -45,7 +45,7 @@ local AssemblyPlan = {
{ 1, {3}, 0, "techage:ta4_detector_magnet"}, { 1, {3}, 0, "techage:ta4_detector_magnet"},
{ 1, {1}, 0, "techage:ta4_detector_magnet"}, { 1, {1}, 0, "techage:ta4_detector_magnet"},
{ 1, {1,1}, 0, "techage:ta4_detector_magnet"}, { 1, {1,1}, 0, "techage:ta4_detector_magnet"},
-- level 2 -- level 2
-- left/right -- left/right
{ 2, {3,3,3,2}, 1, "techage:ta4_collider_pipe_inlet"}, { 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, {}, 0, "techage:ta4_collider_pipe_outlet"},
{ 3, {1}, 0, "techage:ta4_detector_magnet"}, { 3, {1}, 0, "techage:ta4_detector_magnet"},
{ 3, {1,1}, 0, "techage:ta4_detector_magnet"}, { 3, {1,1}, 0, "techage:ta4_detector_magnet"},
-- Core block -- Core block
{ 1, {}, 0, "techage:ta4_detector_core"}, { 1, {}, 0, "techage:ta4_detector_core"},
} }
@ -156,12 +156,12 @@ minetest.register_node("techage:ta4_collider_detector_worker", {
inv:set_size("src", 9) inv:set_size("src", 9)
M(pos):set_string("formspec", formspec()) M(pos):set_string("formspec", formspec())
end, end,
on_receive_fields = function(pos, formname, fields, player) on_receive_fields = function(pos, formname, fields, player)
if minetest.is_protected(pos, player:get_player_name()) then if minetest.is_protected(pos, player:get_player_name()) then
return return
end end
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
if fields.build then if fields.build then
if not nvm.assemble_locked then if not nvm.assemble_locked then
@ -176,7 +176,7 @@ minetest.register_node("techage:ta4_collider_detector_worker", {
end end
end end
end, end,
after_dig_node = function(pos, oldnode) after_dig_node = function(pos, oldnode)
techage.del_mem(pos) techage.del_mem(pos)
end, end,
@ -207,4 +207,3 @@ minetest.register_craft({
{'default:steel_ingot', 'default:mese_crystal', 'techage:aluminum'}, {'default:steel_ingot', 'default:mese_crystal', 'techage:aluminum'},
}, },
}) })

View File

@ -58,7 +58,7 @@ local function plan(images)
end end
end end
return table.concat(tbl) return table.concat(tbl)
end end
local function formspec_help(meta, manual) local function formspec_help(meta, manual)
local bttn local bttn
@ -123,13 +123,13 @@ minetest.register_node("techage:construction_board", {
drawtype = "nodebox", drawtype = "nodebox",
node_box = board_box, node_box = board_box,
selection_box = board_box, selection_box = board_box,
after_place_node = function(pos, placer, itemstack) after_place_node = function(pos, placer, itemstack)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_int("index", 1) meta:set_int("index", 1)
meta:set_string("formspec", formspec_help(meta, techage.manual_DE)) meta:set_string("formspec", formspec_help(meta, techage.manual_DE))
end, end,
on_receive_fields = function(pos, formname, fields, player) on_receive_fields = function(pos, formname, fields, player)
local player_name = player:get_player_name() local player_name = player:get_player_name()
if minetest.is_protected(pos, player_name) then if minetest.is_protected(pos, player_name) then
@ -149,7 +149,7 @@ minetest.register_node("techage:construction_board", {
end end
end end
end, end,
paramtype2 = "wallmounted", paramtype2 = "wallmounted",
paramtype = "light", paramtype = "light",
use_texture_alpha = techage.CLIP, use_texture_alpha = techage.CLIP,
@ -175,13 +175,13 @@ minetest.register_node("techage:construction_board_EN", {
drawtype = "nodebox", drawtype = "nodebox",
node_box = board_box, node_box = board_box,
selection_box = board_box, selection_box = board_box,
after_place_node = function(pos, placer, itemstack) after_place_node = function(pos, placer, itemstack)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_int("index", 1) meta:set_int("index", 1)
meta:set_string("formspec", formspec_help(meta, techage.manual_EN)) meta:set_string("formspec", formspec_help(meta, techage.manual_EN))
end, end,
on_receive_fields = function(pos, formname, fields, player) on_receive_fields = function(pos, formname, fields, player)
local player_name = player:get_player_name() local player_name = player:get_player_name()
if minetest.is_protected(pos, player_name) then if minetest.is_protected(pos, player_name) then
@ -201,7 +201,7 @@ minetest.register_node("techage:construction_board_EN", {
end end
end end
end, end,
paramtype2 = "wallmounted", paramtype2 = "wallmounted",
paramtype = "light", paramtype = "light",
use_texture_alpha = techage.CLIP, use_texture_alpha = techage.CLIP,

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
TA Items Table TA Items Table
]]-- ]]--
@ -118,7 +118,7 @@ techage.Items = {
ta3_programmer = "techage:programmer", ta3_programmer = "techage:programmer",
ta3_doorcontroller = "techage:ta3_doorcontroller", ta3_doorcontroller = "techage:ta3_doorcontroller",
ta3_drill_pipe_wrench = "techage:ta3_drill_pipe_wrench", 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_pipe_wall_entry = "techage:ta3_pipe_wall_entry",
ta3_mesecons_converter = "techage:ta3_mesecons_converter", ta3_mesecons_converter = "techage:ta3_mesecons_converter",
ta3_valve = "techage:ta3_valve_closed", ta3_valve = "techage:ta3_valve_closed",
@ -132,13 +132,13 @@ techage.Items = {
ta4_blinklamp = "techage:rotor_signal_lamp_off", ta4_blinklamp = "techage:rotor_signal_lamp_off",
ta4_nacelle = "techage:ta4_wind_turbine_nacelle", ta4_nacelle = "techage:ta4_wind_turbine_nacelle",
ta4_minicell = "techage:ta4_solar_minicell", ta4_minicell = "techage:ta4_solar_minicell",
ta4_pipe = "techage:ta4_pipeS", ta4_pipe = "techage:ta4_pipeS",
ta4_tube = "techage:ta4_tubeS", ta4_tube = "techage:ta4_tubeS",
ta4_junctionpipe = "techage:ta4_junctionpipe25", ta4_junctionpipe = "techage:ta4_junctionpipe25",
ta4_pipeinlet = "techage:ta4_pipe_inlet", ta4_pipeinlet = "techage:ta4_pipe_inlet",
ta4_turbine = "techage:ta4_turbine", ta4_turbine = "techage:ta4_turbine",
ta4_generator = "techage:ta4_generator", ta4_generator = "techage:ta4_generator",
ta4_heatexchanger = "techage:heatexchanger3", ta4_heatexchanger = "techage:heatexchanger3",
ta4_powercable = "techage:ta4_power_cableS", ta4_powercable = "techage:ta4_power_cableS",
ta4_powerbox = "techage:ta4_power_box", ta4_powerbox = "techage:ta4_power_box",
ta4_solarmodule = "techage:ta4_solar_module", ta4_solarmodule = "techage:ta4_solar_module",
@ -204,9 +204,11 @@ techage.Items = {
ta4_recipeblock = "techage:ta4_recipeblock", ta4_recipeblock = "techage:ta4_recipeblock",
---------------------------- ----------------------------
ta5_flycontroller = "techage:ta5_flycontroller", ta5_flycontroller = "techage:ta5_flycontroller",
ta5_aichip = "techage:ta5_aichip", ta5_aichip = "techage:ta5_aichip",
ta5_tele_pipe = "techage:ta5_tele_pipe", ta5_tele_pipe = "techage:ta5_tele_pipe",
ta5_tele_tube = "techage:ta5_tele_tube", ta5_tele_tube = "techage:ta5_tele_tube",
ta5_chest = "techage:ta5_hl_chest",
ta5_tank = "techage:ta5_hl_tank",
} }
@ -214,4 +216,4 @@ function techage.add_manual_items(table_with_items)
for name, tbl in pairs(table_with_items) do for name, tbl in pairs(table_with_items) do
techage.Items[name] = tbl techage.Items[name] = tbl
end end
end end

View File

@ -237,12 +237,13 @@ techage.manual_DE.aTitel = {
"3,TA5 Flug Controller", "3,TA5 Flug Controller",
"3,TA5 Hyperloop Kiste / TA5 Hyperloop Chest", "3,TA5 Hyperloop Kiste / TA5 Hyperloop Chest",
"3,TA5 Hyperloop Tank / TA5 Hyperloop Tank", "3,TA5 Hyperloop Tank / TA5 Hyperloop Tank",
"3,Hyperloop Teleport Blöcke (geplant)", "3,TA5-Raumgleiter (geplant)",
"3,TA5 Container (geplant)", "2,Teleport Blöcke",
"3,TA5 Teleport Block Gegenstände / TA5 Teleport Block Items", "3,TA5 Teleport Block Gegenstände / TA5 Teleport Block Items",
"3,TA5 Teleport Block Flüssigkeiten / TA5 Teleport Block Liquids", "3,TA5 Teleport Block Flüssigkeiten / TA5 Teleport Block Liquids",
"3,TA5-Raumgleiter (geplant)", "3,Hyperloop Teleport Blöcke (geplant)",
"2,Weitere TA5 Blöcke/Items", "2,Weitere TA5 Blöcke/Items",
"3,TA5 Container (geplant)",
"3,TA5 KI Chip / TA5 AI Chip", "3,TA5 KI Chip / TA5 AI Chip",
} }
@ -2019,35 +2020,39 @@ techage.manual_DE.aText = {
"\n".. "\n"..
"\n".. "\n"..
"\n", "\n",
"Dank einem Spezialantrieb für Lichtgeschwindigkeit können mit dem Raumgleiter auch große Entfernungen sehr schnell überwunden werden.\n"..
"\n",
"Mit Teleport-Blöcken können Dinge zwischen zwei Teleport-Blöcken übertragen werden\\, ohne dass sich dazwischen eine Röhre oder Leitung befinden muss. Für das Pairing der Blöcke musst du zuerst auf der einen Seite einen Namen für den Block eingeben\\, dann kannst du bei dem anderen Block diesen Namen auswählen und so die beiden Blöcke verbinden. Das Pairung kann nur von einem Spieler durchgeführt werden (Spielername wird geprüft) und muss vor einem Server-Neustart abgeschlossen sein. Anderenfalls gehen die Pairing-Daten verloren.\n"..
"\n"..
"Der Plan rechts zeigt\\, wie die Blöcke genutzt werden können.\n"..
"\n"..
"\n"..
"\n",
"Diese Teleport-Blöcke erlauben die Übertragung von Gegenständen und ersetzen somit eine Röhre. Dabei können Entfernungen von bis zu 200 Blöcken überbrückt werden.\n"..
"\n"..
"Ein Teleport-Block benötigt 12 ku Strom.\n"..
"\n"..
"Für die Nutzung der Teleport-Blöcke werden 60 Erfahrungspunkte benötigt.\n"..
"\n"..
"\n"..
"\n",
"Diese Teleport-Blöcke erlauben die Übertragung von Flüssigkeiten und ersetzen somit eine gelbe Leitung. Dabei können Entfernungen von bis zu 200 Blöcken überbrückt werden.\n"..
"\n"..
"Ein Teleport-Block benötigt 12 ku Strom.\n"..
"\n"..
"Für die Nutzung der Teleport-Blöcke werden 60 Erfahrungspunkte benötigt.\n"..
"\n"..
"\n"..
"\n",
"Die Hyperloop Teleport Blöcke erlauben den Aufbau von Hyperloop Netzwerk ohne Hyperloop-Röhren.\n".. "Die Hyperloop Teleport Blöcke erlauben den Aufbau von Hyperloop Netzwerk ohne Hyperloop-Röhren.\n"..
"\n".. "\n"..
"Die Nutzung der Hyperloop Teleport Blöcke benötigt 120 Erfahrungspunkte.\n".. "Die Nutzung der Hyperloop Teleport Blöcke benötigt 120 Erfahrungspunkte.\n"..
"\n", "\n",
"",
"Der TA5 Container erlaubt Techage Anlagen ein- und an einer anderen Stelle wieder auszupacken.\n".. "Der TA5 Container erlaubt Techage Anlagen ein- und an einer anderen Stelle wieder auszupacken.\n"..
"\n".. "\n"..
"Für die Nutzung des TA5 Containers werden 80 Erfahrungspunkte benötigt.\n".. "Für die Nutzung des TA5 Containers werden 80 Erfahrungspunkte benötigt.\n"..
"\n", "\n",
"Teleportblöcke erlauben den Item-Transport ohne Röhren bis zu einer Entfernung von 200 Blöcken.\n"..
"Für das Pairing musst du zuerst auf der einen Seite einen Namen für den Block eingeben\\, dann kannst du bei dem anderen Block diesen Namen auswählen und so die beiden Blöcke verbinden.\n"..
"\n"..
"Teleportblöcke benötigen jeweils 12 ku Strom.\n"..
"\n"..
"Für die Nutzung der Teleportblöcke werden 60 Erfahrungspunkte benötigt.\n"..
"\n"..
"\n"..
"\n",
"Teleportblöcke erlauben den Flüssigkeiten-Transport ohne Leitungen bis zu einer Entfernung von 200 Blöcken.\n"..
"Für das Pairing musst du zuerst auf der einen Seite einen Namen für den Block eingeben\\, dann kannst du bei dem anderen Block diesen Namen auswählen und so die beiden Blöcke verbinden.\n"..
"\n"..
"Teleportblöcke benötigen jeweils 12 ku Strom.\n"..
"\n"..
"Für die Nutzung der Teleportblöcke werden 60 Erfahrungspunkte benötigt.\n"..
"\n"..
"\n"..
"\n",
"Dank einem Spezialantrieb für Lichtgeschwindigkeit können mit dem Raumgleiter auch große Entfernungen sehr schnell überwunden werden.\n"..
"\n",
"",
"Der TA5 KI Chip wird teilweise zur Herstellung von TA5 Blöcken benötigt. Der TA5 KI Chip kann nur auf der TA4 Elektronik Fab hergestellt werden. Dazu werden 10 Erfahrungspunkte benötigt.\n".. "Der TA5 KI Chip wird teilweise zur Herstellung von TA5 Blöcken benötigt. Der TA5 KI Chip kann nur auf der TA4 Elektronik Fab hergestellt werden. Dazu werden 10 Erfahrungspunkte benötigt.\n"..
"\n".. "\n"..
"\n".. "\n"..
@ -2289,14 +2294,15 @@ techage.manual_DE.aItemName = {
"", "",
"", "",
"ta5_flycontroller", "ta5_flycontroller",
"ta4_chest", "ta5_chest",
"ta4_tank", "ta5_tank",
"", "",
"", "",
"ta5_tele_tube", "ta5_tele_tube",
"ta5_tele_pipe", "ta5_tele_pipe",
"", "",
"", "",
"",
"ta5_aichip", "ta5_aichip",
} }
@ -2538,6 +2544,7 @@ techage.manual_DE.aPlanTable = {
"", "",
"", "",
"", "",
"ta5_teleport",
"", "",
"", "",
"", "",
@ -2545,4 +2552,3 @@ techage.manual_DE.aPlanTable = {
"", "",
"", "",
} }

View File

@ -237,11 +237,12 @@ techage.manual_EN.aTitel = {
"3,TA5 Flight Controller", "3,TA5 Flight Controller",
"3,TA5 Hyperloop Chest", "3,TA5 Hyperloop Chest",
"3,TA5 Hyperloop Tank", "3,TA5 Hyperloop Tank",
"3,Hyperloop Teleport Blocks (planned)", "2,Teleport Blocks",
"3,TA5 Container (planned)",
"3,TA5 Teleport Block Items", "3,TA5 Teleport Block Items",
"3,TA5 Teleport Block Liquids", "3,TA5 Teleport Block Liquids",
"2,More TA5 Blocks / Items", "3,Hyperloop Teleport Blocks (planned)",
"2,More TA5 Blocks/Items",
"3,TA5 Container (planned)",
"3,TA5 AI Chip", "3,TA5 AI Chip",
} }
@ -2016,33 +2017,37 @@ techage.manual_EN.aText = {
"\n".. "\n"..
"\n".. "\n"..
"\n", "\n",
"Teleport blocks allow things to be transferred between two teleport blocks without the need for a pipe or tube in between. To pair the blocks\\, you first have to enter a name for the block on one side\\, then you can select this name for the other block and thus connect the two blocks. Pairing can only be carried out by one player (player name is checked) and must be completed before the server is restarted. Otherwise the pairing data will be lost.\n"..
"\n"..
"The map on the right shows how the blocks can be used. \n"..
"\n"..
"\n"..
"\n",
"These teleport blocks allow the transfer of items and thus replace a tube. Distances of up to 200 blocks can be bridged.\n"..
"\n"..
"Each Teleport blocks requires 12 ku of electricity.\n"..
"\n"..
"60 experience points are required to use the teleport blocks. \n"..
"\n"..
"\n"..
"\n",
"These teleport blocks allow the transfer of liquids and thus replace a pipe. Distances of up to 200 blocks can be bridged.\n"..
"\n"..
"Each Teleport blocks requires 12 ku of electricity.\n"..
"\n"..
"60 experience points are required to use the teleport blocks. \n"..
"\n"..
"\n"..
"\n",
"The Hyperloop Teleport Blocks allow the construction of a Hyperloop network without Hyperloop tubes.\n".. "The Hyperloop Teleport Blocks allow the construction of a Hyperloop network without Hyperloop tubes.\n"..
"\n".. "\n"..
"The use of the Hyperloop Teleport Blocks requires 120 experience points.\n".. "The use of the Hyperloop Teleport Blocks requires 120 experience points.\n"..
"\n", "\n",
"",
"The TA5 container allows Techage systems to be packed and unpacked at another location.\n".. "The TA5 container allows Techage systems to be packed and unpacked at another location.\n"..
"\n".. "\n"..
"80 experience points are required to use the TA5 container.\n".. "80 experience points are required to use the TA5 container.\n"..
"\n", "\n",
"Teleport blocks allow items to be transported without tubes up to a distance of 200 blocks.\n"..
"For pairing you first have to enter a name for the block on one side\\, then you can select this name for the other block and thus connect the two blocks.\n"..
"\n"..
"Teleport blocks each require 12 ku of electricity.\n"..
"\n"..
"60 experience points are required to use the Teleport blocks.\n"..
"\n"..
"\n"..
"\n",
"Teleport blocks allow liquids to be transported without pipes up to a distance of 200 blocks.\n"..
"For pairing you first have to enter a name for the block on one side\\, then you can select this name for the other block and thus connect the two blocks.\n"..
"\n"..
"Teleport blocks each require 12 ku of electricity.\n"..
"\n"..
"60 experience points are required to use the Teleport blocks.\n"..
"\n"..
"\n"..
"\n",
"",
"The TA5 AI Chip is partly required for the production of TA5 blocks. The TA5 AI Chip can only be manufactured at the TA4 Electronics Fab. This requires 10 experience points.\n".. "The TA5 AI Chip is partly required for the production of TA5 blocks. The TA5 AI Chip can only be manufactured at the TA4 Electronics Fab. This requires 10 experience points.\n"..
"\n".. "\n"..
"\n".. "\n"..
@ -2284,13 +2289,14 @@ techage.manual_EN.aItemName = {
"", "",
"", "",
"ta5_flycontroller", "ta5_flycontroller",
"ta4_chest", "ta5_chest",
"ta4_tank", "ta5_tank",
"",
"", "",
"ta5_tele_tube", "ta5_tele_tube",
"ta5_tele_pipe", "ta5_tele_pipe",
"", "",
"",
"",
"ta5_aichip", "ta5_aichip",
} }
@ -2531,6 +2537,7 @@ techage.manual_EN.aPlanTable = {
"", "",
"", "",
"", "",
"ta5_teleport",
"", "",
"", "",
"", "",
@ -2538,4 +2545,3 @@ techage.manual_EN.aPlanTable = {
"", "",
"", "",
} }

View File

@ -7,14 +7,14 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
API to add further chapters to the manuals API to add further chapters to the manuals
]]-- ]]--
function techage.add_to_manual(language, titles, texts, items, plans) function techage.add_to_manual(language, titles, texts, items, plans)
local tbl local tbl
if language == "DE" then if language == "DE" then
tbl = techage.manual_DE tbl = techage.manual_DE
elseif language == "EN" then elseif language == "EN" then
@ -37,5 +37,3 @@ function techage.add_to_manual(language, titles, texts, items, plans)
tbl.aPlanTable[#tbl.aPlanTable + 1] = item tbl.aPlanTable[#tbl.aPlanTable + 1] = item
end end
end end

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
Constructioon Plans for TA machines Constructioon Plans for TA machines
]]-- ]]--
@ -162,8 +162,8 @@ techage.ConstructionPlans["steamengine"] = {
{false, BOIL2, false, PI090, false, false, false}, {false, BOIL2, false, PI090, false, false, false},
{false, BOIL1, false, PI090, false, false, false}, {false, BOIL1, false, PI090, false, false, false},
{false, FIBOX, false, PK090, CYLIN, FLYWH, false}, {false, FIBOX, false, PK090, CYLIN, FLYWH, false},
} }
-- --
-- TA2 Storage -- TA2 Storage
-- --
@ -185,7 +185,7 @@ techage.ConstructionPlans["ta2_storage"] = {
{false, false, false, AXL90, WCHST, false, false}, {false, false, false, AXL90, WCHST, false, false},
{false, false, false, AXL90, false, false, false}, {false, false, false, AXL90, false, false, false},
{AXL00, AXL00, AXL00, GRBOX, false, false, false}, {AXL00, AXL00, AXL00, GRBOX, false, false, false},
} }
-- --
-- Item Transport -- Item Transport
@ -201,7 +201,7 @@ techage.ConstructionPlans["itemtransport"] = {
{false}, {false},
{false}, {false},
{CHEST, PUSHR, TB000, GRIND, PUSHR, DISTR, TB000, SIEV2, PUSHR, TB000, CHEST}, {CHEST, PUSHR, TB000, GRIND, PUSHR, DISTR, TB000, SIEV2, PUSHR, TB000, CHEST},
} }
-- --
-- Gravel Rinser -- 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 TK180 = {"techage_tube_knee.png^[transformR180", "techage:tubeS"}
local TK270 = {"techage_tube_knee.png^[transformR270", "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, false, false, SIDEV, false, false, false, false},
{false, GLASS, WATER, GLASS, GLASS, GLASS, GLASS, GLASS}, {false, GLASS, WATER, GLASS, GLASS, GLASS, GLASS, GLASS},
{false, DDIRT, DDIRT, TK000, RINSR, TK270, HOPPR, CHEST}, {false, DDIRT, DDIRT, TK000, RINSR, TK270, HOPPR, CHEST},
@ -290,8 +290,8 @@ techage.ConstructionPlans["ta3_tank"] = {
-- --
-- TA3 Oil Loading station -- TA3 Oil Loading station
-- --
local MCART = {minetest.inventorycube("carts_cart_top.png", local MCART = {minetest.inventorycube("carts_cart_top.png",
"carts_cart_side.png^minecart_logo.png", "carts_cart_side.png^minecart_logo.png"), "carts_cart_side.png^minecart_logo.png", "carts_cart_side.png^minecart_logo.png"),
"minecart:cart"} "minecart:cart"}
local PRAIL = {"carts_rail_straight_pwr.png", "carts:powerrail"} local PRAIL = {"carts_rail_straight_pwr.png", "carts:powerrail"}
local PRAIH = {"carts_rail_straight_pwr.png^[transformR90", "carts:powerrail"} local PRAIH = {"carts_rail_straight_pwr.png^[transformR90", "carts:powerrail"}
@ -493,6 +493,26 @@ techage.ConstructionPlans["ta4_cooler"] = {
{false, false, false, false, false, false, false, false, false}, {false, false, false, false, false, false, false, false, false},
} }
--
-- TA5 Teleport Blocks
--
local TELEP = {"techage_filling_ta4.png^techage_frame_ta5.png^techage_appl_teleport.png", "techage:ta5_tele_pipe"}
local TELET = {"techage_filling_ta4.png^techage_frame_ta5.png^techage_appl_teleport.png", "techage:ta5_tele_tube"}
local PUMP4 = {"techage_filling_ta4.png^techage_appl_pump.png^techage_frame_ta4.png", "techage:t4_pump"}
local ARROW = {"techage_form_arrow.png"}
techage.ConstructionPlans["ta5_teleport"] = {
{false, false, false, false, false, false, false, false, false, false, false},
{false, CHEST, PushR, TELET, false, ARROW, false, TELET, Tubes, CHEST, false},
{false, false, false, false, false, false, false, false, false, false, false},
{false, CHEST, Tubes, TELET, false, ARROW, false, TELET, PushR, CHEST, false},
{false, false, false, false, false, false, false, false, false, false, false},
{false, false, false, false, false, false, false, false, false, false, false},
{false, TANK4, PUMP4, TELEP, false, ARROW, false, TELEP, PIPEH, TANK4, false},
{false, false, false, false, false, false, false, false, false, false, false},
{false, TANK4, PIPEH, TELEP, false, ARROW, false, TELEP, PUMP4, TANK4, false},
}
function techage.add_manual_plans(table_with_plans) function techage.add_manual_plans(table_with_plans)
for name, tbl in pairs(table_with_plans) do for name, tbl in pairs(table_with_plans) do
techage.ConstructionPlans[name] = tbl techage.ConstructionPlans[name] = tbl

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
TA4 TES Generator (dummy) TA4 TES Generator (dummy)
- can be started and stopped - can be started and stopped
- provides netID of cable network - 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",
"techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_generator.png^[transformFX]", "techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_generator.png^[transformFX]",
}, },
after_place_node = function(pos) after_place_node = function(pos)
M(pos):set_int("outdir", networks.side_to_outdir(pos, "R")) M(pos):set_int("outdir", networks.side_to_outdir(pos, "R"))
Cable:after_place_node(pos) Cable:after_place_node(pos)
@ -86,7 +86,7 @@ minetest.register_node("techage:ta4_generator_on", {
}, },
}, },
}, },
paramtype2 = "facedir", paramtype2 = "facedir",
drop = "", drop = "",
groups = {not_in_creative_inventory=1}, groups = {not_in_creative_inventory=1},
@ -128,5 +128,3 @@ minetest.register_craft({
{"", "techage:ta4_wlanchip", ""}, {"", "techage:ta4_wlanchip", ""},
}, },
}) })

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
TA4 Heat Exchanger1 (bottom part) TA4 Heat Exchanger1 (bottom part)
- has a connection to storage and turbine (via pipes) - has a connection to storage and turbine (via pipes)
- acts as a cable junction for Exchanger2 - 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",
"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) after_place_node = function(pos, placer, itemstack, pointed_thing)
Cable:after_place_node(pos) Cable:after_place_node(pos)
Pipe:after_place_node(pos) Pipe:after_place_node(pos)
@ -99,4 +99,3 @@ minetest.register_craft({
{"", "techage:baborium_ingot", ""}, {"", "techage:baborium_ingot", ""},
}, },
}) })

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
TA4 Heat Exchanger2 (middle part) TA4 Heat Exchanger2 (middle part)
(alternatively used as cooler for the TA4 collider) (alternatively used as cooler for the TA4 collider)
@ -35,13 +35,13 @@ local DOWN = 5
local PWR_NEEDED = 5 local PWR_NEEDED = 5
local function heatexchanger1_cmnd(pos, topic, payload) 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, nil, topic, payload, nil,
{"techage:heatexchanger1"}) {"techage:heatexchanger1"})
end end
local function heatexchanger3_cmnd(pos, topic, payload) 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, nil, topic, payload, nil,
{"techage:heatexchanger3"}) {"techage:heatexchanger3"})
end end
@ -59,7 +59,7 @@ local function play_sound(pos)
local mem = techage.get_mem(pos) local mem = techage.get_mem(pos)
if not mem.handle or mem.handle == -1 then if not mem.handle or mem.handle == -1 then
mem.handle = minetest.sound_play("techage_booster", { mem.handle = minetest.sound_play("techage_booster", {
pos = pos, pos = pos,
gain = 0.3, gain = 0.3,
max_hear_distance = 10, max_hear_distance = 10,
loop = true}) loop = true})
@ -95,7 +95,7 @@ local function can_start(pos, nvm)
return S("No power") return S("No power")
end end
end end
-- Used as heat exchanger -- Used as heat exchanger
local netID = networks.determine_netID(pos, Cable, DOWN) local netID = networks.determine_netID(pos, Cable, DOWN)
if heatexchanger1_cmnd(pos, "netID") ~= netID then if heatexchanger1_cmnd(pos, "netID") ~= netID then
return S("Power network connection error") return S("Power network connection error")
@ -139,7 +139,7 @@ end
local function formspec(self, pos, nvm) local function formspec(self, pos, nvm)
local data local data
if nvm.used_as_cooler then if nvm.used_as_cooler then
return cooler_formspec(self, pos, nvm) return cooler_formspec(self, pos, nvm)
end end
@ -182,7 +182,7 @@ local function check_TES_integrity(pos, nvm)
end end
nvm.check_once_again = true nvm.check_once_again = true
return true return true
end end
local State = techage.NodeStates:new({ local State = techage.NodeStates:new({
node_name_passive = "techage:heatexchanger2", 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 if power.consume_power(pos, Cable, DOWN, PWR_NEEDED) ~= PWR_NEEDED then
State:fault(pos, nvm, "No power") State:fault(pos, nvm, "No power")
stop_sound(pos) stop_sound(pos)
return true return true
end end
-- Cyclically check pipe connections -- Cyclically check pipe connections
@ -218,7 +218,7 @@ local function cooler_timer(pos, nvm)
State:fault(pos, nvm, "Pipe connection error") State:fault(pos, nvm, "Pipe connection error")
stop_sound(pos) stop_sound(pos)
end end
return true return true
end end
local function node_timer(pos, elapsed) local function node_timer(pos, elapsed)
@ -233,7 +233,7 @@ local function node_timer(pos, elapsed)
heatexchanger1_cmnd(pos, "stop") heatexchanger1_cmnd(pos, "stop")
power.start_storage_calc(pos, Cable, DOWN) power.start_storage_calc(pos, Cable, DOWN)
end end
if techage.is_running(nvm) then if techage.is_running(nvm) then
local capa = power.get_storage_load(pos, Cable, DOWN, nvm.capa_max) or 0 local capa = power.get_storage_load(pos, Cable, DOWN, nvm.capa_max) or 0
if capa > 0 then if capa > 0 then
@ -243,7 +243,7 @@ local function node_timer(pos, elapsed)
if techage.is_activeformspec(pos) then if techage.is_activeformspec(pos) then
M(pos):set_string("formspec", formspec(State, pos, nvm)) M(pos):set_string("formspec", formspec(State, pos, nvm))
end end
return true return true
end end
local function can_dig(pos, player) local function can_dig(pos, player)
@ -273,7 +273,7 @@ local function after_place_node(pos, placer)
Cable:after_place_node(pos, {DOWN}) Cable:after_place_node(pos, {DOWN})
State:node_init(pos, nvm, own_num) State:node_init(pos, nvm, own_num)
end end
local function after_dig_node(pos, oldnode, oldmetadata, digger) local function after_dig_node(pos, oldnode, oldmetadata, digger)
Cable:after_dig_node(pos) Cable:after_dig_node(pos)
techage.del_mem(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 if minetest.is_protected(pos, player:get_player_name()) then
return return
end end
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
State:state_button_event(pos, nvm, fields) State:state_button_event(pos, nvm, fields)
M(pos):set_string("formspec", formspec(State, pos, nvm)) 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",
"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 = { selection_box = {
type = "fixed", type = "fixed",
fixed = {-1/2, -1.5/2, -1/2, 1/2, 1/2, 1/2}, fixed = {-1/2, -1.5/2, -1/2, 1/2, 1/2, 1/2},
}, },
on_receive_fields = on_receive_fields, on_receive_fields = on_receive_fields,
on_rightclick = on_rightclick, on_rightclick = on_rightclick,
on_timer = node_timer, on_timer = node_timer,

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
TA4 Heat Exchanger3 (top part) 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",
"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_place_node = after_place_node,
after_dig_node = after_dig_node, after_dig_node = after_dig_node,
networks = { networks = {
pipe2 = {}, pipe2 = {},
}, },

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
TA4 Pipe Inlet 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",
"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_place_node = after_place_node,
after_dig_node = after_dig_node, after_dig_node = after_dig_node,
networks = { networks = {
pipe2 = {}, pipe2 = {},
}, },
@ -72,7 +72,7 @@ local Numbers = {
local function get_diameter(pos, in_dir) local function get_diameter(pos, in_dir)
local dir = tubelib2.Dir6dToVector[in_dir] local dir = tubelib2.Dir6dToVector[in_dir]
local pos2, node local pos2, node
pos2 = vector.add(pos, vector.multiply(dir, 4)) pos2 = vector.add(pos, vector.multiply(dir, 4))
node = minetest.get_node(pos2) node = minetest.get_node(pos2)
if node.name == "techage:ta3_pipe_wall_entry" then 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 if node.name == "techage:ta4_pipe_inlet" then
return 5 return 5
end end
pos2 = vector.add(pos, vector.multiply(dir, 6)) pos2 = vector.add(pos, vector.multiply(dir, 6))
node = minetest.get_node(pos2) node = minetest.get_node(pos2)
if node.name == "techage:ta3_pipe_wall_entry" then 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 if node.name == "techage:ta4_pipe_inlet" then
return 7 return 7
end end
pos2 = vector.add(pos, vector.multiply(dir, 8)) pos2 = vector.add(pos, vector.multiply(dir, 8))
node = minetest.get_node(pos2) node = minetest.get_node(pos2)
if node.name == "techage:ta3_pipe_wall_entry" then if node.name == "techage:ta3_pipe_wall_entry" then
@ -116,11 +116,11 @@ local function check_volume(pos, in_dir, owner)
-- calculate size -- calculate size
local pos1 = {x = cpos.x - radius, y = cpos.y - radius, z = cpos.z - radius} 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 pos2 = {x = cpos.x + radius, y = cpos.y + radius, z = cpos.z + radius}
local _, node_tbl = minetest.find_nodes_in_area(pos1, pos2, local _, node_tbl = minetest.find_nodes_in_area(pos1, pos2,
{"default:gravel", "techage:ta4_pipe_inlet", {"default:gravel", "techage:ta4_pipe_inlet",
"basic_materials:concrete_block", "default:obsidian_glass", "basic_materials:concrete_block", "default:obsidian_glass",
"techage:glow_gravel"}) "techage:glow_gravel"})
if node_tbl["default:obsidian_glass"] > 1 then if node_tbl["default:obsidian_glass"] > 1 then
return S("one window maximum") return S("one window maximum")
elseif node_tbl["default:obsidian_glass"] + node_tbl["basic_materials:concrete_block"] ~= Numbers.shell[radius] then elseif node_tbl["default:obsidian_glass"] + node_tbl["basic_materials:concrete_block"] ~= Numbers.shell[radius] then
return S("wrong number of shell nodes") return S("wrong number of shell nodes")

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
TA4 Nodes TA4 Nodes
]]-- ]]--
@ -34,4 +34,3 @@ minetest.register_node("techage:glow_gravel", {
sounds = default.node_sound_gravel_defaults(), sounds = default.node_sound_gravel_defaults(),
drop = "", drop = "",
}) })

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
TA4 TES Gas Turbine TA4 TES Gas Turbine
]]-- ]]--
@ -19,7 +19,7 @@ local S = techage.S
local Pipe = techage.LiquidPipe local Pipe = techage.LiquidPipe
local function generator_cmnd(pos, topic, payload) 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"}) {"techage:ta4_generator", "techage:ta4_generator_on"})
end end
@ -36,7 +36,7 @@ local function play_sound(pos)
local mem = techage.get_mem(pos) local mem = techage.get_mem(pos)
if not mem.handle or mem.handle == -1 then if not mem.handle or mem.handle == -1 then
mem.handle = minetest.sound_play("techage_turbine", { mem.handle = minetest.sound_play("techage_turbine", {
pos = pos, pos = pos,
gain = 0.4, gain = 0.4,
max_hear_distance = 10, max_hear_distance = 10,
loop = true}) 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",
"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) after_place_node = function(pos)
Pipe:after_place_node(pos) Pipe:after_place_node(pos)
end, 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") swap_node(pos, "techage:ta4_turbine")
stop_sound(pos) stop_sound(pos)
generator_cmnd(pos, "stop") generator_cmnd(pos, "stop")
@ -151,7 +151,7 @@ techage.register_node({"techage:ta4_turbine", "techage:ta4_turbine_on"}, {
on_node_load = function(pos, node) on_node_load = function(pos, node)
if node.name == "techage:ta4_turbine_on" then if node.name == "techage:ta4_turbine_on" then
play_sound(pos) play_sound(pos)
end end
end, end,
}) })
@ -163,4 +163,3 @@ minetest.register_craft({
{"", "techage:ta4_wlanchip", ""}, {"", "techage:ta4_wlanchip", ""},
}, },
}) })

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
Biogas flare Biogas flare
]]-- ]]--
@ -65,7 +65,7 @@ for idx,ratio in ipairs(lRatio) do
}, },
}, },
}, },
after_destruct = function(pos, oldnode) after_destruct = function(pos, oldnode)
pos.y = pos.y + 1 pos.y = pos.y + 1
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
@ -73,7 +73,7 @@ for idx,ratio in ipairs(lRatio) do
minetest.remove_node(pos) minetest.remove_node(pos)
end end
end, end,
use_texture_alpha = true, use_texture_alpha = true,
inventory_image = "techage_flame.png", inventory_image = "techage_flame.png",
paramtype = "light", paramtype = "light",
@ -93,16 +93,16 @@ end
local function start_flarestack(pos, playername) local function start_flarestack(pos, playername)
if minetest.is_protected( 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 playername) then
return return
end end
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
flame({x=pos.x, y=pos.y+1, z=pos.z}) flame({x=pos.x, y=pos.y+1, z=pos.z})
local handle = minetest.sound_play("gasflare", { local handle = minetest.sound_play("gasflare", {
pos = pos, pos = pos,
max_hear_distance = 20, max_hear_distance = 20,
gain = 1, gain = 1,
loop = true}) loop = true})
--print("handle", handle) --print("handle", handle)
meta:set_int("handle", handle) meta:set_int("handle", handle)
@ -123,7 +123,7 @@ minetest.register_node("techage:gasflare", {
"techage_gasflare.png", "techage_gasflare.png",
"techage_gasflare.png^techage_appl_hole2.png", "techage_gasflare.png^techage_appl_hole2.png",
}, },
after_place_node = function(pos, placer, itemstack, pointed_thing) after_place_node = function(pos, placer, itemstack, pointed_thing)
local node = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}) local node = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z})
if node.name ~= "air" then if node.name ~= "air" then
@ -131,14 +131,14 @@ minetest.register_node("techage:gasflare", {
end end
minetest.add_node({x=pos.x, y=pos.y+1, z=pos.z}, {name = "techage:gasflare2"}) minetest.add_node({x=pos.x, y=pos.y+1, z=pos.z}, {name = "techage:gasflare2"})
end, end,
on_punch = function(pos, node, puncher) on_punch = function(pos, node, puncher)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local handle = meta:get_int("handle") local handle = meta:get_int("handle")
minetest.sound_stop(handle) minetest.sound_stop(handle)
start_flarestack(pos, puncher:get_player_name()) start_flarestack(pos, puncher:get_player_name())
end, end,
after_dig_node = function(pos, oldnode, oldmetadata, digger) after_dig_node = function(pos, oldnode, oldmetadata, digger)
--print(dump(oldmetadata)) --print(dump(oldmetadata))
stop_flarestack(pos, oldmetadata.fields.handle) stop_flarestack(pos, oldmetadata.fields.handle)
@ -149,7 +149,7 @@ minetest.register_node("techage:gasflare", {
end, end,
paramtype = "light", paramtype = "light",
light_source = 0, light_source = 0,
sunlight_propagates = true, sunlight_propagates = true,
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {cracky=2, crumbly=2, choppy=2}, 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^techage_appl_hole2.png",
"techage_gasflare.png" "techage_gasflare.png"
}, },
drawtype = "nodebox", drawtype = "nodebox",
node_box = { node_box = {
type = "fixed", type = "fixed",
@ -173,7 +173,7 @@ minetest.register_node("techage:gasflare2", {
}, },
}, },
paramtype = "light", paramtype = "light",
light_source = 0, light_source = 0,
sunlight_propagates = true, sunlight_propagates = true,
paramtype2 = "facedir", paramtype2 = "facedir",
diggable = false, diggable = false,

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
TA3 Booster TA3 Booster
]]-- ]]--
@ -39,7 +39,7 @@ local function play_sound(pos)
local mem = techage.get_mem(pos) local mem = techage.get_mem(pos)
if not mem.handle or mem.handle == -1 then if not mem.handle or mem.handle == -1 then
mem.handle = minetest.sound_play("techage_booster", { mem.handle = minetest.sound_play("techage_booster", {
pos = pos, pos = pos,
gain = 1, gain = 1,
max_hear_distance = 7, max_hear_distance = 7,
loop = true}) 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^techage_frame_ta3.png",
"techage_filling_ta3.png^techage_appl_compressor.png^[transformFX^techage_frame_ta3.png", "techage_filling_ta3.png^techage_appl_compressor.png^[transformFX^techage_frame_ta3.png",
}, },
on_timer = function(pos, elapsed) on_timer = function(pos, elapsed)
local consumed = power.consume_power(pos, Cable, nil, PWR_NEEDED) local consumed = power.consume_power(pos, Cable, nil, PWR_NEEDED)
if consumed == PWR_NEEDED then if consumed == PWR_NEEDED then
@ -94,7 +94,7 @@ minetest.register_node("techage:ta3_booster", {
end, end,
after_place_node = after_place_node, after_place_node = after_place_node,
after_dig_node = after_dig_node, after_dig_node = after_dig_node,
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {cracky=2, crumbly=2, choppy=2}, groups = {cracky=2, crumbly=2, choppy=2},
on_rotate = screwdriver.disallow, on_rotate = screwdriver.disallow,
@ -130,7 +130,7 @@ minetest.register_node("techage:ta3_booster_on", {
}, },
}, },
}, },
on_timer = function(pos, elapsed) on_timer = function(pos, elapsed)
local consumed = power.consume_power(pos, Cable, nil, PWR_NEEDED) local consumed = power.consume_power(pos, Cable, nil, PWR_NEEDED)
if consumed < PWR_NEEDED then if consumed < PWR_NEEDED then
@ -142,7 +142,7 @@ minetest.register_node("techage:ta3_booster_on", {
end, end,
after_place_node = after_place_node, after_place_node = after_place_node,
after_dig_node = after_dig_node, after_dig_node = after_dig_node,
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {not_in_creative_inventory = 1}, groups = {not_in_creative_inventory = 1},
diggable = false, diggable = false,
@ -185,7 +185,7 @@ techage.register_node({"techage:ta3_booster", "techage:ta3_booster_on"}, {
on_node_load = function(pos, node) on_node_load = function(pos, node)
if node.name == "techage:ta3_booster_on" then if node.name == "techage:ta3_booster_on" then
play_sound(pos) play_sound(pos)
end end
end, end,
}) })
@ -197,4 +197,3 @@ minetest.register_craft({
{"basic_materials:steel_bar", "default:wood", "basic_materials:steel_bar"}, {"basic_materials:steel_bar", "default:wood", "basic_materials:steel_bar"},
}, },
}) })

View File

@ -7,9 +7,9 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
Cooking routines for furnace Cooking routines for furnace
]]-- ]]--
-- for lazy programmers -- for lazy programmers
@ -40,7 +40,7 @@ local function all_ingredients_available(output, ingr)
end end
end end
end end
end end
-- Return a list with all outputs of the given list of ingredients -- Return a list with all outputs of the given list of ingredients
local function get_recipes(ingr) local function get_recipes(ingr)
@ -60,7 +60,7 @@ local function get_recipes(ingr)
return KeyList return KeyList
end end
end end
function techage.furnace.get_ingredients(pos) function techage.furnace.get_ingredients(pos)
local inv = M(pos):get_inventory() local inv = M(pos):get_inventory()
local tbl = {} local tbl = {}
@ -116,7 +116,7 @@ local function process(inv, recipe, output)
end end
end end
return techage.RUNNING return techage.RUNNING
end end
function techage.furnace.check_if_worth_to_wakeup(pos, nvm) function techage.furnace.check_if_worth_to_wakeup(pos, nvm)
local inv = M(pos):get_inventory() local inv = M(pos):get_inventory()
@ -141,7 +141,7 @@ function techage.furnace.check_if_worth_to_wakeup(pos, nvm)
end end
end end
return true return true
end end
function techage.furnace.smelting(pos, nvm, elapsed) function techage.furnace.smelting(pos, nvm, elapsed)
local inv = M(pos):get_inventory() local inv = M(pos):get_inventory()
@ -154,11 +154,11 @@ function techage.furnace.smelting(pos, nvm, elapsed)
if not recipe then if not recipe then
return techage.FAULT, "recipe error" return techage.FAULT, "recipe error"
end end
elapsed = elapsed + (nvm.leftover or 0) elapsed = elapsed + (nvm.leftover or 0)
while elapsed >= recipe.time do while elapsed >= recipe.time do
state = process(inv, recipe, nvm.output) state = process(inv, recipe, nvm.output)
if state ~= techage.RUNNING then if state ~= techage.RUNNING then
return state return state
end end
elapsed = elapsed - recipe.time elapsed = elapsed - recipe.time
@ -225,4 +225,4 @@ function techage.furnace.register_recipe(recipe)
recipe.items = recipe.recipe recipe.items = recipe.recipe
recipe.type = "ta3_melting" recipe.type = "ta3_melting"
techage.recipes.register_craft(recipe) techage.recipes.register_craft(recipe)
end end

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
TA3 Industrial Furnace Firebox TA3 Industrial Furnace Firebox
]]-- ]]--
@ -72,7 +72,7 @@ end
local function booster_cmnd(pos, cmnd) local function booster_cmnd(pos, cmnd)
return techage.transfer( return techage.transfer(
pos, pos,
"L", -- outdir "L", -- outdir
cmnd, -- topic cmnd, -- topic
nil, -- payload nil, -- payload
@ -102,7 +102,7 @@ minetest.register_node("techage:furnace_firebox", {
on_punch = fuel.on_punch, on_punch = fuel.on_punch,
on_receive_fields = fuel.on_receive_fields, on_receive_fields = fuel.on_receive_fields,
on_rightclick = fuel.on_rightclick, on_rightclick = fuel.on_rightclick,
on_construct = function(pos) on_construct = function(pos)
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
techage.add_node(pos, "techage:furnace_firebox") techage.add_node(pos, "techage:furnace_firebox")
@ -145,7 +145,7 @@ minetest.register_node("techage:furnace_firebox_on", {
is_ground_content = false, is_ground_content = false,
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
drop = "techage:furnace_firebox", drop = "techage:furnace_firebox",
on_timer = node_timer, on_timer = node_timer,
can_dig = fuel.can_dig, can_dig = fuel.can_dig,
on_receive_fields = fuel.on_receive_fields, 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.amount = (nvm.liquid.amount or 0) + count
nvm.liquid.name = "techage:gasoline" nvm.liquid.name = "techage:gasoline"
inv:set_stack("fuel", 1, nil) inv:set_stack("fuel", 1, nil)
end end
end, end,
}) })
liquid.register_nodes({"techage:furnace_firebox", "techage:furnace_firebox_on"}, 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))

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
TA3 Industrial Furnace Top TA3 Industrial Furnace Top
]]-- ]]--
@ -54,12 +54,12 @@ local function formspec(self, pos, nvm)
"tooltip[2,2;1,1;"..self:get_state_tooltip(nvm).."]".. "tooltip[2,2;1,1;"..self:get_state_tooltip(nvm).."]"..
"list[context;dst;3,0;2,2;]".. "list[context;dst;3,0;2,2;]"..
"label[6,0;"..S("Outp")..": "..idx.."/"..num.."]".. "label[6,0;"..S("Outp")..": "..idx.."/"..num.."]"..
"item_image_button[6.5,0.5;1,1;"..outp..";b1;]".. "item_image_button[6.5,0.5;1,1;"..outp..";b1;]"..
"button[6,1.5;1,1;priv;<<]".. "button[6,1.5;1,1;priv;<<]"..
"button[7,1.5;1,1;next;>>]".. "button[7,1.5;1,1;next;>>]"..
"list[current_player;main;0,3.5;8,4;]" .. "list[current_player;main;0,3.5;8,4;]" ..
"listring[current_player;main]".. "listring[current_player;main]"..
"listring[context;src]" .. "listring[context;src]" ..
@ -76,7 +76,7 @@ end
local function firebox_cmnd(pos, cmnd) local function firebox_cmnd(pos, cmnd)
return techage.transfer( 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 nil, -- outdir
cmnd, -- topic cmnd, -- topic
nil, -- payload nil, -- payload
@ -120,7 +120,7 @@ local function keep_running(pos, elapsed)
if nvm.toggle then -- progress bar/arrow if nvm.toggle then -- progress bar/arrow
M(pos):set_string("formspec", formspec(crd.State, pos, nvm)) M(pos):set_string("formspec", formspec(crd.State, pos, nvm))
end end
end end
local function allow_metadata_inventory_put(pos, listname, index, stack, player) local function allow_metadata_inventory_put(pos, listname, index, stack, player)
if minetest.is_protected(pos, player:get_player_name()) then if minetest.is_protected(pos, player:get_player_name()) then
@ -259,7 +259,7 @@ local tubing = {
end, end,
} }
local _, node_name_ta3, _ = local _, node_name_ta3, _ =
techage.register_consumer("furnace", S("Furnace Top"), tiles, { techage.register_consumer("furnace", S("Furnace Top"), tiles, {
drawtype = "normal", drawtype = "normal",
cycle_time = CYCLE_TIME, cycle_time = CYCLE_TIME,
@ -298,4 +298,3 @@ minetest.register_craft({
{"", "techage:vacuum_tube", ""}, {"", "techage:vacuum_tube", ""},
}, },
}) })

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
TA4 Industrial Furnace Heater 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_frame_ta3.png",
"techage_concrete.png^techage_appl_heater.png^techage_frame_ta3.png", "techage_concrete.png^techage_appl_heater.png^techage_frame_ta3.png",
}, },
on_timer = function(pos, elapsed) on_timer = function(pos, elapsed)
local consumed = power.consume_power(pos, Cable, nil, PWR_NEEDED) local consumed = power.consume_power(pos, Cable, nil, PWR_NEEDED)
if consumed == PWR_NEEDED then if consumed == PWR_NEEDED then
@ -62,7 +62,7 @@ minetest.register_node("techage:furnace_heater", {
end, end,
after_place_node = after_place_node, after_place_node = after_place_node,
after_dig_node = after_dig_node, after_dig_node = after_dig_node,
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {cracky=2, crumbly=2, choppy=2}, groups = {cracky=2, crumbly=2, choppy=2},
on_rotate = screwdriver.disallow, 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_frame_ta3.png",
"techage_concrete.png^techage_appl_heater_on.png^techage_frame_ta3.png", "techage_concrete.png^techage_appl_heater_on.png^techage_frame_ta3.png",
}, },
on_timer = function(pos, elapsed) on_timer = function(pos, elapsed)
local consumed = power.consume_power(pos, Cable, nil, PWR_NEEDED) local consumed = power.consume_power(pos, Cable, nil, PWR_NEEDED)
if consumed < PWR_NEEDED then if consumed < PWR_NEEDED then
@ -91,7 +91,7 @@ minetest.register_node("techage:furnace_heater_on", {
end, end,
after_place_node = after_place_node, after_place_node = after_place_node,
after_dig_node = after_dig_node, after_dig_node = after_dig_node,
light_source = 8, light_source = 8,
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {not_in_creative_inventory = 1}, groups = {not_in_creative_inventory = 1},
@ -124,7 +124,7 @@ techage.register_node({"techage:furnace_heater", "techage:furnace_heater_on"}, {
return true return true
end end
end end
}) })
minetest.register_craft({ minetest.register_craft({
output = "techage:furnace_heater", output = "techage:furnace_heater",

View File

@ -7,42 +7,42 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
Cooking recipes for furnace Cooking recipes for furnace
]]-- ]]--
techage.furnace.register_recipe({ techage.furnace.register_recipe({
output = "techage:iron_ingot", output = "techage:iron_ingot",
recipe = {"default:iron_lump"}, recipe = {"default:iron_lump"},
time = 2, time = 2,
}) })
techage.furnace.register_recipe({ techage.furnace.register_recipe({
output = "default:obsidian", output = "default:obsidian",
recipe = {"default:cobble"}, recipe = {"default:cobble"},
time = 8, time = 8,
}) })
if techage.modified_recipes_enabled then if techage.modified_recipes_enabled then
techage.furnace.register_recipe({ techage.furnace.register_recipe({
output = "default:bronze_ingot 4", output = "default:bronze_ingot 4",
recipe = {"default:copper_ingot", "default:copper_ingot", "default:copper_ingot", "default:tin_ingot"}, recipe = {"default:copper_ingot", "default:copper_ingot", "default:copper_ingot", "default:tin_ingot"},
time = 2, time = 2,
}) })
techage.furnace.register_recipe({ techage.furnace.register_recipe({
output = "default:steel_ingot 4", output = "default:steel_ingot 4",
recipe = {"default:coal_lump", "default:iron_lump", "default:iron_lump", "default:iron_lump"}, recipe = {"default:coal_lump", "default:iron_lump", "default:iron_lump", "default:iron_lump"},
time = 4, time = 4,
}) })
end end
if minetest.global_exists("wielded_light") then if minetest.global_exists("wielded_light") then
techage.furnace.register_recipe({ techage.furnace.register_recipe({
output = "techage:meridium_ingot", output = "techage:meridium_ingot",
recipe = {"default:steel_ingot", "default:mese_crystal_fragment"}, recipe = {"default:steel_ingot", "default:mese_crystal_fragment"},
heat = 4, heat = 4,
time = 3, time = 3,
}) })
@ -68,15 +68,15 @@ minetest.after(1, function()
if recipe.items[1] and string.split(recipe.items[1], ":")[1] == "group" then 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 for _,item in ipairs(node_group(string.split(recipe.items[1], ":")[2])) do
techage.furnace.register_recipe({ techage.furnace.register_recipe({
output = recipe.output, output = recipe.output,
recipe = {item}, recipe = {item},
time = math.floor((recipe.width + 1) / 2), time = math.floor((recipe.width + 1) / 2),
}) })
end end
else else
techage.furnace.register_recipe({ techage.furnace.register_recipe({
output = recipe.output, output = recipe.output,
recipe = recipe.items, recipe = recipe.items,
time = math.floor((recipe.width + 1) / 2), time = math.floor((recipe.width + 1) / 2),
}) })
end end
@ -90,8 +90,8 @@ end)
techage.furnace.register_recipe({ techage.furnace.register_recipe({
output = "techage:basalt_glass2", output = "techage:basalt_glass2",
recipe = { recipe = {
"techage:basalt_gravel", "techage:basalt_gravel",
"techage:basalt_gravel", "techage:basalt_gravel",
}, },
time = 4, time = 4,
}) })
@ -99,8 +99,8 @@ techage.furnace.register_recipe({
techage.furnace.register_recipe({ techage.furnace.register_recipe({
output = "techage:basalt_glass", output = "techage:basalt_glass",
recipe = { recipe = {
"techage:sieved_basalt_gravel", "techage:sieved_basalt_gravel",
"techage:sieved_basalt_gravel", "techage:sieved_basalt_gravel",
}, },
time = 4, time = 4,
}) })
@ -108,7 +108,7 @@ techage.furnace.register_recipe({
techage.furnace.register_recipe({ techage.furnace.register_recipe({
output = "techage:basalt_glass_thin2 2", output = "techage:basalt_glass_thin2 2",
recipe = { recipe = {
"techage:basalt_gravel", "techage:basalt_gravel",
}, },
time = 4, time = 4,
}) })
@ -116,7 +116,7 @@ techage.furnace.register_recipe({
techage.furnace.register_recipe({ techage.furnace.register_recipe({
output = "techage:basalt_glass_thin 2", output = "techage:basalt_glass_thin 2",
recipe = { recipe = {
"techage:sieved_basalt_gravel", "techage:sieved_basalt_gravel",
}, },
time = 4, time = 4,
}) })
@ -124,7 +124,7 @@ techage.furnace.register_recipe({
techage.furnace.register_recipe({ techage.furnace.register_recipe({
output = "techage:basalt_glass_thin_xl2", output = "techage:basalt_glass_thin_xl2",
recipe = { recipe = {
"techage:basalt_gravel", "techage:basalt_gravel",
}, },
time = 4, time = 4,
}) })
@ -132,7 +132,7 @@ techage.furnace.register_recipe({
techage.furnace.register_recipe({ techage.furnace.register_recipe({
output = "techage:basalt_glass_thin_xl", output = "techage:basalt_glass_thin_xl",
recipe = { recipe = {
"techage:sieved_basalt_gravel", "techage:sieved_basalt_gravel",
}, },
time = 4, time = 4,
}) })
@ -140,7 +140,7 @@ techage.furnace.register_recipe({
techage.furnace.register_recipe({ techage.furnace.register_recipe({
output = "basic_materials:concrete_block 4", output = "basic_materials:concrete_block 4",
recipe = { recipe = {
"basic_materials:wet_cement", "basic_materials:wet_cement",
"default:sand", "default:sand",
"default:gravel", "default:gravel",
"techage:steelmat", "techage:steelmat",
@ -149,12 +149,12 @@ techage.furnace.register_recipe({
}) })
if minetest.global_exists("moreores") then if minetest.global_exists("moreores") then
if techage.modified_recipes_enabled then if techage.modified_recipes_enabled then
minetest.clear_craft({output = "moreores:mithril_ingot"}) minetest.clear_craft({output = "moreores:mithril_ingot"})
minetest.clear_craft({output = "moreores:silver_ingot"}) minetest.clear_craft({output = "moreores:silver_ingot"})
end end
techage.furnace.register_recipe({ techage.furnace.register_recipe({
output = 'moreores:silver_ingot', output = 'moreores:silver_ingot',
recipe = {'moreores:silver_lump'}, recipe = {'moreores:silver_lump'},

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
TA4 Electrolyzer TA4 Electrolyzer
]]-- ]]--
@ -58,7 +58,7 @@ end
local function can_start(pos, nvm, state) local function can_start(pos, nvm, state)
nvm.liquid = nvm.liquid or {} nvm.liquid = nvm.liquid or {}
nvm.liquid.amount = nvm.liquid.amount or 0 nvm.liquid.amount = nvm.liquid.amount or 0
if nvm.liquid.amount < CAPACITY then if nvm.liquid.amount < CAPACITY then
return true return true
end end
@ -99,7 +99,7 @@ local function generating(pos, nvm)
nvm.num_pwr_units = nvm.num_pwr_units - PWR_UNITS_PER_HYDROGEN_ITEM nvm.num_pwr_units = nvm.num_pwr_units - PWR_UNITS_PER_HYDROGEN_ITEM
end end
end end
end end
-- converts power into hydrogen -- converts power into hydrogen
local function node_timer(pos, elapsed) local function node_timer(pos, elapsed)
@ -107,7 +107,7 @@ local function node_timer(pos, elapsed)
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
nvm.liquid = nvm.liquid or {} nvm.liquid = nvm.liquid or {}
nvm.liquid.amount = nvm.liquid.amount or 0 nvm.liquid.amount = nvm.liquid.amount or 0
if nvm.liquid.amount < CAPACITY then if nvm.liquid.amount < CAPACITY then
local in_dir = meta:get_int("in_dir") local in_dir = meta:get_int("in_dir")
local curr_load = power.get_storage_load(pos, Cable, in_dir, 1) local curr_load = power.get_storage_load(pos, Cable, in_dir, 1)
@ -183,7 +183,7 @@ local tool_config = {
{ {
type = "const", type = "const",
name = "needed", name = "needed",
label = S("Maximum power consumption [ku]"), label = S("Maximum power consumption [ku]"),
tooltip = S("Maximum possible\ncurrent consumption"), tooltip = S("Maximum possible\ncurrent consumption"),
value = PWR_NEEDED, value = PWR_NEEDED,
}, },
@ -191,7 +191,7 @@ local tool_config = {
type = "dropdown", type = "dropdown",
choices = "20%,40%,60%,80%,100%", choices = "20%,40%,60%,80%,100%",
name = "reduction", name = "reduction",
label = S("Current limitation"), label = S("Current limitation"),
tooltip = S("Configurable value\nfor the current limit"), tooltip = S("Configurable value\nfor the current limit"),
default = "100%", default = "100%",
}, },
@ -199,12 +199,12 @@ local tool_config = {
type = "dropdown", type = "dropdown",
choices = "0%,20%,40%,60%,80%", choices = "0%,20%,40%,60%,80%",
name = "turnoff", 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"), tooltip = S("If the charge of the storage\nsystem exceeds the configured value,\nthe block switches off"),
default = "0%", default = "0%",
}, },
} }
minetest.register_node("techage:ta4_electrolyzer", { minetest.register_node("techage:ta4_electrolyzer", {
description = S("TA4 Electrolyzer"), description = S("TA4 Electrolyzer"),
tiles = { tiles = {
@ -223,14 +223,14 @@ minetest.register_node("techage:ta4_electrolyzer", {
end end
return liquid.is_empty(pos) return liquid.is_empty(pos)
end, end,
after_place_node = after_place_node, after_place_node = after_place_node,
after_dig_node = after_dig_node, after_dig_node = after_dig_node,
on_punch = liquid.on_punch, on_punch = liquid.on_punch,
on_receive_fields = on_receive_fields, on_receive_fields = on_receive_fields,
on_timer = node_timer, on_timer = node_timer,
on_rightclick = on_rightclick, on_rightclick = on_rightclick,
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {cracky=2, crumbly=2, choppy=2}, groups = {cracky=2, crumbly=2, choppy=2},
on_rotate = screwdriver.disallow, on_rotate = screwdriver.disallow,
@ -272,7 +272,7 @@ minetest.register_node("techage:ta4_electrolyzer_on", {
on_punch = liquid.on_punch, on_punch = liquid.on_punch,
on_timer = node_timer, on_timer = node_timer,
on_rightclick = on_rightclick, on_rightclick = on_rightclick,
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {not_in_creative_inventory=1}, groups = {not_in_creative_inventory=1},
on_rotate = screwdriver.disallow, on_rotate = screwdriver.disallow,
@ -339,7 +339,7 @@ techage.register_node({"techage:ta4_electrolyzer", "techage:ta4_electrolyzer_on"
meta:set_string("turnoff", "0%") meta:set_string("turnoff", "0%")
end end
end, end,
}) })
minetest.register_craft({ minetest.register_craft({
output = "techage:ta4_electrolyzer", output = "techage:ta4_electrolyzer",
@ -349,4 +349,3 @@ minetest.register_craft({
{'default:steel_ingot', "techage:ta4_wlanchip", 'default:steel_ingot'}, {'default:steel_ingot', "techage:ta4_wlanchip", 'default:steel_ingot'},
}, },
}) })

View File

@ -7,7 +7,7 @@
AGPL v3 AGPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
TA4 Fuel Cell TA4 Fuel Cell
]]-- ]]--
@ -67,7 +67,7 @@ local function can_start(pos, nvm, state)
end end
local function consuming(pos, nvm) local function consuming(pos, nvm)
if nvm.num_pwr_units <= 0 then if nvm.num_pwr_units <= 0 then
nvm.num_pwr_units = nvm.num_pwr_units + PWR_UNITS_PER_HYDROGEN_ITEM nvm.num_pwr_units = nvm.num_pwr_units + PWR_UNITS_PER_HYDROGEN_ITEM
nvm.liquid.amount = nvm.liquid.amount - 1 nvm.liquid.amount = nvm.liquid.amount - 1
@ -190,7 +190,7 @@ minetest.register_node("techage:ta4_fuelcell", {
end end
return liquid.is_empty(pos) return liquid.is_empty(pos)
end, end,
after_place_node = after_place_node, after_place_node = after_place_node,
after_dig_node = after_dig_node, after_dig_node = after_dig_node,
get_generator_data = get_generator_data, get_generator_data = get_generator_data,
@ -199,7 +199,7 @@ minetest.register_node("techage:ta4_fuelcell", {
on_timer = node_timer, on_timer = node_timer,
on_rightclick = on_rightclick, on_rightclick = on_rightclick,
ta4_formspec = techage.generator_settings("ta4", PWR_PERF), ta4_formspec = techage.generator_settings("ta4", PWR_PERF),
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {cracky=2, crumbly=2, choppy=2}, groups = {cracky=2, crumbly=2, choppy=2},
on_rotate = screwdriver.disallow, 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) return State:on_receive_message(pos, topic, payload)
end end
end, end,
}) })
control.register_nodes({"techage:ta4_fuelcell", "techage:ta4_fuelcell_on"}, { control.register_nodes({"techage:ta4_fuelcell", "techage:ta4_fuelcell_on"}, {
on_receive = function(pos, tlib2, topic, payload) 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, running = techage.is_running(nvm) or false,
available = PWR_PERF, available = PWR_PERF,
provided = nvm.provided or 0, provided = nvm.provided or 0,
termpoint = meta:get_string("termpoint"), termpoint = meta:get_string("termpoint"),
} }
end end
return false return false

Some files were not shown because too many files have changed in this diff Show More