data.raw["underground-belt"]["underground-belt"].max_distance = 5
data.raw["underground-belt"]["fast-underground-belt"].max_distance = 10
data.raw["underground-belt"]["express-underground-belt"].max_distance = 15


bobmods.lib.recipe.replace_ingredient("science-pack-2", "transport-belt", "black-transport-belt")
bobmods.lib.recipe.replace_ingredient("lab", "transport-belt", "black-transport-belt")



if data.raw.item["tin-plate"] then
  bobmods.lib.recipe.replace_ingredient("transport-belt", "iron-plate", "tin-plate")
  bobmods.lib.recipe.replace_ingredient("underground-belt", "iron-plate", "tin-plate")
  bobmods.lib.recipe.replace_ingredient("splitter", "iron-plate", "tin-plate")
end


bobmods.lib.tech.add_prerequisite("logistics-2", "steel-processing")

if data.raw.item["bronze-alloy"] then
  bobmods.lib.recipe.replace_ingredient("fast-transport-belt", "steel-plate", "bronze-alloy")
  bobmods.lib.recipe.replace_ingredient("fast-underground-belt", "steel-plate", "bronze-alloy")
  bobmods.lib.recipe.replace_ingredient("fast-splitter", "steel-plate", "bronze-alloy")
  bobmods.lib.tech.add_prerequisite("logistics-2", "alloy-processing-1")
end

if data.raw.item["steel-gear-wheel"] then
  bobmods.lib.recipe.replace_ingredient("fast-transport-belt", "iron-gear-wheel", "steel-gear-wheel")
  bobmods.lib.recipe.replace_ingredient("fast-underground-belt", "iron-gear-wheel", "steel-gear-wheel")
  bobmods.lib.recipe.replace_ingredient("fast-splitter", "iron-gear-wheel", "steel-gear-wheel")
end



if data.raw.item["aluminium-plate"] then
  bobmods.lib.recipe.replace_ingredient("express-transport-belt", "steel-plate", "aluminium-plate")
  bobmods.lib.recipe.replace_ingredient("express-underground-belt", "steel-plate", "aluminium-plate")
  bobmods.lib.recipe.replace_ingredient("express-splitter", "steel-plate", "aluminium-plate")
  bobmods.lib.tech.add_prerequisite("logistics-3", "aluminium-processing")
end

if data.raw.item["steel-bearing"] then
  if data.raw.item["cobalt-steel-bearing"] then
    bobmods.lib.recipe.add_ingredient("express-transport-belt", {"cobalt-steel-bearing", 4})
  elseif data.raw.item["brass-bearing"] then
    bobmods.lib.recipe.add_ingredient("express-transport-belt", {"brass-bearing", 4})
  else
    bobmods.lib.recipe.add_ingredient("express-transport-belt", {"steel-bearing", 4})
  end
  if settings.startup["bobmods-logistics-beltrequireprevious"].value == true then
    if data.raw.item["cobalt-steel-bearing"] then
      bobmods.lib.recipe.add_ingredient("express-underground-belt", {"cobalt-steel-bearing", 20})
      bobmods.lib.recipe.add_ingredient("express-splitter", {"cobalt-steel-bearing", 12})
    elseif data.raw.item["brass-bearing"] then
      bobmods.lib.recipe.add_ingredient("express-underground-belt", {"brass-bearing", 20})
      bobmods.lib.recipe.add_ingredient("express-splitter", {"brass-bearing", 12})
    else
      bobmods.lib.recipe.add_ingredient("express-underground-belt", {"steel-bearing", 20})
      bobmods.lib.recipe.add_ingredient("express-splitter", {"steel-bearing", 12})
    end
  else
    if data.raw.item["cobalt-steel-bearing"] then
      bobmods.lib.recipe.add_ingredient("express-splitter", {"cobalt-steel-bearing", 4})
    elseif data.raw.item["brass-bearing"] then
      bobmods.lib.recipe.add_ingredient("express-splitter", {"brass-bearing", 4})
    else
      bobmods.lib.recipe.add_ingredient("express-splitter", {"steel-bearing", 4})
    end
  end
else
  bobmods.lib.recipe.add_ingredient("express-transport-belt", {"iron-gear-wheel", 1})
  if settings.startup["bobmods-logistics-beltrequireprevious"].value == true then
    bobmods.lib.recipe.add_ingredient("express-underground-belt", {"iron-gear-wheel", 5})
    bobmods.lib.recipe.add_ingredient("express-splitter", {"iron-gear-wheel", 4})
  else
    bobmods.lib.recipe.add_ingredient("express-splitter", {"iron-gear-wheel", 2})
  end
end

if data.raw.item["cobalt-steel-gear-wheel"] then
  bobmods.lib.recipe.replace_ingredient("express-transport-belt", "iron-gear-wheel", "cobalt-steel-gear-wheel")
  bobmods.lib.recipe.replace_ingredient("express-underground-belt", "iron-gear-wheel", "cobalt-steel-gear-wheel")
  bobmods.lib.recipe.replace_ingredient("express-splitter", "iron-gear-wheel", "cobalt-steel-gear-wheel")
  bobmods.lib.tech.add_prerequisite("logistics-3", "cobalt-processing")
elseif data.raw.item["brass-gear-wheel"] then
  bobmods.lib.recipe.replace_ingredient("express-transport-belt", "iron-gear-wheel", "brass-gear-wheel")
  bobmods.lib.recipe.replace_ingredient("express-underground-belt", "iron-gear-wheel", "brass-gear-wheel")
  bobmods.lib.recipe.replace_ingredient("express-splitter", "iron-gear-wheel", "brass-gear-wheel")
  bobmods.lib.tech.add_prerequisite("logistics-3", "zinc-processing")
end



if data.raw.item["titanium-plate"] then
  bobmods.lib.recipe.replace_ingredient("green-transport-belt", "steel-plate", "titanium-plate")
  bobmods.lib.recipe.replace_ingredient("green-underground-belt", "steel-plate", "titanium-plate")
  bobmods.lib.recipe.replace_ingredient("green-splitter", "steel-plate", "titanium-plate")
  bobmods.lib.tech.add_prerequisite("bob-logistics-4", "titanium-processing")
end

if data.raw.item["titanium-bearing"] then
  bobmods.lib.recipe.add_ingredient("green-transport-belt", {"titanium-bearing", 4})
  if settings.startup["bobmods-logistics-beltrequireprevious"].value == true then
    bobmods.lib.recipe.add_ingredient("green-underground-belt", {"titanium-bearing", 20})
    bobmods.lib.recipe.add_ingredient("green-splitter", {"titanium-bearing", 12})
  else
    bobmods.lib.recipe.add_ingredient("green-splitter", {"titanium-bearing", 4})
  end
else
  bobmods.lib.recipe.add_ingredient("green-transport-belt", {"iron-gear-wheel", 1})
  if settings.startup["bobmods-logistics-beltrequireprevious"].value == true then
    bobmods.lib.recipe.add_ingredient("green-underground-belt", {"iron-gear-wheel", 5})
    bobmods.lib.recipe.add_ingredient("green-splitter", {"iron-gear-wheel", 4})
  else
    bobmods.lib.recipe.add_ingredient("green-splitter", {"iron-gear-wheel", 2})
  end
end

if data.raw.item["titanium-gear-wheel"] then
  bobmods.lib.recipe.replace_ingredient("green-transport-belt", "iron-gear-wheel", "titanium-gear-wheel")
  bobmods.lib.recipe.replace_ingredient("green-underground-belt", "iron-gear-wheel", "titanium-gear-wheel")
  bobmods.lib.recipe.replace_ingredient("green-splitter", "iron-gear-wheel", "titanium-gear-wheel")
end



if settings.startup["bobmods-logistics-extremelyfastbelt"].value == true then
  if data.raw.item["nitinol-alloy"] then
    bobmods.lib.recipe.replace_ingredient("purple-transport-belt", "steel-plate", "nitinol-alloy")
    bobmods.lib.recipe.replace_ingredient("purple-underground-belt", "steel-plate", "nitinol-alloy")
    bobmods.lib.recipe.replace_ingredient("purple-splitter", "steel-plate", "nitinol-alloy")
    bobmods.lib.tech.add_prerequisite("bob-logistics-5", "nitinol-processing")
  end

  if data.raw.item["nitinol-bearing"] then
    bobmods.lib.recipe.add_ingredient("purple-transport-belt", {"nitinol-bearing", 4})
    if settings.startup["bobmods-logistics-beltrequireprevious"].value == true then
      bobmods.lib.recipe.add_ingredient("purple-underground-belt", {"nitinol-bearing", 20})
      bobmods.lib.recipe.add_ingredient("purple-splitter", {"nitinol-bearing", 12})
    else
      bobmods.lib.recipe.add_ingredient("purple-splitter", {"nitinol-bearing", 4})
    end
  else
    bobmods.lib.recipe.add_ingredient("purple-transport-belt", {"iron-gear-wheel", 1})
    if settings.startup["bobmods-logistics-beltrequireprevious"].value == true then
      bobmods.lib.recipe.add_ingredient("purple-underground-belt", {"iron-gear-wheel", 5})
      bobmods.lib.recipe.add_ingredient("purple-splitter", {"iron-gear-wheel", 4})
    else
      bobmods.lib.recipe.add_ingredient("purple-splitter", {"iron-gear-wheel", 2})
    end
  end

  if data.raw.item["nitinol-gear-wheel"] then
    bobmods.lib.recipe.replace_ingredient("purple-transport-belt", "iron-gear-wheel", "nitinol-gear-wheel")
    bobmods.lib.recipe.replace_ingredient("purple-underground-belt", "iron-gear-wheel", "nitinol-gear-wheel")
    bobmods.lib.recipe.replace_ingredient("purple-splitter", "iron-gear-wheel", "nitinol-gear-wheel")
  end

  if data.raw.item["advanced-processing-unit"] then
    bobmods.lib.recipe.replace_ingredient("purple-splitter", "processing-unit", "advanced-processing-unit")
  end
end

