Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for siege mortar ammo #3169

Merged

Conversation

Rhinous
Copy link
Contributor

@Rhinous Rhinous commented Jun 4, 2024

Additions

  • Added an extra field to the AmmoDef class spawnAsSiegeAmmo which when set to false for a shell will blacklist it from spawning as siege ammo

Changes

  • Removed the harmsHealth check for mortar siege ammo to allow for shells whose damagedefs don't directly harm health to be used by sieges such as Tox Gas shells, Airburst or those added by the Biological Warfare mod
  • Added spawnAsSiegeAmmo false to the patch for Firefoam and Smoke shells, stopping them from spawning in sieges
  • Reworked the transpiler patch for LordToil_Siege.LordToilTick so that checking what ammo is available on the ground is the same as what gets called in

Reasoning

  • The old implementation was broken and was spawning every type of shell including firefoam and smoke (non-lethal)
  • The addition of spawnAsSiegeAmmo to AmmoDef allows for easy patching of modded shells and allows for fine control of which shells are used in a siege
  • Before there was no patch for if the ammo currently on the ground was counted in the same way that the resupply patch saw it. This meant that you could in rare cases end up with a possible infinite loop of calling in more resupply's every few seconds.
  • Had to use a transpiler as the logic is done internally. Transpiler patch replaces the following if condition
    image

Testing

Check tests you have performed:

  • Compiles without warnings
  • Game runs without errors
  • Playtested a colony (specify how long) - Devtest spawning siege raids having them shoot until they get resupplied and removing their ammo repeatedly to force a resupply

@Rhinous Rhinous requested review from a team as code owners June 4, 2024 05:02
Copy link

github-actions bot commented Jun 4, 2024

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

@github-actions github-actions bot added the Download in Comments This PR has a zipfile download available. label Jun 4, 2024
@Rhinous Rhinous marked this pull request as draft June 6, 2024 02:22
Copy link

github-actions bot commented Jun 6, 2024

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

@Rhinous Rhinous changed the title Fix sieges using non lethal ammo Fixes for siege mortar ammo Jun 6, 2024
Copy link

github-actions bot commented Jun 6, 2024

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

@Rhinous Rhinous marked this pull request as ready for review June 6, 2024 08:55
Airomeda
Airomeda previously approved these changes Jun 6, 2024
Copy link
Contributor

@Airomeda Airomeda left a comment

Choose a reason for hiding this comment

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

works as intended, the endless shell reinforcement pod bug is also gone 👍

<Operation Class="PatchOperationAddModExtension">
<xpath>Defs/DamageDef[defName="ToxGas"]</xpath>
<value>
<li Class="CombatExtended.DamageDefExtensionCE">
Copy link
Contributor

Choose a reason for hiding this comment

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

I honestly think this is probably something we'd prefer to add to the ammo item, rather than the DamageDef itself--that leaves us finer control over what does or doesn't spawn for mortar shells dropped to sieges. Thoughts?

Copy link
Contributor Author

@Rhinous Rhinous Jun 7, 2024

Choose a reason for hiding this comment

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

Yeah I don't really like how currently we can't control it per shell, was originally done this way to stay similar to the old/vanilla method of just checking damage but it's definitely gotten bloated/overcomplicated. What do you think about scrapping the damage/harmshealth checks entirely and instead adding something like SpawnAsSiegeAmmo to the AmmoDef class? That way we can just blacklist shells we don't want since I think default behaviour should be to include them

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I think an easy true/false we can just assign to each shell as an override is probably our easiest way to address edge cases. Leave the more straight-forward checks in the code to filter out shells that obviously aren't suitable for siege, but we'll just use xml to address any outliers as necessary. Otherwise, we end up with a hideous, expensive string of checks that still will find a way to let some strange shells spawn when they shouldn't.

Copy link

github-actions bot commented Jun 8, 2024

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

@Rhinous
Copy link
Contributor Author

Rhinous commented Jun 8, 2024

Updated to use spawnAsSiegeAmmo instead. Still filters out shells who have no projectile or explosive damagedef or dont pass the checks for marketvalue / emp. Check the updated xml patch for the firefoam and smoke shells for example usage.

@N7Huntsman N7Huntsman merged commit 91a0f89 into CombatExtended-Continued:Development Jun 8, 2024
2 checks passed
@Rhinous Rhinous deleted the siege_fix_ammo branch June 8, 2024 13:38
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.

4 participants