-
-
Notifications
You must be signed in to change notification settings - Fork 447
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
Fix setPedOnFire(ped, false) doesn't cancel TASK_SIMPLE_PLAYER_ON_FIRE #3930
base: master
Are you sure you want to change the base?
Conversation
@@ -2594,7 +2594,7 @@ bool CStaticFunctionDefinitions::SetPedOnFire(CClientEntity& Entity, bool bOnFir | |||
{ | |||
if (IS_PED(&Entity)) | |||
{ | |||
if (!Entity.IsLocalEntity()) | |||
if (!Entity.IsLocalEntity() && &Entity != GetLocalPlayer()) |
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.
Why? This function should work with local peds too.
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.
This is agreed with botder and dutchman
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.
Can you explain? Why should not local peds use this function?
@@ -854,7 +854,7 @@ void CPedSA::SetBleeding(bool bBleeding) | |||
bool CPedSA::SetOnFire(bool onFire) | |||
{ | |||
CPedSAInterface* pInterface = GetPedInterface(); | |||
if (onFire == !!pInterface->pFireOnPed) | |||
if (onFire && pInterface->pFireOnPed) |
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.
setPedOnFire(ped, false)
doesn't return false if the ped wasn't on fire
CTask* task = taskManager->GetTaskSecondary(TASK_SECONDARY_PARTIAL_ANIM); | ||
if (task && task->GetTaskType() == TASK_SIMPLE_PLAYER_ON_FIRE) | ||
taskManager->RemoveTaskSecondary(TASK_SECONDARY_PARTIAL_ANIM); |
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.
Can you call RemoveTaskSecondary
without task
checks? If you are unable to do so, please add RemoveSecondaryTaskIfExists
in CTaskManager
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.
I don't understand what's wrong with this check?
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.
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.
This code can be reusable and has its own logical scope. So you can extract a method here for better readability
if (taskManager)
taskManager->RemoveTaskSecondaryIfExists(TASK_SECONDARY_PARTIAL_ANIM, TASK_SIMPLE_PLAYER_ON_FIRE);
Or overload the RemoveTaskSecondary method:
if (taskManager)
taskManager->RemoveTaskSecondary(TASK_SECONDARY_PARTIAL_ANIM, TASK_SIMPLE_PLAYER_ON_FIRE);
Fixed #3249