Skip to content

1.1 Introduction

XeoNovaDan edited this page Feb 29, 2020 · 10 revisions

Turret Extensions adds a new mod extension called TurretFrameworkExtension to open up previously hardcoded or unavailable values to XML, which can now be easily modified. You can create new turrets that are dependent on Turret Extensions, or add values from TurretFrameworkExtension to existing turrets via XPath patching.

If you're unfamiliar with XPath patching, you can learn more about it here.

To do either of the above, you'd use XML that's similar to the following:

Making a new turret

<ThingDef ParentName="BuildingBase">
    <defName>MyNewTurret</defName>
    <!-- standard turret XML goes here -->
    <modExtensions>
        <li Class="TurretExtensions.TurretFrameworkExtension">
            <!-- properties go here -->
        </li>
    </modExtensions>
</ThingDef>

XPath patching an existing turret

<Operation Class="PatchOperationAddModExtension">
    <xpath>/Defs/ThingDef[defName="SomeExistingTurret"]</xpath>
    <value>
        <li Class="TurretExtensions.TurretFrameworkExtension">
            <!-- properties go here -->
        </li>
    </value>
</Operation>

A full list of properties that TurretFrameworkExtension currently opens up, along with their default values:

<li Class="TurretExtensions.TurretFrameworkExtension">
    <gunFaceDirectionOnSpawn>Unspecified</gunFaceDirectionOnSpawn>
    <firingArc>360</firingArc>
    <useManningPawnShootingAccuracy>true</useManningPawnShootingAccuracy>
    <useManningPawnAimingDelayFactor>true</useManningPawnAimingDelayFactor>
    <manningPawnShootingAccuracyOffset>0</manningPawnShootingAccuracyOffset>
    <canForceAttack>false</canForceAttack>
    <affectedByEMP>true</affectedByEMP>
</li>

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

Next: Properties