-
Notifications
You must be signed in to change notification settings - Fork 332
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -357,7 +357,8 @@ public void ExternalCallDropCasing(int randomSeedOffset = -1) | |
|
|
||
| public override bool TryCastShot() | ||
| { | ||
| if (!CompAmmo?.TryPrepareShot() ?? false) | ||
| int ammoConsumedPerShot = (CompAmmo.Props.ammoSet?.ammoConsumedPerShot ?? 1) * VerbPropsCE.ammoConsumedPerShotCount; | ||
| if (!CompAmmo?.TryPrepareShot(ammoConsumedPerShot) ?? false) | ||
| { | ||
| return false; | ||
| } | ||
|
|
@@ -392,7 +393,7 @@ protected virtual bool OnCastSuccessful() | |
| int ammoConsumedPerShot = (CompAmmo.Props.ammoSet?.ammoConsumedPerShot ?? 1) * VerbPropsCE.ammoConsumedPerShotCount; | ||
| CompAmmo.Notify_ShotFired(ammoConsumedPerShot); | ||
|
|
||
| if (ShooterPawn != null && !CompAmmo.CanBeFiredNow) | ||
| if (ShooterPawn != null && (!CompAmmo.CanBeFiredNow || ammoConsumedPerShot > CompAmmo.CurMagCount)) | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| { | ||
| CompAmmo.TryStartReload(); | ||
| resetRetarget(); | ||
|
|
||
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.