diff --git a/guide.lua b/guide.lua
index 1f245cb..ac36118 100644
--- a/guide.lua
+++ b/guide.lua
@@ -17,7 +17,8 @@
local S=minetest.get_translator("industrialtest")
local pages={
- introduction={
+ {
+ name="introduction",
title=S("Introduction"),
icon=industrialtest.elementKeys.paper,
content=[[
@@ -27,7 +28,8 @@ local pages={
]]
},
- electricalNetwork={
+ {
+ name="electricalNetwork",
title=S("Electrical network"),
icon="industrialtest:insulated_copper_cable",
content=[[
@@ -50,6 +52,25 @@ local pages={
Figure 1. Voltage levels and respective cables
]]
+ },
+ {
+ name="cableFormer",
+ title=S("Cable Former"),
+ icon="industrialtest:cable_former",
+ content=[[
+ Cable Former
+
+ Cable Former can be used to produce cables with higher material efficiency. It can, however, only produce cables from metals so for example Glass Fibre Cable can't be produced in it.
+
+
+ ---------------------------------------
+ | Input voltage level | Recipe type |
+ ---------------------------------------
+ | LV | Cable forming |
+ |-------------------------------------|
+ Figure 1. Machine information for Cable Former
+
+ ]]
}
}
@@ -65,18 +86,21 @@ local function getGuideFormspec(playerName,pageName)
-- Contents sidebar
local PAGE_BUTTON_HEIGHT=0.7
- local index=0
- for name,page in pairs(pages) do
- table.insert(formspec,string.format("container[0,%f]",index*PAGE_BUTTON_HEIGHT))
+ for i,page in ipairs(pages) do
+ table.insert(formspec,string.format("container[0,%f]",(i-1)*PAGE_BUTTON_HEIGHT))
table.insert(formspec,string.format("item_image[0,0;%f,%f;%s]",PAGE_BUTTON_HEIGHT,PAGE_BUTTON_HEIGHT,page.icon))
- table.insert(formspec,string.format("button[%f,0;%f,%f;%s;%s]",PAGE_BUTTON_HEIGHT+0.05,3.45-PAGE_BUTTON_HEIGHT,PAGE_BUTTON_HEIGHT,name,page.title))
+ table.insert(formspec,string.format("button[%f,0;%f,%f;%s;%s]",PAGE_BUTTON_HEIGHT+0.05,3.45-PAGE_BUTTON_HEIGHT,PAGE_BUTTON_HEIGHT,page.name,page.title))
table.insert(formspec,"container_end[]")
- index=index+1
end
table.insert(formspec,"scroll_container_end[]")
- if pageName and pages[pageName] then
- table.insert(formspec,string.format("hypertext[4.2,0.4;10.7,10.3;content;%s]",pages[pageName].content))
+ if pageName then
+ for _,page in ipairs(pages) do
+ if page.name==pageName then
+ table.insert(formspec,string.format("hypertext[4.2,0.4;10.7,10.3;content;%s]",page.content))
+ break
+ end
+ end
end
return table.concat(formspec,"")
@@ -92,10 +116,10 @@ local function handleGuideFields(player,formname,fields)
return
end
- for name,_ in pairs(pages) do
- if fields[name] then
+ for _,page in ipairs(pages) do
+ if fields[page.name] then
minetest.close_formspec(player:get_player_name(),formname)
- showGuide(player:get_player_name(),name)
+ showGuide(player:get_player_name(),page.name)
break
end
end