User Guide/Tome additions

electrolyzer instructions
Simple getting started guide
Some new page layouts that can be used for additional information
This commit is contained in:
Sirrobzeroone 2021-06-27 22:48:07 +10:00
parent 0a7cc0ce80
commit 2897e859b9
17 changed files with 309 additions and 10 deletions

View File

@ -41,7 +41,7 @@ local function get_formspec(time, power, input, out1, out2, state)
ele.formspec.power_meter(power)..
ele.formspec.fluid_bar(1, 0, input)..
"image[1.2,2.45;0.5,0.5;elepower_gui_icon_fluid_electrolyzer_in.png]"..
"tooltip[1.0,2.0;1,1;"..minetest.colorize("#0399c6"," Water\nHeavy Water\n BioFuel").."]"..
"tooltip[1.0,2.0;1,1;"..minetest.colorize("#0399c6"," Water\nHeavy Water\n BioMass").."]"..
ele.formspec.state_switcher(3.5, 0, state)..
bar..
ele.formspec.fluid_bar(6, 0, out1)..

View File

@ -217,9 +217,164 @@ eletome.ai.fusion_reactor.over = ""
-- Structure - {[4] = "reg_node_name_1",
-- [5] = "image_name_1.png",
-- [6] = "reg_node_name_1"}
--below only used on help pages
-- how_use_1 = left page text
-- hu_img_1 = <optional> image below text, can be a png file name string or a table with a single
--entry containing a container and formspec ("container[2.25,6.6]"..<formspec>.."container_end[]")
-- note x can be adjusted but y cant be changed without causing possible overlap with txt
-- how_use_t2 and hu_img_2 = as above but right page
eletome.ai.nodes = {}
-- Help Pages
eletome.ai.nodes["getting_started"] = {how_use_1 = "This is a getting started guide for Elepower. "..
"The first step is to create your first power generator. "..
"The coal-fired generator is a good starting generator "..
"as it will produce power from anything that is burnable."..
"You will need 3 Steel Ingots, 2 Wound copper coils, "..
"1 Furnace and 1 Machine block to create a coal-fired generator. "..
"To craft all those you will need a Total of: "..
"174 leaves, 17 Copper Ingots, 8 Stone blocks, 9 Steel Ingots, "..
"3 sand, 2 Iron ingots, 2 Silver Ingots and 2 Mese Crystal Fragments\n",
hu_img_1 = {"container[1.0,6.6]"..
-- line 1
"style_type[item_image_button;bgimg=elepower_tome_bgimg_2.png]"..
"item_image_button[0.375,0.25;1,1;default:blueberry_bush_leaves;leaves;]"..
"tooltip[leaves;Any Leaves;#30434c;#f9f9f9]"..
"style[num;font_size=-2;font=bold;textcolor=#FFF]"..
"hypertext[0.375,0.9;1,1;num;<style size=12><right><b>174</b></right></style>]"..
"image[1.5,0.375;0.75,0.75;elepower_tome_icon_crafting.png]"..
"tooltip[1.5,0.375;0.75,0.75;Crafting;#30434c;#f9f9f9]"..
"item_image_button[2.375,0.25;1,1;basic_materials:oil_extract;basic_materials:oil_extract;]"..
"hypertext[2.375,0.9;1,1;num;<style size=12><right><b>58</b></right></style>]"..
"image[3.5,0.375;0.75,0.75;elepower_tome_icon_cooking.png]"..
"tooltip[3.5,0.375;0.75,0.75;Cooking;#30434c;#f9f9f9]"..
"item_image_button[4.375,0.25;1,1;basic_materials:paraffin;basic_materials:paraffin;]"..
"hypertext[4.375,0.9;1,1;num;<style size=12><right><b>58</b></right></style>]"..
"image[5.5,0.375;0.75,0.75;elepower_tome_icon_cooking.png]"..
"tooltip[5.5,0.375;0.75,0.75;Cooking;#30434c;#f9f9f9]"..
"item_image_button[6.375,0.25;1,1;basic_materials:plastic_sheet;basic_materials:plastic_sheet;]"..
"hypertext[6.375,0.9;1,1;num;<style size=12><right><b>58</b></right></style>]"..
-- line 2
"item_image_button[0.75,1.5;1,1;basic_materials:plastic_sheet;basic_materials:plastic_sheet;]"..
"hypertext[0.75,2.15;1,1;num;<style size=12><right><b>56</b></right></style>]"..
"image[1.875,1.625;0.75,0.75;elepower_tome_icon_crafting.png]"..
"tooltip[1.875,1.625;0.75,0.75;Crafting;#30434c;#f9f9f9]"..
"item_image_button[2.75,1.5;1,1;basic_materials:empty_spool;basic_materials:empty_spool;]"..
"hypertext[2.75,2.15;1,1;num;<style size=12><right><b>24</b></right></style>]"..
"item_image_button[3.875,1.5;1,1;default:copper_ingot;default:copper_ingot;]"..
"hypertext[3.875,2.15;1,1;num;<style size=12><right><b>12</b></right></style>]"..
"image[5,1.625;0.75,0.75;elepower_tome_icon_crafting.png]"..
"tooltip[5,1.625;0.75,0.75;Crafting;#30434c;#f9f9f9]"..
"item_image_button[5.875,1.5;1,1;basic_materials:copper_wire;basic_materials:copper_wire;]"..
"hypertext[5.875,2.15;1,1;num;<style size=12><right><b>12</b></right></style>]"..
-- line 3 -- bug single digits vanish randomly
"item_image_button[0.25,2.75;1,1;basic_materials:copper_wire;basic_materials:copper_wire;]"..
"hypertext[0.25,3.4;1,1;num;<style size=12><right><b>02</b></right></style>]"..
"item_image_button[1.375,2.75;1,1;default:mese_crystal_fragment;default:mese_crystal_fragment;]"..
"hypertext[1.375,3.4;1,1;num;<style size=12><right><b>02</b></right></style>]"..
"item_image_button[2.5,2.75;1,1;basic_materials:plastic_sheet;basic_materials:plastic_sheet;]"..
"hypertext[2.5,3.4;1,1;num2;<style size=12><right><b>02</b></right></style>]"..
"item_image_button[3.625,2.75;1,1;default:steel_ingot;default:steel_ingot;]"..
"hypertext[3.625,3.4;1,1;num;<style size=12><right><b>02</b></right></style>]"..
"item_image_button[4.75,2.75;1,1;default:copper_ingot;default:copper_ingot;]"..
"hypertext[4.75,3.4;1,1;num;<style size=12><right><b>01</b></right></style>]"..
"image[5.875,2.875;0.75,0.75;elepower_tome_icon_crafting.png]"..
"tooltip[5.875,2.875;0.75,0.75;Crafting;#30434c;#f9f9f9]"..
"item_image_button[6.75,2.75;1,1;basic_materials:motor;basic_materials:motor;]"..
"hypertext[6.75,3.4;1,1;num;<style size=12><right><b>02</b></right></style>]"..
"container_end[]"},
hu_img_2 = {"container[0,0]"..
"style_type[item_image_button;bgimg=elepower_tome_bgimg_2.png]"..
--line 1
"container[2.5,0]"..
"item_image_button[0.375,0.25;1,1;default:stone;default:stone;]"..
"hypertext[0.375,0.9;1,1;num;<style size=12><right><b>08</b></right></style>]"..
"image[1.5,0.375;0.75,0.75;elepower_tome_icon_crafting.png]"..
"tooltip[1.5,0.25;0.75,0.75;Crafting;#30434c;#f9f9f9]"..
"item_image_button[2.375,0.25;1,1;default:furnace;default:furnace;]"..
"hypertext[2.375,0.9;1,1;num;<style size=12><right><b>01</b></right></style>]"..
"container_end[]"..
-- line 2
"container[2.5,1.25]"..
"item_image_button[0.375,0.25;1,1;default:sand;default:sand;]"..
"hypertext[0.375,0.9;1,1;num;<style size=12><right><b>03</b></right></style>]"..
"image[1.5,0.375;0.75,0.75;elepower_tome_icon_cooking.png]"..
"tooltip[1.5,0.25;0.75,0.75;Cooking;#30434c;#f9f9f9]"..
"item_image_button[2.375,0.25;1,1;default:glass;default:glass;]"..
"hypertext[2.375,0.9;1,1;num;<style size=12><right><b>03</b></right></style>]"..
"container_end[]"..
-- line 3
"container[1.875,2.5]"..
"item_image_button[0.375,0.25;1,1;basic_materials:copper_wire;basic_materials:copper_wire;]"..
"hypertext[0.375,0.9;1,1;num;<style size=12><right><b>08</b></right></style>]"..
"item_image_button[1.5,0.25;1,1;elepower_dynamics:iron_ingot;elepower_dynamics:iron_ingot;]"..
"hypertext[1.5,0.9;1,1;num;<style size=12><right><b>02</b></right></style>]"..
"image[2.625,0.375;0.75,0.75;elepower_tome_icon_crafting.png]"..
"tooltip[2.625,0.375;0.75,0.75;Crafting;#30434c;#f9f9f9]"..
"item_image_button[3.5,0.25;1,1;elepower_dynamics:wound_copper_coil;elepower_dynamics:wound_copper_coil;]"..
"hypertext[3.5,0.9;1,1;num;<style size=12><right><b>06</b></right></style>]"..
"container_end[]"..
-- line 4
"container[0.875,3.75]"..
"item_image_button[0.375,0.25;1,1;default:copper_ingot;default:copper_ingot;]"..
"hypertext[0.375,0.9;1,1;num;<style size=12><right><b>04</b></right></style>]"..
"item_image_button[1.5,0.25;1,1;moreores:silver_ingot;moreores:silver_ingot;]"..
"hypertext[1.5,0.9;1,1;num;<style size=12><right><b>02</b></right></style>]"..
"image[2.625,0.375;0.75,0.75;elepower_tome_icon_alloying.png]"..
"tooltip[2.625,0.375;0.75,0.75;Alloying;#30434c;#f9f9f9]"..
"item_image_button[3.5,0.25;1,1;basic_materials:brass_ingot;basic_materials:brass_ingot;]"..
"hypertext[3.5,0.9;1,1;num;<style size=12><right><b>04</b></right></style>]"..
"image[4.625,0.375;0.75,0.75;elepower_tome_icon_crafting.png]"..
"tooltip[4.625,0.25;0.75,0.75;Crafting;#30434c;#f9f9f9]"..
"item_image_button[5.5,0.25;1,1;elepower_dynamics:brass_gear;elepower_dynamics:brass_gear;]"..
"hypertext[5.5,0.9;1,1;num;<style size=12><right><b>01</b></right></style>]"..
"container_end[]"..
-- line 5
"container[0.75,5]"..
"item_image_button[0.375,0.25;1,1;default:steel_ingot;default:steel_ingot;]"..
"hypertext[0.375,0.9;1,1;num;<style size=12><right><b>04</b></right></style>]"..
"item_image_button[1.5,0.25;1,1;default:glass;default:glass;]"..
"hypertext[1.5,0.9;1,1;num;<style size=12><right><b>03</b></right></style>]"..
"item_image_button[2.625,0.25;1,1;elepower_dynamics:brass_gear;elepower_dynamics:brass_gear;]"..
"hypertext[2.625,0.9;1,1;num;<style size=12><right><b>01</b></right></style>]"..
"item_image_button[3.75,0.25;1,1;basic_materials:motor;basic_materials:motor;]"..
"hypertext[3.75,0.9;1,1;num;<style size=12><right><b>01</b></right></style>]"..
"image[4.875,0.375;0.75,0.75;elepower_tome_icon_crafting.png]"..
"tooltip[4.875,0.25;0.75,0.75;Crafting;#30434c;#f9f9f9]"..
"item_image_button[5.75,0.25;1,1;elepower_machines:machine_block;elepower_machines:machine_block;]"..
"hypertext[5.875,0.9;1,1;num;<style size=12><right><b>01</b></right></style>]"..
"container_end[]"..
-- line 6
"container[0.75,6.25]"..
"item_image_button[0.375,0.25;1,1;default:steel_ingot;default:steel_ingot;]"..
"hypertext[0.375,0.9;1,1;num;<style size=12><right><b>03</b></right></style>]"..
"item_image_button[1.5,0.25;1,1;elepower_dynamics:wound_copper_coil;elepower_dynamics:wound_copper_coil;]"..
"hypertext[1.5,0.9;1,1;num;<style size=12><right><b>02</b></right></style>]"..
"item_image_button[2.625,0.25;1,1;default:furnace;default:furnace;]"..
"hypertext[2.625,0.9;1,1;num;<style size=12><right><b>01</b></right></style>]"..
"item_image_button[3.75,0.25;1,1;elepower_machines:machine_block;elepower_machines:machine_block;]"..
"hypertext[3.75,0.9;1,1;num;<style size=12><right><b>01</b></right></style>]"..
"image[4.875,0.375;0.75,0.75;elepower_tome_icon_crafting.png]"..
"tooltip[4.875,0.25;0.75,0.75;Crafting;#30434c;#f9f9f9]"..
"item_image_button[5.75,0.25;1,1;elepower_machines:generator;elepower_machines:generator;]"..
"hypertext[5.875,0.9;1,1;num;<style size=12><right><b>01</b></right></style>]"..
"container_end[]"..
-- line 7
"container[0.5,7.75]"..
"hypertext[0,0;7.5,3;end;<style color=#1f1f1f size=13><left>"..
"Now you have your generator built, place it down and then place the machines you wish to power "..
"next to it.\n Later on you'll need to join machines to power generators using power conduit."..
"</left></style>]"..
"container_end[]"..
"container_end[]"
}
}
eletome.ai.nodes["creating_your_first_pcb"] = {}
eletome.ai.nodes["upgrading_machines"] = {}
-- Generators Page
eletome.ai.nodes["elepower_machines:generator"] = {lb_top_img = "default:coal_lump",
lb_top_tt = "Burnable Items",
@ -269,7 +424,19 @@ eletome.ai.nodes["elepower_machines:super_power_cell_0"] = {lb_top_img = "e
-- (Simple) Machines Page
eletome.ai.nodes["elepower_machines:alloy_furnace"] = {lb_top_img = "default_tin_ingot.png",
lb_top_tt ="2 Materials\nto be Alloyed",
lb_btm_tt = " used per second"}
lb_btm_tt = " used per second",
how_use = ""
}
eletome.ai.nodes["elepower_machines:electrolyzer"] = {how_use = "The Electrolyzer is used to create gases out of certain fluids. The electrolyzer can accept three "..
"fluids/liquids, although not at the same time - water, heavy water and biofuel. The electrolyzer will "..
"at the cost of 128 EpUs a second break each down into different gases, see table below\n ",
how_use_p2 = "To extract gas from the electrolyzer you will need a fluid pump, bucketeer and an empty gas canister. "..
"The electrolyzer can only output to a single bucketeer so you will need to empty one gas completely before "..
"you will be able to bottle the second gas (always oxygen).",
hu_img_1 = "elepower_tome_electrolyzer_outputs.png",
hu_img_2 = "elepower_tome_electrolyzer_assemble.png"
}
-- Fluid Pump Page
eletome.ai.nodes["elepower_machines:pump"] = {lb_top_img = "elepower_gui_icon_fluid_electrolyzer_in.png", lb_top_tt = "Fluid"}

View File

@ -16,7 +16,6 @@
-- Determine if a text string --
-- is for an image or not --
----------------------------------
function eletome.is_image(text)
local value = false
if type(text) == "string" then

View File

@ -35,11 +35,15 @@ function eletome.contents_page()
"are called EpU (Elepower Unit).\n"..
"New crafts are added to the game as well as new machines "..
"to enable these new crafts and make use of EpU/s.\n\n"..
"A big thank you to IcyDiamond the orginal creator of this mod."
"A big thank you to IcyDiamond the orginal creator of this mod.\n\n"
local heading_lp = "hypertext[0.50,0.70;8.5,1.2;content_lp_h_tome;"..sty_h0s.."Elepower Tome"..sty_h0e.."]"
local content_lp = "hypertext[0.75,1.8;8.0,8.0;content_lp_c_text;"..sty_h3s..content_lp_txt..sty_h3s.."]"
local content_lp = "hypertext[0.75,1.8;8.0,5.5;content_lp_c_text;"..sty_h3s..content_lp_txt..sty_h3s.."]"
local links_lp = "hypertext[0.75,6.8;8.0,4.0;help;"..sty_h3s..
"<action name=getting_started>Getting Started</action>\n"..
"<action name=creating_your_first_pcb>Creating your 1st PCB</action>\n"..
"<action name=upgrading_machines>Upgrading Machines</action>"..
sty_h3e.."]"
-- Contents page right page Content
local heading_rp = "hypertext[9.0,0.7;8.5,1.0;content_rp_h_cont;"..sty_h1s.."Contents"..sty_h1e.."]"
@ -91,7 +95,7 @@ function eletome.contents_page()
sty_h3e.."]"
-- Assemble contents page
local eletome_cont = heading_lp..content_lp..
local eletome_cont = heading_lp..content_lp..links_lp..
heading_rp..heading_rp_craft..craft_rp_txt..
heading_rp_mach..subhead_mach_gen

View File

@ -133,6 +133,7 @@ function eletome.machines(machine,page_num)
local lb_btm_tt = " EpUs per second"
local mb_title_txt
local mb_recipe_items
local how_use
-- Check for custom values in additional info and set
if add_info.nodes[name_reg] then
@ -150,7 +151,7 @@ function eletome.machines(machine,page_num)
lb_btm_tt = add_info.nodes[name_reg].lb_btm_tt or " EpUs per second"
mb_title_txt = add_info.nodes[name_reg].mb_title_txt or nil
mb_recipe_items = add_info.nodes[name_reg].mb_recipe_items or nil
how_use = add_info.nodes[name_reg].how_use or nil
end
-- catch empty recipe.items and check new crafts
@ -193,6 +194,12 @@ function eletome.machines(machine,page_num)
--3rd square item
m_recipe = m_recipe.."item_image_button["..(14.85)..","..(1+y_off+0.1)..";2.2,2.2;"..mach_key[name_des]..";"..mach_key[name_des]..";]"
if how_use then
m_recipe = m_recipe.."image["..(14.80)..","..(1+y_off+0.05)..";0.4,0.4;elepower_gui_icon_info.png]"
m_recipe = m_recipe.."tooltip["..(14.80)..","..(1+y_off+0.05)..";0.4,0.4; Click for\nHow to use;"..eletome.tooltip_color.."]"
end
-- 1st square items
-- Top Item
@ -261,7 +268,7 @@ function eletome.machines(machine,page_num)
else
minetest.log("info", "elepower_tome: "..lb_btm_img.." entered value must be 1-4 digits or a string ending in .png")
minetest.debug()
end
end

View File

@ -115,6 +115,35 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
minetest.show_formspec(player:get_player_name(), "elepower_tome:tome", eletome_bg..eletome_lrg_img)
end
-- Clicked Help page
if fields.help then
local eletome_bg = eletome.tome_bg
local eletome_how_use = eletome.how_use_page(fields.help)
minetest.show_formspec(player:get_player_name(), "elepower_tome:tome", eletome_bg..eletome_how_use)
end
-- Clicked How to use page
if fields.description == "action:machine-ele_user" then
local how_use = false
local node_name
for k,v in pairs(eletome.ai.nodes) do
if fields[k] then
if eletome.ai.nodes[k].how_use then
how_use = true
node_name = k
end
end
end
if how_use then
local eletome_bg = eletome.tome_bg
local eletome_how_use = eletome.how_use_page(node_name)
minetest.show_formspec(player:get_player_name(), "elepower_tome:tome", eletome_bg..eletome_how_use)
end
end
--minetest.debug(dump(fields))
end)
@ -170,7 +199,7 @@ function eletome.instructions_page(machine)
-- remove "description = action:machine-" from string
local machine_name = string.match(machine, "-(.*)")
minetest.debug(machine_name)
-- remove "_"
local mach_name = string.gsub(machine_name,"_", " ")
@ -279,4 +308,97 @@ function eletome.large_image_page(machine)
local eletome_lrg_img = image..heading
return eletome_lrg_img
end
function eletome.how_use_page(name_value)
-- Page to view how to use a node/getting started
--"action:getting_started"
--"elepower_machines:electrolyzer" = ""
local t_split = string.split(name_value,":")
local is_help = false
if t_split[1] == "action" then
is_help = true
end
-- get page heading and sub-heading
local pg_heading
local pg_subhead
if is_help then
pg_heading = string.gsub(t_split[2],"_", " ")
-- change all 1st letters to upper -
-- https://stackoverflow.com/questions/20284515/capitalize-first-letter-of-every-word-in-lua
pg_heading = string.gsub(" "..pg_heading, "%W%l", string.upper):sub(2)
pg_subhead = "Help"
name_value = t_split[2]
else
pg_heading = minetest.registered_nodes[name_value].description
pg_subhead = "How to use"
end
-- Assign Common styles to local vars
local sty_h0s = eletome.common_styles.style_h0s
local sty_h0e = eletome.common_styles.style_h0e
local sty_h1s = eletome.common_styles.style_h1s
local sty_h1e = eletome.common_styles.style_h1e
local sty_h2s = eletome.common_styles.style_h2s
local sty_h2e = eletome.common_styles.style_h2e
local sty_h3s = eletome.common_styles.style_h3s
local sty_h3e = eletome.common_styles.style_h3e
local sty_h4s = eletome.common_styles.style_h4s
local sty_h4e = eletome.common_styles.style_h4e
-- Additional Info Table
local add_info = eletome.ai.nodes
---------------
-- left page --
---------------
local left_image = add_info[name_value].hu_img_1 or "elepower_tome_empty.png"
local lp_offset = 0
if left_image == "elepower_tome_empty.png" then
lp_offset = 3.75
end
if type(left_image) == "table" then
left_image = add_info[name_value].hu_img_1[1]
else
left_image = "image[2.25,6.6;5,3.75;"..left_image.."]"
end
local lp_heading = "hypertext[0.5,0.7;8.5,1.1;lp_heading;"..sty_h0s..pg_heading..sty_h0e.."]"
local lp_sub_head = "hypertext[0.5,1.4;8.5,1.0;lp_sub_heading;"..sty_h1s..pg_subhead..sty_h1e.."]"
local lp_image = left_image
local lp_text = "hypertext[0.75,2.1;8.0,"..(4.5+lp_offset)..";use_txt;"..sty_h4s..(add_info[name_value].how_use_1 or "")..sty_h4e.."]"
----------------
-- Right page --
----------------
local right_image = add_info[name_value].hu_img_2 or "elepower_tome_empty.png"
local right_txt = add_info[name_value].how_use_2 or ""
local rp_txt_offset = 0
local rp_img_offset = 0
if right_image == "elepower_tome_empty.png" then
rp_txt_offset = 3.75
end
if right_txt == "" or right_txt == nil then
rp_img_offset = -6.1
end
if type(right_image) == "table" then
right_image = "container[9.25,"..(6.6+rp_img_offset).."]"..add_info[name_value].hu_img_2[1].."container_end[]"
else
right_image = "image[10.75,"..(6.6+rp_img_offset)..";5,3.75;"..right_image.."]"
end
local rp_text = "hypertext[9.25,1.4;8.0,"..(4.5+rp_txt_offset)..";use_txt;"..sty_h4s..right_txt..sty_h4e.."]"
local rp_image = right_image
local eletome_how_use = lp_heading..lp_sub_head..lp_image..lp_text..rp_text ..rp_image
return eletome_how_use
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 702 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 793 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 769 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 773 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 725 B