Jump to content

[MOD] High Efficiency Turrets (HET)


KaneNOD

Recommended Posts

Hello everyone. I'm KaneNOD and i'm trying to build a mod for this game. I'm new on modding but i'm trying to make my best.

 

Pls, visit this link to find the mod i'm building, subscribe it and leave your feedback about it and help me to make this mod better.

 

https://steamcommunity.com/sharedfiles/filedetails/?id=1821043731

index.php?action=dlattach;topic=5785.0;attach=2614;image

 

Have a nice week everyone.

 

Good luck and have fun!!!  ;D

thumb.thumb.jpg.3665e97327a53544bb1f7e2799c3ed3e.jpg

Link to comment
Share on other sites

There is a lack of description / documentation.

 

Based on screenshots, this mod just gives 100% Accuracy and Efficiency to turrets, quite lazy for my survival gameplay.

 

The accuracy is already in the game right from the start.

 

The 100% of efficiency has been changed according to its rarity.

 

The value of turrets is much higher than normal turrets. To buy one, you need more money, so to buy one you need to spend more.

 

I will change the probability of dropping a HET turret. This will make it harder to find a HET turret.

 

You need to subscribe the mod and test it to give me wa right feedback. Want everyone follow the mod. I make some changes and I need your support to understand how to make this mod better.

 

Gook luck and have fun!  ;)

Link to comment
Share on other sites

I would like to read more accurate and detailed description, so that I can imagine what the mod does, and what player does to get such turrets. Could you review it, please?

 

All changes made since the beginning of my project have been described in the "Update Notes" or "ChangeLog" area on Steam.

 

You can read them at this link: https://steamcommunity.com/sharedfiles/filedetails/changelog/1821043731

Link to comment
Share on other sites

Need help to create HET ForceGun on my mod. Everything is ok for me, but not understand why the HETForceGun is not working in Turret Factory! Can someone that knows about moding in this game, help me to solve the problem?

 


weapongenerator.lua

--======================================================================================================--
--=========================================HET FORCE TURRET=============================================--
--======================================================================================================--

function WeaponGenerator.generateHETForceGun(rand, force, tech, material, rarity)
    local weapon = Weapon()
    weapon:setBeam()

    local fireDelay = 0.2 -- always the same with beams, does not really matter
    local reach = rand:getFloat(150, 200)

    weapon.fireDelay = fireDelay
    weapon.reach = reach
    weapon.appearanceSeed = rand:getInt()
    weapon.continuousBeam = true
    weapon.appearance = WeaponAppearance.Tesla
    weapon.name = "HET Force Gun /* Weapon Name*/"%_t
    weapon.prefix = "HET Force Gun /* Weapon Prefix*/"%_t
    weapon.icon = "data/textures/icons/HETforce-gun.png" -- previously echo-ripples.png
    weapon.sound = "beam"
    weapon.material = material
    weapon.rarity = rarity
    weapon.tech = tech

    local forceFactor = (1 + rand:getFloat(0.5, 1) + rarity.value) * material.strengthFactor * material.strengthFactor

    weapon.impactParticles = ImpactParticles.Energy
    weapon.blength = weapon.reach

    local hue = rand:getFloat(0, 360)
    local saturation = 0.3
    local value = 0.1
    local forceType = rand:getInt(1, 6)
    if forceType == 1 then -- ForceType::OtherPush
        weapon.otherForce = force * forceFactor
        weapon.banimationSpeed = 1
        hue = 0
        value = 0.4
        saturation = 0.05
    elseif forceType == 2 then -- ForceType::OtherPull
        weapon.otherForce = -force * forceFactor
        weapon.banimationSpeed = -1
        hue = 240
        value = 0.5
        saturation = 0.2
    elseif forceType == 3 then -- ForceType::SelfPush
        weapon.selfForce = force * forceFactor
        weapon.banimationSpeed = 1
        hue = 60
        value = 0.4
    elseif forceType == 4 then -- ForceType::SelfPull
        weapon.selfForce = -force * forceFactor
        weapon.banimationSpeed = -1
        hue = 180
        value = 0.4
        saturation = 0.1
    elseif forceType == 5 then -- ForceType::BothPush
        weapon.otherForce = force * forceFactor
        weapon.selfForce = force * forceFactor
        weapon.banimationSpeed = 1
        hue = 30
        value = 0.4
    elseif forceType == 6 then -- ForceType::BothPull
        weapon.otherForce = -force * forceFactor
        weapon.selfForce = -force * forceFactor
        weapon.banimationSpeed = -1
        hue = 210
        value = 0.5
        saturation = 0.2
    end

    weapon.bouterColor = ColorHSV(hue, 1, value * 0.25)
    weapon.binnerColor = ColorHSV(hue, saturation, value)
    weapon.bwidth = 0.5
    weapon.bauraWidth = 1
    weapon.banimationSpeed = weapon.banimationSpeed * 4
    weapon.bshape = BeamShape.Swirly

    return weapon
end

generatorFunction[WeaponType.HETForceGun] = WeaponGenerator.generateHETForceGun

turretgenerator.lua

--======================================================================================================--
--=========================================HET FORCE TURRET=============================================--
--======================================================================================================--

scales[WeaponType.HETForceGun] = scales[WeaponType.ForceGun]
possibleSpecialties[WeaponType.HETForceGun] = possibleSpecialties[WeaponType.ForceGun]

function TurretGenerator.generateHETForceTurret(rand, force, tech, material, rarity)
    local result = TurretTemplate()

    -- generate weapons
    local numWeapons = rand:getInt(1, 2)

    local weapon = WeaponGenerator.generateHETForceGun(rand, force, tech, material, rarity)

    force = math.max(math.abs(weapon.selfForce), math.abs(weapon.otherForce))

    local requiredCrew = math.floor(1 + math.sqrt(force / 2000))
    local crew = Crew()
    crew:add(requiredCrew, CrewMan(CrewProfessionType.Engine))
    result.crew = crew

    if weapon.otherForce ~= 0 then weapon.otherForce = weapon.otherForce / numWeapons end
    if weapon.selfForce ~= 0 then weapon.selfForce = weapon.selfForce / numWeapons end

    -- attach weapons to turret
    TurretGenerator.attachWeapons(rand, result, weapon, numWeapons)

    -- add more beams, for this we add invisible weapons doing nothing but creating beams
    local weapons = {result:getWeapons()}
    for _, weapon in pairs(weapons) do
        weapon.selfForce = 0
        weapon.otherForce = 0
        weapon.bshape = BeamShape.Swirly
        weapon.bshapeSize = 1.25
        weapon.appearance = WeaponAppearance.Invisible
        result:addWeapon(weapon)
    end

    local forceToEnergy = rand:getFloat(1, 4)
    local energyPerSecond = force / 1000 * forceToEnergy
    local increasePerSecond = energyPerSecond * rand:getFloat(0.01, 0.03)
    TurretGenerator.createContinuousEnergyCooling(result, energyPerSecond, increasePerSecond)

    TurretGenerator.scale(rand, result, WeaponType.HETForceGun, tech, 1)
    TurretGenerator.addSpecialties(rand, result, WeaponType.HETForceGun)

    return result
end

generatorFunction[WeaponType.HETForceGun] = TurretGenerator.generateHETForceTurret

galaxy.lua

-- I don't wanna work on Raw turrets (but can add to my plans if needed!)

weaponProbabilities[WeaponType.HETMiningLaser] =              {p = 0.65} -- Mining Turret
weaponProbabilities[WeaponType.HETSalvagingLaser] =           {p = 0.65} -- Salvage Turret
weaponProbabilities[WeaponType.HETRepairBeam] =      {d = 0.65, p = 1.0} -- Repair Turret
weaponProbabilities[WeaponType.HETForceGun] =        {d = 0.85, p = 1.0} -- Force Gun Turret

weapontype.lua

-- Unarmed Turrets --
WeaponTypes.addType("HETMiningLaser",    "(HET) MiningLaser /* Weapon Type */"%_t,     unarmed)
WeaponTypes.addType("HETSalvagingLaser", "(HET) SalvagingLaser /* Weapon Type */"%_t,  unarmed)
WeaponTypes.addType("HETRepairBeam",     "(HET) Repair /* Weapon Type */"%_t,          unarmed)
WeaponTypes.addType("HETForceGun",       "(HET) Force Gun /* Weapon Type */"%_t,       unarmed)

-- Armed Turrets (Future HET weapons) --

-- WeaponTypes.addType("HETChainGun",             "(HET) Chaingun /* Weapon Type */"%_t,                armed)
-- WeaponTypes.addType("HETPointDefenseChainGun", "(HET) Point Defense Chaingun /* Weapon Type */"%_t,  armed)
-- WeaponTypes.addType("HETPointDefenseLaser",    "(HET) Point Defense Laser /* Weapon Type */"%_t,     armed)
-- WeaponTypes.addType("HETPlasmaGun",            "(HET) Plasma /* Weapon Type */"%_t,                  armed)
-- WeaponTypes.addType("HETRocketLauncher",       "(HET) Launcher /* Weapon Type */"%_t,                armed)
-- WeaponTypes.addType("HETCannon",               "(HET) Cannon /* Weapon Type */"%_t,                  armed)
-- WeaponTypes.addType("HETRailGun",              "(HET) Railgun /* Weapon Type */"%_t,                 armed)
-- WeaponTypes.addType("HETBolter",               "(HET) Bolter /* Weapon Type */"%_t,                  armed)
-- WeaponTypes.addType("HETLightningGun",         "(HET) Lightning Gun /* Weapon Type */"%_t,           armed)
-- WeaponTypes.addType("HETTeslaGun",             "(HET) Tesla Gun /* Weapon Type */"%_t,               armed)
-- WeaponTypes.addType("HETPulseCannon",          "(HET) Pulse Cannon /* Weapon Type */"%_t,            armed)
-- WeaponTypes.addType("HETAntiFighter",          "(HET) Anti Fighter /* Weapon Type */"%_t,            armed)


inventoryitemprice.lua


function ArmedObjectPrice(object)

    local costFactor = 1.0

    -- collect turret stats
    local dps = object.dps
    local material = object.material

    if object.coolingType == 0 and object.heatPerShot > 0 then
        dps = dps * object.shootingTime / (object.shootingTime + object.coolingTime)
    end

    dps = dps + dps * object.shieldDamageMultiplicator + dps * object.hullDamageMultiplicator

    dps = dps + object.hullRepairRate * 2.0 + object.shieldRepairRate * 3.0
    dps = dps + math.abs(object.selfForce) * 0.005 + math.abs(object.otherForce) * 0.01

    local value = dps * 0.5 * object.reach * 0.5

    -- mining laser value scales with the used material and the efficiency
    if object.stoneRefinedEfficiency > 0 or object.stoneRawEfficiency > 0 then
        costFactor = 3.0

        local materialFactor = material.strengthFactor * 5.0
        local efficiencyFactor = object.stoneRefinedEfficiency * 17.5 + object.stoneRawEfficiency * 5.6 -- -30%
	-- default valor local efficiencyFactor = object.stoneRefinedEfficiency * 25.0 + object.stoneRawEfficiency * 8.0

        value = value * materialFactor
        value = value * (1.0 + efficiencyFactor)
    end

    if object.metalRefinedEfficiency > 0 or object.metalRawEfficiency > 0 then
        costFactor = 3.0

        local efficiencyFactor = object.metalRefinedEfficiency * 17.5 + object.metalRawEfficiency * 5.6 -- -30%
	-- default valor local efficiencyFactor = object.metalRefinedEfficiency * 25.0 + object.metalRawEfficiency * 8.0
        value = value * (1.0 + efficiencyFactor)
    end

    -- rocket launchers gain value if they fire seeker rockets
    if object.seeker then
        value = value * 2.5
    end

    --value = value * 1.5
    local rarityFactor = 1.0 + 1.35 ^ object.rarity.value

    value = value * rarityFactor
    value = value * (1.0 + object.shieldPenetration)
    value = value * costFactor

    -- check for numerical errors that can occur by changing weapon stats to things like NaN or inf
    value = math.max(0, value)
    if value ~= value then value = 0 end
    if not (value > -math.huge and value < math.huge) then value = 0 end

    return value
end

 

 

Working.jpg.c81cbe1d621239c0c8cb4fb751de7a43.jpg

Not_Working.jpg.ff8c338ec045f1b4ce7d356f2117b457.jpg

Link to comment
Share on other sites

I solve the problem. The new version of the game changes the scripts for this turret.

 

    local forceToEnergy = rand:getFloat(1, 4)
    local rechargeTime = force / 1000 * forceToEnergy
--  previously
--  local energyPerSecond = force / 1000 * forceToEnergy
    local shootingTime = rechargeTime * rand:getFloat(0.7, 0.9)
--  previously
--  local increasePerSecond = energyPerSecond * rand:getFloat(0.01, 0.03)
    TurretGenerator.createBatteryChargeCooling(result, rechargeTime, shootingTime)
--  previously
--  TurretGenerator.createContinuousEnergyCooling(result, energyPerSecond, increasePerSecond)
    TurretGenerator.scale(rand, result, WeaponType.ForceGun, tech, 1)
    TurretGenerator.addSpecialties(rand, result, WeaponType.ForceGun)

    result:updateStaticStats()
-- Now the "result" is updated by Statics Stats of the turret
-- previously this line don't exist

 

Now it works fine!  ;D

 

Link to comment
Share on other sites

  • 4 weeks later...

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...