-
Notifications
You must be signed in to change notification settings - Fork 290
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
Add missing damage sources kills and suicide to kills list #2092
Merged
Coolthulhu
merged 12 commits into
cataclysmbnteam:upload
from
leoCottret:add-explosions-to-kill-count
Oct 30, 2022
Merged
Add missing damage sources kills and suicide to kills list #2092
Coolthulhu
merged 12 commits into
cataclysmbnteam:upload
from
leoCottret:add-explosions-to-kill-count
Oct 30, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Coolthulhu
reviewed
Oct 21, 2022
Coolthulhu
reviewed
Oct 21, 2022
Coolthulhu
reviewed
Oct 21, 2022
Coolthulhu
reviewed
Oct 21, 2022
Coolthulhu
reviewed
Oct 21, 2022
Coolthulhu
reviewed
Oct 30, 2022
safe_reference<player> player::get_safe_reference() | ||
{ | ||
return anchor.reference_to( this ); | ||
} |
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.
Minor: should probably be in Character
or even Creature
.
NPCs don't get hostile when hit by grenades yet. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Purpose of change
Explosion kills from player (grenades, launchers...) were not added to his kills list, probably due to the difficulty to know who's responsible for the explosion (it was a TODO somewhere).
Since explosions kills would be added to kills list, it seemed logical to add the player to his kills list if he killed himself.
Note that direct hit that killed a creature (from a grenade or launcher) already counted, but the explosion after the hit didn't.
Describe the solution
Non technical:
Kills from player with:
are now added to his kill count list
If the player kill himself through damages triggered/caused by himself (including explosions), or through the "Q" key, he will be added to his kill count list.
Both old and new explosions are supported.
Technical:
details
item
get anactivated_by
field that stores who activated the object. This field is now sent to intermediate functions that call theexplosion()
functionsprojectile_attack()
already had anorigin
field that stores who is firing. This field is now sent to intermediate functions that call theexplosion()
functionsexplosion()
functions, get asource
parameter, for who is the source of the explosionexplosion()
functions create aqueued_explosion
type, that will be executed later in the code. I stored thesource
here.queued_explosion
is executed, they will call the old/new explosions functions (inexplosion_funcs::regular
), and apply the damages. Before this function used a nullptr as source, now they use thesource
Describe alternatives you've considered
Developping this, I realised the many cases where a kill from a player is not added to his kill count, when it should.
So excluding what's fixed by this PR, there are still some cases, including but not limited to:
Testing
Have a friendly npc with a stack of grenades