local effects = require("__core__.lualib.surface-render-parameter-effects")
local asteroid_util = require("__space-age__.prototypes.planet.asteroid-spawn-definitions")
local planet_catalogue_gleba = require("__space-age__.prototypes.planet.procession-catalogue-gleba")

data:extend({
	{
		type = "surface-property",
		name = "gasous_atmosphere",
		default_value = 0,
	},
	{
		type = "space-connection",
		name = "fulgora-vesta",
		subgroup = "planet-connections",
		from = "fulgora",
		to = "vesta",
		order = "h",
		length = 20000,
		asteroid_spawn_definitions = asteroid_util.spawn_definitions(asteroid_util.gleba_fulgora)
	},
})
if settings.startup["ske_vesta_original_generation"].value then
require("__skewer_planet_vesta__/prototypes/planet/planet-vesta-map-gen")
local planet_map_gen = require("prototypes/planet/planet-map-gen")

data:extend(
{
  {
    type = "planet",
    name = "vesta",
    icon = "__skewer_planet_vesta__/graphics/icons/vesta_icon.png",
    starmap_icon = "__skewer_planet_vesta_assets__/graphics/technology/vesta.png",
    starmap_icon_size = 2000,
    gravity_pull = 10,
    distance = 30,
    orientation = 0.40,
    magnitude = 5,
    label_orientation = 0.15,
	tier = 5,
    order = "f[vesta]",
    subgroup = "planets",
    map_gen_settings = planet_map_gen.vesta(),
    pollutant_type = nil,
    solar_power_in_space = 160,
    platform_procession_set =
    {
      arrival = {"planet-to-platform-b"},
      departure = {"platform-to-planet-a"}
    },
    planet_procession_set =
    {
      arrival = {"platform-to-planet-b"},
      departure = {"planet-to-platform-a"}
    },
    procession_graphic_catalogue = planet_catalogue_gleba,
    surface_render_parameters =
    {
      clouds =
      {
        shape_noise_texture =
        {
          filename = "__core__/graphics/clouds-noise.png",
          size = 2048
        },
        detail_noise_texture =
        {
          filename = "__core__/graphics/clouds-detail-noise.png",
          size = 2048
        },

        warp_sample_1 = { scale = 0.8 / 16 },
        warp_sample_2 = { scale = 3.75 * 0.8 / 32, wind_speed_factor = 0 },
        warped_shape_sample = { scale = 2 * 0.18 / 32 },
        additional_density_sample = { scale = 1.5 * 0.18 / 32, wind_speed_factor = 1.77 },
        detail_sample_1 = { scale = 1.709 / 32, wind_speed_factor = 0.2 / 1.709 },
        detail_sample_2 = { scale = 2.179 / 32, wind_speed_factor = 0.33 / 2.179 },

        scale = 1,
        movement_speed_multiplier = 2.55,
        opacity = 0.15,
        opacity_at_night = 0.25,
        density_at_night = 1,
        detail_factor = 1.55,
        detail_factor_at_night = 2,
        shape_warp_strength = 0.15,
        shape_warp_weight = 0.6,
        detail_sample_morph_duration = 0,
      },

      -- Should be based on the default day/night times, ie
      -- sun starts to set at 0.25
      -- sun fully set at 0.45
      -- sun starts to rise at 0.55
      -- sun fully risen at 0.75
      -- On fulgora night looks a bit longer to look right with the lightning.
      day_night_cycle_color_lookup =
      {
        {0.0, "__space-age__/graphics/lut/fulgora-1-noon.png"},
        {0.2, "__space-age__/graphics/lut/fulgora-1-noon.png"},
        {0.3, "__space-age__/graphics/lut/fulgora-2-afternoon.png"},
        {0.4, "__space-age__/graphics/lut/fulgora-3-after-sunset.png"},
        {0.6, "__space-age__/graphics/lut/fulgora-4-before-dawn.png"},
        {0.7, "__space-age__/graphics/lut/fulgora-5-morning.png"},
      },
    },
    surface_properties =
    {
      ["day-night-cycle"] = 30 * minute,
      ["magnetic-field"] = 15,
      pressure = 500,
      ["solar-power"] = 75,
      gravity = 10,
	  gasous_atmosphere = 100
    },
    asteroid_spawn_influence = 1,
    asteroid_spawn_definitions = asteroid_util.spawn_definitions(asteroid_util.gleba_fulgora, 0.9),
    persistent_ambient_sounds =
    {
      base_ambience = {filename = "__space-age__/sound/wind/base-wind-fulgora.ogg", volume = 0.5},
      wind = {filename = "__space-age__/sound/wind/wind-fulgora.ogg", volume = 0.8},
      crossfade =
      {
        order = {"wind", "base_ambience"},
        curve_type = "cosine",
        from = {control = 0.35, volume_percentage = 0.0},
        to = {control = 2, volume_percentage = 100.0}
      },
      semi_persistent =
      {
        {
          sound = {variations = sound_variations("__space-age__/sound/world/semi-persistent/distant-thunder", 4, 0.6)},
          delay_mean_seconds = 33,
          delay_variance_seconds = 7
        },
        {
          sound =
          {
            variations = sound_variations("__space-age__/sound/world/semi-persistent/sand-wind-gust", 5, 0.45),
            advanced_volume_control =
            {
              fades = {fade_in = {curve_type = "cosine", from = {control = 0.5, volume_percentage = 0.0}, to = {1.5, 100.0}}}
            }
          },
          delay_mean_seconds = 15,
          delay_variance_seconds = 9,
        },
      }
    },
    entities_require_heating = false,
    ticks_between_player_effects = 2
  },
})
else
require("__skewer_planet_vesta__/prototypes/planet/planet-vesta-map-gen-platform")
local planet_map_gen_platform = require("prototypes/planet/planet-map-gen-platform")

data:extend(
{
  {
    type = "planet",
    name = "vesta",
    icon = "__skewer_planet_vesta__/graphics/icons/vesta_icon.png",
    starmap_icon = "__skewer_planet_vesta__/graphics/vesta.png",
    starmap_icon_size = 2000,
    gravity_pull = 10,
    distance = 30,
    orientation = 0.40,
    magnitude = 4.5,
    label_orientation = 0.15,
	tier = 5,
    order = "f[vesta]",
    subgroup = "planets",
    map_gen_settings = planet_map_gen_platform.vesta_platform(),
    pollutant_type = nil,
    solar_power_in_space = 320,
    platform_procession_set =
    {
      arrival = {"planet-to-platform-b"},
      departure = {"platform-to-planet-a"}
    },
    planet_procession_set =
    {
      arrival = {"platform-to-planet-b"},
      departure = {"planet-to-platform-a"}
    },
    procession_graphic_catalogue = planet_catalogue_gleba,
    surface_render_parameters =
    {
      clouds =
      {
        shape_noise_texture =
        {
          filename = "__core__/graphics/clouds-noise.png",
          size = 2048
        },
        detail_noise_texture =
        {
          filename = "__core__/graphics/clouds-detail-noise.png",
          size = 2048
        },

        warp_sample_1 = { scale = 0.8 / 16 },
        warp_sample_2 = { scale = 3.75 * 0.8 / 32, wind_speed_factor = 0 },
        warped_shape_sample = { scale = 2 * 0.18 / 32 },
        additional_density_sample = { scale = 1.5 * 0.18 / 32, wind_speed_factor = 1.77 },
        detail_sample_1 = { scale = 1.709 / 32, wind_speed_factor = 0.2 / 1.709 },
        detail_sample_2 = { scale = 2.179 / 32, wind_speed_factor = 0.33 / 2.179 },

        scale = 1,
        movement_speed_multiplier = 2.55,
        opacity = 0.15,
        opacity_at_night = 0.25,
        density_at_night = 1,
        detail_factor = 1.55,
        detail_factor_at_night = 2,
        shape_warp_strength = 0.15,
        shape_warp_weight = 0.6,
        detail_sample_morph_duration = 0,
      },
      day_night_cycle_color_lookup =
      {
        {0.0, "__space-age__/graphics/lut/fulgora-1-noon.png"},
        {0.2, "__space-age__/graphics/lut/fulgora-1-noon.png"},
        {0.3, "__space-age__/graphics/lut/fulgora-2-afternoon.png"},
        {0.4, "__space-age__/graphics/lut/fulgora-3-after-sunset.png"},
        {0.6, "__space-age__/graphics/lut/fulgora-4-before-dawn.png"},
        {0.7, "__space-age__/graphics/lut/fulgora-5-morning.png"},
      },
    },
    surface_properties =
    {
      ["day-night-cycle"] = 30 * minute,
      ["magnetic-field"] = 15,
      pressure = 500,
      ["solar-power"] = 75,
      gravity = 10,
	  gasous_atmosphere = 100
    },
    asteroid_spawn_influence = 1,
    asteroid_spawn_definitions = asteroid_util.spawn_definitions(asteroid_util.gleba_fulgora, 0.9),
    persistent_ambient_sounds =
    {
      base_ambience = {filename = "__space-age__/sound/wind/base-wind-fulgora.ogg", volume = 0.5},
      wind = {filename = "__space-age__/sound/wind/wind-fulgora.ogg", volume = 0.8},
      crossfade =
      {
        order = {"wind", "base_ambience"},
        curve_type = "cosine",
        from = {control = 0.35, volume_percentage = 0.0},
        to = {control = 2, volume_percentage = 100.0}
      },
      semi_persistent =
      {
        {
          sound = {variations = sound_variations("__space-age__/sound/world/semi-persistent/distant-thunder", 4, 0.6)},
          delay_mean_seconds = 33,
          delay_variance_seconds = 7
        },
        {
          sound =
          {
            variations = sound_variations("__space-age__/sound/world/semi-persistent/sand-wind-gust", 5, 0.45),
            advanced_volume_control =
            {
              fades = {fade_in = {curve_type = "cosine", from = {control = 0.5, volume_percentage = 0.0}, to = {1.5, 100.0}}}
            }
          },
          delay_mean_seconds = 15,
          delay_variance_seconds = 9,
        },
      }
    },
    entities_require_heating = false,
    ticks_between_player_effects = 2
  },
})
end