Add TA5 heat exchanger for the FR
@ -75,6 +75,10 @@ local Commands = {
|
||||
local resp = control.send(pos, Cable, outdir, "con", "off")
|
||||
return "off " .. resp
|
||||
end,
|
||||
function(pos, outdir)
|
||||
local resp = control.request(pos, Cable, outdir, "con", "no_gas")
|
||||
return "no_gas: " .. concentrate(resp)
|
||||
end,
|
||||
}
|
||||
|
||||
local function after_place_node(pos, placer, itemstack)
|
||||
|
@ -3,14 +3,12 @@
|
||||
TechAge
|
||||
=======
|
||||
|
||||
Copyright (C) 2019-2021 Joachim Stolberg
|
||||
Copyright (C) 2019-2022 Joachim Stolberg
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
TA4 TES Generator (dummy)
|
||||
- can be started and stopped
|
||||
- provides netID of cable network
|
||||
TA5 Fusion Reactor Generator
|
||||
]]--
|
||||
|
||||
-- for lazy programmers
|
||||
@ -20,6 +18,11 @@ local S = techage.S
|
||||
local Cable = techage.ElectricCable
|
||||
local power = networks.power
|
||||
|
||||
local CYCLE_TIME = 2
|
||||
local STANDBY_TICKS = 1
|
||||
local COUNTDOWN_TICKS = 2
|
||||
local PWR_PERF = 800
|
||||
|
||||
local function swap_node(pos, name)
|
||||
local node = techage.get_node_lvm(pos)
|
||||
if node.name == name then
|
||||
@ -29,16 +32,78 @@ local function swap_node(pos, name)
|
||||
minetest.swap_node(pos, node)
|
||||
end
|
||||
|
||||
minetest.register_node("techage:ta4_generator", {
|
||||
description = S("TA4 Generator"),
|
||||
local function start_node(pos, nvm)
|
||||
local meta = M(pos)
|
||||
nvm.provided = 0
|
||||
nvm.alive_cnt = 5
|
||||
techage.evaluate_charge_termination(nvm, meta)
|
||||
local outdir = meta:get_int("outdir")
|
||||
power.start_storage_calc(pos, Cable, outdir)
|
||||
swap_node(pos, "techage:ta5_generator_on")
|
||||
minetest.get_node_timer(pos):start(CYCLE_TIME)
|
||||
--play_sound(pos)
|
||||
end
|
||||
|
||||
local function stop_node(pos, nvm)
|
||||
nvm.provided = 0
|
||||
local outdir = M(pos):get_int("outdir")
|
||||
--stop_sound(pos)
|
||||
power.start_storage_calc(pos, Cable, outdir)
|
||||
swap_node(pos, "techage:ta5_generator")
|
||||
end
|
||||
|
||||
local function on_receive_fields(pos, formname, fields, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return
|
||||
end
|
||||
local nvm = techage.get_nvm(pos)
|
||||
State:state_button_event(pos, nvm, fields)
|
||||
end
|
||||
|
||||
local function on_rightclick(pos, node, clicker)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
--techage.set_activeformspec(pos, clicker)
|
||||
--M(pos):set_string("formspec", formspec(State, pos, nvm))
|
||||
end
|
||||
|
||||
local function get_generator_data(pos, outdir, tlib2)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
--if nvm.running and techage.is_running(nvm) then
|
||||
return {level = (nvm.load or 0) / PWR_PERF, perf = PWR_PERF, capa = PWR_PERF * 2}
|
||||
--end
|
||||
end
|
||||
|
||||
local function node_timer(pos, elapsed)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
nvm.alive_cnt = (nvm.alive_cnt or 0) - 1
|
||||
print("node_timer", nvm.alive_cnt)
|
||||
if nvm.alive_cnt > 0 then
|
||||
local meta = M(pos)
|
||||
local outdir = meta:get_int("outdir")
|
||||
local tp1 = tonumber(meta:get_string("termpoint1"))
|
||||
local tp2 = tonumber(meta:get_string("termpoint2"))
|
||||
nvm.provided = power.provide_power(pos, Cable, outdir, PWR_PERF, tp1, tp2)
|
||||
print("nvm.provided", nvm.provided)
|
||||
local val = power.get_storage_load(pos, Cable, outdir, PWR_PERF)
|
||||
if val > 0 then
|
||||
nvm.load = val
|
||||
end
|
||||
else
|
||||
swap_node(pos, "techage:ta5_generator")
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
minetest.register_node("techage:ta5_generator", {
|
||||
description = S("TA5 Generator"),
|
||||
tiles = {
|
||||
-- up, down, right, left, back, front
|
||||
"techage_filling_ta4.png^techage_frame_ta4_top.png",
|
||||
"techage_filling_ta4.png^techage_frame_ta4.png",
|
||||
"techage_filling_ta4.png^techage_appl_hole_electric.png^techage_frame_ta4.png",
|
||||
"techage_filling_ta4.png^techage_appl_open.png^techage_frame_ta4.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_ta5_top.png",
|
||||
"techage_filling_ta4.png^techage_frame_ta4_bottom.png",
|
||||
"techage_filling_ta4.png^techage_appl_hole_electric.png^techage_frame_ta5.png",
|
||||
"techage_filling_ta4.png^techage_appl_open.png^techage_frame_ta5.png",
|
||||
"techage_filling_ta4.png^techage_frame_ta5.png^techage_appl_generator.png",
|
||||
"techage_filling_ta4.png^techage_frame_ta5.png^techage_appl_generator.png^[transformFX]",
|
||||
},
|
||||
|
||||
after_place_node = function(pos)
|
||||
@ -50,6 +115,10 @@ minetest.register_node("techage:ta4_generator", {
|
||||
techage.del_mem(pos)
|
||||
end,
|
||||
|
||||
get_generator_data = get_generator_data,
|
||||
ta3_formspec = techage.generator_settings("ta3", PWR_PERF),
|
||||
--on_receive_fields = on_receive_fields,
|
||||
--on_rightclick = on_rightclick,
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky=2, crumbly=2, choppy=2},
|
||||
on_rotate = screwdriver.disallow,
|
||||
@ -57,16 +126,16 @@ minetest.register_node("techage:ta4_generator", {
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("techage:ta4_generator_on", {
|
||||
description = S("TA4 Generator"),
|
||||
minetest.register_node("techage:ta5_generator_on", {
|
||||
description = S("TA5 Generator"),
|
||||
tiles = {
|
||||
-- up, down, right, left, back, front
|
||||
"techage_filling_ta4.png^techage_frame_ta4_top.png",
|
||||
"techage_filling_ta4.png^techage_frame_ta4.png",
|
||||
"techage_filling_ta4.png^techage_appl_hole_electric.png^techage_frame_ta4.png",
|
||||
"techage_filling_ta4.png^techage_appl_open.png^techage_frame_ta4.png",
|
||||
"techage_filling_ta4.png^techage_frame_ta5_top.png",
|
||||
"techage_filling_ta4.png^techage_frame_ta4_bottom.png",
|
||||
"techage_filling_ta4.png^techage_appl_hole_electric.png^techage_frame_ta5.png",
|
||||
"techage_filling_ta4.png^techage_appl_open.png^techage_frame_ta5.png",
|
||||
{
|
||||
image = "techage_filling4_ta4.png^techage_appl_generator4.png^techage_frame4_ta4.png",
|
||||
image = "techage_filling4_ta4.png^techage_appl_generator4.png^techage_frame4_ta5.png",
|
||||
backface_culling = false,
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
@ -76,7 +145,7 @@ minetest.register_node("techage:ta4_generator_on", {
|
||||
},
|
||||
},
|
||||
{
|
||||
image = "techage_filling4_ta4.png^techage_appl_generator4.png^[transformFX]^techage_frame4_ta4.png",
|
||||
image = "techage_filling4_ta4.png^techage_appl_generator4.png^[transformFX]^techage_frame4_ta5.png",
|
||||
backface_culling = false,
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
@ -87,6 +156,11 @@ minetest.register_node("techage:ta4_generator_on", {
|
||||
},
|
||||
},
|
||||
|
||||
get_generator_data = get_generator_data,
|
||||
ta3_formspec = techage.generator_settings("ta3", PWR_PERF),
|
||||
--on_receive_fields = on_receive_fields,
|
||||
--on_rightclick = on_rightclick,
|
||||
on_timer = node_timer,
|
||||
paramtype2 = "facedir",
|
||||
drop = "",
|
||||
groups = {not_in_creative_inventory=1},
|
||||
@ -96,19 +170,18 @@ minetest.register_node("techage:ta4_generator_on", {
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
|
||||
-- The generator is a dummy, it only has to network connection to check the netID
|
||||
power.register_nodes({"techage:ta4_generator", "techage:ta4_generator_on"}, Cable, "con", {"R"})
|
||||
power.register_nodes({"techage:ta5_generator", "techage:ta5_generator_on"}, Cable, "gen", {"R"})
|
||||
|
||||
-- controlled by the turbine
|
||||
techage.register_node({"techage:ta4_generator", "techage:ta4_generator_on"}, {
|
||||
techage.register_node({"techage:ta5_generator", "techage:ta5_generator_on"}, {
|
||||
on_transfer = function(pos, in_dir, topic, payload)
|
||||
if topic == "netID" then
|
||||
local outdir = M(pos):get_int("outdir")
|
||||
return networks.determine_netID(pos, Cable, outdir)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
if topic == "trigger" then
|
||||
nvm.alive_cnt = 5
|
||||
elseif topic == "start" then
|
||||
swap_node(pos, "techage:ta4_generator_on")
|
||||
start_node(pos, nvm)
|
||||
elseif topic == "stop" then
|
||||
swap_node(pos, "techage:ta4_generator")
|
||||
stop_node(pos, nvm)
|
||||
end
|
||||
end,
|
||||
on_recv_message = function(pos, src, topic, payload)
|
||||
@ -120,11 +193,11 @@ techage.register_node({"techage:ta4_generator", "techage:ta4_generator_on"}, {
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "techage:ta4_generator",
|
||||
recipe = {
|
||||
{"", "dye:blue", ""},
|
||||
{"", "techage:generator", ""},
|
||||
{"", "techage:ta4_wlanchip", ""},
|
||||
},
|
||||
})
|
||||
--minetest.register_craft({
|
||||
-- output = "techage:ta5_generator",
|
||||
-- recipe = {
|
||||
-- {"", "dye:blue", ""},
|
||||
-- {"", "techage:generator", ""},
|
||||
-- {"", "techage:ta4_wlanchip", ""},
|
||||
-- },
|
||||
--})
|
||||
|
@ -41,15 +41,6 @@ local function heatexchanger3_cmnd(pos, topic, payload)
|
||||
{"techage:ta5_heatexchanger3"})
|
||||
end
|
||||
|
||||
local function swap_node(pos, name)
|
||||
local node = techage.get_node_lvm(pos)
|
||||
if node.name == name then
|
||||
return
|
||||
end
|
||||
node.name = name
|
||||
minetest.swap_node(pos, node)
|
||||
end
|
||||
|
||||
local function play_sound(pos)
|
||||
local mem = techage.get_mem(pos)
|
||||
if not mem.handle or mem.handle == -1 then
|
||||
@ -72,7 +63,7 @@ local function stop_sound(pos)
|
||||
end
|
||||
end
|
||||
|
||||
local function concentrate(t)
|
||||
local function count_trues(t)
|
||||
local cnt = 0
|
||||
for _,v in ipairs(t) do
|
||||
if v then
|
||||
@ -91,7 +82,7 @@ local CheckCommands = {
|
||||
end,
|
||||
function(pos)
|
||||
local resp = heatexchanger1_cmnd(pos, "test_gas_blue")
|
||||
local cnt = concentrate(resp)
|
||||
local cnt = count_trues(resp)
|
||||
if cnt ~= EXPECT_BLUE then
|
||||
return S("Blue pipe error (@1/@2)", cnt, EXPECT_BLUE)
|
||||
end
|
||||
@ -99,7 +90,7 @@ local CheckCommands = {
|
||||
end,
|
||||
function(pos)
|
||||
local resp = heatexchanger3_cmnd(pos, "test_gas_green")
|
||||
local cnt = concentrate(resp)
|
||||
local cnt = count_trues(resp)
|
||||
if cnt ~= EXPECT_GREEN then
|
||||
return S("Green pipe error (@1/@2)", cnt, EXPECT_GREEN)
|
||||
end
|
||||
@ -130,30 +121,39 @@ end
|
||||
local function start_node(pos, nvm)
|
||||
play_sound(pos)
|
||||
nvm.ticks = 0
|
||||
nvm.temperature = 20
|
||||
heatexchanger1_cmnd(pos, "start")
|
||||
end
|
||||
|
||||
local function stop_node(pos, nvm)
|
||||
stop_sound(pos)
|
||||
nvm.temperature = 20
|
||||
heatexchanger1_cmnd(pos, "stop")
|
||||
end
|
||||
|
||||
local function temp_indicator (nvm, x, y)
|
||||
local temp = nvm.temperature or 20
|
||||
return "image[" .. x .. "," .. y .. ";1,2;techage_form_temp_bg.png^[lowpart:" ..
|
||||
temp .. ":techage_form_temp_fg.png]" ..
|
||||
"tooltip[" .. x .. "," .. y .. ";1,2;" .. S("water temperature") .. ";#0C3D32;#FFFFFF]"
|
||||
end
|
||||
|
||||
local function formspec(self, pos, nvm)
|
||||
return "size[4,2]"..
|
||||
"box[0,-0.1;3.8,0.5;#c6e8ff]" ..
|
||||
return "size[5,3]"..
|
||||
"box[0,-0.1;4.8,0.5;#c6e8ff]" ..
|
||||
"label[0.2,-0.1;" .. minetest.colorize( "#000000", DESCRIPTION) .. "]" ..
|
||||
"image_button[1.5,1;1,1;".. self:get_state_button_image(nvm) ..";state_button;]"..
|
||||
"tooltip[1.5,1;1,1;"..self:get_state_tooltip(nvm).."]"
|
||||
temp_indicator (nvm, 1, 1) ..
|
||||
"image_button[3.2,1.5;1,1;".. self:get_state_button_image(nvm) ..";state_button;]"..
|
||||
"tooltip[3.2,1.5;1,1;"..self:get_state_tooltip(nvm).."]"
|
||||
end
|
||||
|
||||
local function check_integrity(pos, nvm)
|
||||
-- Check every 30 sec
|
||||
nvm.ticks = ((nvm.ticks or 0) % 15) + 1
|
||||
if CheckCommands[nvm.ticks] then
|
||||
local res = CheckCommands[nvm.ticks](pos)
|
||||
if res ~= true then return res end
|
||||
nvm.result = CheckCommands[nvm.ticks](pos)
|
||||
end
|
||||
return true
|
||||
return nvm.result
|
||||
end
|
||||
|
||||
local State = techage.NodeStates:new({
|
||||
@ -182,15 +182,23 @@ local function consume_power(pos, nvm)
|
||||
end
|
||||
end
|
||||
|
||||
local function steam_management(pos, nvm)
|
||||
nvm.temperature = nvm.temperature or 20
|
||||
nvm.temperature = math.min(nvm.temperature + 1, 100)
|
||||
if nvm.temperature > 80 then
|
||||
heatexchanger1_cmnd(pos, "trigger")
|
||||
end
|
||||
end
|
||||
|
||||
local function node_timer(pos, elapsed)
|
||||
print("node_timer")
|
||||
local nvm = techage.get_nvm(pos)
|
||||
nvm.temperature = nvm.temperature or 20
|
||||
consume_power(pos, nvm)
|
||||
local res = check_integrity(pos, nvm)
|
||||
if res ~= true then
|
||||
State:fault(pos, nvm, res)
|
||||
stop_sound(pos)
|
||||
heatexchanger1_cmnd(pos, "stop")
|
||||
if check_integrity(pos, nvm) == true then
|
||||
steam_management(pos, nvm)
|
||||
else
|
||||
State:fault(pos, nvm, nvm.result)
|
||||
stop_node(pos, nvm)
|
||||
end
|
||||
return State:is_active(nvm)
|
||||
end
|
||||
@ -262,7 +270,6 @@ minetest.register_node("techage:ta5_heatexchanger2", {
|
||||
after_place_node = after_place_node,
|
||||
can_dig = can_dig,
|
||||
after_dig_node = after_dig_node,
|
||||
get_storage_data = get_storage_data,
|
||||
|
||||
paramtype2 = "facedir",
|
||||
groups = {crumbly = 2, cracky = 2, snappy = 2},
|
||||
|
@ -24,6 +24,7 @@ local power = networks.power
|
||||
local liquid = networks.liquid
|
||||
local control = networks.control
|
||||
|
||||
local CAPACITY = 6
|
||||
local SHELLBLOCKS = {"techage:ta5_fr_shell", "techage:ta5_fr_nucleus", "techage:ta5_magnet1", "techage:ta5_magnet2"}
|
||||
|
||||
minetest.register_node("techage:ta5_magnet1", {
|
||||
@ -95,7 +96,25 @@ minetest.register_node("techage:ta5_magnet2", {
|
||||
})
|
||||
|
||||
power.register_nodes({"techage:ta5_magnet1"}, Cable, "con", {"B"})
|
||||
liquid.register_nodes({"techage:ta5_magnet1", "techage:ta5_magnet2"}, Pipe, "tank", {"U", "D"}, {})
|
||||
liquid.register_nodes({"techage:ta5_magnet1", "techage:ta5_magnet2"}, Pipe, "tank", {"U", "D"}, {
|
||||
capa = CAPACITY,
|
||||
peek = function(pos, indir)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
return liquid.srv_peek(nvm)
|
||||
end,
|
||||
put = function(pos, indir, name, amount)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
return liquid.srv_put(nvm, name, amount, CAPACITY)
|
||||
end,
|
||||
take = function(pos, indir, name, amount)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
return liquid.srv_take(nvm, name, amount)
|
||||
end,
|
||||
untake = function(pos, indir, name, amount)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
liquid.srv_put(nvm, name, amount, CAPACITY)
|
||||
end,
|
||||
})
|
||||
|
||||
local function check_plasma(pos, param2)
|
||||
local pos1 = networks.get_relpos(pos, "F", param2)
|
||||
@ -141,14 +160,24 @@ end
|
||||
local function on_request(pos, tlib2, topic)
|
||||
--print("on_request", topic)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
nvm.liquid = nvm.liquid or {}
|
||||
nvm.liquid.amount = nvm.liquid.amount or 0
|
||||
if topic == "test_power" and tlib2 == Cable then
|
||||
nvm.has_power = true
|
||||
return true
|
||||
elseif topic == "test_gas_blue" and tlib2 == Pipe then
|
||||
-- Test if gas is available
|
||||
nvm.gas_cnt = 1
|
||||
return true
|
||||
return nvm.liquid.amount == CAPACITY
|
||||
elseif topic == "test_gas_green" and tlib2 == Pipe then
|
||||
-- Test if gas is heated
|
||||
nvm.gas_cnt = (nvm.gas_cnt or 0) - 1
|
||||
return nvm.gas_cnt == 0
|
||||
local res = nvm.gas_cnt == 0 and nvm.has_power
|
||||
nvm.has_power = false
|
||||
return res
|
||||
elseif topic == "no_gas" then
|
||||
nvm.liquid.amount = 0
|
||||
return true
|
||||
elseif topic == "test_plasma" then
|
||||
local node = minetest.get_node(pos) or {}
|
||||
return check_plasma(pos, node.param2)
|
||||
|
191
fusion_reactor/ta5_pump.lua
Normal file
@ -0,0 +1,191 @@
|
||||
--[[
|
||||
|
||||
TechAge
|
||||
=======
|
||||
|
||||
Copyright (C) 2019-2022 Joachim Stolberg
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
TA5 Pump
|
||||
|
||||
]]--
|
||||
|
||||
local S2P = minetest.string_to_pos
|
||||
local P2S = minetest.pos_to_string
|
||||
local M = minetest.get_meta
|
||||
local S = techage.S
|
||||
local Pipe2 = techage.LiquidPipe
|
||||
local Pipe3 = techage.GasPipe
|
||||
local liquid = networks.liquid
|
||||
local Flip = networks.Flip
|
||||
|
||||
local STANDBY_TICKS = 16
|
||||
local COUNTDOWN_TICKS = 4
|
||||
local CYCLE_TIME = 2
|
||||
local CAPA = 4
|
||||
|
||||
local WRENCH_MENU = {{
|
||||
type = "output",
|
||||
name = "flowrate",
|
||||
label = S("Total flow rate"),
|
||||
tooltip = S("Total flow rate in liquid units"),
|
||||
}}
|
||||
|
||||
local State = techage.NodeStates:new({
|
||||
node_name_passive = "techage:t5_pump",
|
||||
node_name_active = "techage:t5_pump_on",
|
||||
infotext_name = S("TA45 Pump"),
|
||||
cycle_time = CYCLE_TIME,
|
||||
standby_ticks = STANDBY_TICKS,
|
||||
})
|
||||
|
||||
local function pumping(pos, nvm)
|
||||
local outdir = M(pos):get_int("outdir")
|
||||
local taken, name = liquid.take(pos, Pipe2, Flip[outdir], nil, CAPA)
|
||||
if taken > 0 then
|
||||
local leftover = liquid.put(pos, Pipe3, outdir, name, taken)
|
||||
if leftover and leftover > 0 then
|
||||
liquid.untake(pos, Pipe2, Flip[outdir], name, leftover)
|
||||
if leftover == taken then
|
||||
State:blocked(pos, nvm)
|
||||
return 0
|
||||
end
|
||||
State:keep_running(pos, nvm, COUNTDOWN_TICKS)
|
||||
return taken - leftover
|
||||
end
|
||||
State:keep_running(pos, nvm, COUNTDOWN_TICKS)
|
||||
return taken
|
||||
end
|
||||
State:idle(pos, nvm)
|
||||
return 0
|
||||
end
|
||||
|
||||
local function after_place_node(pos, placer)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
local number = techage.add_node(pos, "techage:t5_pump")
|
||||
State:node_init(pos, nvm, number)
|
||||
M(pos):set_int("outdir", networks.side_to_outdir(pos, "R"))
|
||||
Pipe2:after_place_node(pos)
|
||||
Pipe3:after_place_node(pos)
|
||||
end
|
||||
|
||||
local function node_timer(pos, elapsed)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
nvm.flowrate = (nvm.flowrate or 0) + pumping(pos, nvm)
|
||||
return State:is_active(nvm)
|
||||
end
|
||||
|
||||
local function on_rightclick(pos, node, clicker)
|
||||
if minetest.is_protected(pos, clicker:get_player_name()) then
|
||||
return
|
||||
end
|
||||
|
||||
local nvm = techage.get_nvm(pos)
|
||||
if node.name == "techage:t5_pump" then
|
||||
State:start(pos, nvm)
|
||||
elseif node.name == "techage:t5_pump_on" then
|
||||
State:stop(pos, nvm)
|
||||
end
|
||||
end
|
||||
|
||||
local function after_dig_node(pos, oldnode, oldmetadata, digger)
|
||||
Pipe2:after_dig_node(pos)
|
||||
Pipe3:after_dig_node(pos)
|
||||
techage.del_mem(pos)
|
||||
end
|
||||
|
||||
local tiles_pas = {
|
||||
-- up, down, right, left, back, front
|
||||
"techage_filling_ta4.png^techage_frame_ta5_top.png^techage_appl_arrow.png",
|
||||
"techage_filling_ta4.png^techage_frame_ta4_bottom.png",
|
||||
"techage_filling_ta4.png^techage_appl_hole_ta5_pipe2.png^techage_frame_ta5.png",
|
||||
"techage_filling_ta4.png^techage_appl_hole_pipe.png^techage_frame_ta5.png",
|
||||
"techage_filling_ta4.png^techage_appl_pump.png^techage_frame_ta5.png^[transformFX",
|
||||
"techage_filling_ta4.png^techage_appl_pump.png^techage_frame_ta5.png",
|
||||
}
|
||||
|
||||
local tiles_act = {
|
||||
-- up, down, right, left, back, front
|
||||
"techage_filling_ta4.png^techage_frame_ta5_top.png^techage_appl_arrow.png",
|
||||
"techage_filling_ta4.png^techage_frame_ta4_bottom.png",
|
||||
"techage_filling_ta4.png^techage_appl_hole_ta5_pipe2.png^techage_frame_ta5.png",
|
||||
"techage_filling_ta4.png^techage_appl_hole_pipe.png^techage_frame_ta5.png",
|
||||
{
|
||||
image = "techage_filling8_ta4.png^techage_appl_pump8.png^techage_frame8_ta5.png^[transformFX",
|
||||
backface_culling = false,
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 32,
|
||||
aspect_h = 32,
|
||||
length = 2.0,
|
||||
},
|
||||
},
|
||||
{
|
||||
image = "techage_filling8_ta4.png^techage_appl_pump8.png^techage_frame8_ta5.png",
|
||||
backface_culling = false,
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 32,
|
||||
aspect_h = 32,
|
||||
length = 2.0,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
minetest.register_node("techage:t5_pump", {
|
||||
description = S("TA5 Pump"),
|
||||
tiles = tiles_pas,
|
||||
after_place_node = after_place_node,
|
||||
on_rightclick = on_rightclick,
|
||||
on_timer = node_timer,
|
||||
after_dig_node = after_dig_node,
|
||||
on_rotate = screwdriver.disallow,
|
||||
paramtype2 = "facedir",
|
||||
on_rotate = screwdriver.disallow,
|
||||
groups = {cracky=2},
|
||||
is_ground_content = false,
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
ta4_formspec = WRENCH_MENU,
|
||||
})
|
||||
|
||||
minetest.register_node("techage:t5_pump_on", {
|
||||
description = S("TA5 Pump"),
|
||||
tiles = tiles_act,
|
||||
--after_place_node = after_place_node4,
|
||||
on_rightclick = on_rightclick,
|
||||
on_timer = node_timer,
|
||||
after_dig_node = after_dig_node,
|
||||
on_rotate = screwdriver.disallow,
|
||||
paramtype2 = "facedir",
|
||||
on_rotate = screwdriver.disallow,
|
||||
diggable = false,
|
||||
groups = {not_in_creative_inventory=1},
|
||||
is_ground_content = false,
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
})
|
||||
|
||||
techage.register_node({"techage:t5_pump", "techage:t5_pump_on"}, {
|
||||
on_recv_message = function(pos, src, topic, payload)
|
||||
return State:on_receive_message(pos, topic, payload)
|
||||
end,
|
||||
})
|
||||
|
||||
-- Pumps have to provide one output and one input side
|
||||
liquid.register_nodes({
|
||||
"techage:t5_pump", "techage:t5_pump_on",
|
||||
}, Pipe2, "pump", {"L"}, {})
|
||||
|
||||
liquid.register_nodes({
|
||||
"techage:t5_pump", "techage:t5_pump_on",
|
||||
}, Pipe3, "pump", {"R"}, {})
|
||||
|
||||
--minetest.register_craft({
|
||||
-- output = "techage:t5_pump",
|
||||
-- recipe = {
|
||||
-- {"default:tin_ingot", "dye:red", "default:steel_ingot"},
|
||||
-- {"", "techage:t4_pump", ""},
|
||||
-- {"", "", ""},
|
||||
-- },
|
||||
--})
|
@ -134,19 +134,22 @@ Pipe:set_valid_sides("techage:ta5_turbine", {"L", "U"})
|
||||
Pipe:set_valid_sides("techage:ta5_turbine_on", {"L", "U"})
|
||||
|
||||
techage.register_node({"techage:ta5_turbine", "techage:ta5_turbine_on"}, {
|
||||
-- used by heatexchanger1
|
||||
on_transfer = function(pos, in_dir, topic, payload)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
if topic == "start" then -- used by heatexchanger1
|
||||
if topic == "trigger" then
|
||||
return generator_cmnd(pos, topic, payload)
|
||||
elseif topic == "start" then
|
||||
swap_node(pos, "techage:ta5_turbine_on")
|
||||
play_sound(pos)
|
||||
return generator_cmnd(pos, topic, payload)
|
||||
elseif topic == "stop" then -- used by heatexchanger1
|
||||
elseif topic == "stop" then
|
||||
swap_node(pos, "techage:ta5_turbine")
|
||||
stop_sound(pos)
|
||||
return generator_cmnd(pos, topic, payload)
|
||||
elseif topic == "turbine" then -- used by heatexchanger1
|
||||
elseif topic == "turbine" then
|
||||
return true
|
||||
else -- used by heatexchanger1
|
||||
else
|
||||
return generator_cmnd(pos, topic, payload)
|
||||
end
|
||||
end,
|
||||
|
3
init.lua
@ -408,8 +408,9 @@ dofile(MP.."/fusion_reactor/controller.lua")
|
||||
dofile(MP.."/fusion_reactor/heatexchanger3.lua")
|
||||
dofile(MP.."/fusion_reactor/heatexchanger2.lua")
|
||||
dofile(MP.."/fusion_reactor/heatexchanger1.lua")
|
||||
--dofile(MP.."/fusion_reactor/generator.lua")
|
||||
dofile(MP.."/fusion_reactor/generator.lua")
|
||||
dofile(MP.."/fusion_reactor/turbine.lua")
|
||||
dofile(MP.."/fusion_reactor/ta5_pump.lua")
|
||||
|
||||
-- Prevent other mods from using IE
|
||||
techage.IE = nil
|
||||
|
@ -64,3 +64,4 @@ techage.register_mobs_mods("wildlife")
|
||||
techage.register_mobs_mods("mobs_skeletons")
|
||||
techage.register_mobs_mods("mobs_dwarves")
|
||||
techage.register_mobs_mods("mobf_trader")
|
||||
techage.register_mobs_mods("ts_vehicles")
|
||||
|
@ -127,10 +127,10 @@ local function node_timer(pos, elapsed)
|
||||
local fuel = has_fuel(pos, nvm)
|
||||
if running and not fuel then
|
||||
State:standby(pos, nvm, S("no fuel"))
|
||||
stop_node(pos, nvm, State)
|
||||
stop_node(pos, nvm, State)
|
||||
elseif not running and fuel then
|
||||
State:start(pos, nvm)
|
||||
-- start_node() is called implicit
|
||||
-- start_node() is called implicit
|
||||
elseif running then
|
||||
local meta = M(pos)
|
||||
local outdir = meta:get_int("outdir")
|
||||
|
Before Width: | Height: | Size: 706 B After Width: | Height: | Size: 617 B |
Before Width: | Height: | Size: 664 B After Width: | Height: | Size: 514 B |
Before Width: | Height: | Size: 574 B After Width: | Height: | Size: 430 B |
Before Width: | Height: | Size: 342 B After Width: | Height: | Size: 273 B |