NQualityOfLife.Weapons.Comps.WeaponComp_Properties - Niilo007/RimWorld-NQoL GitHub Wiki

WeaponComp_Properties

Related:


XML

<comps Inherit="True">
    <li Class="NQualityOfLife.Weapons.Comps.WeaponComp_Properties" MayRequireAnyOf="Niilo007.NiilosQoL,Niilo007.NiilosQoL.Dev">
        <magazineSize>ushort</magazineSize>
        <reloadTicks>ushort</reloadTicks>
        <weaponType>BoltOrPumpAction | SemiAuto | FullAuto | BreechOrMuzzleLoading</weaponType>
        <reloadStartSound>SoundDef</reloadStartSound> <!-- Interact_AssaultRifle -->
        <reloadDoneSound>SoundDef</reloadDoneSound> <!-- Interact_Rifle -->
        <postShotSmokeSize>float</postShotSmokeSize> <!-- -1 -->
        <backBlast>bool</backBlast> <!-- false -->
        <durabilityPerShot>byte</durabilityPerShot> <!-- 0 -->
        <hasBipod>bool</hasBipod> <!-- false -->
        <bipodGraphic> <!-- null -->

        </bipodGraphic>
        <debug>bool</debug> <!-- false -->
    </li>
</comps>

Features

Back Blast

Reloading


Usage

Requires the use of:

<verbClass>NQualityOfLife.Weapons.Verb_Shoot</verbClass>

along with the comp!

Using:

<verbClass>Verb_Shoot</verbClass>

will work too. The class will be changed over to the NQoL Verb_Shoot at startup if the comp is present.


If you add the comp to your own def with the MayRequireAnyOf:

<li Class="NQualityOfLife.Weapons.Comps.WeaponComp_Properties" MayRequireAnyOf="Niilo007.NiilosQoL,Niilo007.NiilosQoL.Dev">

as shown here, NQoL can be a soft dependency.
No patching or load folders needed!

You must also set verbClass to:

<verbClass>Verb_Shoot</verbClass>

If you want to use NQoL as a soft dependency.


weaponType

Weapons can have multiple types at the same time, such as:

<weaponType>SemiAuto, FullAuto</weaponType>

hasBipod

Set to true to allow pawns to go prone and deploy a bipod. Having the bipod deployed increases accuracy and makes the shooter a smaller target.


bipodGraphic

The bipodGraphic is an optional Verse.GraphicData that allows for having a separate texture for the weapon when the bipod is deployed.

The bipodGraphic requires a texPath and for the weapon def to use the NQualityOfLife.Weapons.GunGraphic graphicClass.

<ThingDef>
    <!-- ... -->
    <graphicData>
        <graphicClass>NQualityOfLife.Weapons.GunGraphic</graphicClass>
    </graphicData>
    <!-- ... -->
    <comps Inherit="True">
        <li Class="NQualityOfLife.Weapons.Comps.WeaponComp_Properties" MayRequireAnyOf="Niilo007.NiilosQoL,Niilo007.NiilosQoL.Dev">
            <hasBipod>true</hasBipod>
            <bipodGraphic>
                <texPath>Weapons/MG 34 BB</texPath>
            </bipodGraphic>
        </li>
    </comps>
    <!-- ... -->
</ThingDef>

Errors

A missing weaponType value will give the following config error:

Config error in NMS_Gun_M1_Garand: 'NQualityOfLife.Weapons.Comps.WeaponComp_Properties' - 'NMS_Gun_M1_Garand' - Invalid 'weaponType'! -> 'Invalid' - Weapon types: 'Invalid | BoltOrPumpAction | SemiAuto | FullAuto | BreechOrMuzzleLoading'

The below error is given if the bipodGraphic is given, but the weapon def doesn't have the NQualityOfLife.Weapons.GunGraphic graphicClass.

Config error in NMS_Gun_MG34_B: 'NQualityOfLife.Weapons.Comps.WeaponComp_Properties' - 'NMS_Gun_MG34_B' - 'bipodGraphic' requires the weapon to use: 'NQualityOfLife.Weapons.GunGraphic' currently has: 'Verse.Graphic_Single'


Examples

Used In Example:

<verbs>
    <li>
        <verbClass>NQualityOfLife.Weapons.Verb_Shoot</verbClass>
        <hasStandardCommand>true</hasStandardCommand>
        <defaultProjectile>Bullet_NMS_Gun_Panzerschreck</defaultProjectile>
        <forcedMissRadius>0</forcedMissRadius>
        <warmupTime>4.5</warmupTime>
        <ai_AvoidFriendlyFireRadius>8</ai_AvoidFriendlyFireRadius>
        <range>35.9</range>
        <burstShotCount>1</burstShotCount>
        <soundCast>RocketswarmLauncher_Fire</soundCast>
        <soundCastTail>GunTail_Heavy</soundCastTail>
        <onlyManualCast>false</onlyManualCast>
        <targetParams>
            <canTargetLocations>true</canTargetLocations>
        </targetParams>
        <muzzleFlashScale>20</muzzleFlashScale>
    </li>
</verbs>
<comps Inherit="True">
    <li Class="NQualityOfLife.Weapons.Comps.WeaponComp_Properties" MayRequireAnyOf="Niilo007.NiilosQoL,Niilo007.NiilosQoL.Dev">
        <magazineSize>1</magazineSize>
        <reloadTicks>300</reloadTicks>
        <reloadStartSound>Machining_Stop</reloadStartSound>
        <reloadDoneSound>Artillery_ShellLoaded</reloadDoneSound>
        <postShotSmokeSize>0.5</postShotSmokeSize>
        <backBlast>true</backBlast>
        <durabilityPerShot>1</durabilityPerShot>
        <weaponType>BreechOrMuzzleLoading</weaponType>
    </li>
</comps>

Used In Example:

<verbs>
    <li>
        <verbClass>NQualityOfLife.Weapons.Verb_Shoot</verbClass>
        <hasStandardCommand>true</hasStandardCommand>
        <defaultProjectile>Bullet_NMS_Gun_M1_Garand</defaultProjectile>
        <warmupTime>0.85</warmupTime>
        <range>34.9</range>
        <soundCast>GunShot_NMS_Gun_M1_Garand</soundCast>
        <soundCastTail>GunTail_Medium</soundCastTail>
        <muzzleFlashScale>9</muzzleFlashScale>
    </li>
</verbs>
<comps Inherit="True">
    <li Class="NQualityOfLife.Weapons.Comps.WeaponComp_Properties" MayRequireAnyOf="Niilo007.NiilosQoL,Niilo007.NiilosQoL.Dev">
        <magazineSize>8</magazineSize>
        <reloadStartSound>NMS_Gun_M1_Garand_Ping</reloadStartSound>
        <reloadTicks>180</reloadTicks>
        <weaponType>SemiAuto</weaponType>
    </li>
</comps>

Used In Example:

<ThingDef ParentName="Base_NMS_SMG">
    <defName>NMS_Gun_MP40_</defName>
    <verbs>
        <li>
            <verbClass>Verb_Shoot</verbClass>
            <hasStandardCommand>true</hasStandardCommand>
            <defaultProjectile>Bullet_NMS_MP40_</defaultProjectile>
            <warmupTime>1</warmupTime>
            <ticksBetweenBurstShots>7</ticksBetweenBurstShots> 
            <burstShotCount>3</burstShotCount>
            <range>20.9</range>
            <soundCast>GunShot_NMS_MP40_</soundCast>
            <soundCastTail>GunTail_Medium</soundCastTail>
            <muzzleFlashScale>9</muzzleFlashScale>
        </li>
    </verbs>
    <comps Inherit="True">
        <li Class="NQualityOfLife.Weapons.Comps.WeaponComp_Properties" MayRequireAnyOf="Niilo007.NiilosQoL,Niilo007.NiilosQoL.Dev">
            <magazineSize>32</magazineSize>
            <reloadTicks>120</reloadTicks>
            <reloadStartSound>NMS_Gun_MP40_Reload_Start</reloadStartSound>
            <reloadDoneSound>NMS_Gun_MP40_Reload_Done</reloadDoneSound>
            <debug>False</debug>
            <weaponType>FullAuto</weaponType>
        </li>
    </comps>
</ThingDef>

⚠️ **GitHub.com Fallback** ⚠️