Jump to content
  • 0

Code cleanup in turretgenerator.lua


FuryoftheStars

Suggestion

Not required as I doubt it has any real impact on anything (I have some OCD, which is the only reason why I'm pointing it out), but if my understanding of everything is correct, the following sections of code are dead / don't do anything.

 

Everything is in turretgenerator.lua

 

Lines 315 and 316, the entries for Penetration and Explosive can be removed.

local Specialty = {

    HighDamage = c(),
    HighRange = c(),
    HighFireRate = c(),
    BurstFireEnergy = c(),
    BurstFire = c(),
    AutomaticFire = c(),
    HighEfficiency = c(), -- only applicable to salvage and mining laser
    HighShootingTime = c(),
    LessEnergyConsumption = c(),
    IonizedProjectile = c(),
    Penetration = c(),
    Explosive = c(), -- AOE damage
}

 

Line 377, the entry for Specialty.Penetration can be removed.

possibleSpecialties[WeaponType.ChainGun] = {
    {specialty = Specialty.HighDamage, probability = 0.1},
    {specialty = Specialty.HighRange, probability = 0.1},
    {specialty = Specialty.IonizedProjectile, probability = 0.05},
    {specialty = Specialty.Penetration, probability = 0.05},
    {specialty = Specialty.HighFireRate, probability = 0.2},
    {specialty = Specialty.BurstFire, probability = 0.1},
    {specialty = Specialty.AutomaticFire, probability = 0.05},
}

 

Lines 492 - 495 can be removed.

-- railgun always have block penetration
if type == WeaponType.RailGun then
    table.insert(specialties, Specialty.Penetration)
end

 

Lines 497 - 501 can be removed.

-- rocketlauncher and anti-fighter always have explosive damage
if type == WeaponType.RocketLauncher
        or type == WeaponType.AntiFighter then
    table.insert(specialties, Specialty.Explosive)
end

 

Line 528, the check for "and not turret.coaxial" can be removed (you're now properly handling this back at line 465, so this is now redundant).

if s == Specialty.AutomaticFire and not turret.coaxial then

Link to comment
Share on other sites

0 answers to this suggestion

Recommended Posts

There have been no answers to this suggestion yet

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...