Skip to content

Fix multiple damage instances in certain areas during explosions #4187

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

Merged
merged 2 commits into from
May 4, 2025

Conversation

FileEX
Copy link
Contributor

@FileEX FileEX commented May 2, 2025

Fixes #997 and #4125

The world in SA is divided into sectors for optimization purposes. Sectors are determined based on position, and it's possible for a single point to be located in multiple sectors simultaneously — for example, at the corner where four sectors meet. To prevent logic from being processed multiple times for the same entities, a mechanism called 'scan codes' was introduced. When scanning sectors, a new scan code is set, and each entity is assigned the current scan code during processing. Entities that already have the current scan code are skipped, as they've already been handled.

For some reason, R* likely forgot to include the scan code logic in the explosion-related functions, which caused the same entities to be processed (and receive damage) multiple times. This explains why the bug only occurred in specific areas — those happened to be at sector boundaries where a point was part of multiple sectors simultaneously

@FileEX FileEX changed the title Fix bug Fix multiple damage instances in certain areas during explosions May 2, 2025
@Dutchman101 Dutchman101 merged commit 3bce408 into multitheftauto:master May 4, 2025
3 of 6 checks passed
MTABot pushed a commit that referenced this pull request May 4, 2025
3bce408 Fix multiple damage instances in certain areas during explosions (#4187)
@FileEX FileEX deleted the bugfix/explosion_damage branch May 4, 2025 20:45
@lopezloo lopezloo mentioned this pull request May 6, 2025
1 task
@lopezloo lopezloo linked an issue May 6, 2025 that may be closed by this pull request
1 task
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.

Explosions dealing up to x4 damage onClientPlayerDamage/onClientVehicleDamage - triggers twice for explosion
2 participants