Skip to content

Helfima/helmod

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Helmod

This a mod for Factorio: Mod Page

Data model here

To see the data in the game, open Helmod, click on Admin icon, choose Global tab

Remote API

Name of remote interface helmod_interface Use remote.call from your mod for request data

Methodes:

  • get_models : Return all models
  • get_recipe(recipe_data) : Return the recipe with products and ingredients

To traverse the model, start with the root block model.block_root and to traverse each block block.children

Data Class:

  • Model : the model
  • Block : a block that contains blocks or recipes
  • Recipe : a helmod recipe, the type recipe is native recipe of Factorio, otherwise is custom recipe

Examples:

-- return all models
local data = remote.call("helmod_interface", "get_models")
---Traverse model to append products and ingredients on each recipe
---@param data ModelData | BlokcData | RecipeData
function UnitTestPanel:loopDataRemoteAPI(data)
    if data.class == "Model" then
        for _, child in pairs(data.block_root.children) do
            self:loopDataRemoteAPI(child)
        end
    elseif data.class == "Block" then
        for _, child in pairs(data.children) do
            self:loopDataRemoteAPI(child)
        end
    elseif data.class == "Recipe" then
        local recipe = remote.call("helmod_interface", "get_recipe", data)
        data.products = recipe.products
        data.ingredients = recipe.ingredients
    end
end

About

Factorio Mod

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 37

Languages