Begin implementing in-game guide
This commit is contained in:
parent
10045582e9
commit
6348ca2094
@ -538,6 +538,7 @@ if industrialtest.mclAvailable then
|
|||||||
industrialtest.elementKeys.cactus="mcl_core:cactus"
|
industrialtest.elementKeys.cactus="mcl_core:cactus"
|
||||||
industrialtest.elementKeys.gunpowder="mcl_mobitems:gunpowder"
|
industrialtest.elementKeys.gunpowder="mcl_mobitems:gunpowder"
|
||||||
industrialtest.elementKeys.chest="mcl_chests:chest_small"
|
industrialtest.elementKeys.chest="mcl_chests:chest_small"
|
||||||
|
industrialtest.elementKeys.paper="mcl_core:paper"
|
||||||
industrialtest.elementKeys.groupSapling="group:sapling"
|
industrialtest.elementKeys.groupSapling="group:sapling"
|
||||||
industrialtest.elementKeys.groupLeaves="group:leaves"
|
industrialtest.elementKeys.groupLeaves="group:leaves"
|
||||||
industrialtest.elementKeys.stickyResin=(industrialtest.mods.mclRubber and "mcl_rubber:rubber_raw" or "industrialtest:sticky_resin")
|
industrialtest.elementKeys.stickyResin=(industrialtest.mods.mclRubber and "mcl_rubber:rubber_raw" or "industrialtest:sticky_resin")
|
||||||
@ -773,6 +774,7 @@ elseif industrialtest.mtgAvailable then
|
|||||||
industrialtest.elementKeys.cactus="default:cactus"
|
industrialtest.elementKeys.cactus="default:cactus"
|
||||||
industrialtest.elementKeys.gunpowder="tnt:gunpowder"
|
industrialtest.elementKeys.gunpowder="tnt:gunpowder"
|
||||||
industrialtest.elementKeys.chest="default:chest"
|
industrialtest.elementKeys.chest="default:chest"
|
||||||
|
industrialtest.elementKeys.paper="default:paper"
|
||||||
industrialtest.elementKeys.groupSapling="group:sapling"
|
industrialtest.elementKeys.groupSapling="group:sapling"
|
||||||
industrialtest.elementKeys.groupLeaves="group:leaves"
|
industrialtest.elementKeys.groupLeaves="group:leaves"
|
||||||
industrialtest.elementKeys.stickyResin="industrialtest:sticky_resin"
|
industrialtest.elementKeys.stickyResin="industrialtest:sticky_resin"
|
||||||
|
|||||||
84
guide.lua
Normal file
84
guide.lua
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
-- IndustrialTest
|
||||||
|
-- Copyright (C) 2025 mrkubax10
|
||||||
|
|
||||||
|
-- This program is free software: you can redistribute it and/or modify
|
||||||
|
-- it under the terms of the GNU General Public License as published by
|
||||||
|
-- the Free Software Foundation, either version 3 of the License, or
|
||||||
|
-- (at your option) any later version.
|
||||||
|
|
||||||
|
-- This program is distributed in the hope that it will be useful,
|
||||||
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
-- GNU General Public License for more details.
|
||||||
|
|
||||||
|
-- You should have received a copy of the GNU General Public License
|
||||||
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
local S=minetest.get_translator("industrialtest")
|
||||||
|
|
||||||
|
local pages={
|
||||||
|
introduction={
|
||||||
|
title=S("Introduction"),
|
||||||
|
icon=industrialtest.elementKeys.paper,
|
||||||
|
content=[[
|
||||||
|
<big>Introduction</big>
|
||||||
|
<left>
|
||||||
|
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.
|
||||||
|
</left>
|
||||||
|
]]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
local function getGuideFormspec(playerName,pageName)
|
||||||
|
local formspec={
|
||||||
|
"formspec_version[4]",
|
||||||
|
"size[15,10.8]",
|
||||||
|
"label[0.1,0.2;"..S("IndustrialTest Guide").."]",
|
||||||
|
--"scrollbaroptions[]",
|
||||||
|
"scrollbar[3.6,0.4;0.5,10.3;vertical;scrollbarList;0]",
|
||||||
|
"scroll_container[0.1,0.4;4,10.3;scrollbarList;vertical]"
|
||||||
|
}
|
||||||
|
|
||||||
|
-- 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))
|
||||||
|
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,"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))
|
||||||
|
end
|
||||||
|
|
||||||
|
return table.concat(formspec,"")
|
||||||
|
end
|
||||||
|
|
||||||
|
local function showGuide(playerName,page)
|
||||||
|
minetest.show_formspec(playerName,"industrialtest:guide",getGuideFormspec(playerName,page))
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
local function handleGuideFields(player,formname,fields)
|
||||||
|
if formname~="industrialtest:guide" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
for name,_ in pairs(pages) do
|
||||||
|
if fields[name] then
|
||||||
|
minetest.close_formspec(player:get_player_name(),formname)
|
||||||
|
showGuide(player:get_player_name(),name)
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
minetest.register_on_player_receive_fields(handleGuideFields)
|
||||||
|
|
||||||
|
minetest.register_chatcommand("industrialtest_guide",{
|
||||||
|
description=S("Shows graphical guide for content and features provided by IndustrialTest"),
|
||||||
|
func=showGuide
|
||||||
|
})
|
||||||
1
init.lua
1
init.lua
@ -98,6 +98,7 @@ dofile(modpath.."/tools/wrench.lua")
|
|||||||
|
|
||||||
dofile(modpath.."/upgrades.lua")
|
dofile(modpath.."/upgrades.lua")
|
||||||
dofile(modpath.."/craftitems.lua")
|
dofile(modpath.."/craftitems.lua")
|
||||||
|
dofile(modpath.."/guide.lua")
|
||||||
dofile(modpath.."/nodes.lua")
|
dofile(modpath.."/nodes.lua")
|
||||||
if industrialtest.config.developerMode then
|
if industrialtest.config.developerMode then
|
||||||
dofile(modpath.."/utils.lua")
|
dofile(modpath.."/utils.lua")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user