-- energy_per_shield MK1 is 20J per shield unit, MK2 is 30J.
-- max_shield_value MK1 is 50, MK2 is 150
-- buffer_capacity MK1 is "120J", MK2 is 180J
-- input_flow_limit MK1 is "240W", MK2 is 360W

data.raw["energy-shield-equipment"]["energy-shield-equipment"].max_shield_value = 75

data.raw["energy-shield-equipment"]["energy-shield-mk2-equipment"].energy_per_shield = "2kJ"
data.raw["energy-shield-equipment"]["energy-shield-mk2-equipment"].energy_source.input_flow_limit = "24kW"

data:extend(
{
  {
    type = "energy-shield-equipment",
    name = "energy-shield-mk3-equipment",
    max_shield_value = 300,
    energy_per_shield = "2kJ",
    energy_source =
    {
      type = "electric",
      buffer_capacity = "24kJ",
      input_flow_limit = "48kW",
      usage_priority = "primary-input"
    },
    shape =
    {
      width = 2,
      height = 2,
      type = "full"
    },
    sprite = 
    {
      filename = "__bobwarfare__/graphics/equipment/energy-shield-mk3-equipment.png",
      width = 64,
      height = 64,
      priority = "medium"
    },
  },

  {
    type = "energy-shield-equipment",
    name = "energy-shield-mk4-equipment",
    max_shield_value = 600,
    energy_per_shield = "2kJ",
    energy_source =
    {
      type = "electric",
      buffer_capacity = "30kJ",
      input_flow_limit = "60kW",
      usage_priority = "primary-input"
    },
    shape =
    {
      width = 2,
      height = 2,
      type = "full"
    },
    sprite = 
    {
      filename = "__bobwarfare__/graphics/equipment/energy-shield-mk4-equipment.png",
      width = 64,
      height = 64,
      priority = "medium"
    },
  },

  {
    type = "energy-shield-equipment",
    name = "energy-shield-mk5-equipment",
    max_shield_value = 1200,
    energy_per_shield = "2kJ",
    energy_source =
    {
      type = "electric",
      buffer_capacity = "36kJ",
      input_flow_limit = "72kW",
      usage_priority = "primary-input"
    },
    shape =
    {
      width = 2,
      height = 2,
      type = "full"
    },
    sprite = 
    {
      filename = "__bobwarfare__/graphics/equipment/energy-shield-mk5-equipment.png",
      width = 64,
      height = 64,
      priority = "medium"
    },
  },

  {
    type = "energy-shield-equipment",
    name = "energy-shield-mk6-equipment",
    max_shield_value = 2400,
    energy_per_shield = "2kJ",
    energy_source =
    {
      type = "electric",
      buffer_capacity = "42kJ",
      input_flow_limit = "84kW",
      usage_priority = "primary-input"
    },
    shape =
    {
      width = 2,
      height = 2,
      type = "full"
    },
    sprite = 
    {
      filename = "__bobwarfare__/graphics/equipment/energy-shield-mk6-equipment.png",
      width = 64,
      height = 64,
      priority = "medium"
    },
  },
}
)

data.raw["battery-equipment"]["battery-mk2-equipment"].energy_source.buffer_capacity = "200KJ"
data.raw["battery-equipment"]["battery-mk2-equipment"].energy_source.input_flow_limit = "2MW"
data.raw["battery-equipment"]["battery-mk2-equipment"].energy_source.output_flow_limit = "2MW"

data:extend(
{
  {
    type = "battery-equipment",
    name = "battery-mk3-equipment",
    sprite = 
    {
      filename = "__bobwarfare__/graphics/equipment/battery-mk3-equipment.png",
      width = 32,
      height = 64,
      priority = "medium"
    },
    shape =
    {
      width = 1,
      height = 2,
      type = "full"
    },
    energy_source =
    {
      type = "electric",
      buffer_capacity = "1200KJ",
      input_flow_limit = "12MW",
      output_flow_limit = "12MW",
      usage_priority = "terciary"
    }
  },
  {
    type = "battery-equipment",
    name = "battery-mk4-equipment",
    sprite = 
    {
      filename = "__bobwarfare__/graphics/equipment/battery-mk4-equipment.png",
      width = 32,
      height = 64,
      priority = "medium"
    },
    shape =
    {
      width = 1,
      height = 2,
      type = "full"
    },
    energy_source =
    {
      type = "electric",
      buffer_capacity = "3MJ",
      input_flow_limit = "30MW",
      output_flow_limit = "30MW",
      usage_priority = "terciary"
    }
  },
  {
    type = "battery-equipment",
    name = "battery-mk5-equipment",
    sprite = 
    {
      filename = "__bobwarfare__/graphics/equipment/battery-mk5-equipment.png",
      width = 32,
      height = 64,
      priority = "medium"
    },
    shape =
    {
      width = 1,
      height = 2,
      type = "full"
    },
    energy_source =
    {
      type = "electric",
      buffer_capacity = "7500KJ",
      input_flow_limit = "75MW",
      output_flow_limit = "75MW",
      usage_priority = "terciary"
    }
  },
  {
    type = "battery-equipment",
    name = "battery-mk6-equipment",
    sprite = 
    {
      filename = "__bobwarfare__/graphics/equipment/battery-mk6-equipment.png",
      width = 32,
      height = 64,
      priority = "medium"
    },
    shape =
    {
      width = 1,
      height = 2,
      type = "full"
    },
    energy_source =
    {
      type = "electric",
      buffer_capacity = "18MJ",
      input_flow_limit = "180MW",
      output_flow_limit = "180MW",
      usage_priority = "terciary"
    }
  },
}
)


data:extend(
{
  {
    type = "generator-equipment",
    name = "fusion-reactor-equipment-2",
    sprite = 
    {
      filename = "__bobwarfare__/graphics/equipment/fusion-reactor-equipment-2.png",
      width = 128,
      height = 128,
      priority = "medium"
    },
    shape =
    {
      width = 4,
      height = 4,
      type = "full"
    },
    energy_source =
    {
      type = "electric",
      usage_priority = "primary-output"
    },
    power = "125kW"
  },
  {
    type = "generator-equipment",
    name = "fusion-reactor-equipment-3",
    sprite = 
    {
      filename = "__bobwarfare__/graphics/equipment/fusion-reactor-equipment-3.png",
      width = 128,
      height = 128,
      priority = "medium"
    },
    shape =
    {
      width = 4,
      height = 4,
      type = "full"
    },
    energy_source =
    {
      type = "electric",
      usage_priority = "primary-output"
    },
    power = "200kW"
  },
  {
    type = "generator-equipment",
    name = "fusion-reactor-equipment-4",
    sprite = 
    {
      filename = "__bobwarfare__/graphics/equipment/fusion-reactor-equipment-4.png",
      width = 128,
      height = 128,
      priority = "medium"
    },
    shape =
    {
      width = 4,
      height = 4,
      type = "full"
    },
    energy_source =
    {
      type = "electric",
      usage_priority = "primary-output"
    },
    power = "300kW"
  },
}
)


data:extend(
{
  {
    type = "active-defense-equipment",
    name = "combat-robot-dispenser-equipment",
    sprite = 
    {
      filename = "__bobwarfare__/graphics/equipment/combat-robot-dispenser-equipment.png",
      width = 64,
      height = 64,
      priority = "medium"
    },
    shape =
    {
      width = 2,
      height = 2,
      type = "full"
    },
    energy_source =
    {
      type = "electric",
      usage_priority = "secondary-input",
      buffer_capacity = "501kJ"
    },
    attack_parameters =
    {
      type = "projectile",
      ammo_category = "electric",
      cooldown = 60 * 15,
      damage_modifier = 1,
      projectile_center = {0, 0},
      projectile_creation_distance = 0.6,
      range = 10,
      ammo_type =
      {
        type = "projectile",
        category = "electric",
        energy_consumption = "500kJ",
        action = 
        {
          {
            type = "direct",
            action_delivery =
            {
              type = "instant",
              source_effects =
              {
                {
                  type = "create-entity",
                  show_in_tooltip = true,
                  entity_name = "distractor",
                },
              }
            }
          }
        }
      }
    },
    automatic = true
  },
}
)


data:extend(
{
  {
    type = "night-vision-equipment",
    name = "night-vision-equipment-2",
    sprite = 
    {
      filename = "__base__/graphics/equipment/night-vision-equipment.png",
      width = 96,
      height = 64,
      priority = "medium"
    },
    shape =
    {
      width = 3,
      height = 2,
      type = "full"
    },
    energy_source =
    {
      type = "electric",
      buffer_capacity = "18kJ",
      input_flow_limit = "36kW",
      usage_priority = "primary-input"
    },
    energy_input = "1500W",
    tint = {r = 0.1, g = 0.1, b = 0, a = 0.2}
  },
  {
    type = "night-vision-equipment",
    name = "night-vision-equipment-3",
    sprite = 
    {
      filename = "__base__/graphics/equipment/night-vision-equipment.png",
      width = 96,
      height = 64,
      priority = "medium"
    },
    shape =
    {
      width = 3,
      height = 2,
      type = "full"
    },
    energy_source =
    {
      type = "electric",
      buffer_capacity = "24kJ",
      input_flow_limit = "48kW",
      usage_priority = "primary-input"
    },
    energy_input = "2kW",
    tint = {r = 0.1, g = 0.1, b = 0.1, a = 0.2}
  },
}
)


data:extend(
{
  {
    type = "solar-panel-equipment",
    name = "solar-panel-equipment-2",
    sprite = 
    {
      filename = "__bobwarfare__/graphics/equipment/solar-panel-equipment-2.png",
      width = 32,
      height = 32,
      priority = "medium"
    },
    shape =
    {
      width = 1,
      height = 1,
      type = "full"
    },
    energy_source =
    {
      type = "electric",
      usage_priority = "primary-output"
    },
    power = "1500W"
  },
  {
    type = "solar-panel-equipment",
    name = "solar-panel-equipment-3",
    sprite = 
    {
      filename = "__bobwarfare__/graphics/equipment/solar-panel-equipment-3.png",
      width = 32,
      height = 32,
      priority = "medium"
    },
    shape =
    {
      width = 1,
      height = 1,
      type = "full"
    },
    energy_source =
    {
      type = "electric",
      usage_priority = "primary-output"
    },
    power = "2500W"
  },
  {
    type = "solar-panel-equipment",
    name = "solar-panel-equipment-4",
    sprite = 
    {
      filename = "__bobwarfare__/graphics/equipment/solar-panel-equipment-4.png",
      width = 32,
      height = 32,
      priority = "medium"
    },
    shape =
    {
      width = 1,
      height = 1,
      type = "full"
    },
    energy_source =
    {
      type = "electric",
      usage_priority = "primary-output"
    },
    power = "4kW"
  },
}
)

function bob_basic_laser_defense_equipment(name, sprite, buffer_capacity, energy_consumption, projectile, damage_modifier, cooldown, range)
return
  {
    type = "active-defense-equipment",
    name = name,
    sprite = 
    {
      filename = sprite,
      width = 64,
      height = 96,
      priority = "medium"
    },
    shape =
    {
      width = 2,
      height = 3,
      type = "full"
    },
    energy_source =
    {
      type = "electric",
      usage_priority = "secondary-input",
      buffer_capacity = buffer_capacity
    },
    attack_parameters =
    {
      type = "projectile",
      ammo_category = "electric",
      cooldown = cooldown,
      damage_modifier = damage_modifier,
      projectile_center = {0, 0},
      projectile_creation_distance = 0.6,
      range = range,
      sound = make_laser_sounds(),
      ammo_type =
      {
        type = "projectile",
        category = "electric",
        energy_consumption = energy_consumption,
        projectile = projectile,
        speed = 1,
        action = 
        {
          {
            type = "direct",
            action_delivery =
            {
              {
                type = "projectile",
                projectile = projectile,
                starting_speed = 0.28
              }
            }
          }
        }
      }
    },
    automatic = true
  }
end

data:extend(
{
--  bob_basic_laser_defense_equipment(name, sprite, buffer_capacity, energy_consumption, projectile, damage_modifier, cooldown, range)
  bob_basic_laser_defense_equipment("basic-laser-defense-equipment-2", "__bobwarfare__/graphics/equipment/basic-laser-defense-equipment-2.png", "26kJ", "12500J", "bob-green-laser", 1.5, 15, 16),
  bob_basic_laser_defense_equipment("basic-laser-defense-equipment-3", "__bobwarfare__/graphics/equipment/basic-laser-defense-equipment-3.png", "46kJ", "15kJ", "bob-blue-laser", 2.1, 12, 17),
  bob_basic_laser_defense_equipment("basic-laser-defense-equipment-4", "__bobwarfare__/graphics/equipment/basic-laser-defense-equipment-4.png", "71kJ", "17500J", "bob-purple-laser", 2.8, 10, 18),
  bob_basic_laser_defense_equipment("basic-laser-defense-equipment-5", "__bobwarfare__/graphics/equipment/basic-laser-defense-equipment-5.png", "101kJ", "20kJ", "bob-yellow-laser", 3.6, 8.5, 19),
  bob_basic_laser_defense_equipment("basic-laser-defense-equipment-6", "__bobwarfare__/graphics/equipment/basic-laser-defense-equipment-6.png", "136kJ", "22500J", "bob-white-laser", 4.5, 7.5, 20),
}
)


data:extend(
{
  {
    type = "movement-bonus-equipment",
    name = "basic-exoskeleton-equipment-2",
    sprite = 
    {
      filename = "__base__/graphics/equipment/basic-exoskeleton-equipment.png",
      width = 64,
      height = 128,
      priority = "medium"
    },
    shape =
    {
      width = 2,
      height = 4,
      type = "full"
    },
    energy_source =
    {
      type = "electric",
      usage_priority = "secondary-input"
    },
    energy_consumption = "3kW",
    movement_bonus = 0.45
  },
  {
    type = "movement-bonus-equipment",
    name = "basic-exoskeleton-equipment-3",
    sprite = 
    {
      filename = "__base__/graphics/equipment/basic-exoskeleton-equipment.png",
      width = 64,
      height = 128,
      priority = "medium"
    },
    shape =
    {
      width = 2,
      height = 4,
      type = "full"
    },
    energy_source =
    {
      type = "electric",
      usage_priority = "secondary-input"
    },
    energy_consumption = "4kW",
    movement_bonus = 0.6
  },
}
)
