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 pages={
introduction={
{
name="introduction",
title=S("Introduction"),
icon=industrialtest.elementKeys.paper,
content=[[
@@ -27,7 +28,8 @@ local pages={
</left>
]]
},
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
</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
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