require("__hide-elevated-rail-keybind__.prototypes.hidden-rail-pictures")

local entities = {}

-------------------
---  Hidden Rails
-------------------

local rails = { "elevated-curved-rail-a", "elevated-curved-rail-b", "elevated-straight-rail",
    "elevated-half-diagonal-rail" }

for i, rail in ipairs(rails) do
    local hidden_rail = table.deepcopy(data.raw[rail][rail])
    hidden_rail.name = "hidden-" .. rail
    hidden_rail.selection_priority = 1
    hidden_rail.pictures = elevated_rail_pictures(rail)
    hidden_rail.fence_pictures = elevated_rail_fences_pictures(rail)
    hidden_rail.selectable_in_game = false
    hidden_rail.allow_copy_paste = false
    table.insert(entities, hidden_rail)
end


--------------------------
---  Hidden Rail Support
--------------------------
local hidden_rail_support = table.deepcopy(data.raw["rail-support"]["rail-support"])

hidden_rail_support.name = "hidden-rail-support"
hidden_rail_support.selection_priority = 1
hidden_rail_support.graphics_set =
{
    structure =
    {
        layers =
        {
            util.sprite_load("__hide-elevated-rail-keybind__/graphics/entity/elevated-rail-pylon/elevated-rail-pylon",
                {
                    priority = "high",
                    direction_count = 8,
                    back_equals_front = true,
                    scale = 0.5
                }),
            util.sprite_load("__hide-elevated-rail-keybind__/graphics/entity/elevated-rail-pylon/elevated-rail-pylon-shadow",
                {
                    priority = "high",
                    direction_count = 8,
                    back_equals_front = true,
                    draw_as_shadow = true,
                    scale = 0.5
                }),
        }
    },

    underwater_structure = util.sprite_load(
        "__elevated-rails__/graphics/entity/elevated-rail-pylon/elevated-rail-pylon-underwater",
        {
            direction_count = 8,
            back_equals_front = true,
            scale = 0.5
        }),

    water_reflection =
    {
        pictures = util.sprite_load(
            "__elevated-rails__/graphics/entity/elevated-rail-pylon/elevated-rail-pylon-reflection",
            {
                priority = "extra-high",
                variation_count = 8,
                scale = 0.5
            }),
        rotate = false,
    }
}
hidden_rail_support.order = "a"
hidden_rail_support.selectable_in_game = false
hidden_rail_support.allow_copy_paste = false
table.insert(entities, hidden_rail_support)

--------------------------
---  Hidden Rail Support
--------------------------

local hidden_rail_ramp = table.deepcopy(data.raw["rail-ramp"]["rail-ramp"])

hidden_rail_ramp.selection_priority = 1
hidden_rail_ramp.name = "hidden-rail-ramp"
hidden_rail_ramp.selectable_in_game = false
hidden_rail_ramp.allow_copy_paste = false
hidden_rail_ramp.pictures = rails_ramp_pictures()
hidden_rail_ramp.fence_pictures = rails_ramp_fences_pictures()
table.insert(entities, hidden_rail_ramp)


data:extend(entities)
