Reloadable Abilities - KonradHeinser/EBSGFramework GitHub Wiki

This comp allows you to make abilities that require the things be consumed in order to be used again when charges run out. This is not the same as the charges you can add to AbilityDefs directly, though it can be used in conjunction with charges to allow users to use the ability multiple times between cooldowns without allowing them to use all charges in a very short time. As a result, the charges for this comp are listed in the description rather than on the gizmo itself. The basic comp looks like this:

        <comps>
            <li Class="EBSGFramework.CompProperties_AbilityReloadable">
            </li>
        </comps>

Within the comp you have these options:

  • maxCharges : Default (1) : How many of these charges the pawn can have at any given time. This is also the amount they will have when they spawn
  • ammoDef : The ThingDef that acts as "ammo" for the ability. If you leave this empty, then the ability will never be reloadable
  • ammoPerCharge : How much of the ammo to use for each charge
  • removeOnceEmpty : Default (False) : Removes the ability from the pawn when it runs out of charges. Probably only useful if you left ammoDef empty
  • reloadDuration : Default (60) : How many ticks the pawn spends with the ammo to reload the ability
  • reloadSound : SoundDef played once when the reload is complete
  • disableAutoSearch : Default (False) : Prevents the job from making pawns automatically reload this ability. Generally only recommended if the ammoDef is something rare or valuable that has other purposes beyond reloading abilities
  • noChargesRemaining : Default(AbilityNoCharges) : The string used to tell the user there are no charges remaining
  • remainingCharges : Default (ChargesRemaining) : The string used to tell the user how many charges remain

This variation of the fire spew ability has an additional "cost" of 10 chemfuel. The pawn starts with 10 charges, and if they use all 10 without ever resupplying on chemfuel, then the ability will be unusable. The charges of 3 allows the user to use the ability 3 times in quick succession, but they must wait 1 day for each of these uses to cooldown

    <AbilityDef>
        <defName>FireChemSpew</defName>
        <label>fire-chem spew</label>
        <description>.</description>
        <iconPath>UI/Abilities/FireSpew</iconPath>
        <cooldownTicksRange>60000</cooldownTicksRange>
        <aiCanUse>true</aiCanUse>
        <ai_IsIncendiary>true</ai_IsIncendiary>
        <sendMessageOnCooldownComplete>true</sendMessageOnCooldownComplete>
        <warmupStartSound>FireSpew_Warmup</warmupStartSound>
        <charges>3</charges>
        <cooldownPerCharge>true</cooldownPerCharge>
        <verbProperties>
            <verbClass>Verb_CastAbility</verbClass>
            <range>7.9</range>
            <warmupTime>1</warmupTime>
            <soundCast>FireSpew_Resolve</soundCast>
            <targetParams>
                <canTargetLocations>true</canTargetLocations>
            </targetParams>
        </verbProperties>
        <comps>
            <li Class="EBSGFramework.CompProperties_AbilityReloadable">
                <maxCharges>10</maxCharges>
                <ammoPerCharge>10</ammoPerCharge>
                <ammoDef>Chemfuel</ammoDef>
            </li>
            <li Class="CompProperties_AbilityFireSpew">
                <range>7.9</range>
                <lineWidthEnd>3</lineWidthEnd>
                <filthDef>Filth_FlammableBile</filthDef>
                <effecterDef>Fire_Spew</effecterDef>
                <canHitFilledCells>true</canHitFilledCells>
            </li>
        </comps>
    </AbilityDef>
⚠️ **GitHub.com Fallback** ⚠️