Skip to content

[Bug] FailOnMissingItems check breaks apparel-mounted weapons (e.g. DMS Mobile Dragoon missile pods) #3

@jinnonn

Description

@jinnonn

Summary

ThrowThem's Harmony patch on JobDriver_AttackStatic.MakeNewToils silently cancels
attack jobs for any apparel-mounted ranged weapon, making them completely non-functional
when ThrowThem is active.

Affected mods (confirmed)

  • Dead Man's Switch - Mobile Dragoon (shoulder missile pods, smoke launchers, etc.)
  • Likely any mod that puts ranged verbs on worn apparel

Root cause

In `JobDriver_AttackStatic_MakeNewToils.cs`, a Prefix adds an end condition via 
`HelperClass.FailOnMissingItems`:
if (verbToUse?.EquipmentSource != null)
{
  __instance.FailOnMissingItems(pawn, pawn.CurJob.verbToUse.EquipmentSource);
}

HelperClass.FailOnMissingItems returns JobCondition.Incompletable if the item is not
found in pawn.equipment OR pawn.inventory:

if (!x.equipment.Contains(t) && !x.inventory.Contains(t))
    return JobCondition.Incompletable;

For apparel-mounted weapons, EquipmentSource is the worn apparel piece — which lives
in pawn.apparel, not in pawn.equipment or pawn.inventory. The check always fails,
the job is immediately cancelled on its first tick, and no error is logged, making
this very hard to diagnose.

Reproduction steps

  1. Install Dead Man's Switch - Mobile Dragoon + its dependencies
  2. Install Throw Them
  3. Equip a mech with a shoulder missile pod (any)
  4. Draft the pawn, click the missile pod fire gizmo with mouse or hotkey
  5. Nothing happens — no targeting, no shot, no log output

(Without ThrowThem: works fine)

Proposed fix

Add pawn.apparel to the FailOnMissingItems check in HelperClass.cs:

// Before:
if (!x.equipment.Contains(t) && !x.inventory.Contains(t))
    return JobCondition.Incompletable;

// After:
if (!x.equipment.Contains(t) && !x.inventory.Contains(t) 
    && !x.apparel.WornApparel.Contains(t))
    return JobCondition.Incompletable;

This is a one-line change that keeps all existing ThrowThem behaviour intact while
allowing apparel-mounted weapons to function normally.

Game version is 1.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions