techage/coal_power_station/cooler.lua

135 lines
3.4 KiB
Lua
Raw Normal View History

--[[
TechAge
=======
2020-01-26 01:15:44 +03:00
Copyright (C) 2019-2020 Joachim Stolberg
GPL v3
See LICENSE.txt for more information
2019-05-06 22:09:13 +03:00
TA3 Cooler
]]--
-- for lazy programmers
local M = minetest.get_meta
local S = techage.S
2019-06-08 23:57:01 +03:00
local Pipe = techage.SteamPipe
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
2020-01-26 01:15:44 +03:00
local function after_place_node(pos)
Pipe:after_place_node(pos)
end
local function after_dig_node(pos, oldnode)
Pipe:after_dig_node(pos)
techage.del_mem(pos)
end
2019-05-06 22:09:13 +03:00
minetest.register_node("techage:cooler", {
description = S("TA3 Cooler"),
2019-05-06 22:09:13 +03:00
tiles = {
-- up, down, right, left, back, front
2020-01-26 01:15:44 +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",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = 32,
aspect_h = 32,
length = 0.4,
},
},
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-05-06 22:09:13 +03:00
},
2020-01-26 01:15:44 +03:00
after_place_node = after_place_node,
after_dig_node = after_dig_node,
paramtype2 = "facedir",
groups = {cracky=2, crumbly=2, choppy=2},
on_rotate = screwdriver.disallow,
is_ground_content = false,
sounds = default.node_sound_wood_defaults(),
})
2020-01-26 01:15:44 +03:00
-- legacy node
2019-05-06 22:09:13 +03:00
minetest.register_node("techage:cooler_on", {
2020-01-26 01:15:44 +03:00
description = S("TA3 Cooler"),
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",
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-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",
},
2020-01-26 01:15:44 +03:00
after_place_node = after_place_node,
after_dig_node = after_dig_node,
paramtype2 = "facedir",
2020-01-26 01:15:44 +03:00
drop = "techage:cooler",
groups = {cracky=2, crumbly=2, choppy=2, not_in_creative_inventory=1},
on_rotate = screwdriver.disallow,
is_ground_content = false,
sounds = default.node_sound_wood_defaults(),
})
2020-01-26 01:15:44 +03:00
Pipe:add_secondary_node_names({"techage:cooler", "techage:cooler_on"})
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)
2020-01-26 01:15:44 +03:00
return transfer(pos, in_dir, topic, payload)
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"},
},
})