Skip to content

Conversation

@FileEX
Copy link
Member

@FileEX FileEX commented Jan 6, 2025

Fixed #3249

@TheNormalnij
Copy link
Member

TheNormalnij commented Jan 11, 2025

Why do you want to extend the setPedOnFire function instead of adding the new function removePedTask?
A new behavior is not intuitive. Your setPedOnFire(ped, false) does something with ped tasks ever if the ped has no fire effect.

Maybe im wrong here.
Does isElementOnFire return true before you call setPedOnFire(ped, false) when a ped has no fire effect?
Does the player lose health when TASK_SIMPLE_PLAYER_ON_FIRE is active?

@FileEX
Copy link
Member Author

FileEX commented Jan 11, 2025

Why do you want to extend the setPedOnFire function instead of adding the new function removePedTask?

We already have the killPedTask function.

A new behavior is not intuitive. Your setPedOnFire(ped, false) does something with ped tasks ever if the ped has no fire effect.

Yeah, it's a intentional because before using setPedOnFire, you can use extinguishFire, which means the player won't be on fire anymore, but the PLAYER_ON_FIRE task will remain active. That's why I changed the approach to return false if there's no fire.

Does isElementOnFire return true before you call setPedOnFire(ped, false) when a ped has no fire effect?

No

Does the player lose health when TASK_SIMPLE_PLAYER_ON_FIRE is active?

No, but as mentioned in the issue, it causes some problems with aiming.

I see that my proposed simple solution, which involves interrupting the PLAYER_ON_FIRE task after setting setPedOnFire to false (which is logical because if we don't want fire, we also don't want the task associated with it), is not well-received. I don't see the point in calling two separate functions:

setPedOnFire(ped, false) -- to extinguish the fire
killPedTask(ped, "secondary") -- to remove the PLAYER_ON_FIRE task

In my opinion, this approach doesn't make sense, because this action should be executed along with extinguishing the fire, not separately and manually by the scripter.

@TheNormalnij
Copy link
Member

Yeah, it's a intentional because before using setPedOnFire, you can use extinguishFire, which means the player won't be on fire anymore, but the PLAYER_ON_FIRE task will remain active. That's why I changed the approach to return false if there's no fire.

This is a problem. extinguishFire should disable the task or don't touch peds. A ped should not be able to get this bugged state when the ped isn't on fire but has active PLAYER_ON_FIRE task

@FileEX
Copy link
Member Author

FileEX commented Jan 29, 2025

Yeah, it's a intentional because before using setPedOnFire, you can use extinguishFire, which means the player won't be on fire anymore, but the PLAYER_ON_FIRE task will remain active. That's why I changed the approach to return false if there's no fire.

This is a problem. extinguishFire should disable the task or don't touch peds. A ped should not be able to get this bugged state when the ped isn't on fire but has active PLAYER_ON_FIRE task

Done. I used a hook on the CFire::Extinguish function so that it aborts the task when a ped is affected. I think this is the best solution.

image

Co-authored-by: Uladzislau Nikalayevich <[email protected]>
botder
botder previously approved these changes Feb 7, 2025
@botder botder merged commit 3a0dc29 into multitheftauto:master Feb 7, 2025
6 checks passed
@botder botder added the bugfix Solution to a bug of any kind label Feb 7, 2025
@botder botder added this to the 1.6.1 milestone Feb 7, 2025
MTABot pushed a commit that referenced this pull request Feb 7, 2025
3a0dc29 Fix setPedOnFire(ped, false) doesn't cancel TASK_SIMPLE_PLAYER_ON_FIRE (PR #3930, Fixes #3249)
@FileEX FileEX deleted the bugfix/fire_task branch February 7, 2025 21:25
@TheNormalnij TheNormalnij mentioned this pull request Feb 19, 2025
1 task
botder added a commit that referenced this pull request Feb 19, 2025
MTABot pushed a commit that referenced this pull request Feb 19, 2025
4d7b193 Revert changes from pull request #3930
5b9ce93 Update client en_US pot
@FileEX FileEX restored the bugfix/fire_task branch February 19, 2025 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Solution to a bug of any kind

Projects

None yet

Development

Successfully merging this pull request may close these issues.

setPedOnFire(ped, false) doesn't cancel TASK_SIMPLE_PLAYER_ON_FIRE

3 participants