Skip to content

WeaponAnimations

flango edited this page Mar 6, 2023 · 7 revisions

×× Animated weapons ××

❗❗ Experimental. Not included in the release version due to performance issues. ❗❗

Adds your own custom animations to warmup/cooldown stages of weapons.

preview 1 preview 2

How does it work?

Every <li> node (anim) in either <warmupAnim> or <cooldownAnim> overrides the default equipment rendering for <duration> in ticks. The animation goes in the order of nodes in the list.

Use <startRot> and <endRot> to change the weapon's rotation in an anim node and <startOffset> and <endOffset> to change the offset.

Use <pause> to freeze the anim at its starting points and <smooth> to make the animation speed less linear (SmoothStep).

image


Performance impact: 🟧 Very bad. Gets worse over time, scales with the number of pawns and animated weapons.

Type: Comp

XML Node: ThingDef/comps/li


Examples:

Sword

<comps>
    <li Class="flangoCore.CompProperties_AnimatedWeapon">
        <cooldownAnim>
            <li> <!-- Swing from one side to another -->
                <duration>10</duration>
                <startRot>20</startRot>
                <endRot>160</endRot>
                <startOffset>(0.6,0,0.5)</startOffset>
                <endOffset>(0.6,0,-0.5)</endOffset>
                <smooth>true</smooth>
            </li>
            <li> <!-- Pause at last anim's endOffset -->
                <pause>true</pause>
                <duration>5</duration>
                <startRot>160</startRot>
                <startOffset>(0.6,0,-0.5)</startOffset>
            </li>
            <li> <!-- Swing to the center -->
                <duration>10</duration>
                <startRot>160</startRot>
                <endRot>90</endRot>
                <startOffset>(0.6,0,-0.5)</startOffset>
                <endOffset>(0.4,0,0)</endOffset>
                <smooth>true</smooth>
            </li>
            <li> <!-- Thrust the sword forward (stab) -->
                <duration>10</duration>
                <startRot>90</startRot>
                <endRot>90</endRot>
                <startOffset>(0.4,0,0)</startOffset>
                <endOffset>(1,0,0)</endOffset>
                <smooth>true</smooth>
            </li>
            <li> <!-- Pull the sword back -->
                <duration>10</duration>
                <startRot>90</startRot>
                <endRot>90</endRot>
                <startOffset>(1,0,0)</startOffset>
                <endOffset>(0.4,0,0)</endOffset>
                <smooth>true</smooth>
            </li>
            <li> <!-- Pause -->
                <pause>true</pause>
                <duration>5</duration>
                <startRot>90</startRot>
            </li>
        </cooldownAnim>
    </li>
</comps>

Shotgun spin

<comps>
    <li Class="flangoCore.CompProperties_AnimatedWeapon">
        <cooldownAnim>
            <li> <!-- Move slightly closer to the pawn -->
                <duration>15</duration>
                <startRot>80</startRot>
                <endRot>80</endRot>
                <startOffset>(0.4,0,0)</startOffset>
                <endOffset>(0.3,0,0)</endOffset>
                <smooth>true</smooth>
            </li>
            <li> <!-- Speen -->
                <duration>30</duration>
                <startRot>440</startRot>
                <endRot>80</endRot>
                <startOffset>(0.3,0,0)</startOffset>
                <endOffset>(0.4,0,0)</endOffset>
                <smooth>true</smooth>
            </li>
        </cooldownAnim>
    </li>
</comps>

🦩 Home

🚧 - 404 Page not found.
🖼 - Preview needed.

🟡 - Works but has some TODOs.
🟠 - Basic functionality implemented.
🔴 - Not working properly.
❓ - Not tested.


--== XML ==--

💡 Abilities

General

Ability Givers

Equipment Abilities

🟡 Should recode some stuff 🟡

🌳 Skill Trees

🟠 WIP, work/kill XP gain not implemented 🟠

Defs

Comps

🏘 Buildings

⚙ Comps

🏹 Equipment

General

Weapons

Projectiles

🧪 Hediffs

🧍‍♂‍ Pawn behaviors

📊 Stats

🎲 Misc

🧔 Vanilla Expanded

✨ Debug (Dev Mode)


--== C# ==--

📂 Shared Classes

🧬 Patches


Clone this wiki locally