2019-04-27 18:42:27 +03:00
|
|
|
--[[
|
|
|
|
|
|
|
|
TechAge
|
|
|
|
=======
|
|
|
|
|
|
|
|
Copyright (C) 2019 Joachim Stolberg
|
|
|
|
|
2019-08-22 21:49:47 +03:00
|
|
|
GPL v3
|
2019-04-27 18:42:27 +03:00
|
|
|
See LICENSE.txt for more information
|
|
|
|
|
2019-05-06 22:09:13 +03:00
|
|
|
TA3 Cooler
|
2019-04-27 18:42:27 +03:00
|
|
|
|
|
|
|
]]--
|
|
|
|
|
|
|
|
-- for lazy programmers
|
|
|
|
local M = minetest.get_meta
|
2019-07-02 22:33:12 +03:00
|
|
|
local S = techage.S
|
2019-04-27 18:42:27 +03:00
|
|
|
|
2019-06-08 23:57:01 +03:00
|
|
|
local Pipe = techage.SteamPipe
|
2019-04-27 18:42:27 +03:00
|
|
|
|
2019-06-16 22:06:16 +03:00
|
|
|
local function transfer(pos, in_dir, topic, payload)
|
|
|
|
return techage.transfer(pos, in_dir, topic, payload, Pipe,
|
|
|
|
{"techage:coalboiler_base"})
|
|
|
|
end
|
|
|
|
|
2019-04-27 18:42:27 +03:00
|
|
|
local function swap_node(pos, name)
|
2019-10-07 01:09:39 +03:00
|
|
|
local node = techage.get_node_lvm(pos)
|
2019-04-27 18:42:27 +03:00
|
|
|
if node.name == name then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
node.name = name
|
|
|
|
minetest.swap_node(pos, node)
|
|
|
|
end
|
|
|
|
|
2019-05-06 22:09:13 +03:00
|
|
|
minetest.register_node("techage:cooler", {
|
2019-07-02 22:33:12 +03:00
|
|
|
description = S("TA3 Cooler"),
|
2019-05-06 22:09:13 +03:00
|
|
|
tiles = {
|
|
|
|
-- up, down, right, left, back, front
|
|
|
|
"techage_filling_ta3.png^techage_appl_cooler.png^techage_frame_ta3.png",
|
|
|
|
"techage_filling_ta3.png^techage_appl_cooler.png^techage_frame_ta3.png",
|
|
|
|
"techage_filling_ta3.png^techage_frame_ta3.png^techage_steam_hole.png",
|
|
|
|
"techage_filling_ta3.png^techage_frame_ta3.png^techage_steam_hole.png",
|
2019-05-11 02:21:03 +03:00
|
|
|
"techage_filling_ta3.png^techage_frame_ta3.png^techage_cooler.png",
|
|
|
|
"techage_filling_ta3.png^techage_frame_ta3.png^techage_cooler.png",
|
2019-05-06 22:09:13 +03:00
|
|
|
},
|
2019-04-27 18:42:27 +03:00
|
|
|
|
2019-05-21 17:37:05 +03:00
|
|
|
on_construct = tubelib2.init_mem,
|
2019-04-27 18:42:27 +03:00
|
|
|
|
|
|
|
paramtype2 = "facedir",
|
|
|
|
groups = {cracky=2, crumbly=2, choppy=2},
|
|
|
|
on_rotate = screwdriver.disallow,
|
|
|
|
is_ground_content = false,
|
|
|
|
sounds = default.node_sound_wood_defaults(),
|
|
|
|
})
|
|
|
|
|
|
|
|
|
2019-05-06 22:09:13 +03:00
|
|
|
minetest.register_node("techage:cooler_on", {
|
2019-04-27 18:42:27 +03:00
|
|
|
tiles = {
|
|
|
|
-- up, down, right, left, back, front
|
|
|
|
{
|
2019-05-06 22:09:13 +03:00
|
|
|
image = "techage_filling4_ta3.png^techage_appl_cooler4.png^techage_frame4_ta3.png",
|
|
|
|
backface_culling = false,
|
|
|
|
animation = {
|
|
|
|
type = "vertical_frames",
|
|
|
|
aspect_w = 32,
|
|
|
|
aspect_h = 32,
|
|
|
|
length = 0.4,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
image = "techage_filling4_ta3.png^techage_appl_cooler4.png^techage_frame4_ta3.png",
|
2019-04-27 18:42:27 +03:00
|
|
|
backface_culling = false,
|
|
|
|
animation = {
|
|
|
|
type = "vertical_frames",
|
|
|
|
aspect_w = 32,
|
|
|
|
aspect_h = 32,
|
2019-05-06 22:09:13 +03:00
|
|
|
length = 0.4,
|
2019-04-27 18:42:27 +03:00
|
|
|
},
|
|
|
|
},
|
2019-05-06 22:09:13 +03:00
|
|
|
"techage_filling_ta3.png^techage_frame_ta3.png^techage_steam_hole.png",
|
|
|
|
"techage_filling_ta3.png^techage_frame_ta3.png^techage_steam_hole.png",
|
2019-05-11 02:21:03 +03:00
|
|
|
"techage_filling_ta3.png^techage_frame_ta3.png^techage_cooler.png",
|
|
|
|
"techage_filling_ta3.png^techage_frame_ta3.png^techage_cooler.png",
|
2019-04-27 18:42:27 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
paramtype2 = "facedir",
|
|
|
|
groups = {not_in_creative_inventory=1},
|
|
|
|
diggable = false,
|
|
|
|
on_rotate = screwdriver.disallow,
|
|
|
|
is_ground_content = false,
|
|
|
|
sounds = default.node_sound_wood_defaults(),
|
|
|
|
})
|
|
|
|
|
2019-06-08 23:57:01 +03:00
|
|
|
-- for mechanical pipe connections
|
2019-05-21 17:37:05 +03:00
|
|
|
techage.power.register_node({"techage:cooler", "techage:cooler_on"}, {
|
|
|
|
conn_sides = {"L", "R"},
|
2019-06-08 23:57:01 +03:00
|
|
|
power_network = Pipe,
|
2019-10-05 20:19:18 +03:00
|
|
|
after_tube_update = function(node, pos, out_dir, peer_pos, peer_in_dir)
|
|
|
|
swap_node(pos, "techage:cooler")
|
|
|
|
end,
|
2019-06-08 23:57:01 +03:00
|
|
|
})
|
|
|
|
|
|
|
|
-- for logical communication
|
|
|
|
techage.register_node({"techage:cooler", "techage:cooler_on"}, {
|
|
|
|
on_transfer = function(pos, in_dir, topic, payload)
|
|
|
|
if topic == "start" then
|
2019-06-16 22:06:16 +03:00
|
|
|
if transfer(pos, in_dir, topic, nil) then
|
2019-06-08 23:57:01 +03:00
|
|
|
swap_node(pos, "techage:cooler_on")
|
2019-06-16 22:06:16 +03:00
|
|
|
return true
|
2019-06-08 23:57:01 +03:00
|
|
|
end
|
|
|
|
elseif topic == "stop" then
|
|
|
|
swap_node(pos, "techage:cooler")
|
2019-06-16 22:06:16 +03:00
|
|
|
return transfer(pos, in_dir, topic, nil)
|
|
|
|
elseif topic == "running" then
|
|
|
|
if transfer(pos, in_dir, topic, nil) then
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
swap_node(pos, "techage:cooler")
|
2019-06-08 23:57:01 +03:00
|
|
|
end
|
2019-06-16 22:06:16 +03:00
|
|
|
return false
|
2019-06-08 23:57:01 +03:00
|
|
|
end
|
2019-05-21 17:37:05 +03:00
|
|
|
})
|
|
|
|
|
2019-05-11 17:52:59 +03:00
|
|
|
minetest.register_craft({
|
|
|
|
output = "techage:cooler",
|
|
|
|
recipe = {
|
|
|
|
{"basic_materials:steel_bar", "default:wood", "basic_materials:steel_bar"},
|
|
|
|
{"techage:steam_pipeS", "basic_materials:gear_steel", "techage:steam_pipeS"},
|
|
|
|
{"basic_materials:steel_bar", "default:wood", "basic_materials:steel_bar"},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|