Guest User

Untitled

a guest
Oct 21st, 2019
362
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.11 KB | None | 0 0
  1. script.on_event({defines.events.on_init},
  2.     function(e)
  3.         removed_items = {"transport-belt", "fast-transport-belt"}
  4.         for name, recipe in pairs(data.raw.recipe) do
  5.             if recipe.result then
  6.               for _, removeName in ipairs(removed_items) do
  7.                   if recipe.result == removeName then
  8.                       recipe.enabled = false
  9.                       disabled_recipes[name] = name
  10.                   end
  11.               end
  12.             elseif recipe.results then
  13.               for ingredientIndex, ingredient in pairs(recipe.results) do
  14.                 for _, removeName in ipairs(removed_items) do
  15.                   if (ingredient.name and ingredient.name == removeName) or (ingredient[1] and ingredient[1] == removeName ) then
  16.                       recipe.enabled = false
  17.                       disabled_recipes[name] = name
  18.                   end
  19.                 end
  20.               end
  21.             end
  22.         end
  23.  
  24.         for name, technology in pairs(data.raw.technology) do
  25.           if technology.effects then
  26.             for index=#technology.effects,1,-1 do
  27.               local effect = technology.effects[index]
  28.               if effect.type == "unlock_recipe" then
  29.                 if disabled_recipes[effect.recipe] then
  30.                     table.remove(technology.effects, index)
  31.                 end
  32.               end
  33.             end
  34.           end
  35.         end
  36.     end
  37. )
Advertisement
Add Comment
Please, Sign In to add comment