Efficiency mod in 0.16

Place to get help with not working mods / modding interface.
Post Reply
Tierre
Inserter
Inserter
Posts: 35
Joined: Sat Oct 14, 2017 3:44 pm
Contact:

Efficiency mod in 0.16

Post by Tierre »

Hi all,

There was a great mod called Efficiency in 0.15
https://mods.factorio.com/mod/efficiency
It should still work in 0.16 but i have a problem loading it.
It says "Recipe is in crafting categoty but has a non-item ingridient liquid-sulfuric-acid". It is said about better Processing Unit recipe.

Can anybody help me solve this? It also says about conficting mods with angelpetrochem and omnilib, but i think its just that they have something to do with sul;furic acid and not the problem with mod confilct itself.

Edit - corrected typos
Last edited by Tierre on Sun May 20, 2018 9:08 am, edited 2 times in total.

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2904
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Efficiency mod in 0.16

Post by darkfrei »

We have in vanilla:
data.raw["god-controller"].default.crafting_categories[1] = "crafting"
data.raw.player.player.crafting_categories[1] = "crafting"

It means, by all recipes with fluids it can't be crafted by player.
So, you are need to read all recipes and if it has fluid ingredients, set it to some another category. If you have no category, it's also "crafting".

It must be defined as in vanilla:
data.raw.recipe["sulfuric-acid"].category = "chemistry"

And by your mod must be (as example):
data.raw.recipe["liquid-sulfuric-acid"].category = "chemistry"


UPD:
Same code I have in https://mods.factorio.com/mod/Steamed,

Your must be like (not tested):

Code: Select all

for recipe_name, recipe_prot in pairs (data.raw.recipe) do
  local recipe_handlers = {recipe_prot}
  if recipe_prot.normal then table.insert(recipe_handlers, recipe_prot.normal) end
  if recipe_prot.expensive then table.insert(recipe_handlers, recipe_prot.expensive) end

  local has_fluids = false
  for i, handler_prot in pairs (recipe_handlers) do
    if handler_prot.ingredients then
      for j, ingredient in pairs (handler_prot.ingredients) do
        if ingredient.type and ingredient.type == 'fluid' then
          has_fluids = true
        end
      end
    end
    if handler_prot.results then
      for j, result in pairs (handler_prot.results) do
        if result.type and result.type == 'fluid' then
          has_fluids = true
        end
      end
    end
  end
  if recipe_prot.category and has_fluids then 
    if recipe_prot.category == "crafting" then
      recipe_prot.category = "crafting-with-fluid"
      log ('recipe category by '.. recipe_name.. ' was changed to "crafting-with-fluid"')
    end
  elseif ((not (recipe_prot.category)) and (has_fluids)) then 
    recipe_prot.category = "crafting-with-fluid"
    log ('it was no recipe category by '.. recipe_name)
  end
end

Tierre
Inserter
Inserter
Posts: 35
Joined: Sat Oct 14, 2017 3:44 pm
Contact:

Re: Efficiency mod in 0.16

Post by Tierre »

The problem is that it just modifies existing recipe. So maybe it just needs to assign a correct category to changed recipe, instead of going through all recipees?

Also for your fix do i need to create and put it into data.lua? I never mod myself but i lik to change mods for my liking, so i can inderstand code but don't know some basic things (like what is the difference between data.lua abd data-final-fixes.lua and what headers should i make in new files).


PS Didn't help - still can't load with the same error.

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2904
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Efficiency mod in 0.16

Post by darkfrei »

Tierre wrote:what is the difference between data.lua abd data-final-fixes.lua and what headers should i make in new files.
First started
data.lua
then second started:
data-updates.lua
then third started:
data-final-fixes.lua
http://lua-api.factorio.com/latest/Data-Lifecycle.html

So, put this code in next file. Did you read Factorio/factorio-current.log file? Here is logging and you can read what exactly happens.

Post Reply

Return to “Modding help”