Skip to content

Fix DoOutOfAmmoAction#4181

Merged
N7Huntsman merged 4 commits intoDevelopmentfrom
Fix-Unequipping-Weapon
Feb 8, 2026
Merged

Fix DoOutOfAmmoAction#4181
N7Huntsman merged 4 commits intoDevelopmentfrom
Fix-Unequipping-Weapon

Conversation

@ViralReaction
Copy link
Copy Markdown
Contributor

@ViralReaction ViralReaction commented Aug 19, 2025

Changes

Describe adjustments to existing features made in this merge, e.g.

  • Changes bool method into an if check
  • Adds max amount of ammo to pickup equal to 4 times the magazine size

Reasoning

Why did you choose to implement things this way, e.g.

  • Pawns that are going through DoOutOfAmmoAction will unequip weapon even if they find ammo on the ground. Premature unequipping of pawns doesn't help anyone.
  • Raiders are theoretically suppose to search the immediate area around them for ammo if they don't have any. If they are out but still find some on the ground the weapon will still be unequipped.
  • To reproduce on a colonist equip a weapon with no ammo and no ammo in inventory. Spawning ammo next to pawn and clicking reload will have the pawn reload the weapon and have it in inventory instead of equipped.
  • Max amount of ammo mirrors amount in JobGiver_TakeAndEquip

Alternatives

Describe alternative implementations you have considered, e.g.

  • Suffer

Testing

Check tests you have performed:

  • Compiles without warnings
  • Game runs without errors
  • (For compatibility patches) ...with and without patched mod loaded
  • Playtested a colony (specify how long)

@ViralReaction ViralReaction requested review from a team as code owners August 19, 2025 02:49
@github-actions
Copy link
Copy Markdown

You can download the rebuilt assembly for this PR here: https://combatextended.lp-programming.com/CombatExtended-17058185106.zip

@github-actions github-actions Bot added the Download in Comments This PR has a zipfile download available. label Aug 19, 2025
@github-actions
Copy link
Copy Markdown

You can download the rebuilt assembly for this PR here: https://combatextended.lp-programming.com/CombatExtended-17169571223.zip

Copy link
Copy Markdown
Contributor

@perkinslr perkinslr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 494 probably should try to resolve the missing ammo via this PR change, and then check again before returning. Might be worth making doOutOfAmmoAction return a bool for if it found more ammo or not. Otherwise just repeat the HasAmmo check.

Copy link
Copy Markdown
Contributor

@N7Huntsman N7Huntsman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally functions as intended.

However, if a colonist picks up ammo off the ground as the result of being manually commanded to reload with none in their inventory (as opposed to reloading while firing at a target), they will pick up the ammo but won't then reload with the ammo they just picked up--and it would be desirable for them to do so.

@github-actions
Copy link
Copy Markdown

You can download the rebuilt assembly for this PR here: https://combatextended.lp-programming.com/CombatExtended-20184730675.zip

@ViralReaction
Copy link
Copy Markdown
Contributor Author

Generally functions as intended.

However, if a colonist picks up ammo off the ground as the result of being manually commanded to reload with none in their inventory (as opposed to reloading while firing at a target), they will pick up the ammo but won't then reload with the ammo they just picked up--and it would be desirable for them to do so.

This should be resolved now

@github-actions
Copy link
Copy Markdown

You can download the rebuilt assembly for this PR here: https://combatextended.lp-programming.com/CombatExtended-20185157926.zip

@N7Huntsman N7Huntsman merged commit f383bc4 into Development Feb 8, 2026
3 checks passed
@N7Huntsman N7Huntsman deleted the Fix-Unequipping-Weapon branch February 8, 2026 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Download in Comments This PR has a zipfile download available.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants