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

Ammo file refactoring #404

Merged
merged 7 commits into from
Apr 26, 2024

Conversation

LengthenedGradient
Copy link
Contributor

  • Refactors VerifyData in the ammo file
  • Provides documentation for the ammo file
  • Eliminates cook off edge cases that were confirmed unintended when first implemented.

LengthenedGradient and others added 7 commits April 24, 2024 00:37
Annotated some more things in the file, Simplified the logic of VerifyData and fixed what was confirmed to be a likely typo in the detonation code that prevented ammo crates with a single shot from being able to cookoff, only detonate.

(Planned in a future commit is to fix cookoffs being impossible for shells above a certain weight)
Caps the VolumeRoll randomness to 25% minimum, particularly for larger calibers.

Originally `BulletData.RoundVolume ^ 0.5` was not capped and could reach values above 150 (e.g. 155mmC AP), and since math.rand(0,150) is never larger than 150, it was possible for high caliber ammo types to be immune to cookoff. This was confirmed as unintentional.

Adjusting the random range would require us knowing some upper bound on BulletData.RoundVolume (if you consider ACF missiles than the upper bound stretches the range quite a bit). So capping is the simplest solution that doesn't change the detonation changes for anything below the cap. I determined 25% minimum was a reasonable choice, but that could be changed if necessary.

AmmoRoll was updated for the very rare case that the random call returns exactly the ratio (e.g. 1 for 1)
- Improved caliber verification for non scalable weapons, now it should properly default to 50mm if the weapon is defined but the user failed to provide a caliber value.
- Fixed weapon name and weapon short name having trouble accounting for scalable weapons having items registered items under them.
- Added a bunch of spaces between variables and the start of conditions.
- Removed seemingly unused WeaponData field from ammo crates.
@TwistedTail TwistedTail merged commit dcabf43 into ACF-Team:dev Apr 26, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants