ElectroTurret


Adds Electro Turrets, which are early game electric turrets

Content
2 months ago
2.0
2.21K
Combat

g No turret body

2 months ago

Seems like its missing the turret body.
https://imgur.com/a/Svd1Jpk

2 months ago

gonna fix it asap, thanks for the tip

2 months ago
(updated 2 months ago)

Thanks, I commented in the other thread about damage research and how to fix it :)

Thank you for keeping this mod alive, love it!

2 months ago
(updated 2 months ago)

Was trying to fix the turret body issue, as it was REALLY bugging me, but couldn't figure it out.

Best I managed to get is a mini body and oversized turret... But looking at this mod (and its origin) it really needs to be re-written for v2 from scratch. There are all sorts of things that just don't make sense to me (but also I got no idea when it comes to modding...)

Anyway, heres the best I managed, but nothing I could do seemed to have increased the size of the turret body...
https://imgur.com/a/IHz2xX8

Going to give up as I have no idea what I am doing, thought that if I reference the base laser tower base it would work, but no idea... seems it wasn't really doing any changes no matter what I was doing with scale or anything like that...

Anyway I think the thing that made it better was to use latest version of https://lua-api.factorio.com/2.0.11/types/TurretBaseVisualisation.html but I got really muddled with it.

Heres the mess I ended up with

function shock_turret_extension(inputs)
    return {
        filename = "__ElectroTurret__/graphics/entity/shock-turret/shock-turret-gun-start.png",
        priority = "medium",
        width = 66,
        height = 67,
        frame_count = inputs.frame_count or 15,
        line_length = inputs.line_length or 0,
        run_mode = inputs.run_mode or "forward",
        axially_symmetrical = false,
        direction_count = 4,
        shift = { -0.03125, -0.984375 }
    }
end

function shock_turret_extension_shadow(inputs)
    return {
        filename = "__ElectroTurret__/graphics/entity/shock-turret/shock-turret-gun-start-shadow.png",
        width = 92,
        height = 50,
        frame_count = inputs.frame_count or 15,
        line_length = inputs.line_length or 0,
        run_mode = inputs.run_mode or "forward",
        axially_symmetrical = false,
        direction_count = 4,
        draw_as_shadow = true,
        shift = { 1.375, 0 }
    }
end

function shock_turret_extension_mask(inputs)
    return {
        filename = "__ElectroTurret__/graphics/entity/shock-turret/shock-turret-gun-start-mask.png",
        flags = { "mask" },
        width = 51,
        height = 47,
        frame_count = inputs.frame_count or 15,
        line_length = inputs.line_length or 0,
        run_mode = inputs.run_mode or "forward",
        axially_symmetrical = false,
        apply_runtime_tint = true,
        direction_count = 4,
        shift = { -0.015625, -1.26563 }
    }
end

data:extend({
    {
        type = "electric-turret",
        name = "adikings-shock-turret",
        icon = "__ElectroTurret__/graphics/icons/shock-turret.png",
        icon_size = 64,
        flags = { "placeable-player", "placeable-enemy", "player-creation" },
        minable = { mining_time = 0.5, result = "adikings-shock-turret" },
        max_health = 400,
        resistances = {
            {
                type = "fire",
                percent = 50
            },
            {
                type = "explosion",
                percent = 30
            }
        },
        corpse = "medium-remnants",
        collision_box = { { -0.7, -0.7 }, { 0.7, 0.7 } },
        selection_box = { { -1, -1 }, { 1, 1 } },
        rotation_speed = 0.01,
        preparing_speed = 0.05,
        folding_speed = 0.05,
        dying_explosion = "medium-explosion",
        energy_source = {
            type = "electric",
            buffer_capacity = "800kJ",
            input_flow_limit = "9600kW",
            drain = "12kW",
            usage_priority = "primary-input"
        },
        folded_animation = {
            layers = {
                shock_turret_extension { frame_count = 1, line_length = 1 },
                shock_turret_extension_shadow { frame_count = 1, line_length = 1 },
                shock_turret_extension_mask { frame_count = 1, line_length = 1 }
            }
        },
        preparing_animation = {
            layers = {
                shock_turret_extension {},
                shock_turret_extension_shadow {},
                shock_turret_extension_mask {}
            }
        },
        prepared_animation = {
            layers = {
                {
                    filename = "__ElectroTurret__/graphics/entity/shock-turret/shock-turret-gun.png",
                    line_length = 8,
                    width = 68,
                    height = 68,
                    frame_count = 1,
                    direction_count = 64,
                    shift = { -0.03125, -1 }
                },
                {
                    filename = "__ElectroTurret__/graphics/entity/shock-turret/shock-turret-gun-mask.png",
                    flags = { "mask" },
                    line_length = 8,
                    width = 54,
                    height = 44,
                    frame_count = 1,
                    apply_runtime_tint = true,
                    direction_count = 64,
                    shift = { -0.03125, -1.3125 }
                },
                {
                    filename = "__ElectroTurret__/graphics/entity/shock-turret/shock-turret-gun-shadow.png",
                    line_length = 8,
                    width = 88,
                    height = 52,
                    frame_count = 1,
                    direction_count = 64,
                    draw_as_shadow = true,
                    shift = { 1.5, 0 }
                }
            }
        },
        folding_animation = {
            layers = {
                shock_turret_extension { run_mode = "backward" },
                shock_turret_extension_shadow { run_mode = "backward" },
                shock_turret_extension_mask { run_mode = "backward" }
            }
        },
        base_picture = {
            layers = {
                {
                    filename = "__base__/graphics/entity/laser-turret/laser-turret-base.png",
                    priority = "high",
                    width = 138,
                    height = 104,
                    shift = util.by_pixel(-0.5, 2),
                    scale = 0.5
                },
                {
                    filename = "__ElectroTurret__/graphics/entity/shock-turret/shock-turret-base-mask.png",
                    flags = { "mask" },
                    width = 54,
                    height = 45,
                    apply_runtime_tint = true,
                    direction_count = 1,
                    frame_count = 1,
                    shift = { -0.046875, -0.109375 }
                 }
            }
        },
        vehicle_impact_sound = {
            filename = "__base__/sound/car-metal-impact.ogg",
            volume = 0.65
        },
        attack_parameters = {
            type = "projectile",
            ammo_category = "adikings-shock-turret",
            cooldown = 25,
            projectile_center = { -0.09375, -0.2 },
            projectile_creation_distance = 1.4,
            range = 20,
            sound = {
                filename = "__ElectroTurret__/sound/shock-turret-attack.ogg",
                volume = 0.4
            },
            damage_modifier = 1.0,
            ammo_type = {
                type = "projectile",
                category = "electric",
                energy_consumption = "200kJ",
                action = {
                    {
                        type = "direct",
                        action_delivery = {
                            {
                                type = "projectile",
                                projectile = "adikings-shock-lightning",
                                starting_speed = 0.8
                            }
                        }
                    }
                }
            }
        },
        call_for_help_radius = 40,
        graphics_set =
        {
            base_visualisation =
            {
                animation =
                {
                    layers =
                    {
                        {
                            filename = "__base__/graphics/entity/laser-turret/laser-turret-base.png",
                            priority = "high",
                            width = 138,
                            height = 104,
                            shift = util.by_pixel(-0.5, 2),
                            scale = 0.5
                        },
                        {
                            filename = "__ElectroTurret__/graphics/entity/shock-turret/shock-turret-gun-shadow.png",
                            line_length = 8,
                            width = 88,
                            height = 52,
                            frame_count = 1,
                            direction_count = 64,
                            draw_as_shadow = true,
                            shift = { 1.5, 0 },
                        }
                    }
                }
            }
        },
    }
})
2 months ago

i think the problem is a factorio bug. My code is ok and points at the png files in the correct manner, i also have tried by placing new files in a different folder, no matter how i tried, the base never showed up. I'll look into that code and adapt if needed. Thanks a ton!

2 months ago

Seems your code fixed the problem. Thanks a lot. Have a try! New Release.

2 months ago

Just tested it, you did it! The base now looks proper! Thanks for the update!

New response