TA3 turbine and cooler added
This commit is contained in:
parent
7c72c7c5e4
commit
d733fab61e
@ -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 = {}
|
||||
|
||||
@ -205,6 +206,12 @@ end
|
||||
|
||||
function techage.distributor.after_tube_update(node, pos, out_dir, peer_pos, peer_in_dir)
|
||||
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 {}
|
||||
if not peer_in_dir then
|
||||
mem.connections[out_dir] = nil -- del connection
|
||||
@ -217,7 +224,12 @@ end
|
||||
|
||||
-- Needed if the junction consumes power in addition
|
||||
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
|
||||
|
||||
function techage.distributor.after_dig_node(pos, oldnode)
|
||||
|
@ -97,6 +97,7 @@ minetest.register_node("techage:coalboiler_base", {
|
||||
after_tube_update = consumer.after_tube_update,
|
||||
--on_timer = node_timer,
|
||||
|
||||
drop = "",
|
||||
paramtype2 = "facedir",
|
||||
on_rotate = screwdriver.disallow,
|
||||
groups = {cracky=2},
|
||||
|
@ -66,6 +66,10 @@ local function valid_power_dir(pos, power_dir, in_dir)
|
||||
return power_dir == in_dir
|
||||
end
|
||||
|
||||
local function can_start(pos, mem, state)
|
||||
return mem.temperature and mem.temperature > 80
|
||||
end
|
||||
|
||||
local function start_node(pos, mem, state)
|
||||
generator.turn_power_on(pos, POWER_CAPACITY)
|
||||
end
|
||||
@ -80,6 +84,7 @@ local State = techage.NodeStates:new({
|
||||
standby_ticks = STANDBY_TICKS,
|
||||
has_item_meter = false,
|
||||
formspec_func = formspec,
|
||||
can_start = can_start,
|
||||
start_node = start_node,
|
||||
stop_node = stop_node,
|
||||
})
|
||||
@ -244,6 +249,7 @@ minetest.register_node("techage:coalboiler_top", {
|
||||
trigger_boiler = function(pos)
|
||||
local mem = tubelib2.get_mem(pos)
|
||||
mem.fire_trigger = true
|
||||
print("trigger_boiler")
|
||||
if not minetest.get_node_timer(pos):is_started() then
|
||||
minetest.get_node_timer(pos):start(CYCLE_TIME)
|
||||
end
|
||||
@ -278,6 +284,7 @@ minetest.register_node("techage:coalboiler_top", {
|
||||
minetest.after(0.5, move_to_water, pos)
|
||||
end,
|
||||
|
||||
drop = "",
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky=1},
|
||||
on_rotate = screwdriver.disallow,
|
||||
|
@ -8,7 +8,7 @@
|
||||
LGPLv2.1+
|
||||
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 Axle = techage.Axle
|
||||
local Power = techage.SteamPipe
|
||||
local distributor = techage.distributor
|
||||
|
||||
local function swap_node(pos, name)
|
||||
@ -37,21 +37,29 @@ end
|
||||
|
||||
local function turn_on(pos, dir, sum)
|
||||
if sum > 0 then
|
||||
swap_node(pos, "techage:gearbox_on")
|
||||
swap_node(pos, "techage:cooler_on")
|
||||
else
|
||||
swap_node(pos, "techage:gearbox")
|
||||
swap_node(pos, "techage:cooler")
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_node("techage:gearbox", {
|
||||
description = I("TA2 Gearbox"),
|
||||
tiles = {"techage_filling_ta2.png^techage_axle_gearbox.png^techage_frame_ta2.png"},
|
||||
minetest.register_node("techage:cooler", {
|
||||
description = I("TA3 Cooler"),
|
||||
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 = {
|
||||
turn_on = turn_on,
|
||||
read_power_consumption = distributor.read_power_consumption,
|
||||
power_network = Axle,
|
||||
power_network = Power,
|
||||
power_consumption = POWER_CONSUMPTION,
|
||||
animated_power_network = true,
|
||||
--animated_power_network = true,
|
||||
},
|
||||
|
||||
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 = {
|
||||
-- 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,
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 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 = {
|
||||
turn_on = turn_on,
|
||||
read_power_consumption = distributor.read_power_consumption,
|
||||
power_network = Axle,
|
||||
power_network = Power,
|
||||
power_consumption = POWER_CONSUMPTION,
|
||||
animated_power_network = true,
|
||||
--animated_power_network = true,
|
||||
},
|
||||
|
||||
after_tube_update = distributor.after_tube_update,
|
||||
@ -99,3 +121,4 @@ minetest.register_node("techage:gearbox_on", {
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
|
||||
Power:add_secondary_node_names({"techage:cooler", "techage:cooler_on"})
|
||||
|
@ -66,7 +66,7 @@ end
|
||||
minetest.register_node("techage:coalfirebox", {
|
||||
description = I("TA3 Coal Power Station Firebox"),
|
||||
inventory_image = "techage_coal_boiler_inv.png",
|
||||
tiles = {"techage_coal_boiler_mesh.png"},
|
||||
tiles = {"techage_coal_boiler_mesh_top.png"},
|
||||
drawtype = "mesh",
|
||||
mesh = "techage_boiler_large.obj",
|
||||
selection_box = {
|
||||
|
@ -188,6 +188,7 @@ minetest.register_node("techage:generator", {
|
||||
on_rightclick = on_rightclick,
|
||||
on_timer = node_timer,
|
||||
|
||||
drop = "",
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky=2, crumbly=2, choppy=2},
|
||||
on_rotate = screwdriver.disallow,
|
||||
@ -199,37 +200,28 @@ minetest.register_node("techage:generator_on", {
|
||||
description = I("TA3 Generator"),
|
||||
tiles = {
|
||||
-- up, down, right, left, back, front
|
||||
"techage_filling_ta2.png^techage_frame_ta2.png",
|
||||
"techage_filling_ta2.png^techage_frame_ta2.png",
|
||||
"techage_filling_ta3.png^techage_frame_ta3.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,
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 32,
|
||||
aspect_h = 32,
|
||||
length = 0.6,
|
||||
},
|
||||
},
|
||||
"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,
|
||||
length = 0.3,
|
||||
},
|
||||
},
|
||||
{
|
||||
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,
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 32,
|
||||
aspect_h = 32,
|
||||
length = 1.2,
|
||||
length = 0.3,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -47,8 +47,8 @@ local function turn_power_on_clbk(pos, in_dir, sum)
|
||||
mem.running = sum > 0
|
||||
end
|
||||
|
||||
-- called from flywheel
|
||||
local function start_cylinder(pos, on)
|
||||
-- called from generator
|
||||
local function start_turbine(pos, on)
|
||||
local mem = tubelib2.get_mem(pos)
|
||||
if on and mem.running then
|
||||
consumer.turn_power_on(pos, POWER_CONSUMPTION)
|
||||
@ -79,7 +79,7 @@ minetest.register_node("techage:turbine", {
|
||||
power_network = Pipe,
|
||||
power_side = "L",
|
||||
valid_power_dir = valid_power_dir,
|
||||
start_cylinder = start_cylinder,
|
||||
start_turbine = start_turbine,
|
||||
},
|
||||
|
||||
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_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,
|
||||
animation = {
|
||||
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,
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
@ -133,7 +133,7 @@ minetest.register_node("techage:turbine_on", {
|
||||
power_network = Pipe,
|
||||
power_side = "L",
|
||||
valid_power_dir = valid_power_dir,
|
||||
start_cylinder = start_cylinder,
|
||||
start_turbine = start_turbine,
|
||||
},
|
||||
|
||||
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
|
||||
with the TA3 Generator.
|
||||
(see TA3 Coal Power Station)]]), "techage:turbine")
|
||||
|
||||
Pipe:add_secondary_node_names({"techage:turbine", "techage:turbine_on"})
|
12
init.lua
12
init.lua
@ -87,12 +87,12 @@ else
|
||||
end
|
||||
|
||||
-- Coal power station
|
||||
--dofile(MP.."/coal_power_station/firebox.lua")
|
||||
--dofile(MP.."/coal_power_station/boiler_base.lua")
|
||||
--dofile(MP.."/coal_power_station/boiler_top.lua")
|
||||
--dofile(MP.."/coal_power_station/generator.lua")
|
||||
--dofile(MP.."/coal_power_station/turbine.lua")
|
||||
--dofile(MP.."/coal_power_station/cooler.lua")
|
||||
dofile(MP.."/coal_power_station/firebox.lua")
|
||||
dofile(MP.."/coal_power_station/boiler_base.lua")
|
||||
dofile(MP.."/coal_power_station/boiler_top.lua")
|
||||
dofile(MP.."/coal_power_station/generator.lua")
|
||||
dofile(MP.."/coal_power_station/turbine.lua")
|
||||
dofile(MP.."/coal_power_station/cooler.lua")
|
||||
|
||||
|
||||
--dofile(MP.."/test/battery.lua")
|
||||
|
Binary file not shown.
@ -62,6 +62,10 @@ local function formspec(self, pos, mem)
|
||||
default.get_hotbar_bg(0, 3)
|
||||
end
|
||||
|
||||
local function can_start(pos, mem, state)
|
||||
return mem.temperature and mem.temperature > 80
|
||||
end
|
||||
|
||||
local function start_node(pos, mem, state)
|
||||
generator.turn_power_on(pos, POWER_CAPACITY)
|
||||
end
|
||||
@ -76,6 +80,7 @@ local State = techage.NodeStates:new({
|
||||
standby_ticks = STANDBY_TICKS,
|
||||
has_item_meter = false,
|
||||
formspec_func = formspec,
|
||||
can_start = can_start,
|
||||
start_node = start_node,
|
||||
stop_node = stop_node,
|
||||
})
|
||||
|
BIN
textures/techage_appl_cooler.png
Normal file
BIN
textures/techage_appl_cooler.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 383 B |
BIN
textures/techage_appl_cooler4.png
Normal file
BIN
textures/techage_appl_cooler4.png
Normal file
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 |
BIN
textures/techage_appl_generator4.png
Normal file
BIN
textures/techage_appl_generator4.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 487 B |
Loading…
Reference in New Issue
Block a user