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

fix "Explosion processing is delayed to end of turn for explode-on-impact ammo" #1908

Conversation

leoCottret
Copy link
Collaborator

Summary

SUMMARY: Bugfixes "add explosion effect triggers after each explosive ammo is shot"

Purpose of change

Fixes #1904

Describe the solution

Adding a "explosion_handler::get_explosion_queue().execute();" after a projectile is shot.
(Cf additional context of the issue for more details)
I repeated the steps in the issue, shotted 5 ammoes and got 5 nice explosions, precisely one after each shot,

Describe alternatives you've considered

None for now

Testing

I repeated the steps in the issue.
I also tried some grenades but they worked fine. And I think it's not even related.
I tried to do the same by giving a weapon to a NPC, and I think it works, but he one shotted himself with it. Is it me or they don't seem to be able to shoot at more than 3 meters even with the right commands?

Additional context

About this part
"This may require some measure to prevent two executes being called on the same queue in one call stack."
I suppose we're safe, unless I'm missing something, because the explosion queue uses a singleton (the explosion queue will always be the same object), so even if it's called several times at different places in one turn, the object will always be updated between each call.

@Coolthulhu Coolthulhu self-assigned this Sep 27, 2022
@Coolthulhu Coolthulhu merged commit 65cbf93 into cataclysmbnteam:upload Sep 29, 2022
@Coolthulhu
Copy link
Member

I was worried about chain explosions, but I can't find a good way of causing those.
If they can happen, we'll need a special case for them. For example, having explosion queue operate on a temporary. Otherwise it might run into an undefined behavior as the queue it is processing changes mid-processing.

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.

Explosion processing is delayed to end of turn for explode-on-impact ammo
2 participants