Implement Geothermal Generator
This commit is contained in:
33
api.lua
33
api.lua
@@ -20,6 +20,7 @@ industrialtest.api={}
|
||||
industrialtest.api.maceratorRecipes={}
|
||||
industrialtest.api.compressorRecipes={}
|
||||
industrialtest.api.extractorRecipes={}
|
||||
industrialtest.api.geothermalGeneratorFuels={}
|
||||
|
||||
industrialtest.api.lvPowerFlow=600
|
||||
industrialtest.api.mvPowerFlow=2400
|
||||
@@ -408,3 +409,35 @@ end
|
||||
industrialtest.api.getExtractorRecipeResult=function(recipe)
|
||||
return industrialtest.api.extractorRecipes[recipe]
|
||||
end
|
||||
-- \brief Registers fuel that can be used in geothermal generator
|
||||
-- \param fuel Table with following keys: <name>, <calorificValue>, <storageItems>
|
||||
-- which is a table containing items which are tables with following keys: <name>, <leftover>
|
||||
-- \returns nil
|
||||
industrialtest.api.registerGeothermalGeneratorFuel=function(config)
|
||||
local definition={
|
||||
name=config.name or "",
|
||||
calorificValue=config.calorificValue or 0,
|
||||
texture=config.texture or "industrialtest_gui_fluid_bg.png",
|
||||
storageItems=config.storageItems or {}
|
||||
}
|
||||
industrialtest.api.geothermalGeneratorFuels[definition.name]=definition
|
||||
end
|
||||
-- \brief Returns generator fuel information
|
||||
-- \param name Name of fuel
|
||||
-- \returns Table with following keys: name, calorificValue, storageItems
|
||||
industrialtest.api.getGeothermalGeneratorFuel=function(name)
|
||||
return industrialtest.api.geothermalGeneratorFuels[name]
|
||||
end
|
||||
-- \brief Returns generator fuel information by item name
|
||||
-- \param name ID of item
|
||||
-- \returns Table with following keys: name, calorificValue, storageItems or nil in case of failure
|
||||
industrialtest.api.getGeothermalGeneratorFuelByItem=function(name)
|
||||
for _,value in pairs(industrialtest.api.geothermalGeneratorFuels) do
|
||||
for _,item in ipairs(value.storageItems) do
|
||||
if item.name==name then
|
||||
return value
|
||||
end
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user