TA3 turbine and cooler added

This commit is contained in:
Joachim Stolberg 2019-05-06 21:09:13 +02:00
parent 7c72c7c5e4
commit d733fab61e
14 changed files with 88 additions and 46 deletions

View File

@ -193,7 +193,8 @@ end
-- --
-- Distributor functions for nodes with 6 power sides (view from the outside) -- Distributor functions for nodes with 6 power sides (per defautl) or
-- optionally two or more sides via valid_power_dir (view from the outside)
-- --
techage.distributor = {} techage.distributor = {}
@ -205,6 +206,12 @@ end
function techage.distributor.after_tube_update(node, pos, out_dir, peer_pos, peer_in_dir) function techage.distributor.after_tube_update(node, pos, out_dir, peer_pos, peer_in_dir)
local mem = tubelib2.get_mem(pos) local mem = tubelib2.get_mem(pos)
-- Check direction
local trd = TRD(pos)
if trd.valid_power_dir then
local pwr_dir = get_power_dir(pos)
if not trd.valid_power_dir(pos, pwr_dir, tubelib2.Turn180Deg[out_dir]) then return end
end
mem.connections = mem.connections or {} mem.connections = mem.connections or {}
if not peer_in_dir then if not peer_in_dir then
mem.connections[out_dir] = nil -- del connection mem.connections[out_dir] = nil -- del connection
@ -217,7 +224,12 @@ end
-- Needed if the junction consumes power in addition -- Needed if the junction consumes power in addition
function techage.distributor.read_power_consumption(pos, in_dir) function techage.distributor.read_power_consumption(pos, in_dir)
return power_consumption(pos, in_dir) - TRD(pos).power_consumption or 0 -- Check direction
local trd = TRD(pos)
if trd.valid_power_dir then
if not trd(pos).valid_power_dir(pos, get_power_dir(pos), in_dir) then return 0 end
end
return power_consumption(pos, in_dir) - trd.power_consumption or 0
end end
function techage.distributor.after_dig_node(pos, oldnode) function techage.distributor.after_dig_node(pos, oldnode)

View File

@ -97,6 +97,7 @@ minetest.register_node("techage:coalboiler_base", {
after_tube_update = consumer.after_tube_update, after_tube_update = consumer.after_tube_update,
--on_timer = node_timer, --on_timer = node_timer,
drop = "",
paramtype2 = "facedir", paramtype2 = "facedir",
on_rotate = screwdriver.disallow, on_rotate = screwdriver.disallow,
groups = {cracky=2}, groups = {cracky=2},

View File

@ -66,6 +66,10 @@ local function valid_power_dir(pos, power_dir, in_dir)
return power_dir == in_dir return power_dir == in_dir
end end
local function can_start(pos, mem, state)
return mem.temperature and mem.temperature > 80
end
local function start_node(pos, mem, state) local function start_node(pos, mem, state)
generator.turn_power_on(pos, POWER_CAPACITY) generator.turn_power_on(pos, POWER_CAPACITY)
end end
@ -80,6 +84,7 @@ local State = techage.NodeStates:new({
standby_ticks = STANDBY_TICKS, standby_ticks = STANDBY_TICKS,
has_item_meter = false, has_item_meter = false,
formspec_func = formspec, formspec_func = formspec,
can_start = can_start,
start_node = start_node, start_node = start_node,
stop_node = stop_node, stop_node = stop_node,
}) })
@ -244,6 +249,7 @@ minetest.register_node("techage:coalboiler_top", {
trigger_boiler = function(pos) trigger_boiler = function(pos)
local mem = tubelib2.get_mem(pos) local mem = tubelib2.get_mem(pos)
mem.fire_trigger = true mem.fire_trigger = true
print("trigger_boiler")
if not minetest.get_node_timer(pos):is_started() then if not minetest.get_node_timer(pos):is_started() then
minetest.get_node_timer(pos):start(CYCLE_TIME) minetest.get_node_timer(pos):start(CYCLE_TIME)
end end
@ -278,6 +284,7 @@ minetest.register_node("techage:coalboiler_top", {
minetest.after(0.5, move_to_water, pos) minetest.after(0.5, move_to_water, pos)
end, end,
drop = "",
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {cracky=1}, groups = {cracky=1},
on_rotate = screwdriver.disallow, on_rotate = screwdriver.disallow,

View File

@ -8,7 +8,7 @@
LGPLv2.1+ LGPLv2.1+
See LICENSE.txt for more information See LICENSE.txt for more information
TA2 Gearbox TA3 Cooler
]]-- ]]--
@ -23,7 +23,7 @@ local I,_ = dofile(MP.."/intllib.lua")
local POWER_CONSUMPTION = 1 local POWER_CONSUMPTION = 1
local Axle = techage.Axle local Power = techage.SteamPipe
local distributor = techage.distributor local distributor = techage.distributor
local function swap_node(pos, name) local function swap_node(pos, name)
@ -37,21 +37,29 @@ end
local function turn_on(pos, dir, sum) local function turn_on(pos, dir, sum)
if sum > 0 then if sum > 0 then
swap_node(pos, "techage:gearbox_on") swap_node(pos, "techage:cooler_on")
else else
swap_node(pos, "techage:gearbox") swap_node(pos, "techage:cooler")
end end
end end
minetest.register_node("techage:gearbox", { minetest.register_node("techage:cooler", {
description = I("TA2 Gearbox"), description = I("TA3 Cooler"),
tiles = {"techage_filling_ta2.png^techage_axle_gearbox.png^techage_frame_ta2.png"}, 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",
"techage_filling_ta3.png^techage_frame_ta3.png",
"techage_filling_ta3.png^techage_frame_ta3.png",
},
techage = { techage = {
turn_on = turn_on, turn_on = turn_on,
read_power_consumption = distributor.read_power_consumption, read_power_consumption = distributor.read_power_consumption,
power_network = Axle, power_network = Power,
power_consumption = POWER_CONSUMPTION, power_consumption = POWER_CONSUMPTION,
animated_power_network = true, --animated_power_network = true,
}, },
after_place_node = distributor.after_place_node, after_place_node = distributor.after_place_node,
@ -66,26 +74,40 @@ minetest.register_node("techage:gearbox", {
}) })
minetest.register_node("techage:gearbox_on", { minetest.register_node("techage:cooler_on", {
tiles = { tiles = {
-- up, down, right, left, back, front -- up, down, right, left, back, front
{ {
image = "techage_filling4_ta2.png^techage_axle_gearbox4.png^techage_frame4_ta2.png", image = "techage_filling4_ta3.png^techage_appl_cooler4.png^techage_frame4_ta3.png",
backface_culling = false, backface_culling = false,
animation = { animation = {
type = "vertical_frames", type = "vertical_frames",
aspect_w = 32, aspect_w = 32,
aspect_h = 32, aspect_h = 32,
length = 0.6, 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,
},
},
"techage_filling_ta3.png^techage_frame_ta3.png^techage_steam_hole.png",
"techage_filling_ta3.png^techage_frame_ta3.png^techage_steam_hole.png",
"techage_filling_ta3.png^techage_frame_ta3.png",
"techage_filling_ta3.png^techage_frame_ta3.png",
}, },
techage = { techage = {
turn_on = turn_on, turn_on = turn_on,
read_power_consumption = distributor.read_power_consumption, read_power_consumption = distributor.read_power_consumption,
power_network = Axle, power_network = Power,
power_consumption = POWER_CONSUMPTION, power_consumption = POWER_CONSUMPTION,
animated_power_network = true, --animated_power_network = true,
}, },
after_tube_update = distributor.after_tube_update, after_tube_update = distributor.after_tube_update,
@ -99,3 +121,4 @@ minetest.register_node("techage:gearbox_on", {
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
}) })
Power:add_secondary_node_names({"techage:cooler", "techage:cooler_on"})

View File

@ -66,7 +66,7 @@ end
minetest.register_node("techage:coalfirebox", { minetest.register_node("techage:coalfirebox", {
description = I("TA3 Coal Power Station Firebox"), description = I("TA3 Coal Power Station Firebox"),
inventory_image = "techage_coal_boiler_inv.png", inventory_image = "techage_coal_boiler_inv.png",
tiles = {"techage_coal_boiler_mesh.png"}, tiles = {"techage_coal_boiler_mesh_top.png"},
drawtype = "mesh", drawtype = "mesh",
mesh = "techage_boiler_large.obj", mesh = "techage_boiler_large.obj",
selection_box = { selection_box = {

View File

@ -188,6 +188,7 @@ minetest.register_node("techage:generator", {
on_rightclick = on_rightclick, on_rightclick = on_rightclick,
on_timer = node_timer, on_timer = node_timer,
drop = "",
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,
@ -199,37 +200,28 @@ minetest.register_node("techage:generator_on", {
description = I("TA3 Generator"), description = I("TA3 Generator"),
tiles = { tiles = {
-- up, down, right, left, back, front -- up, down, right, left, back, front
"techage_filling_ta2.png^techage_frame_ta2.png", "techage_filling_ta3.png^techage_frame_ta3.png",
"techage_filling_ta2.png^techage_frame_ta2.png", "techage_filling_ta3.png^techage_frame_ta3.png",
"techage_filling_ta3.png^techage_appl_hole_electric.png^techage_frame_ta3.png",
"techage_filling_ta3.png^techage_appl_open.png^techage_frame_ta3.png",
{ {
image = "techage_filling4_ta2.png^techage_axle_clutch4.png^techage_frame4_ta2.png", image = "techage_filling4_ta3.png^techage_appl_generator4.png^techage_frame4_ta3.png",
backface_culling = false, backface_culling = false,
animation = { animation = {
type = "vertical_frames", type = "vertical_frames",
aspect_w = 32, aspect_w = 32,
aspect_h = 32, aspect_h = 32,
length = 0.6, length = 0.3,
},
},
"techage_filling_ta2.png^techage_appl_open.png^techage_frame_ta2.png",
{
image = "techage_filling8_ta2.png^techage_frame8_ta2.png^techage_flywheel8.png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = 32,
aspect_h = 32,
length = 1.2,
}, },
}, },
{ {
image = "techage_filling8_ta2.png^techage_frame8_ta2.png^techage_flywheel8.png^[transformFX]", image = "techage_filling4_ta3.png^techage_appl_generator4.png^techage_frame4_ta3.png",
backface_culling = false, backface_culling = false,
animation = { animation = {
type = "vertical_frames", type = "vertical_frames",
aspect_w = 32, aspect_w = 32,
aspect_h = 32, aspect_h = 32,
length = 1.2, length = 0.3,
}, },
}, },
}, },

View File

@ -47,8 +47,8 @@ local function turn_power_on_clbk(pos, in_dir, sum)
mem.running = sum > 0 mem.running = sum > 0
end end
-- called from flywheel -- called from generator
local function start_cylinder(pos, on) local function start_turbine(pos, on)
local mem = tubelib2.get_mem(pos) local mem = tubelib2.get_mem(pos)
if on and mem.running then if on and mem.running then
consumer.turn_power_on(pos, POWER_CONSUMPTION) consumer.turn_power_on(pos, POWER_CONSUMPTION)
@ -79,7 +79,7 @@ minetest.register_node("techage:turbine", {
power_network = Pipe, power_network = Pipe,
power_side = "L", power_side = "L",
valid_power_dir = valid_power_dir, valid_power_dir = valid_power_dir,
start_cylinder = start_cylinder, start_turbine = start_turbine,
}, },
after_place_node = function(pos, placer) after_place_node = function(pos, placer)
@ -107,7 +107,7 @@ minetest.register_node("techage:turbine_on", {
"techage_filling_ta3.png^techage_appl_open.png^techage_frame_ta3.png", "techage_filling_ta3.png^techage_appl_open.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",
{ {
image = "techage_filling4_ta2.png^techage_cylinder4.png^techage_frame4_ta2.png", image = "techage_filling4_ta3.png^techage_appl_turbine4.png^techage_frame4_ta3.png",
backface_culling = false, backface_culling = false,
animation = { animation = {
type = "vertical_frames", type = "vertical_frames",
@ -117,7 +117,7 @@ minetest.register_node("techage:turbine_on", {
}, },
}, },
{ {
image = "techage_filling4_ta2.png^techage_cylinder4.png^techage_frame4_ta2.png", image = "techage_filling4_ta3.png^techage_appl_turbine4.png^techage_frame4_ta3.png",
backface_culling = false, backface_culling = false,
animation = { animation = {
type = "vertical_frames", type = "vertical_frames",
@ -133,7 +133,7 @@ minetest.register_node("techage:turbine_on", {
power_network = Pipe, power_network = Pipe,
power_side = "L", power_side = "L",
valid_power_dir = valid_power_dir, valid_power_dir = valid_power_dir,
start_cylinder = start_cylinder, start_turbine = start_turbine,
}, },
after_tube_update = consumer.after_tube_update, after_tube_update = consumer.after_tube_update,
@ -161,3 +161,5 @@ I([[Part of the Coal Power Station.
Has to be placed side by side Has to be placed side by side
with the TA3 Generator. with the TA3 Generator.
(see TA3 Coal Power Station)]]), "techage:turbine") (see TA3 Coal Power Station)]]), "techage:turbine")
Pipe:add_secondary_node_names({"techage:turbine", "techage:turbine_on"})

View File

@ -87,12 +87,12 @@ else
end end
-- Coal power station -- Coal power station
--dofile(MP.."/coal_power_station/firebox.lua") dofile(MP.."/coal_power_station/firebox.lua")
--dofile(MP.."/coal_power_station/boiler_base.lua") dofile(MP.."/coal_power_station/boiler_base.lua")
--dofile(MP.."/coal_power_station/boiler_top.lua") dofile(MP.."/coal_power_station/boiler_top.lua")
--dofile(MP.."/coal_power_station/generator.lua") dofile(MP.."/coal_power_station/generator.lua")
--dofile(MP.."/coal_power_station/turbine.lua") dofile(MP.."/coal_power_station/turbine.lua")
--dofile(MP.."/coal_power_station/cooler.lua") dofile(MP.."/coal_power_station/cooler.lua")
--dofile(MP.."/test/battery.lua") --dofile(MP.."/test/battery.lua")

Binary file not shown.

View File

@ -62,6 +62,10 @@ local function formspec(self, pos, mem)
default.get_hotbar_bg(0, 3) default.get_hotbar_bg(0, 3)
end end
local function can_start(pos, mem, state)
return mem.temperature and mem.temperature > 80
end
local function start_node(pos, mem, state) local function start_node(pos, mem, state)
generator.turn_power_on(pos, POWER_CAPACITY) generator.turn_power_on(pos, POWER_CAPACITY)
end end
@ -76,6 +80,7 @@ local State = techage.NodeStates:new({
standby_ticks = STANDBY_TICKS, standby_ticks = STANDBY_TICKS,
has_item_meter = false, has_item_meter = false,
formspec_func = formspec, formspec_func = formspec,
can_start = can_start,
start_node = start_node, start_node = start_node,
stop_node = stop_node, stop_node = stop_node,
}) })

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 688 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 423 B

After

Width:  |  Height:  |  Size: 385 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 487 B