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

Fix setPedOnFire(ped, false) doesn't cancel TASK_SIMPLE_PLAYER_ON_FIRE #3930

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions Client/game_sa/CPedSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
TheNormalnij marked this conversation as resolved.
Show resolved Hide resolved
return false;

auto* fireManager = static_cast<CFireManagerSA*>(pGame->GetFireManager());
Expand All @@ -877,10 +877,16 @@ bool CPedSA::SetOnFire(bool onFire)
else
{
CFire* fire = fireManager->GetFire(static_cast<CFireSAInterface*>(pInterface->pFireOnPed));
if (!fire)
return false;
if (fire)
fire->Extinguish();

fire->Extinguish();
CTaskManager* taskManager = m_pPedIntelligence->GetTaskManager();
if (taskManager)
{
CTask* task = taskManager->GetTaskSecondary(TASK_SECONDARY_PARTIAL_ANIM);
if (task && task->GetTaskType() == TASK_SIMPLE_PLAYER_ON_FIRE)
taskManager->RemoveTaskSecondary(TASK_SECONDARY_PARTIAL_ANIM);
FileEX marked this conversation as resolved.
Show resolved Hide resolved
}
}

return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2594,7 +2594,7 @@ bool CStaticFunctionDefinitions::SetPedOnFire(CClientEntity& Entity, bool bOnFir
{
if (IS_PED(&Entity))
{
if (!Entity.IsLocalEntity())
if (!Entity.IsLocalEntity() && &Entity != GetLocalPlayer())
TheNormalnij marked this conversation as resolved.
Show resolved Hide resolved
return false;

CClientPed& Ped = static_cast<CClientPed&>(Entity);
Expand Down
2 changes: 1 addition & 1 deletion Client/mods/deathmatch/logic/luadefs/CLuaElementDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2520,7 +2520,7 @@ bool CLuaElementDefs::SetLowLodElement(lua_State* luaVM, CClientEntity* pEntity,

bool CLuaElementDefs::SetElementOnFire(CClientEntity* entity, bool onFire) noexcept
{
if (!entity->IsLocalEntity())
if (!entity->IsLocalEntity() && entity != CStaticFunctionDefinitions::GetLocalPlayer())
return false;

return entity->SetOnFire(onFire);
Expand Down
Loading