Skip to content

Refactor fire hooks and enable ground fire ignition for peds - #5213

Open
MohabCodeX wants to merge 2 commits into
multitheftauto:masterfrom
MohabCodeX:refactor/move-fire-weapon-hooks
Open

Refactor fire hooks and enable ground fire ignition for peds#5213
MohabCodeX wants to merge 2 commits into
multitheftauto:masterfrom
MohabCodeX:refactor/move-fire-weapon-hooks

Conversation

@MohabCodeX

Copy link
Copy Markdown
Contributor

As part of the ongoing cleanup of old hooks in CMultiplayerSA.cpp, this PR moves the remaining fire and weapon hooks over to CMultiplayerSA_Weapons.cpp and fixes a few long-standing issues with fire behavior.

Fixes

  • Peds not catching fire from ground flames: In original GTA:SA, ground fire only ever set the local player on fire. Non-player peds, bots, and remote players would just walk straight through flames without catching fire. They now ignite properly when stepping on active fire.
  • FPS drops when checking peds near fire: Since fire checks run every frame, looping through all peds caused noticeable lag. Added quick bounding-box pre-checks so distant peds are skipped immediately without doing heavy math, keeping framerates solid.
  • Missing attacker / kill attribution from fire: When fire spread or came from area weapons like Flamethrowers and Molotovs, the game forgot who started it and showed nil in logs. The original attacker is now preserved and credited for damage and kills.

Testing

task_hooks_test.zip

To test these changes:

  1. Start the test resource in console: start task_hooks_test
  2. Test walking ped ignition:
    • Run /testwalkped to spawn a bot walking toward you.
    • Spray flames on the floor with a Flamethrower or throw a Molotov.
    • Check that the ped catches fire as soon as he steps on the flames, the HUD shows Ped On Fire State: YES, and damage logs credit you without any lag.
  3. Test damage attribution & explosions:
    • Run /testexplosion (or /testped) to spawn a stationary dummy.
    • Attack it with Molotovs, Flamethrower, or Rocket Launcher and verify your name shows up as the attacker in the chat logs.
  4. You can use /resetperf at any point to reset the FPS and telemetry stats.

Checklist

  • Your code should follow the coding guidelines.
  • Smaller pull requests are easier to review. If your pull request is beefy, your pull request should be reviewable commit-by-commit.

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.

1 participant