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

Prevent ranged damage from hitting twice #424

Merged
merged 2 commits into from
Mar 9, 2023
Merged

Prevent ranged damage from hitting twice #424

merged 2 commits into from
Mar 9, 2023

Conversation

thokkat
Copy link
Contributor

@thokkat thokkat commented Mar 8, 2023

After a npc is hit by a bolt it's stopped. In move routine there's a check if npc is moving into the shooting line. If true this causes a double hit because it happens before the bolt is deleted from bullets list. This can be prevented by checking if bolt has the Stopped flag.

@Try
Copy link
Owner

Try commented Mar 8, 2023

Hm, nice!
Just curious, how to reproduce case, when damage happen twice?

@thokkat
Copy link
Contributor Author

thokkat commented Mar 8, 2023

Actually i haven't found a way to reproduce this reliably. When i load a save for testing it happens like every second time at least once.

Sometime if this raytest yields true.

if(i.cb!=nullptr && list.rayTest(npc,i.lastPos,i.pos,i.tgRange,proj)) {
i.cb->onCollide(*npc.toNpc());

@Try Try merged commit 7559ccc into Try:master Mar 9, 2023
@Try
Copy link
Owner

Try commented Mar 9, 2023

I've added check into other onCollide, for sake of consistency

@thokkat thokkat deleted the bullet branch March 10, 2023 15:38
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.

2 participants