From 096b85ee1c8f1c3fbf03c213a5ff8cbf644be351 Mon Sep 17 00:00:00 2001 From: Joachim Stolberg Date: Tue, 30 Apr 2019 23:58:42 +0200 Subject: [PATCH] guide help improved --- basis/guide.lua | 37 +++++++++++++------- init.lua | 1 - iron_age/charcoalpile.lua | 20 +++++++++++ iron_age/coalburner.lua | 25 ++++++++++++++ iron_age/funnel.lua | 21 +++++++----- iron_age/gravelsieve.lua | 6 ++++ iron_age/hammer.lua | 11 +++--- iron_age/help.lua | 71 --------------------------------------- iron_age/lighter.lua | 6 +++- iron_age/main.lua | 15 +++++++++ iron_age/meltingpot.lua | 3 ++ 11 files changed, 119 insertions(+), 97 deletions(-) delete mode 100644 iron_age/help.lua diff --git a/basis/guide.lua b/basis/guide.lua index 2250859..ecc8e50 100644 --- a/basis/guide.lua +++ b/basis/guide.lua @@ -19,6 +19,7 @@ local MP = minetest.get_modpath("techage") local S, NS = dofile(MP.."/intllib.lua") local Recipes = {} +local ItemNames = {} local RecipeList = {} local PlanImages = {} local NamesAsStr = "" @@ -40,13 +41,22 @@ local function plan(images) end 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]".. default.gui_bg.. default.gui_bg_img.. default.gui_slots.. - "tabheader[0,0;tab;"..S("Help,Plan")..";1;;true]".. - "table[0.1,0;8.6,3;page;"..NamesAsStr..";"..idx.."]".. - "textarea[0.3,3.7;9,6.2;help;Help:;"..Recipes[idx].."]" + "item_image[7.6,0;1,1;techage:construction_board]".. + bttn.. + "table[0.1,0;7,3;page;"..NamesAsStr..";"..idx.."]".. + "textarea[0.3,3.7;9,6.2;help;"..S("Help")..":;"..Recipes[idx].."]" end local function formspec_plan(idx) @@ -54,8 +64,8 @@ local function formspec_plan(idx) default.gui_bg.. default.gui_bg_img.. default.gui_slots.. - "tabheader[0,0;tab;"..S("Help,Plan")..";2;;true]".. "label[0,0;"..RecipeList[idx]..":]".. + "button[8,0;1,0.8;back;<<]".. plan(PlanImages[idx]) end @@ -66,7 +76,7 @@ local board_box = { 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"), inventory_image = 'techage_constr_plan_inv.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 return end + print(dump(fields)) local meta = minetest.get_meta(pos) local idx = meta:get_int("help_idx") idx = techage.range(idx, 1, #Recipes) - if fields.tab == "1" then - meta:set_string("formspec", formspec_help(idx)) - elseif fields.tab == "2" then + if fields.plan then meta:set_string("formspec", formspec_plan(idx)) + elseif fields.back then + meta:set_string("formspec", formspec_help(idx)) elseif fields.page then local evt = minetest.explode_table_event(fields.page) if evt.type == "CHG" then @@ -110,17 +121,18 @@ minetest.register_node("techage:constr_board", { }) minetest.register_craft({ - output = "techage:constr_board", + output = "techage:construction_board", 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"}, - {"", "", ""}, }, }) -function techage.register_help_page(name, text, images) +function techage.register_help_page(name, text, item_name, images) RecipeList[#RecipeList+1] = name + ItemNames[#ItemNames+1] = item_name or "plan" NamesAsStr = table.concat(RecipeList, ", ") or "" Recipes[#Recipes+1] = text PlanImages[#PlanImages+1] = images or "none" @@ -128,6 +140,7 @@ end function techage.register_chap_page(name, text) RecipeList[#RecipeList+1] = name + ItemNames[#ItemNames+1] = "-" NamesAsStr = table.concat(RecipeList, ",") or "" Recipes[#Recipes+1] = text PlanImages[#PlanImages+1] = "none" diff --git a/init.lua b/init.lua index 1d8d3d9..1b9c6ff 100644 --- a/init.lua +++ b/init.lua @@ -55,7 +55,6 @@ else dofile(MP.."/iron_age/tools.lua") end dofile(MP.."/iron_age/recipes.lua") - dofile(MP.."/iron_age/help.lua") if minetest.global_exists("wielded_light") then dofile(MP.."/iron_age/meridium.lua") end diff --git a/iron_age/charcoalpile.lua b/iron_age/charcoalpile.lua index 890e0f1..ccf1c65 100644 --- a/iron_age/charcoalpile.lua +++ b/iron_age/charcoalpile.lua @@ -212,3 +212,23 @@ minetest.register_lbm({ 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) diff --git a/iron_age/coalburner.lua b/iron_age/coalburner.lua index b3c6ec1..1a33e84 100644 --- a/iron_age/coalburner.lua +++ b/iron_age/coalburner.lua @@ -189,3 +189,28 @@ function techage.stop_burner(pos) local handle = meta:get_int("handle") minetest.sound_stop(handle) 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) diff --git a/iron_age/funnel.lua b/iron_age/funnel.lua index 8e1163b..d090235 100644 --- a/iron_age/funnel.lua +++ b/iron_age/funnel.lua @@ -119,14 +119,14 @@ minetest.register_node("techage:funnel_ta1", { }) ---minetest.register_craft({ --- output = "techage:funnel_ta1", --- recipe = { --- {"group:wood", "", "group:wood"}, --- {"default:steel_ingot", "default:mese_crystal", "tubelib:tubeS"}, --- {"group:wood", "", "group:wood"}, --- }, ---}) +minetest.register_craft({ + output = "techage:funnel_ta1", + recipe = { + {"default:stone", "", "default:stone"}, + {"default:stone", "default:gold_ingot", "default:stone"}, + {"", "default:stone", ""}, + }, +}) techage.register_node("techage:funnel_ta1", {}, { on_pull_item = nil, -- not needed @@ -138,3 +138,8 @@ techage.register_node("techage:funnel_ta1", {}, { return techage.put_items(inv, "main", stack) 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") \ No newline at end of file diff --git a/iron_age/gravelsieve.lua b/iron_age/gravelsieve.lua index f8c56e7..ae0e0c9 100644 --- a/iron_age/gravelsieve.lua +++ b/iron_age/gravelsieve.lua @@ -193,3 +193,9 @@ minetest.register_craft({ minetest.register_alias("techage:sieve", "techage: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") \ No newline at end of file diff --git a/iron_age/hammer.lua b/iron_age/hammer.lua index 80fc415..42ebcb8 100644 --- a/iron_age/hammer.lua +++ b/iron_age/hammer.lua @@ -32,7 +32,7 @@ local function handler(player_name, node, itemstack, digparams) end 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", tool_capabilities = { full_punch_interval = 1.0, @@ -51,7 +51,7 @@ minetest.register_tool("techage:hammer_bronze", { }) 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", tool_capabilities = { full_punch_interval = 1.0, @@ -70,7 +70,7 @@ minetest.register_tool("techage:hammer_steel", { }) 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", tool_capabilities = { full_punch_interval = 0.9, @@ -89,7 +89,7 @@ minetest.register_tool("techage:hammer_mese", { }) 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", tool_capabilities = { full_punch_interval = 0.9, @@ -139,3 +139,6 @@ minetest.register_craft({ {"", "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") diff --git a/iron_age/help.lua b/iron_age/help.lua deleted file mode 100644 index 01507dd..0000000 --- a/iron_age/help.lua +++ /dev/null @@ -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) \ No newline at end of file diff --git a/iron_age/lighter.lua b/iron_age/lighter.lua index 03ed0f6..e7a8758 100644 --- a/iron_age/lighter.lua +++ b/iron_age/lighter.lua @@ -63,7 +63,7 @@ minetest.register_node("techage:coal_lighter_burn", { }) minetest.register_node("techage:lighter", { - description = S("Lighter"), + description = S("TA1 Lighter"), tiles = {"techage_lighter.png"}, on_ignite = function(pos, igniter) 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") + diff --git a/iron_age/main.lua b/iron_age/main.lua index 03b8391..85e89dd 100644 --- a/iron_age/main.lua +++ b/iron_age/main.lua @@ -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) minetest.swap_node(pos, {name = name}) local node = minetest.registered_nodes[name] @@ -27,3 +31,14 @@ 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. +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 +]])) + diff --git a/iron_age/meltingpot.lua b/iron_age/meltingpot.lua index 1d22502..4c76a06 100644 --- a/iron_age/meltingpot.lua +++ b/iron_age/meltingpot.lua @@ -509,3 +509,6 @@ function techage.ironage_register_recipe(recipe) unified_inventory.register_craft(recipe) 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")