diff --git a/guide.lua b/guide.lua index 7f75d1d..1215f2c 100644 --- a/guide.lua +++ b/guide.lua @@ -26,6 +26,7 @@ local pages={ IndustrialTest implements finite power functionality which can be used to perform various tasks using generators and consumers. Such features are not a new thing in Luanti, as there are older mods which do that already. This mod, however, proves to be more flexible. + ]] }, { @@ -38,6 +39,7 @@ local pages={ In order to attach electricity consumers to power sources (like generators, batteries, further just called generators) electrical network is used. Consumers can get connected either directly to generators or through various cables. Each generator can output certain voltage (this is actually amperage, however since this mod doesn't simulate electricity accurately, it's called voltage), the same situation is for consumers as they can only handle up to certain voltage. Figure 1 shows voltage levels present in this mod. If voltage is too high for cable it will melt without dropping anything while consumer will explode also without dropping anything and possibly destroying terrain around. Power capacity is measured in EU (Energy Units) and the voltage is EU/update. + Picture 1 shows environment after consumer explosion. -------------------------------------------- @@ -51,6 +53,8 @@ local pages={ -------------------------------------------- Figure 1. Voltage levels and respective cables + + Picture 1. Environment after consumer explosion ]] }, { @@ -60,7 +64,7 @@ local pages={ 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. + 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. --------------------------------------- @@ -71,6 +75,8 @@ local pages={ --------------------------------------- Figure 1. Machine information for Cable Former + + Picture 1. Cable Former running ]] }, { @@ -80,7 +86,7 @@ local pages={ content=[[ Canning Machine - Canning Machine is used to move certain fluid from one item to another. The common usage is to refill fuel in Jetpack or Fuel Can. + Canning Machine is used to move certain fluid from one item to another. The common usage is to refill fuel in Jetpack or Fuel Can. --------------------------------------- @@ -91,10 +97,19 @@ local pages={ --------------------------------------- Figure 1. Machine information for Canning Machine + + Picture 1. Canning Machine refilling Fuel Can with fuel from Coalfuel Cell ]] } } +local function preprocessHypertext(content,vars) + for key,value in pairs(vars) do + content=string.gsub(content,string.format("{{%s}}",key),value) + end + return content +end + local function getGuideFormspec(playerName,pageName) local formspec={ "formspec_version[4]", @@ -115,12 +130,17 @@ local function getGuideFormspec(playerName,pageName) end table.insert(formspec,"scroll_container_end[]") - 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 + -- Introduction page is shown by default + pageName=(pageName or "introduction") + + for _,page in ipairs(pages) do + if page.name==pageName then + local content=preprocessHypertext(page.content,{ + IMAGE_WIDTH=700, + ITEM_HEIGHT=16 + }) + table.insert(formspec,string.format("hypertext[4.2,0.4;10.7,10.3;content;%s]",content)) + break end end diff --git a/textures/industrialtest_guide_cable_former.png b/textures/industrialtest_guide_cable_former.png new file mode 100644 index 0000000..18fe159 Binary files /dev/null and b/textures/industrialtest_guide_cable_former.png differ diff --git a/textures/industrialtest_guide_canning_machine.png b/textures/industrialtest_guide_canning_machine.png new file mode 100644 index 0000000..2ecc947 Binary files /dev/null and b/textures/industrialtest_guide_canning_machine.png differ diff --git a/textures/industrialtest_guide_explosion.png b/textures/industrialtest_guide_explosion.png new file mode 100644 index 0000000..de0a876 Binary files /dev/null and b/textures/industrialtest_guide_explosion.png differ diff --git a/textures/industrialtest_guide_introduction.png b/textures/industrialtest_guide_introduction.png new file mode 100644 index 0000000..7ff73d5 Binary files /dev/null and b/textures/industrialtest_guide_introduction.png differ