Electronic Fab and Vacuum Tubes added

This commit is contained in:
Joachim Stolberg 2019-05-01 23:01:14 +02:00
parent b62334148a
commit 38d115fdf3
24 changed files with 428 additions and 48 deletions

View File

@ -200,8 +200,7 @@ local function allow_metadata_inventory_put(pos, listname, index, stack, player)
if minetest.is_protected(pos, player:get_player_name()) then if minetest.is_protected(pos, player:get_player_name()) then
return 0 return 0
end end
local inv = minetest.get_meta(pos):get_inventory() local inv = M(pos):get_inventory()
local trd = TRD(pos)
if listname == "recipe" then if listname == "recipe" then
stack:set_count(1) stack:set_count(1)
inv:set_stack(listname, index, stack) inv:set_stack(listname, index, stack)
@ -210,8 +209,8 @@ local function allow_metadata_inventory_put(pos, listname, index, stack, player)
elseif listname == "output" then elseif listname == "output" then
on_output_change(pos, inv, stack) on_output_change(pos, inv, stack)
return 0 return 0
elseif listname == "src" and trd.State:get_state(M(pos)) == techage.STANDBY then elseif listname == "src" then
trd.State:start(pos, M(pos)) TRD(pos).State:start_if_standby(pos)
end end
return stack:get_count() return stack:get_count()
end end
@ -402,7 +401,7 @@ local node_name_ta2, node_name_ta3, node_name_ta4 =
groups = {choppy=2, cracky=2, crumbly=2}, groups = {choppy=2, cracky=2, crumbly=2},
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
num_items = {0,1,2,4}, num_items = {0,1,2,4},
power_consumption = {0,2,3,4}, power_consumption = {0,4,6,9},
}) })
minetest.register_craft({ minetest.register_craft({

View File

@ -117,18 +117,14 @@ end
local function allow_metadata_inventory_put(pos, listname, index, stack, player) local function allow_metadata_inventory_put(pos, listname, index, stack, player)
local meta = M(pos) local inv = M(pos):get_inventory()
local trd = TRD(pos)
local inv = meta:get_inventory()
local list = inv:get_list(listname) local list = inv:get_list(listname)
if minetest.is_protected(pos, player:get_player_name()) then if minetest.is_protected(pos, player:get_player_name()) then
return 0 return 0
end end
if listname == "src" then if listname == "src" then
if trd.State:get_state(M(pos)) == techage.STANDBY then TRD(pos).State:start_if_standby(pos)
trd.State:start(pos, meta)
end
return stack:get_count() return stack:get_count()
elseif stack:get_count() == 1 and elseif stack:get_count() == 1 and
(list[index]:get_count() == 0 or stack:get_name() ~= list[index]:get_name()) then (list[index]:get_count() == 0 or stack:get_name() ~= list[index]:get_name()) then
@ -273,7 +269,8 @@ local function change_filter_settings(pos, slot, val)
filter_settings(pos) filter_settings(pos)
meta:set_string("formspec", formspec(TRD(pos).State, pos, meta)) local mem = tubelib2.get_mem(pos)
meta:set_string("formspec", formspec(TRD(pos).State, pos, mem))
return true return true
end end

View File

@ -0,0 +1,288 @@
--[[
TechAge
=======
Copyright (C) 2019 Joachim Stolberg
LGPLv2.1+
See LICENSE.txt for more information
TA2/TA3/TA4 Electronic Fab
]]--
-- 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
-- Techage Related Data
local TRD = function(pos) return (minetest.registered_nodes[minetest.get_node(pos).name] or {}).techage end
-- Load support for intllib.
local MP = minetest.get_modpath("techage")
local I,_ = dofile(MP.."/intllib.lua")
local STANDBY_TICKS = 10
local COUNTDOWN_TICKS = 6
local CYCLE_TIME = 6
local ValidInput = {
{}, -- 1
{ -- 2
["default:glass"] = true,
["basic_materials:copper_wire"] = true,
["basic_materials:plastic_sheet"] = true,
},
{}, -- 3
{}, -- 4
}
local Input = {
{}, -- 1
{"default:glass", "basic_materials:copper_wire", "basic_materials:plastic_sheet"}, --2
{}, -- 3
{}, -- 4
}
local Output = {
"", -- 1
"techage:vacuum_tube", -- 2
"", -- 3
"", -- 4
}
local function formspec(self, pos, mem)
return "size[8,8]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"list[context;src;0,0;3,3;]"..
"item_image[0,0;1,1;default:glass]"..
"item_image[0,1;1,1;basic_materials:copper_wire]"..
"item_image[0,2;1,1;basic_materials:plastic_sheet]"..
"image[3.5,0;1,1;"..techage.get_power_image(pos, mem).."]"..
"image[3.5,1;1,1;techage_form_arrow.png]"..
"image_button[3.5,2;1,1;".. self:get_state_button_image(mem) ..";state_button;]"..
"list[context;dst;5,0;3,3;]"..
"item_image[5,0;1,1;techage:vacuum_tube]"..
"list[current_player;main;0,4;8,4;]"..
"listring[context;dst]"..
"listring[current_player;main]"..
"listring[context;src]"..
"listring[current_player;main]"..
default.get_hotbar_bg(0, 4)
end
local function allow_metadata_inventory_put(pos, listname, index, stack, player)
if minetest.is_protected(pos, player:get_player_name()) then
return 0
end
--local meta = minetest.get_meta(pos)
--local inv = meta:get_inventory()
local trd = TRD(pos)
if listname == "src" and ValidInput[trd.stage][stack:get_name()] then
trd.State:start_if_standby(pos)
return stack:get_count()
end
return 0
end
local function allow_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local stack = inv:get_stack(from_list, from_index)
return allow_metadata_inventory_put(pos, to_list, to_index, stack, player)
end
local function allow_metadata_inventory_take(pos, listname, index, stack, player)
if minetest.is_protected(pos, player:get_player_name()) then
return 0
end
return stack:get_count()
end
local function making(pos, trd, mem, inv)
if inv:room_for_item("dst", ItemStack(Output[trd.stage])) then
for _,name in ipairs(Input[trd.stage]) do
if not inv:contains_item("src", ItemStack(name)) then
trd.State:idle(pos, mem)
return
end
end
for _,name in ipairs(Input[trd.stage]) do
inv:remove_item("src", ItemStack(name))
end
inv:add_item("dst", ItemStack(Output[trd.stage]))
trd.State:keep_running(pos, mem, COUNTDOWN_TICKS)
return
end
trd.State:idle(pos, mem)
end
local function keep_running(pos, elapsed)
local mem = tubelib2.get_mem(pos)
local trd = TRD(pos)
local inv = M(pos):get_inventory()
if inv then
making(pos, trd, mem, inv)
end
return trd.State:is_active(mem)
end
local function on_receive_fields(pos, formname, fields, player)
if minetest.is_protected(pos, player:get_player_name()) then
return
end
local mem = tubelib2.get_mem(pos)
TRD(pos).State:state_button_event(pos, mem, fields)
end
local function can_dig(pos, player)
if minetest.is_protected(pos, player:get_player_name()) then
return false
end
local inv = M(pos):get_inventory()
return inv:is_empty("dst") and inv:is_empty("src")
end
local tiles = {}
-- '#' will be replaced by the stage number
tiles.pas = {
-- up, down, right, left, back, front
"techage_filling_ta#.png^techage_frame_ta#_top.png",
"techage_filling_ta#.png^techage_frame_ta#.png",
"techage_filling_ta#.png^techage_frame_ta#.png^techage_appl_outp.png",
"techage_filling_ta#.png^techage_frame_ta#.png^techage_appl_inp.png",
"techage_filling_ta#.png^techage_appl_electronic_fab.png^techage_frame_ta#.png",
"techage_filling_ta#.png^techage_appl_electronic_fab.png^techage_frame_ta#.png",
}
tiles.act = {
-- up, down, right, left, back, front
"techage_filling_ta#.png^techage_frame_ta#_top.png",
"techage_filling_ta#.png^techage_frame_ta#.png",
"techage_filling_ta#.png^techage_frame_ta#.png^techage_appl_outp.png",
"techage_filling_ta#.png^techage_frame_ta#.png^techage_appl_inp.png",
{
image = "techage_filling4_ta#.png^techage_appl_electronic_fab4.png^techage_frame4_ta#.png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = 32,
aspect_h = 32,
length = 0.5,
},
},
{
image = "techage_filling4_ta#.png^techage_appl_electronic_fab4.png^techage_frame4_ta#.png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = 32,
aspect_h = 32,
length = 0.5,
},
},
}
tiles.def = {
-- up, down, right, left, back, front
"techage_filling_ta#.png^techage_frame_ta#_top.png",
"techage_filling_ta#.png^techage_frame_ta#.png",
"techage_filling_ta#.png^techage_frame_ta#.png^techage_appl_outp.png^techage_appl_defect.png",
"techage_filling_ta#.png^techage_frame_ta#.png^techage_appl_inp.png^techage_appl_defect.png",
"techage_filling_ta#.png^techage_appl_electronic_fab.png^techage_frame_ta#.png^techage_appl_defect.png",
"techage_filling_ta#.png^techage_appl_electronic_fab.png^techage_frame_ta#.png^techage_appl_defect.png",
}
local tubing = {
on_pull_item = function(pos, in_dir, num)
local meta = minetest.get_meta(pos)
if meta:get_int("pull_dir") == in_dir then
local inv = M(pos):get_inventory()
return techage.get_items(inv, "dst", num)
end
end,
on_push_item = function(pos, in_dir, stack)
local meta = minetest.get_meta(pos)
if meta:get_int("push_dir") == in_dir or in_dir == 5 then
local inv = M(pos):get_inventory()
return techage.put_items(inv, "src", stack)
end
end,
on_unpull_item = function(pos, in_dir, stack)
local meta = minetest.get_meta(pos)
if meta:get_int("pull_dir") == in_dir then
local inv = M(pos):get_inventory()
return techage.put_items(inv, "dst", stack)
end
end,
on_recv_message = function(pos, topic, payload)
local resp = TRD(pos).State:on_receive_message(pos, topic, payload)
if resp then
return resp
else
return "unsupported"
end
end,
on_node_load = function(pos)
TRD(pos).State:on_node_load(pos)
end,
on_node_repair = function(pos)
return TRD(pos).State:on_node_repair(pos)
end,
}
local node_name_ta2, node_name_ta3, node_name_ta4 =
techage.register_consumer("electronic_fab", I("Electronic Fab"), tiles, {
drawtype = "normal",
cycle_time = CYCLE_TIME,
standby_ticks = STANDBY_TICKS,
has_item_meter = true,
aging_factor = 10,
formspec = formspec,
tubing = tubing,
after_place_node = function(pos, placer)
local inv = M(pos):get_inventory()
inv:set_size("src", 3*3)
inv:set_size("dst", 3*3)
end,
can_dig = can_dig,
node_timer = keep_running,
on_receive_fields = on_receive_fields,
allow_metadata_inventory_put = allow_metadata_inventory_put,
allow_metadata_inventory_move = allow_metadata_inventory_move,
allow_metadata_inventory_take = allow_metadata_inventory_take,
groups = {choppy=2, cracky=2, crumbly=2},
sounds = default.node_sound_wood_defaults(),
num_items = {0,1,1,1},
power_consumption = {0,8,12,18},
})
minetest.register_craft({
output = node_name_ta2,
recipe = {
{"group:wood", "default:diamond", "group:wood"},
{"techage:tubeS", "basic_materials:gear_steel", "techage:tubeS"},
{"group:wood", "techage:steel_ingot", "group:wood"},
},
})
minetest.register_craftitem("techage:vacuum_tube", {
description = I("TA3 Vacuum Tubes"),
inventory_image = "techage_vacuum_tube.png",
})
if minetest.global_exists("unified_inventory") then
unified_inventory.register_craft_type("electronic_fab", {
description = I("Electronic Fab"),
icon = 'techage_filling_ta2.png^techage_appl_electronic_fab.png^techage_frame_ta2.png',
width = 2,
height = 2,
})
unified_inventory.register_craft({
output = "techage:vacuum_tube",
items = {"default:glass", "basic_materials:copper_wire", "basic_materials:plastic_sheet"},
type = "electronic_fab",
})
end

View File

@ -55,9 +55,8 @@ local function allow_metadata_inventory_put(pos, listname, index, stack, player)
if minetest.is_protected(pos, player:get_player_name()) then if minetest.is_protected(pos, player:get_player_name()) then
return 0 return 0
end end
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if listname == "src" then if listname == "src" then
TRD(pos).State:start_if_standby(pos)
return stack:get_count() return stack:get_count()
elseif listname == "dst" then elseif listname == "dst" then
return 0 return 0
@ -237,7 +236,7 @@ local node_name_ta2, node_name_ta3, node_name_ta4 =
groups = {choppy=2, cracky=2, crumbly=2}, groups = {choppy=2, cracky=2, crumbly=2},
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
num_items = {0,1,2,4}, num_items = {0,1,2,4},
power_consumption = {0,2,3,4}, power_consumption = {0,3,4,5},
}) })
minetest.register_craft({ minetest.register_craft({

View File

@ -57,8 +57,8 @@ local function allow_metadata_inventory_put(pos, listname, index, stack, player)
if minetest.is_protected(pos, player:get_player_name()) then if minetest.is_protected(pos, player:get_player_name()) then
return 0 return 0
end end
if listname == "src" and TRD(pos).State:get_state(M(pos)) == techage.STANDBY then if listname == "src" then
TRD(pos).State:start(pos, M(pos)) TRD(pos).State:start_if_standby(pos)
end end
return stack:get_count() return stack:get_count()
end end
@ -248,7 +248,7 @@ local node_name_ta2, node_name_ta3, node_name_ta4 =
groups = {choppy=2, cracky=2, crumbly=2}, groups = {choppy=2, cracky=2, crumbly=2},
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
num_items = {0,1,2,4}, num_items = {0,1,2,4},
power_consumption = {0,2,3,4}, power_consumption = {0,4,6,9},
}) })
minetest.register_craft({ minetest.register_craft({

View File

@ -108,6 +108,7 @@ function techage.register_consumer(base_name, inv_name, tiles, tNode)
stop_node = power_used and stop_node or nil, stop_node = power_used and stop_node or nil,
}) })
local tTechage = { local tTechage = {
stage = stage,
State = tState, State = tState,
num_items = tNode.num_items[stage], num_items = tNode.num_items[stage],
turn_on = power_used and turn_on_clbk or nil, turn_on = power_used and turn_on_clbk or nil,

View File

@ -33,7 +33,7 @@ local function plan(images)
local img = images[y][x] or false local img = images[y][x] or false
if img ~= false then if img ~= false then
local x_offs, y_offs = (x-1) * 1, (y-1) * 1 + 0.8 local x_offs, y_offs = (x-1) * 1, (y-1) * 1 + 0.8
tbl[#tbl+1] = "image["..x_offs..","..y_offs..";1,1;"..img..".png]" tbl[#tbl+1] = "image["..x_offs..","..y_offs..";1,1;"..img.."]"
end end
end end
end end
@ -130,16 +130,16 @@ minetest.register_craft({
function techage.register_help_page(name, text, item_name, images) function techage.register_help_page(name, text, item_name, images)
RecipeList[#RecipeList+1] = name RecipeList[#RecipeList+1] = " "..name
ItemNames[#ItemNames+1] = item_name or "plan" ItemNames[#ItemNames+1] = item_name or "plan"
NamesAsStr = table.concat(RecipeList, ", ") or "" NamesAsStr = table.concat(RecipeList, ",") or ""
Recipes[#Recipes+1] = text Recipes[#Recipes+1] = text
PlanImages[#PlanImages+1] = images or "none" PlanImages[#PlanImages+1] = images or "none"
end end
function techage.register_chap_page(name, text) function techage.register_chap_page(name, text, item_name)
RecipeList[#RecipeList+1] = name RecipeList[#RecipeList+1] = name
ItemNames[#ItemNames+1] = "-" ItemNames[#ItemNames+1] = item_name or "-"
NamesAsStr = table.concat(RecipeList, ",") or "" NamesAsStr = table.concat(RecipeList, ",") or ""
Recipes[#Recipes+1] = text Recipes[#Recipes+1] = text
PlanImages[#PlanImages+1] = "none" PlanImages[#PlanImages+1] = "none"

View File

@ -208,7 +208,7 @@ function NodeStates:start(pos, mem, called_from_on_timer)
self.start_node(pos, mem, state) self.start_node(pos, mem, state)
end end
mem.techage_state = RUNNING mem.techage_state = RUNNING
mem.techage_countdown = 4 mem.techage_countdown = 1
if called_from_on_timer then if called_from_on_timer then
-- timer has to be stopped once to be able to be restarted -- timer has to be stopped once to be able to be restarted
self.stop_timer = true self.stop_timer = true
@ -333,12 +333,19 @@ function NodeStates:is_active(mem)
return state == RUNNING or state == STANDBY or state == BLOCKED return state == RUNNING or state == STANDBY or state == BLOCKED
end end
function NodeStates:start_if_standby(pos)
local mem = tubelib2.get_mem(pos)
if mem.techage_state == STANDBY then
self:start(pos, mem)
end
end
-- To be called if node is idle. -- To be called if node is idle.
-- If countdown reaches zero, the node is set to STANDBY. -- If countdown reaches zero, the node is set to STANDBY.
function NodeStates:idle(pos, mem) function NodeStates:idle(pos, mem)
local countdown = mem.techage_countdown - 1 local countdown = mem.techage_countdown - 1
mem.techage_countdown = countdown mem.techage_countdown = countdown
if countdown < 0 then if countdown <= 0 then
self:standby(pos, mem) self:standby(pos, mem)
end end
end end

View File

@ -60,13 +60,13 @@ else
end end
-- Steam Engine -- Steam Engine
dofile(MP.."/steam_engine/help.lua")
dofile(MP.."/steam_engine/firebox.lua") dofile(MP.."/steam_engine/firebox.lua")
dofile(MP.."/steam_engine/boiler.lua") dofile(MP.."/steam_engine/boiler.lua")
dofile(MP.."/steam_engine/cylinder.lua") dofile(MP.."/steam_engine/cylinder.lua")
dofile(MP.."/steam_engine/flywheel.lua") dofile(MP.."/steam_engine/flywheel.lua")
dofile(MP.."/steam_engine/gearbox.lua") dofile(MP.."/steam_engine/gearbox.lua")
dofile(MP.."/steam_engine/consumer.lua")
-- Basic Machines -- Basic Machines
dofile(MP.."/basic_machines/pusher.lua") dofile(MP.."/basic_machines/pusher.lua")
dofile(MP.."/basic_machines/blackhole.lua") dofile(MP.."/basic_machines/blackhole.lua")
@ -78,6 +78,7 @@ else
dofile(MP.."/basic_machines/autocrafter.lua") dofile(MP.."/basic_machines/autocrafter.lua")
dofile(MP.."/basic_machines/mark.lua") dofile(MP.."/basic_machines/mark.lua")
dofile(MP.."/basic_machines/forceload.lua") dofile(MP.."/basic_machines/forceload.lua")
dofile(MP.."/basic_machines/electronic_fab.lua")
if techage.basalt_stone_enabled then if techage.basalt_stone_enabled then
dofile(MP.."/basic_machines/basalt.lua") dofile(MP.."/basic_machines/basalt.lua")
end end
@ -96,6 +97,7 @@ else
--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.."/fermenter/gasflare.lua") --dofile(MP.."/fermenter/gasflare.lua")

View File

@ -224,11 +224,11 @@ local PileHelp = S([[Coal Pile to produce charcoal:
(see plan)]]) (see plan)]])
local PileImages = { local PileImages = {
{"default_dirt", "default_dirt", "default_dirt", "default_dirt", "default_dirt"}, {"default_dirt.png", "default_dirt.png", "default_dirt.png", "default_dirt.png", "default_dirt.png"},
{"default_dirt", "default_wood", "default_wood", "default_wood", "default_dirt"}, {"default_dirt.png", "default_wood.png", "default_wood.png", "default_wood.png", "default_dirt.png"},
{"default_dirt", "default_wood", "default_wood", "default_wood", "default_dirt"}, {"default_dirt.png", "default_wood.png", "default_wood.png", "default_wood.png", "default_dirt.png"},
{"default_dirt", "default_wood", "techage_lighter", "default_wood", "default_dirt"}, {"default_dirt.png", "default_wood.png", "techage_lighter.png", "default_wood.png", "default_dirt.png"},
{"default_dirt", "default_dirt", "default_dirt", "default_dirt", "default_dirt"}, {"default_dirt.png", "default_dirt.png", "default_dirt.png", "default_dirt.png", "default_dirt.png"},
} }
techage.register_help_page("Coal Pile", PileHelp, nil, PileImages) techage.register_help_page("Coal Pile", PileHelp, nil, PileImages)

View File

@ -203,14 +203,14 @@ local BurnerHelp = S([[Coal Burner to heat the melting pot:
local BurnerImages = { local BurnerImages = {
{false, false, false, "default_cobble.png^techage_meltingpot", false}, {false, false, false, "default_cobble.png^techage_meltingpot.png", false},
{false, false, false, false, false}, {false, false, false, false, false},
{false, false, "default_cobble", "techage_charcoal", "default_cobble"}, {false, false, "default_cobble.png", "techage_charcoal.png", "default_cobble.png"},
{false, false, "default_cobble", "techage_charcoal", "default_cobble"}, {false, false, "default_cobble.png", "techage_charcoal.png", "default_cobble.png"},
{false, false, "default_cobble", "techage_charcoal", "default_cobble"}, {false, false, "default_cobble.png", "techage_charcoal.png", "default_cobble.png"},
{false, false, "default_cobble", "techage_charcoal", "default_cobble"}, {false, false, "default_cobble.png", "techage_charcoal.png", "default_cobble.png"},
{false, false, false, "techage_lighter", "default_cobble"}, {false, false, false, "techage_lighter.png", "default_cobble.png"},
{false, false, "default_cobble", "default_cobble", "default_cobble"}, {false, false, "default_cobble.png", "default_cobble.png", "default_cobble.png"},
} }
techage.register_help_page("Coal Burner", BurnerHelp, nil, BurnerImages) techage.register_help_page("Coal Burner", BurnerHelp, nil, BurnerImages)

View File

@ -134,7 +134,7 @@ for idx = 0,3 do
paramtype2 = "facedir", paramtype2 = "facedir",
sunlight_propagates = true, sunlight_propagates = true,
is_ground_content = false, is_ground_content = false,
groups = {choppy = 2, cracky = 1}, groups = {choppy = 2, cracky = 1, not_in_creative_inventory = (idx == 3) and 0 or 1},
drop = "techage:sieve3", drop = "techage:sieve3",
}) })
end end

View File

@ -32,13 +32,13 @@ function techage.ironage_swap_nodes(pos1, pos2, name1, name2)
end end
techage.register_chap_page("Iron Age (TA1)", S([[Iron Age is the first level of the available technic stages. techage.register_chap_page("Iron Age (TA1)", S([[Iron Age is the first level of the available technic stages.
The goal of TA1 is to collect and craft enough XYZ Ingots The goal of TA1 is to collect and craft enough Iron Ingots
to be able to build machines for stage 2 (TA2). to be able to build machines for stage 2 (TA2).
1. You have to collect dirt and wood to build a Coal Pile. 1. You have to collect dirt and wood to build a Coal Pile.
(The Coal Pile is needed to produce charcoal) (The Coal Pile is needed to produce charcoal)
2. Build a Coal Burner to melt iron to steel ingots. 2. Build a Coal Burner to melt iron to iron ingots.
3. Craft a Gravel Sieve and collect gravel. 3. Craft a Gravel Sieve and collect gravel.
(A Hammer can be used to smash cobble to gravel) (A Hammer can be used to smash cobble to gravel)
4. Sieve the gravel to get the necessary ores 4. Sieve the gravel to get the necessary ores or go mining.
]])) ]]), "techage:iron_ingot")

View File

@ -255,7 +255,7 @@ minetest.register_node("techage:boiler2", {
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 = Pipe, power_network = Pipe,
trigger_boiler = function(pos) signal_heat = function(pos)
local mem = tubelib2.get_mem(pos) local mem = tubelib2.get_mem(pos)
mem.fire_trigger = true mem.fire_trigger = true
if not minetest.get_node_timer(pos):is_started() then if not minetest.get_node_timer(pos):is_started() then
@ -315,3 +315,14 @@ minetest.register_craft({
{"techage:iron_ingot", "", "techage:iron_ingot"}, {"techage:iron_ingot", "", "techage:iron_ingot"},
}, },
}) })
techage.register_help_page(I("TA2 Boiler Base"),
I([[Part of the steam engine.
Has to be placed on top of the Firebox
and filled with water.
(see TA2 Steam Engine)]]), "techage:boiler1")
techage.register_help_page(I("TA2 Boiler Top"),
I([[Part of the steam engine.
Has to be placed on top of TA2 Boiler Base.
(see TA2 Steam Engine)]]), "techage:boiler2")

View File

@ -155,3 +155,9 @@ minetest.register_craft({
{"default:wood", "techage:iron_ingot", "basic_materials:steel_bar"}, {"default:wood", "techage:iron_ingot", "basic_materials:steel_bar"},
}, },
}) })
techage.register_help_page(I("TA2 Cylinder"),
I([[Part of the steam engine.
Has to be placed side by side
with the TA2 Flywheel.
(see TA2 Steam Engine)]]), "techage:cylinder")

View File

@ -32,8 +32,8 @@ local function node_timer(pos, elapsed)
local mem = tubelib2.get_mem(pos) local mem = tubelib2.get_mem(pos)
if mem.running then if mem.running then
local trd = TRD({x=pos.x, y=pos.y+2, z=pos.z}) local trd = TRD({x=pos.x, y=pos.y+2, z=pos.z})
if trd and trd.trigger_boiler then if trd and trd.signal_heat then
trd.trigger_boiler({x=pos.x, y=pos.y+2, z=pos.z}) trd.signal_heat({x=pos.x, y=pos.y+2, z=pos.z})
end end
mem.burn_cycles = (mem.burn_cycles or 0) - 1 mem.burn_cycles = (mem.burn_cycles or 0) - 1
if mem.burn_cycles <= 0 then if mem.burn_cycles <= 0 then
@ -143,3 +143,16 @@ minetest.register_craft({
{'group:stone', 'group:stone', 'group:stone'}, {'group:stone', 'group:stone', 'group: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,
})

View File

@ -26,7 +26,7 @@ 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 = 12 local POWER_CAPACITY = 20
local Axle = techage.Axle local Axle = techage.Axle
local generator = techage.generator local generator = techage.generator
@ -274,3 +274,11 @@ minetest.register_lbm({
end end
}) })
techage.register_help_page(I("TA2 Flywheel"),
I([[Part of the steam engine.
Has to be placed side by side
with the TA2 Cylinder.
Used to turn on/off the steam engine.
Connect the Flywheel with your TA2 machines
by means of Axles and Gearboxes
(see TA2 Steam Engine)]]), "techage:flywheel")

49
steam_engine/help.lua Normal file
View File

@ -0,0 +1,49 @@
--[[
TechAge
=======
Copyright (C) 2019 Joachim Stolberg
LGPLv2.1+
See LICENSE.txt for more information
TA2 Steam Engine Help
]]--
-- Load support for intllib.
local MP = minetest.get_modpath("techage")
local S, NS = dofile(MP.."/intllib.lua")
techage.register_chap_page(S("Steam Age (TA2)"), S([[Steam Age is the second level of the available technic stages.
The goal of TA2 is build a steam engine and machines
to produce ores and vacuum tubes for the first
electronic devices and machines in TA3.]]), "techage:vacuum_tube")
local HelpText = S([[1. Build a steam machine according
to the plan with TA2 Firebox, TA2 Boiler,
Steam Pipes, TA2 Cyclinder and TA2 Flywheel.
2. Heat the Firebox with coal/charcoal
3. Fill the boiler with water (more than on bucket is needed)
4. Wait until the water is heated
5. Open the steam ventil
6. Start the Flywheel
7. Connect the Flywheel with your machines by means of Axles and Gearboxes]])
local Images = {
{false, false, false, false, false, false, false},
{false, false, false, false, false, false, false},
{false, false, "techage_steam_knee.png", 'techage_steam_pipe.png', "techage_steam_knee.png^[transformR270"},
{false, false, "techage_boiler_top_ta2.png", false, 'techage_steam_pipe.png^[transformR90'},
{false, false, "techage_boiler_bottom_ta2.png", false, 'techage_steam_pipe.png^[transformR90'},
{false, false, "techage_firebox.png^techage_appl_firehole.png^techage_frame_ta2.png", false,
"techage_steam_knee.png^[transformR90",
"techage_filling_ta2.png^techage_cylinder.png^techage_frame_ta2.png",
"techage_filling_ta2.png^techage_frame_ta2.png^techage_flywheel.png^[transformFX]"},
}
techage.register_help_page("Steam Machine", HelpText, nil, Images)

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 185 B

After

Width:  |  Height:  |  Size: 185 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB