Skip to content

Commit

Permalink
Revert "Fix invincible peds" (fix #1404)
Browse files Browse the repository at this point in the history
Reopens #414

Reverts #777

This reverts commit e43d34f.
  • Loading branch information
qaisjp committed Apr 23, 2020
1 parent 71d5201 commit 159d291
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 24 deletions.
28 changes: 13 additions & 15 deletions Client/mods/deathmatch/logic/CClientPed.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/*****************************************************************************
*
* PROJECT: Multi Theft Auto
* PROJECT: Multi Theft Auto v1.0
* (Shared logic for modifications)
* LICENSE: See LICENSE in the top level directory
* FILE: mods/deathmatch/logic/CClientPed.cpp
* FILE: mods/shared_logic/CClientPed.cpp
* PURPOSE: Ped entity class
*
*****************************************************************************/
Expand Down Expand Up @@ -1733,17 +1734,8 @@ void CClientPed::InternalSetHealth(float fHealth)
// Recheck we have a ped, ReCreateModel might destroy it
if (m_pPlayerPed)
{
// update dead state for peds
if (fHealth > 0 && IsDead())
{
m_bDead = false;
}

// Set the new health
m_pPlayerPed->SetHealth(fHealth);

// Recover from dead state to bring the ped back to life
m_pTaskManager->RemoveTask(TASK_PRIORITY_EVENT_RESPONSE_NONTEMP);
}
}
}
Expand Down Expand Up @@ -1892,10 +1884,16 @@ void CClientPed::Kill(eWeaponType weaponType, unsigned char ucBodypart, bool bSt
}
}
}

// set health and armor to 0
SetHealth(0.0f);
SetArmor(0.0f);
if (m_bIsLocalPlayer)
{
SetHealth(0.0f);
SetArmor(0.0f);
}
else
{
LockHealth(0.0f);
LockArmor(0.0f);
}

// Silently remove the ped satchels
DestroySatchelCharges(false, true);
Expand Down
10 changes: 1 addition & 9 deletions Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*****************************************************************************
*
* PROJECT: Multi Theft Auto
* PROJECT: Multi Theft Auto v1.0
* LICENSE: See LICENSE in the top level directory
* FILE: mods/deathmatch/logic/CStaticFunctionDefinitions.cpp
* PURPOSE: Lua static function definitions class
Expand Down Expand Up @@ -1596,14 +1596,6 @@ bool CStaticFunctionDefinitions::SetElementHealth(CElement* pElement, float fHea
// This makes sure the health is set to what will get reported
unsigned char ucHealth = static_cast<unsigned char>(fHealth * 1.25f);
fHealth = static_cast<float>(ucHealth) / 1.25f;

// update dead state for peds
if (fHealth > 0 && pPed->IsDead())
{
pPed->SetIsDead(false);
}

// set new health
pPed->SetHealth(fHealth);
}
else
Expand Down

0 comments on commit 159d291

Please sign in to comment.