10 Commits

5 changed files with 277 additions and 12 deletions

276
guide.lua
View File

@@ -66,6 +66,7 @@ local function createMachineInformationTable(fields,machineName,num)
local fieldLabels={ local fieldLabels={
inputVoltage="Input voltage level", inputVoltage="Input voltage level",
outputVoltage="Output voltage level", outputVoltage="Output voltage level",
voltage="Voltage",
lowVoltage="Low voltage", lowVoltage="Low voltage",
highVoltage="High voltage", highVoltage="High voltage",
recipe="Recipe type", recipe="Recipe type",
@@ -1156,6 +1157,267 @@ local pages={
<left>||Picture 2. Water Mill in water.||</left> <left>||Picture 2. Water Mill in water.||</left>
]] ]]
} }
},
{
name="windMill",
title=S("Wind Mill"),
icon="industrialtest:wind_mill",
content={
[[
<big>||Wind Mill||</big>
<left>
||Wind Mill can be used to produce energy from wind moving it's fan. The amount of produced power depends on height where Wind Mill is put, the higher the more power and it is indicated by icon in formspec. Wind Mill can't be put next to any node or otherwise it won't produce power.||
</left>
]],
createMachineInformationTable({
{
name="outputVoltage",
value="LV"
},
{
name="powerCapacity",
value=string.format("%d EU",industrialtest.WindMill.capacity)
}
},S("Wind Mill")),
[[
<img name="industrialtest_guide_wind_mill.png">
<left>||Picture 1. Wind Mill producing some power.||</left>
]]
}
},
{
name="upgrades",
title=S("Machine upgrades"),
icon="industrialtest:overclocker_upgrade",
content={
[[
<big>||Machine upgrades||</big>
<left>
||Upgrades can be put into special slots in machine formspec for this purpose. They increase machine capabilities while changing other properties. Not all machines can accept upgrades, however this can be determined by presence of four slots on right of formspec where upgrades are put. The following are all machine upgrades:||
</left>
<left>
||<item name="industrialtest:overclocker_upgrade" height="{{ITEM_HEIGHT}}"> <b>Overclocker Upgrade</b> - speeds up the machine.||
||<item name="industrialtest:power_storage_upgrade" height="{{ITEM_HEIGHT}}"> <b>Power Storage Upgrade</b> - increases the amount of power that machine can store.||
||<item name="industrialtest:transformer_upgrade" height="{{ITEM_HEIGHT}}"> <b>Transformer Upgrade</b> - allows machine to be connected to higher voltage by one level.||
</left>
<mono>--</mono>
<img name="industrialtest_guide_upgrades.png">
<left>||Picture 1. <item name="industrialtest:electric_furnace" height="{{ITEM_HEIGHT}}"> <b>Electric Furnace</b> with <item name="industrialtest:overclocker_upgrade" height="{{ITEM_HEIGHT}}"> <b>Overclocker Upgrade</b>.||</left>
]]
}
},
{
name="batpacks",
title=S("BatPacks"),
icon="industrialtest:batpack_v",
content={
[[
<big>||BatPacks||</big>
<left>
||BatPack when equipped charges currently wielded electric item. There are two types of BatPacks:||
</left>
<left>
||<item name="industrialtest:batpack_v" height="{{ITEM_HEIGHT}}"> <b>BatPack</b>||
</left>
]],
createMachineInformationTable({
{
name="voltage",
value="LV"
},
{
name="powerCapacity",
value=string.format("%d EU",industrialtest.BatPack.capacity)
}
},S("BatPack")),
[[
<mono></mono>
<left>
||<item name="industrialtest:lappack_v" height="{{ITEM_HEIGHT}}"> <b>LapPack</b>||
</left>
]],
createMachineInformationTable({
{
name="voltage",
value="MV"
},
{
name="powerCapacity",
value=string.format("%d EU",industrialtest.LapPack.capacity)
}
},S("LapPack"),2)
}
},
{
name="electricToolset",
title=S("Electric toolset"),
icon="industrialtest:electric_drill",
content={
[[
<big>||Electric toolset||</big>
<left>
||Electric toolset consists of typical tools like pickaxe but powered by electricity. While used they don't wear out but instead discharge which allow them to be reused. When completely discharged it's still possible to use the tool but it will be considerably slower. Those are (regular and advanced version):||
</left>
<left>
||<item name="industrialtest:electric_chainsaw" height="{{ITEM_HEIGHT}}"> <b>Electric Chainsaw</b>||
</left>
]],
createMachineInformationTable({
{
name="voltage",
value="LV"
},
{
name="powerCapacity",
value=string.format("%d EU",industrialtest.ElectricChainsaw.capacity)
}
},S("Electric Chainsaw")),
[[
<mono></mono>
<left>
||<item name="industrialtest:electric_drill" height="{{ITEM_HEIGHT}}"> <b>Electric Drill</b>||
</left>
]],
createMachineInformationTable({
{
name="voltage",
value="LV"
},
{
name="powerCapacity",
value=string.format("%d EU",industrialtest.ElectricDrill.capacity)
}
},S("Electric Drill"),2),
[[
<mono></mono>
||<item name="industrialtest:electric_hoe" height="{{ITEM_HEIGHT}}"> <b>Electric Hoe</b>||
]],
createMachineInformationTable({
{
name="voltage",
value="LV"
},
{
name="powerCapacity",
value=string.format("%d EU",industrialtest.ElectricHoe.capacity)
}
},S("Electric Hoe"),3),
[[
<mono></mono>
||<item name="industrialtest:electric_saber" height="{{ITEM_HEIGHT}}"> <b>Electric Saber</b>||
]],
createMachineInformationTable({
{
name="voltage",
value="LV"
},
{
name="powerCapacity",
value=string.format("%d EU",industrialtest.ElectricSaber.capacity)
}
},S("Electric Saber"),4),
[[
<mono></mono>
||<item name="industrialtest:electric_treetap" height="{{ITEM_HEIGHT}}"> <b>Electric Treetap</b>||
]],
createMachineInformationTable({
{
name="voltage",
value="LV"
},
{
name="powerCapacity",
value=string.format("%d EU",industrialtest.ElectricTreetap.capacity)
}
},S("Electric Treetap"),5)
}
},
{
name="jetpacks",
title=S("Jetpacks"),
icon="industrialtest:jetpack_v",
content={
[[
<big>||Jetpacks||</big>
<left>
||Jetpacks allow to combat against the gravity after pressing the jump key. They are equipped as chest part of armor. There are two jetpack types:||
</left>
<left>
||<item name="industrialtest:jetpack_v" height="{{ITEM_HEIGHT}}"> <b>Jetpack</b> - regular jetpack which is powered by fuel, can be refilled in <item name="industrialtest:canning_machine" height="{{ITEM_HEIGHT}}"> <b>Canning Machine</b>.||
</left>
]],
createMachineInformationTable({
{
name="Fuel capacity",
value=string.format("%d mB",industrialtest.Jetpack.capacity)
}
},S("Jetpack")),
[[
<mono></mono>
<left>
||<item name="industrialtest:electric_jetpack" height="{{ITEM_HEIGHT}}"> <b>Electric Jetpack</b> - jetpack powered by electricity.||
</left>
]],
createMachineInformationTable({
{
name="voltage",
value="LV"
},
{
name="powerCapacity",
value=string.format("%d EU",industrialtest.ElectricJetpack.capacity)
}
},S("Electric Jetpack"),2)
}
},
{
name="miningLaser",
title=S("Mining Laser"),
icon="industrialtest:mining_laser",
content={
[[
<big>||Mining Laser||</big>
<left>
||Mining Laser is a tool that emits beam when used. Depending on the mode beam will cause different a result:||
||Mode 1 - breaks nodes at full power, direction where player looks.||
||Mode 2 - breaks nodes at low power, direction where player looks.||
||Mode 3 - breaks nodes at full power, direction only horizontal.||
||Mode 4 - explodes after touching node, direction where player looks.||
</left>
]],
createMachineInformationTable({
{
name="voltage",
value="HV"
},
{
name="powerCapacity",
value=string.format("%d EU",industrialtest.MiningLaser.capacity)
},
{
name="Power per operation (Mode 1)",
value="1250 EU"
},
{
name="Power per operation (Mode 2)",
value="100 EU"
},
{
name="Power per operation (Mode 3)",
value="100 EU"
},
{
name="Power per operation (Mode 4)",
value="5000 EU"
}
},S("Mining Laser"))
}
} }
} }
@@ -1165,25 +1427,27 @@ local function preprocessHypertext(content,vars)
return S(sourceString) return S(sourceString)
end) end)
for key,value in pairs(vars) do -- Replace all sequences which should be treated as variables with values provided in vars
content=string.gsub(content,string.format("{{%s}}",key),value) content=string.gsub(content,"{{([^{}]+)}}",function(var)
end return vars[var] or "nil"
end)
return content return content
end end
local function getGuideFormspec(playerName,pageName) local function getGuideFormspec(playerName,pageName)
local PAGE_BUTTON_HEIGHT=0.7
local formspec={ local formspec={
"formspec_version[4]", "formspec_version[4]",
"size[15,10.8]", "size[15,10.8]",
"label[0.1,0.2;"..S("IndustrialTest Guide").."]", "label[0.1,0.2;"..S("IndustrialTest Guide").."]",
--"scrollbaroptions[]", string.format("scrollbaroptions[max=%f]",(#pages-10.3/PAGE_BUTTON_HEIGHT)*PAGE_BUTTON_HEIGHT*10),
"scrollbar[3.6,0.4;0.5,10.3;vertical;scrollbarList;0]", "scrollbar[3.6,0.4;0.5,10.3;vertical;scrollbarList;0]",
"scroll_container[0.1,0.4;4,10.3;scrollbarList;vertical]" "scroll_container[0.1,0.4;4,10.3;scrollbarList;vertical;0.1]"
} }
-- Contents sidebar -- Contents sidebar
local PAGE_BUTTON_HEIGHT=0.7
for i,page in ipairs(pages) do 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("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("item_image[0,0;%f,%f;%s]",PAGE_BUTTON_HEIGHT,PAGE_BUTTON_HEIGHT,page.icon))

View File

@@ -76,13 +76,14 @@ function industrialtest.WindMill.action(self,pos)
local dimMax=31000 local dimMax=31000
local dim=mcl_worlds.pos_to_dimension(pos) local dim=mcl_worlds.pos_to_dimension(pos)
if dim=="overworld" then if dim=="overworld" then
dimMax=mcl_vars.mg_overworld_max dimMax=mcl_vars.mg_overworld_max_official
elseif dim=="nether" then elseif dim=="nether" then
dimMax=mcl_vars.mg_nether_max dimMax=mcl_vars.mg_nether_max
elseif dim=="end" then elseif dim=="end" then
dimMax=mcl_vars.mg_end_max dimMax=mcl_vars.mg_end_max_official
end end
charging=math.max(mcl_worlds.layer_to_y(pos.y,dim),0)/dimMax local layer,_=mcl_worlds.y_to_layer(pos.y)
charging=math.min(math.max((layer or 0),0)/dimMax,1.0)
end end
local neighbourPositions={ local neighbourPositions={
vector.offset(pos,-1,0,0), vector.offset(pos,-1,0,0),

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@@ -69,8 +69,8 @@ industrialtest.internal.unpackTableInto(industrialtest.LapPack,{
description=S("LapPack"), description=S("LapPack"),
inventoryImage="industrialtest_lappack_v_inv.png", inventoryImage="industrialtest_lappack_v_inv.png",
modelImage="industrialtest_lappack_v.png", modelImage="industrialtest_lappack_v.png",
capacity=60000, capacity=300000,
flow=industrialtest.api.lvPowerFlow flow=industrialtest.api.mvPowerFlow
}) })
industrialtest.LapPack:register() industrialtest.LapPack:register()
@@ -79,7 +79,7 @@ minetest.register_craft({
type="shaped", type="shaped",
output="industrialtest:lappack_v", output="industrialtest:lappack_v",
recipe={ recipe={
{industrialtest.elementKeys.powerCarrier,"industrialtest:electronic_circuit",industrialtest.elementKeys.powerCarrier}, {industrialtest.elementKeys.powerCarrier,"industrialtest:advanced_electronic_circuit",industrialtest.elementKeys.powerCarrier},
{industrialtest.elementKeys.powerCarrier,"industrialtest:batpack_v",industrialtest.elementKeys.powerCarrier}, {industrialtest.elementKeys.powerCarrier,"industrialtest:batpack_v",industrialtest.elementKeys.powerCarrier},
{industrialtest.elementKeys.powerCarrier,"",industrialtest.elementKeys.powerCarrier} {industrialtest.elementKeys.powerCarrier,"",industrialtest.elementKeys.powerCarrier}
} }