Skip to content

CompToggleFireMode

Ogliss edited this page Jul 22, 2020 · 5 revisions

CompToggleFireMode is a simple method to give your guns the option to toggle between multiple fire modes via a gizmo.

Requires Harmony

copy the CompToggleFireMode.dll from the bin/Debug folder to your mods Assemblies folder

simply add the CompToggleFireMode.CompProperties_ToggleFireMode to your weapon, and as many verbs as you want it to have

Example gun

  <ThingDef ParentName="BaseHumanMakeableGun">
    <defName>Gun_MultiLauncher</defName>
    <label>Multi launcher</label>
    <description>A wide-barreled bolt launcher. The bolts can be swapped between incendiary, smoke and EMP.</description>
    <graphicData>
      <texPath>Things/Item/Equipment/WeaponRanged/IncendiaryLauncher</texPath>
      <graphicClass>Graphic_Single</graphicClass>
    </graphicData>
    <soundInteract>Interact_Rifle</soundInteract>
    <generateCommonality>0.3</generateCommonality>
    <statBases>
      <WorkToMake>20000</WorkToMake>
      <Mass>3.4</Mass>
      <RangedWeapon_Cooldown>3.5</RangedWeapon_Cooldown>
    </statBases>
    <costList>
      <Steel>75</Steel>
      <ComponentIndustrial>4</ComponentIndustrial>
    </costList>
    <recipeMaker>
      <skillRequirements>
        <Crafting>4</Crafting>
      </skillRequirements>
    </recipeMaker>
    <comps>
        <li Class="CompToggleFireMode.CompProperties_ToggleFireMode">
            <canSwitchWhileBusy>false</canSwitchWhileBusy> <!-- Default = False, pawn cannot swap modes while 'Busy' (while firing or on cooldown) -->
            <switchStartsCooldown>true</switchStartsCooldown> <!-- Default = False, starts the current verbs cooldown when switched  -->
	</li>
    </comps>
    <verbs>
      <li>
        <verbClass>Verb_Shoot</verbClass>
        <label>Incendiary Shell</label>
        <hasStandardCommand>true</hasStandardCommand>
        <defaultProjectile>Bullet_IncendiaryLauncher</defaultProjectile>
        <warmupTime>3.5</warmupTime>
        <range>23.9</range>
        <forcedMissRadius>1.9</forcedMissRadius>
        <burstShotCount>1</burstShotCount>
        <soundCast>Shot_IncendiaryLauncher</soundCast>
        <soundCastTail>GunTail_Medium</soundCastTail>
        <muzzleFlashScale>14</muzzleFlashScale>
        <targetParams>
          <canTargetLocations>true</canTargetLocations>
        </targetParams>
      </li>
      <li>
        <verbClass>Verb_Shoot</verbClass>
        <label>Smoke Shell</label>
        <hasStandardCommand>true</hasStandardCommand>
        <defaultProjectile>Bullet_SmokeLauncher</defaultProjectile>
        <warmupTime>3.5</warmupTime>
        <range>23.9</range>
        <forcedMissRadius>1.9</forcedMissRadius>
        <burstShotCount>1</burstShotCount>
        <soundCast>Shot_IncendiaryLauncher</soundCast>
        <soundCastTail>GunTail_Medium</soundCastTail>
        <muzzleFlashScale>14</muzzleFlashScale>
        <targetParams>
          <canTargetLocations>true</canTargetLocations>
        </targetParams>
      </li>
      <li>
        <verbClass>Verb_Shoot</verbClass>
        <label>EMP Shell</label>
        <hasStandardCommand>true</hasStandardCommand>
        <defaultProjectile>Bullet_EMPLauncher</defaultProjectile>
        <warmupTime>3.5</warmupTime>
        <range>23.9</range>
        <forcedMissRadius>1.9</forcedMissRadius>
        <burstShotCount>1</burstShotCount>
        <soundCast>Shot_IncendiaryLauncher</soundCast>
        <soundCastTail>GunTail_Medium</soundCastTail>
        <muzzleFlashScale>14</muzzleFlashScale>
        <targetParams>
          <canTargetLocations>true</canTargetLocations>
        </targetParams>
      </li>
    </verbs>
    <tools>
      <li>
        <label>stock</label>
        <capacities>
          <li>Blunt</li>
        </capacities>
        <power>9</power>
        <cooldownTime>2</cooldownTime>
      </li>
      <li>
        <label>barrel</label>
        <capacities>
          <li>Blunt</li>
          <li>Poke</li>
        </capacities>
        <power>9</power>
        <cooldownTime>2</cooldownTime>
      </li>
    </tools>
  </ThingDef>

Clone this wiki locally