5x Production


This mod makes your base not so fast, all recipes are need 5 times more time, 5 times more ingredients and also 5 times more production: the balance will be not changed. Multiply factor can be changed from 1 up to 100.

Tweaks
3 years ago
0.15 - 1.1
684

i 0,5s recipes

3 years ago

Hi darkfrei, very good mod i love it.
Can you add an option to adjust recipes with below 5s time differently.
I wish i could increase production/comsuption/time of for example green circuit and cable which are 0,5s by a factor of 40 while everything else by a factor of 5.
Thanks a lot and keep up the good work.

3 years ago

The mod makes it's stuff automatically, I want as less as possible exceptions. But you can ask on the forum the new mod with this tweak, it needs just tiny code, but it must be done as separated mod.

3 years ago

hm i tried to adjust your function change_handler_recipe but it gives me an error, thats what i did

function change_handler_recipe (handler, factor_k)
local recipe = handler.recipe
if recipe.energy_required > 1 and not 0.5 then
recipe.energy_required = recipe.energy_required or 0.5 -- default for 0.15.34
recipe.energy_required = recipe.energy_required * factor_k
for i, ingredient in pairs (recipe.ingredients) do
ingredient.amount = ingredient.amount * factor_k
end
for i, result in pairs (recipe.results) do
result.amount = result.amount * factor_k
check_result_and_item_stack (result)
end
end
if recipe.energy_required <= 1 or 0.5 then
recipe.energy_required = recipe.energy_required or 0.5 -- default for 0.15.34
recipe.energy_required = recipe.energy_required * factor_k * 2
for i, ingredient in pairs (recipe.ingredients) do
ingredient.amount = ingredient.amount * factor_k * 2
end
for i, result in pairs (recipe.results) do
result.amount = result.amount * factor_k * 2
check_result_and_item_stack (result)
end
end
end

3 years ago

Which line gets error?

3 years ago

i probably did it wrong, i uploaded a screenshot
https://ibb.co/nr0NQKP

3 years ago
(updated 3 years ago)

194: (not 0.5) gives you only (not true), it's false;

energy.required can be not defined, check it before comparing.

You are need:

      local energy_required = recipe.energy_required or 0.5

The same, but more text:

      local energy_required = recipe.energy_required
      if not energy_required then energy_required  = 0.5 end

So, if not first argument, then second.

3 years ago

https://www.lua.org/pil/3.3.html

A useful Lua idiom is x = x or v, which is equivalent to

if not x then x = v end
3 years ago

its working now, thanks a lot !

New response