Introduce tag system for further usage

This commit is contained in:
mrkubax10 2024-09-11 15:29:03 +02:00
parent 636c0cda64
commit 3419fcb660
4 changed files with 20 additions and 13 deletions

View File

@ -14,15 +14,17 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
industrialtest.api={}
industrialtest.api.maceratorRecipes={}
industrialtest.api.compressorRecipes={}
industrialtest.api.extractorRecipes={}
industrialtest.api.cableFormerRecipes={}
industrialtest.api.geothermalGeneratorFuels={}
industrialtest.api.waterMillFuels={}
industrialtest.api.rotaryMaceratorModifiers={}
industrialtest.api.storageCells={}
industrialtest.api={
maceratorRecipes={},
compressorRecipes={},
extractorRecipes={},
cableFormerRecipes={},
geothermalGeneratorFuels={},
waterMillFuels={},
rotaryMaceratorModifiers={},
storageCells={},
tags={}
}
industrialtest.api.lvPowerFlow=600
industrialtest.api.mvPowerFlow=2400

View File

@ -16,6 +16,13 @@
local S=minetest.get_translator("industrialtest")
function industrialtest.api.addTag(name,tag)
if not industrialtest.api.tags[tag] then
industrialtest.api.tags[tag]={}
end
table.insert(industrialtest.api.tags[tag],name)
end
-- \brief Registers dust of certain resource
-- \param name Technical name of resource
-- \param displayName Display name of resource

View File

@ -344,7 +344,7 @@ addPipeworksCompatibility("industrialtest:induction_furnace",{
},"dst")
-- Simple electric item processors
for _,name in ipairs(industrialtest.internal.simpleElectricItemProcessors) do
for _,name in ipairs(industrialtest.api.tags.simpleElectricItemProcessor) do
addPipeworksCompatibility(name,{
{
y=1,

View File

@ -17,8 +17,6 @@
local machine={}
local simpleElectricItemProcessor={}
industrialtest.internal.simpleElectricItemProcessors={}
industrialtest.internal.mclAfterDigNode=function(pos,oldmeta,lists)
-- Taken from https://git.minetest.land/MineClone2/MineClone2/src/branch/master/mods/ITEMS/mcl_furnaces/init.lua#L538
local meta=minetest.get_meta(pos)
@ -783,5 +781,5 @@ function industrialtest.internal.registerSimpleElectricItemProcessor(config)
return simpleElectricItemProcessor.activeOnTimer(pos,elapsed,meta,inv,config)
end
})
table.insert(industrialtest.internal.simpleElectricItemProcessors,"industrialtest:"..config.name)
industrialtest.api.addTag("industrialtest:"..config.name,"simpleElectricItemProcessor")
end