guide help improved

This commit is contained in:
Joachim Stolberg 2019-04-30 23:58:42 +02:00
parent d55f9ce030
commit 096b85ee1c
11 changed files with 119 additions and 97 deletions

View File

@ -19,6 +19,7 @@ local MP = minetest.get_modpath("techage")
local S, NS = dofile(MP.."/intllib.lua") local S, NS = dofile(MP.."/intllib.lua")
local Recipes = {} local Recipes = {}
local ItemNames = {}
local RecipeList = {} local RecipeList = {}
local PlanImages = {} local PlanImages = {}
local NamesAsStr = "" local NamesAsStr = ""
@ -40,13 +41,22 @@ local function plan(images)
end end
local function formspec_help(idx) local function formspec_help(idx)
local bttn
if ItemNames[idx] == "-" then
bttn = ""
elseif ItemNames[idx] == "plan" then
bttn = "button[7.6,1;1,1;plan;"..S("Plan").."]"
else
bttn = "item_image[7.6,1;1,1;"..ItemNames[idx].."]"
end
return "size[9,9]".. return "size[9,9]"..
default.gui_bg.. default.gui_bg..
default.gui_bg_img.. default.gui_bg_img..
default.gui_slots.. default.gui_slots..
"tabheader[0,0;tab;"..S("Help,Plan")..";1;;true]".. "item_image[7.6,0;1,1;techage:construction_board]"..
"table[0.1,0;8.6,3;page;"..NamesAsStr..";"..idx.."]".. bttn..
"textarea[0.3,3.7;9,6.2;help;Help:;"..Recipes[idx].."]" "table[0.1,0;7,3;page;"..NamesAsStr..";"..idx.."]"..
"textarea[0.3,3.7;9,6.2;help;"..S("Help")..":;"..Recipes[idx].."]"
end end
local function formspec_plan(idx) local function formspec_plan(idx)
@ -54,8 +64,8 @@ local function formspec_plan(idx)
default.gui_bg.. default.gui_bg..
default.gui_bg_img.. default.gui_bg_img..
default.gui_slots.. default.gui_slots..
"tabheader[0,0;tab;"..S("Help,Plan")..";2;;true]"..
"label[0,0;"..RecipeList[idx]..":]".. "label[0,0;"..RecipeList[idx]..":]"..
"button[8,0;1,0.8;back;<<]"..
plan(PlanImages[idx]) plan(PlanImages[idx])
end end
@ -66,7 +76,7 @@ local board_box = {
wall_side = {-16/32, -11/32, -16/32, -15/32, 6/16, 8/16}, wall_side = {-16/32, -11/32, -16/32, -15/32, 6/16, 8/16},
} }
minetest.register_node("techage:constr_board", { minetest.register_node("techage:construction_board", {
description = S("TA Construction Board"), description = S("TA Construction Board"),
inventory_image = 'techage_constr_plan_inv.png', inventory_image = 'techage_constr_plan_inv.png',
tiles = {"techage_constr_plan.png"}, tiles = {"techage_constr_plan.png"},
@ -83,13 +93,14 @@ minetest.register_node("techage:constr_board", {
if minetest.is_protected(pos, player:get_player_name()) then if minetest.is_protected(pos, player:get_player_name()) then
return return
end end
print(dump(fields))
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local idx = meta:get_int("help_idx") local idx = meta:get_int("help_idx")
idx = techage.range(idx, 1, #Recipes) idx = techage.range(idx, 1, #Recipes)
if fields.tab == "1" then if fields.plan then
meta:set_string("formspec", formspec_help(idx))
elseif fields.tab == "2" then
meta:set_string("formspec", formspec_plan(idx)) meta:set_string("formspec", formspec_plan(idx))
elseif fields.back then
meta:set_string("formspec", formspec_help(idx))
elseif fields.page then elseif fields.page then
local evt = minetest.explode_table_event(fields.page) local evt = minetest.explode_table_event(fields.page)
if evt.type == "CHG" then if evt.type == "CHG" then
@ -110,17 +121,18 @@ minetest.register_node("techage:constr_board", {
}) })
minetest.register_craft({ minetest.register_craft({
output = "techage:constr_board", output = "techage:construction_board",
recipe = { recipe = {
{"default:sticks", "default:sticks", "default:sticks"}, {"default:stick", "default:stick", "default:stick"},
{"default:paper", "default:paper", "default:paper"},
{"default:paper", "default:paper", "default:paper"}, {"default:paper", "default:paper", "default:paper"},
{"", "", ""},
}, },
}) })
function techage.register_help_page(name, text, 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"
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"
@ -128,6 +140,7 @@ end
function techage.register_chap_page(name, text) function techage.register_chap_page(name, text)
RecipeList[#RecipeList+1] = name RecipeList[#RecipeList+1] = name
ItemNames[#ItemNames+1] = "-"
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

@ -55,7 +55,6 @@ else
dofile(MP.."/iron_age/tools.lua") dofile(MP.."/iron_age/tools.lua")
end end
dofile(MP.."/iron_age/recipes.lua") dofile(MP.."/iron_age/recipes.lua")
dofile(MP.."/iron_age/help.lua")
if minetest.global_exists("wielded_light") then if minetest.global_exists("wielded_light") then
dofile(MP.."/iron_age/meridium.lua") dofile(MP.."/iron_age/meridium.lua")
end end

View File

@ -212,3 +212,23 @@ minetest.register_lbm({
end end
}) })
local PileHelp = S([[Coal Pile to produce charcoal:
- build a 5x5 block dirt base
- place a lighter in the centre
- build a 3x3x3 wood cube around
- cover all with dirt to a 5x5x5 cube
- keep a hole to the lighter
- ignite the lighter and immediately
- close the pile with one wood and one dirt
- open the pile after the smoke disappeared
(see plan)]])
local PileImages = {
{"default_dirt", "default_dirt", "default_dirt", "default_dirt", "default_dirt"},
{"default_dirt", "default_wood", "default_wood", "default_wood", "default_dirt"},
{"default_dirt", "default_wood", "default_wood", "default_wood", "default_dirt"},
{"default_dirt", "default_wood", "techage_lighter", "default_wood", "default_dirt"},
{"default_dirt", "default_dirt", "default_dirt", "default_dirt", "default_dirt"},
}
techage.register_help_page("Coal Pile", PileHelp, nil, PileImages)

View File

@ -189,3 +189,28 @@ function techage.stop_burner(pos)
local handle = meta:get_int("handle") local handle = meta:get_int("handle")
minetest.sound_stop(handle) minetest.sound_stop(handle)
end end
local BurnerHelp = S([[Coal Burner to heat the melting pot:
- build a 3x3xN cobble tower
- more height means more flame heat
- keep a hole open on one side
- put a lighter in
- fill the tower from the top with charcoal
- ignite the lighter
- place the pot in the flame, (one block above the tower)
(see plan)]])
local BurnerImages = {
{false, false, false, "default_cobble.png^techage_meltingpot", false},
{false, false, false, false, false},
{false, false, "default_cobble", "techage_charcoal", "default_cobble"},
{false, false, "default_cobble", "techage_charcoal", "default_cobble"},
{false, false, "default_cobble", "techage_charcoal", "default_cobble"},
{false, false, "default_cobble", "techage_charcoal", "default_cobble"},
{false, false, false, "techage_lighter", "default_cobble"},
{false, false, "default_cobble", "default_cobble", "default_cobble"},
}
techage.register_help_page("Coal Burner", BurnerHelp, nil, BurnerImages)

View File

@ -119,14 +119,14 @@ minetest.register_node("techage:funnel_ta1", {
}) })
--minetest.register_craft({ minetest.register_craft({
-- output = "techage:funnel_ta1", output = "techage:funnel_ta1",
-- recipe = { recipe = {
-- {"group:wood", "", "group:wood"}, {"default:stone", "", "default:stone"},
-- {"default:steel_ingot", "default:mese_crystal", "tubelib:tubeS"}, {"default:stone", "default:gold_ingot", "default:stone"},
-- {"group:wood", "", "group:wood"}, {"", "default:stone", ""},
-- }, },
--}) })
techage.register_node("techage:funnel_ta1", {}, { techage.register_node("techage:funnel_ta1", {}, {
on_pull_item = nil, -- not needed on_pull_item = nil, -- not needed
@ -138,3 +138,8 @@ techage.register_node("techage:funnel_ta1", {}, {
return techage.put_items(inv, "main", stack) return techage.put_items(inv, "main", stack)
end, end,
}) })
techage.register_help_page("TA1 Funnel", [[The Funnel collects dropped items
and pushes them to the right side.
Items are sucked up when they
are dropped on top of the funnel block.]], "techage:funnel_ta1")

View File

@ -193,3 +193,9 @@ minetest.register_craft({
minetest.register_alias("techage:sieve", "techage:sieve3") minetest.register_alias("techage:sieve", "techage:sieve3")
minetest.register_alias("techage:auto_sieve", "techage:auto_sieve3") minetest.register_alias("techage:auto_sieve", "techage:auto_sieve3")
techage.register_help_page("TA1 Gravel Sieve", [[To sieve Gravel and Basalt Gravel
to get ores.
The sieve can be automated by means
of the TA1 Funnel.
Gravel can be found in caves or
generated by means of a TA1 Hammer.]], "techage:sieve3")

View File

@ -32,7 +32,7 @@ local function handler(player_name, node, itemstack, digparams)
end end
minetest.register_tool("techage:hammer_bronze", { minetest.register_tool("techage:hammer_bronze", {
description = I("Bronze Hammer (converts stone into gravel)"), description = I("TA1 Bronze Hammer (smash stone to gravel)"),
inventory_image = "techage_tool_hammer_bronze.png", inventory_image = "techage_tool_hammer_bronze.png",
tool_capabilities = { tool_capabilities = {
full_punch_interval = 1.0, full_punch_interval = 1.0,
@ -51,7 +51,7 @@ minetest.register_tool("techage:hammer_bronze", {
}) })
minetest.register_tool("techage:hammer_steel", { minetest.register_tool("techage:hammer_steel", {
description = I("Steel Hammer (converts stone into gravel)"), description = I("TA1 Steel Hammer (smash stone to gravel)"),
inventory_image = "techage_tool_hammer_steel.png", inventory_image = "techage_tool_hammer_steel.png",
tool_capabilities = { tool_capabilities = {
full_punch_interval = 1.0, full_punch_interval = 1.0,
@ -70,7 +70,7 @@ minetest.register_tool("techage:hammer_steel", {
}) })
minetest.register_tool("techage:hammer_mese", { minetest.register_tool("techage:hammer_mese", {
description = I("Mese Hammer (converts stone into gravel)"), description = I("TA1 Mese Hammer (smash stone to gravel)"),
inventory_image = "techage_tool_hammer_mese.png", inventory_image = "techage_tool_hammer_mese.png",
tool_capabilities = { tool_capabilities = {
full_punch_interval = 0.9, full_punch_interval = 0.9,
@ -89,7 +89,7 @@ minetest.register_tool("techage:hammer_mese", {
}) })
minetest.register_tool("techage:hammer_diamond", { minetest.register_tool("techage:hammer_diamond", {
description = I("Diamond Hammer (converts stone into gravel)"), description = I("TA1 Diamond Hammer (smash stone to gravel)"),
inventory_image = "techage_tool_hammer_diamond.png", inventory_image = "techage_tool_hammer_diamond.png",
tool_capabilities = { tool_capabilities = {
full_punch_interval = 0.9, full_punch_interval = 0.9,
@ -139,3 +139,6 @@ minetest.register_craft({
{"", "group:stick", ""}, {"", "group:stick", ""},
} }
}) })
techage.register_help_page("TA1 xxx Hammer", [[Hammer to smash stone to gravel.
Available as Bronze, Steel, Mese, and Diamond Hammer.]], "techage:hammer_bronze")

View File

@ -1,71 +0,0 @@
--[[
TechAge
=======
Copyright (C) 2019 Joachim Stolberg
LGPLv2.1+
See LICENSE.txt for more information
Help pages
]]--
-- Load support for intllib.
local MP = minetest.get_modpath("techage")
local S, NS = dofile(MP.."/intllib.lua")
local IronAgeHelp = S([[Iron Age is the first level of the available technic stages.
The goal of TA1 is to collect and craft enough XYZ Ingots
to be able to build machines for stage 2 (TA2).
1. You have to collect dirt and wood to build a Coal Pile.
(The Coal Pile is needed to produce charcoal)
2. Build a Coal Burner to melt iron to steel ingots.
3. Craft a Gravel Sieve and collect gravel.
(A Hammer can be used to smash cobble to gravel)
4. Sieve the gravel to get the necessary ores
]])
local PileHelp = S([[Coal Pile to produce charcoal:
- build a 5x5 block dirt base
- place a lighter in the centre
- build a 3x3x3 wood cube around
- cover all with dirt to a 5x5x5 cube
- keep a hole to the lighter
- ignite the lighter and immediately
- close the pile with one wood and one dirt
- open the pile after the smoke disappeared]])
local BurnerHelp = S([[Coal Burner to heat the melting pot:
- build a 3x3xN cobble tower
- more height means more flame heat
- keep a hole open on one side
- put a lighter in
- fill the tower from the top with charcoal
- ignite the lighter
- place the pot in the flame, (one block above the tower)]])
local PileImages = {
{"default_dirt", "default_dirt", "default_dirt", "default_dirt", "default_dirt"},
{"default_dirt", "default_wood", "default_wood", "default_wood", "default_dirt"},
{"default_dirt", "default_wood", "default_wood", "default_wood", "default_dirt"},
{"default_dirt", "default_wood", "techage_lighter", "default_wood", "default_dirt"},
{"default_dirt", "default_dirt", "default_dirt", "default_dirt", "default_dirt"},
}
local BurnerImages = {
{false, false, false, "default_cobble.png^techage_meltingpot", false},
{false, false, false, false, false},
{false, false, "default_cobble", "techage_charcoal", "default_cobble"},
{false, false, "default_cobble", "techage_charcoal", "default_cobble"},
{false, false, "default_cobble", "techage_charcoal", "default_cobble"},
{false, false, "default_cobble", "techage_charcoal", "default_cobble"},
{false, false, false, "techage_lighter", "default_cobble"},
{false, false, "default_cobble", "default_cobble", "default_cobble"},
}
techage.register_chap_page("Iron Age (TA1)", IronAgeHelp)
techage.register_help_page("Coal Pile", PileHelp, PileImages)
techage.register_help_page("Coal Burner", BurnerHelp, BurnerImages)

View File

@ -63,7 +63,7 @@ minetest.register_node("techage:coal_lighter_burn", {
}) })
minetest.register_node("techage:lighter", { minetest.register_node("techage:lighter", {
description = S("Lighter"), description = S("TA1 Lighter"),
tiles = {"techage_lighter.png"}, tiles = {"techage_lighter.png"},
on_ignite = function(pos, igniter) on_ignite = function(pos, igniter)
if minetest.find_node_near(pos, 1, "techage:charcoal") then if minetest.find_node_near(pos, 1, "techage:charcoal") then
@ -89,3 +89,7 @@ minetest.register_craft({
{''}, {''},
} }
}) })
techage.register_help_page("TA1 Lighter", [[lighter to ignite the Coal Burner
and the Coal Pile.]], "techage:lighter")

View File

@ -10,6 +10,10 @@
]]-- ]]--
-- Load support for intllib.
local MP = minetest.get_modpath("techage")
local S, NS = dofile(MP.."/intllib.lua")
function techage.ironage_swap_node(pos, name) function techage.ironage_swap_node(pos, name)
minetest.swap_node(pos, {name = name}) minetest.swap_node(pos, {name = name})
local node = minetest.registered_nodes[name] local node = minetest.registered_nodes[name]
@ -27,3 +31,14 @@ function techage.ironage_swap_nodes(pos1, pos2, name1, name2)
end end
end end
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
to be able to build machines for stage 2 (TA2).
1. You have to collect dirt and wood to build a Coal Pile.
(The Coal Pile is needed to produce charcoal)
2. Build a Coal Burner to melt iron to steel ingots.
3. Craft a Gravel Sieve and collect gravel.
(A Hammer can be used to smash cobble to gravel)
4. Sieve the gravel to get the necessary ores
]]))

View File

@ -509,3 +509,6 @@ function techage.ironage_register_recipe(recipe)
unified_inventory.register_craft(recipe) unified_inventory.register_craft(recipe)
end end
end end
techage.register_help_page("TA1 Melting Pot", [[To melt ores and/or produce alloys.
Place the pot on top of the Coal Burner.]], "techage:meltingpot")