further coal power plant nodes added
125
coal_power_station/boiler_base.lua
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
--[[
|
||||||
|
|
||||||
|
TechAge
|
||||||
|
=======
|
||||||
|
|
||||||
|
Copyright (C) 2019 Joachim Stolberg
|
||||||
|
|
||||||
|
LGPLv2.1+
|
||||||
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
|
TA3 Coal Power Station Boiler Base
|
||||||
|
|
||||||
|
]]--
|
||||||
|
|
||||||
|
-- for lazy programmers
|
||||||
|
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
||||||
|
local P = minetest.string_to_pos
|
||||||
|
local M = minetest.get_meta
|
||||||
|
|
||||||
|
-- Load support for intllib.
|
||||||
|
local MP = minetest.get_modpath("techage")
|
||||||
|
local I,_ = dofile(MP.."/intllib.lua")
|
||||||
|
|
||||||
|
local POWER_CONSUMPTION = 2
|
||||||
|
local STANDBY_TICKS = 4
|
||||||
|
local CYCLE_TIME = 4
|
||||||
|
|
||||||
|
local Pipe = techage.SteamPipe
|
||||||
|
local consumer = techage.consumer
|
||||||
|
|
||||||
|
local function valid_power_dir(pos, power_dir, in_dir)
|
||||||
|
return power_dir == in_dir
|
||||||
|
end
|
||||||
|
|
||||||
|
local function start_node(pos, mem, state)
|
||||||
|
consumer.turn_power_on(pos, POWER_CONSUMPTION)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function stop_node(pos, mem, state)
|
||||||
|
consumer.turn_power_on(pos, 0)
|
||||||
|
end
|
||||||
|
|
||||||
|
local State = techage.NodeStates:new({
|
||||||
|
node_name_passive = "techage:coalboiler_base",
|
||||||
|
cycle_time = CYCLE_TIME,
|
||||||
|
standby_ticks = STANDBY_TICKS,
|
||||||
|
start_node = start_node,
|
||||||
|
stop_node = stop_node,
|
||||||
|
})
|
||||||
|
|
||||||
|
local function turn_on_clbk(pos, in_dir, sum)
|
||||||
|
local mem = tubelib2.get_mem(pos)
|
||||||
|
local state = State:get_state(mem)
|
||||||
|
|
||||||
|
if sum > 0 and state == techage.STOPPED then
|
||||||
|
State:start(pos, mem)
|
||||||
|
elseif sum <= 0 and state == techage.RUNNING then
|
||||||
|
State:stop(pos, mem)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function node_timer(pos, elapsed)
|
||||||
|
print("node_timer")
|
||||||
|
local mem = tubelib2.get_mem(pos)
|
||||||
|
return State:is_active(mem)
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_node("techage:coalboiler_base", {
|
||||||
|
description = I("TA3 Boiler Base"),
|
||||||
|
tiles = {"techage_coal_boiler_mesh_base.png"},
|
||||||
|
drawtype = "mesh",
|
||||||
|
mesh = "techage_boiler_large.obj",
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {-13/32, -16/32, -13/32, 13/32, 16/32, 13/32},
|
||||||
|
},
|
||||||
|
|
||||||
|
techage = {
|
||||||
|
turn_on = turn_on_clbk,
|
||||||
|
read_power_consumption = consumer.read_power_consumption,
|
||||||
|
power_network = Pipe,
|
||||||
|
power_side = "F",
|
||||||
|
valid_power_dir = valid_power_dir,
|
||||||
|
},
|
||||||
|
|
||||||
|
after_place_node = function(pos, placer)
|
||||||
|
local mem = consumer.after_place_node(pos, placer)
|
||||||
|
State:node_init(pos, mem, "")
|
||||||
|
State:start(pos, mem)
|
||||||
|
end,
|
||||||
|
|
||||||
|
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||||
|
State:after_dig_node(pos, oldnode, oldmetadata, digger)
|
||||||
|
consumer.after_dig_node(pos, oldnode)
|
||||||
|
end,
|
||||||
|
|
||||||
|
after_tube_update = consumer.after_tube_update,
|
||||||
|
--on_timer = node_timer,
|
||||||
|
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
on_rotate = screwdriver.disallow,
|
||||||
|
groups = {cracky=2},
|
||||||
|
is_ground_content = false,
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
Pipe:add_secondary_node_names({"techage:coalboiler_base"})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "techage:coalboiler_base",
|
||||||
|
recipe = {
|
||||||
|
{"default:stone", "", "default:stone"},
|
||||||
|
{"techage:iron_ingot", "", "techage:iron_ingot"},
|
||||||
|
{"default:stone", "default:stone", "default:stone"},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
techage.register_help_page(I("TA3 Boiler Base"),
|
||||||
|
I([[Part of the Coal Power Station.
|
||||||
|
Has to be placed on top of the
|
||||||
|
TA3 Coal Power Station Firebox
|
||||||
|
and filled with water.
|
||||||
|
(see TA3 Coal Power Station)]]), "techage:coalboiler_base")
|
@ -8,7 +8,7 @@
|
|||||||
LGPLv2.1+
|
LGPLv2.1+
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
TA3 Coal Power Station Boiler
|
TA3 Coal Power Station Boiler Top
|
||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
@ -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 valid_power_dir(pos, power_dir, in_dir)
|
||||||
|
return power_dir == in_dir
|
||||||
|
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
|
||||||
@ -71,7 +75,7 @@ local function stop_node(pos, mem, state)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local State = techage.NodeStates:new({
|
local State = techage.NodeStates:new({
|
||||||
node_name_passive = "techage:coalboiler1",
|
node_name_passive = "techage:coalboiler_top",
|
||||||
cycle_time = CYCLE_TIME,
|
cycle_time = CYCLE_TIME,
|
||||||
standby_ticks = STANDBY_TICKS,
|
standby_ticks = STANDBY_TICKS,
|
||||||
has_item_meter = false,
|
has_item_meter = false,
|
||||||
@ -216,72 +220,14 @@ local function allow_metadata_inventory_take(pos, listname, index, stack, player
|
|||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("techage:coalboiler2", {
|
minetest.register_node("techage:coalboiler_top", {
|
||||||
|
|
||||||
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
groups = {cracky=1},
|
|
||||||
on_rotate = screwdriver.disallow,
|
|
||||||
is_ground_content = false,
|
|
||||||
sounds = default.node_sound_metal_defaults(),
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("techage:coalboiler1", {
|
|
||||||
description = I("TA3 Coal Power Station Firebox"),
|
|
||||||
inventory_image = "techage_coal_boiler_inv.png",
|
|
||||||
tiles = {"techage_coal_boiler_mesh.png"},
|
|
||||||
drawtype = "mesh",
|
|
||||||
mesh = "techage_boiler_large.obj",
|
|
||||||
selection_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {-14/32, -16/32, -14/32, 14/32, 16/32, 14/32},
|
|
||||||
},
|
|
||||||
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
on_rotate = screwdriver.disallow,
|
|
||||||
groups = {cracky=2},
|
|
||||||
is_ground_content = false,
|
|
||||||
sounds = default.node_sound_stone_defaults(),
|
|
||||||
|
|
||||||
on_timer = node_timer,
|
|
||||||
can_dig = can_dig,
|
|
||||||
allow_metadata_inventory_put = allow_metadata_inventory,
|
|
||||||
allow_metadata_inventory_take = allow_metadata_inventory,
|
|
||||||
on_receive_fields = on_receive_fields,
|
|
||||||
on_rightclick = on_rightclick,
|
|
||||||
|
|
||||||
on_construct = function(pos)
|
|
||||||
local mem = tubelib2.init_mem(pos)
|
|
||||||
mem.running = false
|
|
||||||
mem.burn_cycles = 0
|
|
||||||
local meta = M(pos)
|
|
||||||
meta:set_string("formspec", formspec(mem))
|
|
||||||
local inv = meta:get_inventory()
|
|
||||||
inv:set_size('fuel', 1)
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_metadata_inventory_put = function(pos)
|
|
||||||
local mem = tubelib2.init_mem(pos)
|
|
||||||
mem.running = true
|
|
||||||
-- activate the formspec fire temporarily
|
|
||||||
mem.burn_cycles = BURN_CYCLES
|
|
||||||
M(pos):set_string("formspec", formspec(mem))
|
|
||||||
mem.burn_cycles = 0
|
|
||||||
swap_node(pos, "techage:firebox_on")
|
|
||||||
minetest.get_node_timer(pos):start(CYCLE_TIME)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
-- boiler2: Main part, needed as generator
|
|
||||||
minetest.register_node("techage:boiler2", {
|
|
||||||
description = I("TA3 Boiler Top"),
|
description = I("TA3 Boiler Top"),
|
||||||
tiles = {"techage_coal_boiler.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 = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {-10/32, -48/32, -10/32, 10/32, 16/32, 10/32},
|
fixed = {-13/32, -48/32, -13/32, 13/32, 16/32, 13/32},
|
||||||
},
|
},
|
||||||
|
|
||||||
can_dig = can_dig,
|
can_dig = can_dig,
|
||||||
@ -302,7 +248,8 @@ minetest.register_node("techage:boiler2", {
|
|||||||
minetest.get_node_timer(pos):start(CYCLE_TIME)
|
minetest.get_node_timer(pos):start(CYCLE_TIME)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
power_side = "U",
|
power_side = "F",
|
||||||
|
valid_power_dir = valid_power_dir,
|
||||||
},
|
},
|
||||||
|
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
@ -315,7 +262,7 @@ minetest.register_node("techage:boiler2", {
|
|||||||
local mem = generator.after_place_node(pos)
|
local mem = generator.after_place_node(pos)
|
||||||
State:node_init(pos, mem, "")
|
State:node_init(pos, mem, "")
|
||||||
local node = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z})
|
local node = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z})
|
||||||
if node.name == "techage:boiler1" then
|
if node.name == "techage:coalboiler_base" then
|
||||||
on_rightclick(pos)
|
on_rightclick(pos)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
@ -331,10 +278,26 @@ minetest.register_node("techage:boiler2", {
|
|||||||
minetest.after(0.5, move_to_water, pos)
|
minetest.after(0.5, move_to_water, pos)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
--paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {cracky=1},
|
groups = {cracky=1},
|
||||||
on_rotate = screwdriver.disallow,
|
on_rotate = screwdriver.disallow,
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = default.node_sound_metal_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Pipe:add_secondary_node_names({"techage:coalboiler_top"})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "techage:coalboiler_top",
|
||||||
|
recipe = {
|
||||||
|
{"default:stone", "default:stone", "default:stone"},
|
||||||
|
{"techage:iron_ingot", "", "techage:iron_ingot"},
|
||||||
|
{"default:stone", "", "default:stone"},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
techage.register_help_page(I("TA3 Boiler Top"),
|
||||||
|
I([[Part of the Coal Power Station.
|
||||||
|
Has to be placed on top of TA3 Power Station Boiler Base.
|
||||||
|
(see TA3 Coal Power Station)]]), "techage:coalboiler_top")
|
@ -176,3 +176,24 @@ minetest.register_node("techage:coalfirehole_on", {
|
|||||||
groups = {not_in_creative_inventory=1},
|
groups = {not_in_creative_inventory=1},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "techage:coalfirebox",
|
||||||
|
recipe = {
|
||||||
|
{'default:stone', 'default:stone', 'default:stone'},
|
||||||
|
{'default:steel_ingot', '', 'default:steel_ingot'},
|
||||||
|
{'default:stone', 'default:stone', 'default:stone'},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
techage.register_node("techage:firebox", {"techage:firebox_on"}, {
|
||||||
|
on_push_item = function(pos, in_dir, stack)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
if inv:room_for_item("fuel", stack) then
|
||||||
|
inv:add_item("fuel", stack)
|
||||||
|
minetest.get_node_timer(pos):start(CYCLE_TIME)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
LGPLv2.1+
|
LGPLv2.1+
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
TA2 Steam Engine Flywheel
|
TA3 Power Station Generator
|
||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
@ -26,9 +26,9 @@ local I,_ = dofile(MP.."/intllib.lua")
|
|||||||
local STANDBY_TICKS = 4
|
local STANDBY_TICKS = 4
|
||||||
local COUNTDOWN_TICKS = 4
|
local COUNTDOWN_TICKS = 4
|
||||||
local CYCLE_TIME = 8
|
local CYCLE_TIME = 8
|
||||||
local POWER_CAPACITY = 8
|
local POWER_CAPACITY = 50
|
||||||
|
|
||||||
local Axle = techage.Axle
|
local Cable = techage.ElectricCable
|
||||||
local generator = techage.generator
|
local generator = techage.generator
|
||||||
|
|
||||||
local function formspec(self, pos, mem)
|
local function formspec(self, pos, mem)
|
||||||
@ -43,31 +43,51 @@ local function formspec(self, pos, mem)
|
|||||||
default.get_hotbar_bg(0, 3)
|
default.get_hotbar_bg(0, 3)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function start_cylinder(pos, on)
|
local function start_turbine(pos, on, mem)
|
||||||
|
if not on then
|
||||||
|
if mem.handle then
|
||||||
|
minetest.sound_stop(mem.handle)
|
||||||
|
mem.handle = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
local pos2 = techage.get_pos(pos, 'L')
|
local pos2 = techage.get_pos(pos, 'L')
|
||||||
local trd = TRD(pos2)
|
local trd = TRD(pos2)
|
||||||
if trd and trd.start_cylinder then
|
if trd and trd.start_turbine then
|
||||||
return trd.start_cylinder(pos2, on)
|
return trd.start_turbine(pos2, on, mem)
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
local function can_start(pos, mem, state)
|
local function can_start(pos, mem, state)
|
||||||
return start_cylinder(pos, true)
|
return start_turbine(pos, true, mem)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function play_sound(pos)
|
||||||
|
local mem = tubelib2.get_mem(pos)
|
||||||
|
if mem.techage_state == techage.RUNNING then
|
||||||
|
mem.handle = minetest.sound_play("techage_turbine", {
|
||||||
|
pos = pos,
|
||||||
|
gain = 1,
|
||||||
|
max_hear_distance = 15})
|
||||||
|
minetest.after(2, play_sound, pos)
|
||||||
|
end
|
||||||
end
|
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)
|
||||||
|
mem.techage_state = techage.RUNNING
|
||||||
|
play_sound(pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function stop_node(pos, mem, state)
|
local function stop_node(pos, mem, state)
|
||||||
start_cylinder(pos, false)
|
mem.techage_state = techage.STOPPED
|
||||||
|
start_turbine(pos, false, mem)
|
||||||
generator.turn_power_on(pos, 0)
|
generator.turn_power_on(pos, 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
local State = techage.NodeStates:new({
|
local State = techage.NodeStates:new({
|
||||||
node_name_passive = "techage:flywheel",
|
node_name_passive = "techage:generator",
|
||||||
node_name_active = "techage:flywheel_on",
|
node_name_active = "techage:generator_on",
|
||||||
cycle_time = CYCLE_TIME,
|
cycle_time = CYCLE_TIME,
|
||||||
standby_ticks = STANDBY_TICKS,
|
standby_ticks = STANDBY_TICKS,
|
||||||
formspec_func = formspec,
|
formspec_func = formspec,
|
||||||
@ -81,20 +101,19 @@ local function distibuting(pos, mem)
|
|||||||
State:keep_running(pos, mem, COUNTDOWN_TICKS)
|
State:keep_running(pos, mem, COUNTDOWN_TICKS)
|
||||||
else
|
else
|
||||||
State:fault(pos, mem)
|
State:fault(pos, mem)
|
||||||
start_cylinder(pos, false)
|
start_turbine(pos, false, mem)
|
||||||
generator.turn_power_on(pos, 0)
|
generator.turn_power_on(pos, 0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function node_timer(pos, elapsed)
|
local function node_timer(pos, elapsed)
|
||||||
local mem = tubelib2.get_mem(pos)
|
local mem = tubelib2.get_mem(pos)
|
||||||
print("flywheel node_timer")
|
|
||||||
local pos2 = techage.get_pos(pos, 'L')
|
local pos2 = techage.get_pos(pos, 'L')
|
||||||
if minetest.get_node(pos2).name == "techage:cylinder_on" and tubelib2.get_mem(pos2).running then
|
if minetest.get_node(pos2).name == "techage:turbine_on" and tubelib2.get_mem(pos2).running then
|
||||||
distibuting(pos, mem)
|
distibuting(pos, mem)
|
||||||
else
|
else
|
||||||
State:fault(pos, mem)
|
State:fault(pos, mem)
|
||||||
start_cylinder(pos, false)
|
start_turbine(pos, false, mem)
|
||||||
generator.turn_power_on(pos, 0)
|
generator.turn_power_on(pos, 0)
|
||||||
end
|
end
|
||||||
return State:is_active(mem)
|
return State:is_active(mem)
|
||||||
@ -110,7 +129,7 @@ local function turn_power_on(pos, in_dir, sum)
|
|||||||
mem.power_result = sum
|
mem.power_result = sum
|
||||||
if State:is_active(mem) and sum <= 0 then
|
if State:is_active(mem) and sum <= 0 then
|
||||||
State:fault(pos, mem)
|
State:fault(pos, mem)
|
||||||
start_cylinder(pos, false)
|
start_turbine(pos, false, mem)
|
||||||
-- No automatic turn on
|
-- No automatic turn on
|
||||||
mem.power_capacity = 0
|
mem.power_capacity = 0
|
||||||
end
|
end
|
||||||
@ -134,21 +153,22 @@ local function on_rightclick(pos)
|
|||||||
M(pos):set_string("formspec", formspec(State, pos, mem))
|
M(pos):set_string("formspec", formspec(State, pos, mem))
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("techage:flywheel", {
|
minetest.register_node("techage:generator", {
|
||||||
description = I("TA2 Flywheel"),
|
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_ta2.png^techage_axle_clutch.png^techage_frame_ta2.png",
|
"techage_filling_ta3.png^techage_appl_hole_electric.png^techage_frame_ta3.png",
|
||||||
"techage_filling_ta2.png^techage_appl_open.png^techage_frame_ta2.png",
|
"techage_filling_ta3.png^techage_appl_open.png^techage_frame_ta3.png",
|
||||||
"techage_filling_ta2.png^techage_frame_ta2.png^techage_flywheel.png",
|
"techage_filling_ta3.png^techage_frame_ta3.png^techage_appl_generator.png",
|
||||||
"techage_filling_ta2.png^techage_frame_ta2.png^techage_flywheel.png^[transformFX]",
|
"techage_filling_ta3.png^techage_frame_ta3.png^techage_appl_generator.png^[transformFX]",
|
||||||
},
|
},
|
||||||
techage = {
|
techage = {
|
||||||
turn_on = turn_power_on,
|
turn_on = turn_power_on,
|
||||||
read_power_consumption = generator.read_power_consumption,
|
read_power_consumption = generator.read_power_consumption,
|
||||||
power_network = Axle,
|
power_network = Cable,
|
||||||
|
power_side = "R",
|
||||||
animated_power_network = true,
|
animated_power_network = true,
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -175,8 +195,8 @@ minetest.register_node("techage:flywheel", {
|
|||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("techage:flywheel_on", {
|
minetest.register_node("techage:generator_on", {
|
||||||
description = I("TA2 Flywheel"),
|
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_ta2.png^techage_frame_ta2.png",
|
||||||
@ -216,7 +236,8 @@ minetest.register_node("techage:flywheel_on", {
|
|||||||
techage = {
|
techage = {
|
||||||
turn_on = turn_power_on,
|
turn_on = turn_power_on,
|
||||||
read_power_consumption = generator.read_power_consumption,
|
read_power_consumption = generator.read_power_consumption,
|
||||||
power_network = Axle,
|
power_network = Cable,
|
||||||
|
power_side = "R",
|
||||||
animated_power_network = true,
|
animated_power_network = true,
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -237,3 +258,30 @@ minetest.register_node("techage:flywheel_on", {
|
|||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "techage:generator",
|
||||||
|
recipe = {
|
||||||
|
{"basic_materials:steel_bar", "dye:red", "default:wood"},
|
||||||
|
{"", "basic_materials:gear_steel", "techage:axle"},
|
||||||
|
{"default:wood", "techage:iron_ingot", "basic_materials:steel_bar"},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_lbm({
|
||||||
|
label = "[techage] Generator sound",
|
||||||
|
name = "techage:power_station",
|
||||||
|
nodenames = {"techage:generator_on"},
|
||||||
|
run_at_every_load = true,
|
||||||
|
action = function(pos, node)
|
||||||
|
play_sound(pos)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
techage.register_help_page(I("TA3 Generator"),
|
||||||
|
I([[Part of the Coal Power Station.
|
||||||
|
Has to be placed side by side
|
||||||
|
with the TA3 Turbine.
|
||||||
|
Connect the Generator with your TA3 machines
|
||||||
|
by means of Electric Cables and Junction Boxes
|
||||||
|
(see TA3 Coal Power Station)]]), "techage:generator")
|
@ -8,7 +8,7 @@
|
|||||||
LGPLv2.1+
|
LGPLv2.1+
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
TA2 Steam Engine Cylinder
|
TA3 Power Station Turbine
|
||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
@ -52,26 +52,26 @@ local function start_cylinder(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)
|
||||||
swap_node(pos, "techage:cylinder_on")
|
swap_node(pos, "techage:turbine_on")
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
consumer.turn_power_on(pos, 0)
|
consumer.turn_power_on(pos, 0)
|
||||||
swap_node(pos, "techage:cylinder")
|
swap_node(pos, "techage:turbine")
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
minetest.register_node("techage:cylinder", {
|
minetest.register_node("techage:turbine", {
|
||||||
description = I("TA2 Cylinder"),
|
description = I("TA3 Turbine"),
|
||||||
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_steam_hole.png",
|
||||||
"techage_filling_ta2.png^techage_frame_ta2.png",
|
"techage_filling_ta3.png^techage_frame_ta3.png",
|
||||||
"techage_filling_ta2.png^techage_appl_open.png^techage_frame_ta2.png",
|
"techage_filling_ta3.png^techage_appl_open.png^techage_frame_ta3.png",
|
||||||
"techage_filling_ta2.png^techage_frame_ta2.png^techage_steam_hole.png",
|
"techage_filling_ta3.png^techage_frame_ta3.png^techage_steam_hole.png",
|
||||||
"techage_filling_ta2.png^techage_cylinder.png^techage_frame_ta2.png",
|
"techage_filling_ta3.png^techage_appl_turbine.png^techage_frame_ta3.png",
|
||||||
"techage_filling_ta2.png^techage_cylinder.png^techage_frame_ta2.png",
|
"techage_filling_ta3.png^techage_appl_turbine.png^techage_frame_ta3.png",
|
||||||
},
|
},
|
||||||
techage = {
|
techage = {
|
||||||
turn_on = turn_power_on_clbk,
|
turn_on = turn_power_on_clbk,
|
||||||
@ -98,14 +98,14 @@ minetest.register_node("techage:cylinder", {
|
|||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("techage:cylinder_on", {
|
minetest.register_node("techage:turbine_on", {
|
||||||
description = I("TA2 Cylinder"),
|
description = I("TA3 Turbine"),
|
||||||
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_steam_hole.png",
|
||||||
"techage_filling_ta2.png^techage_frame_ta2.png",
|
"techage_filling_ta3.png^techage_frame_ta3.png",
|
||||||
"techage_filling_ta2.png^techage_appl_open.png^techage_frame_ta2.png",
|
"techage_filling_ta3.png^techage_appl_open.png^techage_frame_ta3.png",
|
||||||
"techage_filling_ta2.png^techage_frame_ta2.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_ta2.png^techage_cylinder4.png^techage_frame4_ta2.png",
|
||||||
backface_culling = false,
|
backface_culling = false,
|
||||||
@ -147,3 +147,17 @@ minetest.register_node("techage:cylinder_on", {
|
|||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "techage:turbine",
|
||||||
|
recipe = {
|
||||||
|
{"basic_materials:steel_bar", "techage:iron_ingot", "default:wood"},
|
||||||
|
{"techage:steam_pipeS", "basic_materials:gear_steel", ""},
|
||||||
|
{"default:wood", "techage:iron_ingot", "basic_materials:steel_bar"},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
techage.register_help_page(I("TA3 Turbine"),
|
||||||
|
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")
|
||||||
|
9
init.lua
@ -87,16 +87,17 @@ 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.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/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")
|
||||||
--dofile(MP.."/test/test.lua")
|
--dofile(MP.."/test/test.lua")
|
||||||
dofile(MP.."/test/generator.lua")
|
--dofile(MP.."/test/generator.lua")
|
||||||
--dofile(MP.."/test/consumer.lua")
|
--dofile(MP.."/test/consumer.lua")
|
||||||
--dofile(MP.."/test/consumer2.lua")
|
--dofile(MP.."/test/consumer2.lua")
|
||||||
|
|
||||||
|
BIN
sounds/techage_turbine.ogg
Normal file
@ -292,6 +292,7 @@ minetest.register_node("techage:boiler2", {
|
|||||||
end,
|
end,
|
||||||
|
|
||||||
--paramtype2 = "facedir",
|
--paramtype2 = "facedir",
|
||||||
|
drop = "",
|
||||||
groups = {cracky=1},
|
groups = {cracky=1},
|
||||||
on_rotate = screwdriver.disallow,
|
on_rotate = screwdriver.disallow,
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
|
@ -188,6 +188,7 @@ minetest.register_node("techage:flywheel", {
|
|||||||
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,
|
||||||
@ -251,6 +252,7 @@ minetest.register_node("techage:flywheel_on", {
|
|||||||
on_rightclick = on_rightclick,
|
on_rightclick = on_rightclick,
|
||||||
on_timer = node_timer,
|
on_timer = node_timer,
|
||||||
|
|
||||||
|
drop = "",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {not_in_creative_inventory=1},
|
groups = {not_in_creative_inventory=1},
|
||||||
diggable = false,
|
diggable = false,
|
||||||
|
@ -25,7 +25,7 @@ local HelpText = S([[1. Build a steam machine according
|
|||||||
to the plan with TA2 Firebox, TA2 Boiler,
|
to the plan with TA2 Firebox, TA2 Boiler,
|
||||||
Steam Pipes, TA2 Cyclinder and TA2 Flywheel.
|
Steam Pipes, TA2 Cyclinder and TA2 Flywheel.
|
||||||
2. Heat the Firebox with coal/charcoal
|
2. Heat the Firebox with coal/charcoal
|
||||||
3. Fill the boiler with water (more than on bucket is needed)
|
3. Fill the boiler with water (more than one bucket is needed)
|
||||||
4. Wait until the water is heated
|
4. Wait until the water is heated
|
||||||
5. Open the steam ventil
|
5. Open the steam ventil
|
||||||
6. Start the Flywheel
|
6. Start the Flywheel
|
||||||
|
@ -12,7 +12,8 @@ local COUNTDOWN_TICKS = 4
|
|||||||
local CYCLE_TIME = 16
|
local CYCLE_TIME = 16
|
||||||
local POWER_CAPACITY = 8
|
local POWER_CAPACITY = 8
|
||||||
|
|
||||||
local Cable = techage.ElectricCable
|
--local Power = techage.ElectricCable
|
||||||
|
local Power = techage.SteamPipe
|
||||||
local generator = techage.generator
|
local generator = techage.generator
|
||||||
|
|
||||||
local function formspec(self, pos, mem)
|
local function formspec(self, pos, mem)
|
||||||
@ -99,7 +100,7 @@ minetest.register_node("techage:generator", {
|
|||||||
techage = {
|
techage = {
|
||||||
turn_on = turn_power_on,
|
turn_on = turn_power_on,
|
||||||
read_power_consumption = generator.read_power_consumption,
|
read_power_consumption = generator.read_power_consumption,
|
||||||
power_network = Cable,
|
power_network = Power,
|
||||||
power_side = "R",
|
power_side = "R",
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -120,3 +121,4 @@ minetest.register_node("techage:generator", {
|
|||||||
on_timer = node_timer,
|
on_timer = node_timer,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Power:add_secondary_node_names({"techage:generator"})
|
||||||
|
BIN
textures/techage_appl_generator.png
Normal file
After Width: | Height: | Size: 423 B |
BIN
textures/techage_appl_turbine.png
Normal file
After Width: | Height: | Size: 410 B |
BIN
textures/techage_appl_turbine4.png
Normal file
After Width: | Height: | Size: 751 B |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
BIN
textures/techage_coal_boiler_mesh_base.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
textures/techage_coal_boiler_mesh_top.png
Normal file
After Width: | Height: | Size: 1.4 KiB |