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 explosions delayed on special monster death effects #2190

Merged

Conversation

leoCottret
Copy link
Collaborator

@leoCottret leoCottret commented Nov 15, 2022

Summary

SUMMARY: Bugfixes "Fix explosions delayed on special monster death effects"

Purpose of change

Fixes #2189
The problem is linked to #2092 , on top of the fact that explosions from monster deaths are delayed by one turn, when they should happen instantly.

A quick explanation:
PR 2092 added the tracking of the source of an explosion (the caster of the spell, the thrower of a grenade, a monster that triggers a special attacks etc.).
This allowed kills from explosives to be added to the player's list.
Before that, explosions were supposed to have no origin/source.
Problem: explosions from monsters death are assumed to happen instantly, not 1 turn after.

Describe the solution

Trigger the explosion just after a monster death, for monsters with on_death effects:

  • "EXPLODE" (eg cleanerbot)
  • "FOCUSEDBEAM" (eg milspec searchlight)

Testing

  • Change radius of explosion to 40 to be sure that the player is caught in the explosion (necessary for the crash to happen)
  • Kill a cleanerbot, no crash
  • Kill a milspec searchlight, no crash

Additional context

This PR does fix the delay problem, which also solves the crash problem, but a monster using some kind of delayed explosion attack could produce the same crash if it dies before the explosion.

@github-actions github-actions bot added the src changes related to source code. label Nov 15, 2022
@Coolthulhu Coolthulhu self-assigned this Nov 15, 2022
@Coolthulhu
Copy link
Member

Seems that we should have explosion queue processing after any explosion is queued, unless the queue is being processed right now. A simple volatile bool in explosion queue class should work.
As in:

  • Queue an explosion
  • Check if we're processing the queue
  • If not, start doing it at the end of "enqueue explosion" function
  • If yes, just return

@olanti-p
Copy link
Contributor

Seems that we should have explosion queue processing after any explosion is queued, unless the queue is being processed right now.

That would defeat the entire point of the queue: to delay explosion processing until after previous world update operation has finished, which is what was causing #175 (vehicle was being exploded mid-processing).

@Coolthulhu Coolthulhu merged commit 70802c0 into cataclysmbnteam:upload Nov 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
src changes related to source code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Military searchlight causes crash when attacked
3 participants