Skip to content

Commit

Permalink
Added distance check
Browse files Browse the repository at this point in the history
  • Loading branch information
Chanka0 committed Feb 19, 2024
1 parent 4bc9ab0 commit 0f915bd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ChaosMod/Effects/db/Screen/ScreenRealFirstPerson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@ static int state = 0;

static bool SafetyCheck()
{
Ped playerPed = PLAYER_PED_ID();
Ped playerPed = PLAYER_PED_ID();
Vector3 playerCoords = GET_ENTITY_COORDS(playerPed, true);
Vector3 cameraCoords = GET_CAM_COORD(eCamera);
// Removes camera on player switch, death, and potential non-existence
// 02/19/2024 - Added distance check for resets not covered by existing checks
if (IS_PLAYER_SWITCH_IN_PROGRESS() || IS_PLAYER_DEAD(PLAYER_ID()) || !ENTITY::DOES_ENTITY_EXIST(playerPed)
|| !ENTITY::IS_ENTITY_VISIBLE(playerPed))
|| !ENTITY::IS_ENTITY_VISIBLE(playerPed)
|| VDIST2(playerCoords.x, playerCoords.y, playerCoords.z, cameraCoords.x, cameraCoords.y, cameraCoords.z) > 3.f)
{
return true;
}
Expand Down

0 comments on commit 0f915bd

Please sign in to comment.