Advertisement
phantum

boxing Fix

Feb 15th, 2017
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.27 KB | None | 0 0
  1. for i,item in pairs(boxing.items) do
  2.     local icon = item.icon;
  3.     local mod = icon:sub(0, icon:find("/")-1);
  4.     mod = mod:sub(3, -3);
  5.     icon = icon:sub(icon:find("/")+1);
  6.  
  7.     local iconPath;
  8.     if boxing.icons[mod] and boxing.icons[mod][icon] then
  9.         iconPath = mod .. "/" .. icon;
  10.     else
  11.         iconPath = "unknown.png";
  12.     end
  13.  
  14.     data:extend({
  15.         {
  16.             type = "recipe",
  17.             name = "wooden-box-" .. item.name,
  18.             localised_name = {"recipe-name.box-*", {"item-name." .. item.name}},
  19.             icon = "__boxing-2__/graphics/icons/box/wooden/" .. iconPath,
  20.             energy_required = 2,
  21.             category = "crafting-with-fluid",
  22.             subgroup = "boxing-wooden-" .. item.subgroup,
  23.             order = item.order,
  24.             ingredients = {
  25.                 {item.name, item.stack_size},
  26.                 {"wooden-box", 1},
  27.             },
  28.             result = "wooden-box-of-" .. item.name,
  29.             enabled = "false",
  30.         },
  31.         {
  32.             type = "recipe",
  33.             name = "wooden-unbox-" .. item.name,
  34.             localised_name = {"recipe-name.unbox-*", {"item-name." .. item.name}},
  35.             icon = "__boxing-2__/graphics/icons/unbox/wooden/" .. iconPath,
  36.             energy_required = 2,
  37.             category = "crafting-with-fluid",
  38.             subgroup = "unboxing-wooden-" .. item.subgroup,
  39.             order = item.order,
  40.             ingredients = {
  41.                 {"wooden-box-of-" .. item.name, 1},
  42.             },
  43.             results = {
  44.                 {type="item", name=item.name, amount=item.stack_size},
  45.                 {type="item", name="wooden-box", amount=1},
  46.             },
  47.             enabled = "false",
  48.         },
  49.         {
  50.             type = "recipe",
  51.             name = "steel-box-" .. item.name,
  52.             localised_name = {"recipe-name.box-*", {"item-name." .. item.name}},
  53.             icon = "__boxing-2__/graphics/icons/box/steel/" .. iconPath,
  54.             energy_required = 5,
  55.             category = "crafting-with-fluid",
  56.             subgroup = "boxing-steel-" .. item.subgroup,
  57.             order = item.order,
  58.             ingredients = {
  59.                 {item.name, item.stack_size},
  60.                 {"steel-box", 1},
  61.             },
  62.             result = "steel-box-of-" .. item.name,
  63.             enabled = "false",
  64.         },
  65.         {
  66.             type = "recipe",
  67.             name = "steel-unbox-" .. item.name,
  68.             localised_name = {"recipe-name.unbox-*", {"item-name." .. item.name}},
  69.             icon = "__boxing-2__/graphics/icons/unbox/steel/" .. iconPath,
  70.             energy_required = 5,
  71.             category = "crafting-with-fluid",
  72.             subgroup = "unboxing-steel-" .. item.subgroup,
  73.             order = item.order,
  74.             ingredients = {
  75.                 {"steel-box-of-" .. item.name, 1},
  76.             },
  77.             results = {
  78.                 {type="item", name=item.name, amount=item.stack_size},
  79.                 {type="item", name="steel-box", amount=1},
  80.             },
  81.             enabled = "false",
  82.         },
  83.     });
  84.     table.insert(boxing.woodenUnlocks, {
  85.         type = "unlock-recipe",
  86.         recipe = "wooden-box-" .. item.name,
  87.     });
  88.     table.insert(boxing.woodenUnlocks, {
  89.         type = "unlock-recipe",
  90.         recipe = "wooden-unbox-" .. item.name,
  91.     });
  92.     table.insert(boxing.steelUnlocks, {
  93.         type = "unlock-recipe",
  94.         recipe = "steel-box-" .. item.name,
  95.     });
  96.     table.insert(boxing.steelUnlocks, {
  97.         type = "unlock-recipe",
  98.         recipe = "steel-unbox-" .. item.name,
  99.     });
  100.     if boxing.tungsten then
  101.         data:extend({
  102.             {
  103.                 type = "recipe",
  104.                 name = "tungsten-box-" .. item.name,
  105.                 localised_name = {"recipe-name.box-*", {"item-name." .. item.name}},
  106.                 icon = "__boxing-2__/graphics/icons/box/tungsten/" .. iconPath,
  107.                 energy_required = 10,
  108.                 category = "crafting-with-fluid",
  109.                 subgroup = "boxing-tungsten-" .. item.subgroup,
  110.                 order = item.order,
  111.                 ingredients = {
  112.                     {item.name, item.stack_size},
  113.                     {"tungsten-box", 1},
  114.                 },
  115.                 result = "tungsten-box-of-" .. item.name,
  116.                 enabled = "false",
  117.             },
  118.             {
  119.                 type = "recipe",
  120.                 name = "tungsten-unbox-" .. item.name,
  121.                 localised_name = {"recipe-name.unbox-*", {"item-name." .. item.name}},
  122.                 icon = "__boxing-2__/graphics/icons/unbox/tungsten/" .. iconPath,
  123.                 energy_required = 10,
  124.                 category = "crafting-with-fluid",
  125.                 subgroup = "unboxing-tungsten-" .. item.subgroup,
  126.                 order = item.order,
  127.                 ingredients = {
  128.                     {"tungsten-box-of-" .. item.name, 1},
  129.                 },
  130.                 results = {
  131.                     {type="item", name=item.name, amount=item.stack_size},
  132.                     {type="item", name="tungsten-box", amount=1},
  133.                 },
  134.                 enabled = "false",
  135.             },
  136.         });
  137.         table.insert(boxing.tungstenUnlocks, {
  138.             type = "unlock-recipe",
  139.             recipe = "tungsten-box-" .. item.name,
  140.         });
  141.         table.insert(boxing.tungstenUnlocks, {
  142.             type = "unlock-recipe",
  143.             recipe = "tungsten-unbox-" .. item.name,
  144.         });
  145.     end
  146. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement