Describe Cable Former in guide

This commit is contained in:
2025-11-21 22:48:59 +01:00
parent f98bebab4e
commit 92ed913cac

View File

@@ -17,7 +17,8 @@
local S=minetest.get_translator("industrialtest") local S=minetest.get_translator("industrialtest")
local pages={ local pages={
introduction={ {
name="introduction",
title=S("Introduction"), title=S("Introduction"),
icon=industrialtest.elementKeys.paper, icon=industrialtest.elementKeys.paper,
content=[[ content=[[
@@ -27,7 +28,8 @@ local pages={
</left> </left>
]] ]]
}, },
electricalNetwork={ {
name="electricalNetwork",
title=S("Electrical network"), title=S("Electrical network"),
icon="industrialtest:insulated_copper_cable", icon="industrialtest:insulated_copper_cable",
content=[[ content=[[
@@ -50,6 +52,25 @@ local pages={
Figure 1. Voltage levels and respective cables Figure 1. Voltage levels and respective cables
</mono> </mono>
]] ]]
},
{
name="cableFormer",
title=S("Cable Former"),
icon="industrialtest:cable_former",
content=[[
<big>Cable Former</big>
<left>
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.
</left>
<mono>
---------------------------------------
| Input voltage level | Recipe type |
---------------------------------------
| LV | Cable forming |
|-------------------------------------|
Figure 1. Machine information for Cable Former
</mono>
]]
} }
} }
@@ -65,18 +86,21 @@ local function getGuideFormspec(playerName,pageName)
-- Contents sidebar -- Contents sidebar
local PAGE_BUTTON_HEIGHT=0.7 local PAGE_BUTTON_HEIGHT=0.7
local index=0 for i,page in ipairs(pages) do
for name,page in pairs(pages) do table.insert(formspec,string.format("container[0,%f]",(i-1)*PAGE_BUTTON_HEIGHT))
table.insert(formspec,string.format("container[0,%f]",index*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("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[]") table.insert(formspec,"container_end[]")
index=index+1
end end
table.insert(formspec,"scroll_container_end[]") table.insert(formspec,"scroll_container_end[]")
if pageName and pages[pageName] then if pageName then
table.insert(formspec,string.format("hypertext[4.2,0.4;10.7,10.3;content;%s]",pages[pageName].content)) 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 end
return table.concat(formspec,"") return table.concat(formspec,"")
@@ -92,10 +116,10 @@ local function handleGuideFields(player,formname,fields)
return return
end end
for name,_ in pairs(pages) do for _,page in ipairs(pages) do
if fields[name] then if fields[page.name] then
minetest.close_formspec(player:get_player_name(),formname) minetest.close_formspec(player:get_player_name(),formname)
showGuide(player:get_player_name(),name) showGuide(player:get_player_name(),page.name)
break break
end end
end end