-
Notifications
You must be signed in to change notification settings - Fork 304
reload when mag has less ammo than required for UB #4110
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
base: Development
Are you sure you want to change the base?
Conversation
You can download the rebuilt assembly for this PR here: https://combatextended.lp-programming.com/CombatExtended-16597596959.zip |
CompAmmo.Notify_ShotFired(ammoConsumedPerShot); | ||
|
||
if (ShooterPawn != null && !CompAmmo.CanBeFiredNow) | ||
if (ShooterPawn != null && (!CompAmmo.CanBeFiredNow || ammoConsumedPerShot > CompAmmo.CurMagCount)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to add this logic to CompAmmoUser.CanFBeFiredNow(), but I'm not sure if it can/should have access to ammoConsumedPerShot since it comes from VerbPropsCE
Guidance would be welcome :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see... Yeah, kinda unfortunate that the ammo per shot is on the verb rather than on the ammo user. You can get there via CompEquippable.PrimaryVerb
within the ammo user comp, just make sure to null-check it in case something strange is going on.
return false; | ||
} | ||
|
||
if (curMagCountInt - ammoConsumedPerShot < 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic makes the game loop if the pawn has no ammo left in the inventory and can`t fire the UB because of insuficcient ammo. More checks could be done to improve logic further
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would probably make most sense to automatically switch them back to the normal weapon firing mode in that case.
Additions
Describe new functionality added by your code, e.g.
Changes
Describe adjustments to existing features made in this merge, e.g.
References
Links to the associated issues or other related pull requests, e.g.
Reasoning
Why did you choose to implement things this way, e.g.
Check tests you have performed: