2020-02-06 22:51:30 +03:00
|
|
|
--[[
|
|
|
|
|
|
|
|
TechAge
|
|
|
|
=======
|
|
|
|
|
|
|
|
Copyright (C) 2019-2020 Joachim Stolberg
|
|
|
|
|
2020-10-19 20:09:17 +03:00
|
|
|
AGPL v3
|
2020-02-06 22:51:30 +03:00
|
|
|
See LICENSE.txt for more information
|
2022-01-03 23:40:31 +03:00
|
|
|
|
2020-02-06 22:51:30 +03:00
|
|
|
TA4 Heat Exchanger3 (top part)
|
|
|
|
|
|
|
|
]]--
|
|
|
|
|
|
|
|
-- for lazy programmers
|
|
|
|
local M = minetest.get_meta
|
|
|
|
local S = techage.S
|
|
|
|
|
|
|
|
local Pipe = techage.LiquidPipe
|
|
|
|
|
|
|
|
local function orientate_node(pos, name)
|
|
|
|
local node = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z})
|
|
|
|
if node.name == name then
|
|
|
|
local param2 = node.param2
|
|
|
|
node = minetest.get_node(pos)
|
|
|
|
node.param2 = param2
|
|
|
|
minetest.swap_node(pos, node)
|
|
|
|
else
|
|
|
|
minetest.remove_node(pos)
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
local function after_place_node(pos)
|
|
|
|
if orientate_node(pos, "techage:heatexchanger2") then
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
Pipe:after_place_node(pos)
|
|
|
|
end
|
|
|
|
|
|
|
|
local function after_dig_node(pos, oldnode)
|
|
|
|
Pipe:after_dig_node(pos)
|
|
|
|
end
|
|
|
|
|
2021-12-11 22:15:55 +03:00
|
|
|
local function cooler_cmnd(pos, topic, payload)
|
|
|
|
return techage.transfer(pos, "R", topic, payload, Pipe,
|
|
|
|
{"techage:ta4_collider_cooler"})
|
|
|
|
end
|
|
|
|
|
2021-06-27 19:29:46 +03:00
|
|
|
local function inlet_cmnd(pos, topic, payload)
|
|
|
|
return techage.transfer(pos, "L", topic, payload, Pipe,
|
2021-12-11 22:15:55 +03:00
|
|
|
{"techage:ta4_pipe_inlet", "techage:ta4_collider_pipe_inlet"})
|
2021-06-27 19:29:46 +03:00
|
|
|
end
|
|
|
|
|
2020-02-06 22:51:30 +03:00
|
|
|
minetest.register_node("techage:heatexchanger3", {
|
|
|
|
description = S("TA4 Heat Exchanger 3"),
|
|
|
|
tiles = {
|
|
|
|
-- up, down, right, left, back, front
|
|
|
|
"techage_filling_ta4.png^techage_frame_ta4_top.png",
|
|
|
|
"techage_hole_ta4.png",
|
|
|
|
"techage_filling_ta4.png^techage_frameT_ta4.png^techage_appl_hole_pipe.png",
|
|
|
|
"techage_filling_ta4.png^techage_frameT_ta4.png^techage_appl_hole_pipe.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",
|
|
|
|
},
|
2022-01-03 23:40:31 +03:00
|
|
|
|
2020-02-06 22:51:30 +03:00
|
|
|
after_place_node = after_place_node,
|
|
|
|
after_dig_node = after_dig_node,
|
2022-01-03 23:40:31 +03:00
|
|
|
|
2021-06-19 16:06:08 +03:00
|
|
|
networks = {
|
|
|
|
pipe2 = {},
|
|
|
|
},
|
2020-02-06 22:51:30 +03:00
|
|
|
paramtype2 = "facedir",
|
|
|
|
groups = {crumbly = 2, cracky = 2, snappy = 2},
|
|
|
|
on_rotate = screwdriver.disallow,
|
|
|
|
is_ground_content = false,
|
|
|
|
sounds = default.node_sound_metal_defaults(),
|
|
|
|
})
|
|
|
|
|
|
|
|
Pipe:add_secondary_node_names({"techage:heatexchanger3"})
|
|
|
|
|
2021-06-27 19:29:46 +03:00
|
|
|
-- command interface, used by heatexchanger2
|
2020-02-06 22:51:30 +03:00
|
|
|
techage.register_node({"techage:heatexchanger3"}, {
|
2021-06-27 19:29:46 +03:00
|
|
|
on_transfer = function(pos, indir, topic, payload)
|
2021-12-11 22:15:55 +03:00
|
|
|
if topic == "cooler" then
|
|
|
|
return cooler_cmnd(pos, topic, payload)
|
|
|
|
else
|
|
|
|
return inlet_cmnd(pos, topic, payload)
|
|
|
|
end
|
2021-06-27 19:29:46 +03:00
|
|
|
end,
|
2020-02-06 22:51:30 +03:00
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
output = "techage:heatexchanger3",
|
|
|
|
recipe = {
|
|
|
|
{"default:tin_ingot", "dye:blue", "default:steel_ingot"},
|
|
|
|
{"techage:ta4_pipeS", "basic_materials:gear_steel", "techage:ta4_pipeS"},
|
|
|
|
{"", "techage:baborium_ingot", ""},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
2022-01-04 21:40:27 +03:00
|
|
|
techage.orientate_node = orientate_node
|