Skip to content

2.1 Introduction

XeoNovaDan edited this page Mar 4, 2020 · 7 revisions

Turret Extensions also adds a new comp called CompUpgradable, a comp that allows for you to make upgradable turrets, both new and existing. Just like with most other comps, you define the properties for CompUpgradable via CompProperties_Upgradable this.

CompUpgradable can be used alongside TurretFrameworkExtension too, but it'll also function just fine without.

To make a turret upgradable, you'd use XML that's similar to the following:

Making a new turret

<ThingDef ParentName="BuildingBase">
    <defName>MyNewTurret</defName>
    <!-- some standard turret XML goes here -->
    <comps>
        <!-- standard turret comps go here -->
        <li Class="TurretExtensions.CompProperties_Upgradable">
            <!-- properties go here -->
        </li>
    </comps>
    <!-- more turret XML goes here -->
</ThingDef>

XML patching an existing turret

<Operation Class="PatchOperationAdd">
    <!-- assuming that the turret has comps, which it most likely will -->
    <xpath>/Defs/ThingDef[defName="SomeExistingTurret"]/comps</xpath>
    <value>
        <li Class="TurretExtensions.CompProperties_Upgradable">
            <!-- properties go here -->
        </li>
    </value>
</Operation>

A full list of upgrade parameters that can be adjusted, along with their default values:

<li Class="TurretExtensions.CompProperties_Upgradable">
    <!-- Basics -->
    <description></description>
    <upgradedTurretDescription></upgradedTurretDescription>

    <!-- Costs -->
    <costStuffCount>0</costStuffCount>
    <costList></costList>
    <researchPrerequisites></researchPrerequisites>
    <workToUpgrade>1</workToUpgrade>
    <constructionSkillPrerequisite>0</constructionSkillPrerequisite>

    <!-- Job Driver -->
    <upgradeWorkFactorStuff>true</upgradeWorkFactorStuff>
    <upgradeFailable>true</upgradeFailable>
    <upgradeEffect></upgradeEffect>
    <upgradeSuccessChanceFactor>1</upgradeSuccessChanceFactor>
    <upgradeFailMinorResourcesRecovered>0.5</upgradeFailMinorResourcesRecovered>
    <upgradeFailMinorResourcesRecovered>0</upgradeFailMinorResourcesRecovered>
    <upgradeFailAlwaysMajor>false</upgradeFailAlwaysMajor>
    <upgradeFailMajorDmgPctRange>
        <min>0.1</min>
        <max>0.5</max>
    </upgradeFailMajorDmgPctRange>
    <upgradeFailMajorChanceFactor>2</upgradeFailMajorChanceFactor>

    <!-- Results -->
    <statOffsets></statOffsets>
    <statFactors></statFactors>
    <graphicData></graphicData>
    <turretTopDrawSize>2</turretTopDrawSize>
    <turretTopOffset></turretTopOffset>
    <fuelCapacityFactor>1</fuelCapacityFactor>
    <fuelMultiplierFactor>1</fuelMultiplierFactor>
    <basePowerConsumptionFactor>1</basePowerConsumptionFactor>
    <turretBurstWarmupTimeFactor>1</turretBurstWarmupTimeFactor>
    <turretBurstCooldownTimeFactor>1</turretBurstCooldownTimeFactor>
    <turretGunDef></turretGunDef>
    <firingArc>-1</firingArc>
    <manningPawnShootingAccuracyOffsetBonus>0</manningPawnShootingAccuracyOffsetBonus>
    <canForceAttack></canForceAttack>
    <affectedByEMP></affectedByEMP>

    <!-- Destroyed -->
    <baseResouceDropPct>0.75</baseResouceDropPct>
    <destroyedResourceDropPct>0.25</destroyedResourceDropPct>
</li>

These are explained more in-depth on the 'Comp Properties' page.

Next: Comp Properties