Skip to content
This repository has been archived by the owner on Apr 14, 2020. It is now read-only.

Adding specific gun functionality for CE patches

Alicecomma edited this page Feb 22, 2020 · 1 revision

As a way to aid patch makers in choosing the right XML code to introduce gun functionality, some pointers:

Synchronously firing barrels

Certain guns can fire bullets from multiple barrels at the same time. This can simply be introduced as below.

  <ThingDef ParentName="BaseHumanMakeableGun">
    <verbs>
      <li Class="CombatExtended.VerbPropertiesCE">
        <ticksBetweenBurstShots>-1</ticksBetweenBurstShots>
        <burstShotCount>2</burstShotCount>
      </li>
    </verbs>
    <comps>
      <li Class="CombatExtended.CompProperties_FireModes">
        <noSingleShot>TRUE</noSingleShot>
        <aiUseBurstMode>TRUE</aiUseBurstMode>
      </li>
    </comps>
  </ThingDef>

The part within "verbs" is crucial. Due to an oversight in vanilla code, negative values are allowed for ticksBetweenBurstShots. Vanilla otherwise adds 1 to your XML value, so setting it negative allows a time between shots of 0 ticks, e.g instantaneously. Then, burstShotCount can be as small or large as you want. CombatExtended will handle the loss in magazine ammo appropriately. The part within "comps" ensures that ONLY all barrels can be fired at once (noSingleShot), and if noSingleShot is false, aiUseBurstMode ensures that enemies always fire multiple barrels at once.