projectile aim player dormancy support

This commit is contained in:
rei-2
2026-05-22 19:28:23 -04:00
parent 8411a58c5b
commit 9275956aae
13 changed files with 57 additions and 45 deletions
@@ -58,7 +58,7 @@ float CAimbotGlobal::GetAimFOV()
return Vars::Aimbot::General::LeadAndRestrict.Value ? 180.f : Vars::Aimbot::General::AimFOV.Value;
}
bool CAimbotGlobal::EntityCenterInFOV(CBaseEntity* pTarget, Vec3 vLocalPos, Vec3 vLocalAngles, float& flFOVTo, Vec3& vPos, Vec3& vAngleTo)
bool CAimbotGlobal::EntityCenterInFOV(CBaseEntity* pTarget, const Vec3& vLocalPos, const Vec3& vLocalAngles, float& flFOVTo, Vec3& vPos, Vec3& vAngleTo)
{
vPos = pTarget->GetCenter();
vAngleTo = Math::CalcAngle(vLocalPos, vPos);
@@ -67,8 +67,11 @@ bool CAimbotGlobal::EntityCenterInFOV(CBaseEntity* pTarget, Vec3 vLocalPos, Vec3
return flFOVTo < GetAimFOV();
}
bool CAimbotGlobal::PlayerBoneInFOV(CTFPlayer* pTarget, Vec3 vLocalPos, Vec3 vLocalAngles, float& flFOVTo, Vec3& vPos, Vec3& vAngleTo, int iHitboxes)
bool CAimbotGlobal::PlayerBoneInFOV(CTFPlayer* pTarget, const Vec3& vLocalPos, const Vec3& vLocalAngles, float& flFOVTo, Vec3& vPos, Vec3& vAngleTo, int iHitboxes)
{
if (pTarget->IsDormant())
return EntityCenterInFOV(pTarget, vLocalPos, vLocalAngles, flFOVTo, vPos, vAngleTo);
matrix3x4* aBones = F::Backtrack.GetBones(pTarget);
if (!Vars::Visuals::Removals::Interpolation.Value)
{
@@ -191,9 +194,9 @@ bool CAimbotGlobal::ShouldAimAtAngle(Vec3 vAngles)
return Math::CalcFov(I::EngineClient->GetViewAngles(), vAngles) < Vars::Aimbot::General::AimFOV.Value;
}
bool CAimbotGlobal::ShouldIgnore(CBaseEntity* pEntity, CTFPlayer* pLocal, CTFWeaponBase* pWeapon)
bool CAimbotGlobal::ShouldIgnore(CBaseEntity* pEntity, CTFPlayer* pLocal, CTFWeaponBase* pWeapon, bool bIgnoreDormant)
{
if (pEntity->IsDormant())
if (bIgnoreDormant ? pEntity->IsDormant() : !H::Entities.GetDormancy(pEntity->entindex()))
return true;
if (auto pGameRules = I::TFGameRules())
@@ -33,14 +33,14 @@ public:
void SortTargetsPost(std::vector<Target_t>& vTargets, int iMethod);
float GetAimFOV();
bool EntityCenterInFOV(CBaseEntity* pTarget, Vec3 vLocalPos, Vec3 vLocalAngles, float& flFOVTo, Vec3& vPos, Vec3& vAngleTo);
bool PlayerBoneInFOV(CTFPlayer* pTarget, Vec3 vLocalPos, Vec3 vLocalAngles, float& flFOVTo, Vec3& vPos, Vec3& vAngleTo, int iHitboxes = Vars::Aimbot::Hitscan::HitboxesEnum::Head | Vars::Aimbot::Hitscan::HitboxesEnum::Body | Vars::Aimbot::Hitscan::HitboxesEnum::Pelvis | Vars::Aimbot::Hitscan::HitboxesEnum::Arms | Vars::Aimbot::Hitscan::HitboxesEnum::Legs);
bool EntityCenterInFOV(CBaseEntity* pTarget, const Vec3& vLocalPos, const Vec3& vLocalAngles, float& flFOVTo, Vec3& vPos, Vec3& vAngleTo);
bool PlayerBoneInFOV(CTFPlayer* pTarget, const Vec3& vLocalPos, const Vec3& vLocalAngles, float& flFOVTo, Vec3& vPos, Vec3& vAngleTo, int iHitboxes = Vars::Aimbot::Hitscan::HitboxesEnum::Head | Vars::Aimbot::Hitscan::HitboxesEnum::Body | Vars::Aimbot::Hitscan::HitboxesEnum::Pelvis | Vars::Aimbot::Hitscan::HitboxesEnum::Arms | Vars::Aimbot::Hitscan::HitboxesEnum::Legs);
bool IsHitboxValid(CBaseEntity* pEntity, int nHitbox, int iHitboxes = Vars::Aimbot::Hitscan::HitboxesEnum::Head | Vars::Aimbot::Hitscan::HitboxesEnum::Body | Vars::Aimbot::Hitscan::HitboxesEnum::Pelvis | Vars::Aimbot::Hitscan::HitboxesEnum::Arms | Vars::Aimbot::Hitscan::HitboxesEnum::Legs);
bool IsHitboxValid(int nHitbox, int iHitboxes = Vars::Aimbot::Projectile::HitboxesEnum::Head | Vars::Aimbot::Projectile::HitboxesEnum::Body | Vars::Aimbot::Projectile::HitboxesEnum::Feet);
bool ShouldMultipoint(CBaseEntity* pEntity = nullptr, int nHitbox = -1, int iHitboxes = Vars::Aimbot::Hitscan::HitboxesEnum::Head | Vars::Aimbot::Hitscan::HitboxesEnum::Body | Vars::Aimbot::Hitscan::HitboxesEnum::Pelvis | Vars::Aimbot::Hitscan::HitboxesEnum::Arms | Vars::Aimbot::Hitscan::HitboxesEnum::Legs);
bool ShouldAimAtAngle(Vec3 vAngles);
bool ShouldIgnore(CBaseEntity* pTarget, CTFPlayer* pLocal, CTFWeaponBase* pWeapon);
bool ShouldIgnore(CBaseEntity* pTarget, CTFPlayer* pLocal, CTFWeaponBase* pWeapon, bool bIgnoreDormant = true);
int GetPriority(int iIndex);
bool FriendlyFire();
@@ -47,7 +47,7 @@ static inline std::vector<Target_t> GetTargets(CTFPlayer* pLocal, CTFWeaponBase*
for (auto pEntity : H::Entities.GetGroup(eGroup))
{
if (F::AimbotGlobal.ShouldIgnore(pEntity, pLocal, pWeapon))
if (F::AimbotGlobal.ShouldIgnore(pEntity, pLocal, pWeapon, !(Vars::Aimbot::Projectile::Modifiers.Value & Vars::Aimbot::Projectile::ModifiersEnum::TargetDormant)))
continue;
bool bTeam = pEntity->m_iTeamNum() == pLocal->m_iTeamNum();
@@ -258,7 +258,7 @@ void CAutoHeal::GetDangers(CTFPlayer* pTarget, bool bVaccinator, float& flBullet
{
auto pPlayer = pEntity->As<CTFPlayer>();
int iIndex = pPlayer->entindex();
if (!pPlayer->CanAttack(true, false))
if (pPlayer->IsDormant() || !pPlayer->CanAttack(true, false))
continue;
auto pWeapon = pPlayer->m_hActiveWeapon()->As<CTFWeaponBase>();
+1 -1
View File
@@ -453,7 +453,7 @@ int CMisc::AntiBackstab(CTFPlayer* pLocal, CUserCmd* pCmd, bool bSendPacket)
for (auto pEntity : H::Entities.GetGroup(EntityEnum::PlayerEnemy))
{
auto pPlayer = pEntity->As<CTFPlayer>();
if (!pPlayer->IsAlive() || pPlayer->IsAGhost() || pPlayer->InCond(TF_COND_STEALTHED))
if (pPlayer->IsDormant() || !pPlayer->IsAlive() || pPlayer->IsAGhost() || pPlayer->InCond(TF_COND_STEALTHED))
continue;
auto pWeapon = pPlayer->m_hActiveWeapon()->As<CTFWeaponBase>();
@@ -131,7 +131,7 @@ float CAntiAim::GetBaseYaw(CTFPlayer* pLocal, CUserCmd* pCmd, bool bFake)
for (auto pEntity : H::Entities.GetGroup(EntityEnum::PlayerEnemy))
{
auto pPlayer = pEntity->As<CTFPlayer>();
if (!pPlayer->IsAlive() || pPlayer->IsAGhost() || F::PlayerUtils.IsIgnored(pPlayer->entindex()))
if (pPlayer->IsDormant() || !pPlayer->IsAlive() || pPlayer->IsAGhost() || F::PlayerUtils.IsIgnored(pPlayer->entindex()))
continue;
const Vec3 vAngleTo = Math::CalcAngle(pLocal->m_vecOrigin(), pPlayer->m_vecOrigin());
+1 -1
View File
@@ -135,7 +135,7 @@ void CResolver::CreateMove()
for (auto& pEntity : H::Entities.GetGroup(EntityEnum::PlayerAll))
{
if (pEntity->entindex() == I::EngineClient->GetLocalPlayer())
if (pEntity->entindex() == I::EngineClient->GetLocalPlayer() || pEntity->IsDormant())
continue;
Vec3 vCurPos = pEntity->GetCenter();
@@ -110,12 +110,12 @@ void CMovementSimulation::Store()
{
auto pPlayer = pEntity->As<CTFPlayer>();
auto& vRecords = m_mRecords[pPlayer->entindex()];
if (!pPlayer->IsAlive() || pPlayer->IsAGhost() || pPlayer->IsDormant() || pPlayer->m_vecVelocity().IsZero())
if (!pPlayer->IsAlive() || pPlayer->IsAGhost() || pPlayer->m_vecVelocity().IsZero())
{
vRecords.clear();
continue;
}
else if (pPlayer->entindex() == I::EngineClient->GetLocalPlayer() || !H::Entities.GetDeltaTime(pPlayer->entindex()))
else if (pPlayer->entindex() == I::EngineClient->GetLocalPlayer() || !H::Entities.GetDeltaTime(pPlayer->entindex()) && !pPlayer->IsDormant())
continue;
Vec3 vVelocity = pPlayer->m_vecVelocity();
@@ -235,6 +235,11 @@ bool CMovementSimulation::Initialize(CBaseEntity* pEntity, MoveStorage& tMoveSto
// setup move data
SetupMoveData(tMoveStorage);
if (I::GameMovement->player = pPlayer, I::GameMovement->mv = &tMoveStorage.m_MoveData; I::GameMovement->CheckStuck())
{
tMoveStorage.m_bFailed = true;
return true;
}
// calculate strafe if desired
if (bStrafe)
+1 -1
View File
@@ -374,7 +374,7 @@ static inline void StorePlayer(CTFPlayer* pPlayer, CTFPlayer* pLocal, Group_t* p
if (Vars::Visuals::Removals::Taunts.Value && pPlayer->InCond(TF_COND_TAUNTING))
tCache.m_vText.emplace_back(ALIGN_TOPRIGHT, "Taunt", Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value);
if (Vars::Debug::Info.Value && !pPlayer->IsDormant() && !bLocal)
if (Vars::Debug::Info.Value && !bLocal /*&& !pPlayer->IsDormant()*/)
{
int iAverage = TIME_TO_TICKS(F::MoveSim.GetPredictedDelta(pPlayer));
int iCurrent = H::Entities.GetChoke(iIndex);
+1 -1
View File
@@ -966,7 +966,7 @@ void CVisuals::Store()
for (auto pEntity : H::Entities.GetGroup(EntityEnum::PlayerAll))
{
auto pPlayer = pEntity->As<CTFPlayer>();
if (pPlayer->entindex() == I::EngineClient->GetLocalPlayer()
if (pPlayer->entindex() == I::EngineClient->GetLocalPlayer() || pPlayer->IsDormant()
|| !F::Groups.GetGroup(pEntity, pGroup, false) || !(pGroup->m_iSightlines & SightlinesEnum::Enabled))
continue;
+30 -25
View File
@@ -7,6 +7,8 @@
#include "../../../Features/CheatDetection/CheatDetection.h"
#include "../../../Features/Resolver/Resolver.h"
static std::unordered_map<unsigned short, DormantData> s_mDormancy = {};
void CEntities::Store()
{
auto pLocal = I::ClientEntityList->GetClientEntity(I::EngineClient->GetLocalPlayer());
@@ -244,36 +246,39 @@ void CEntities::Store()
}
auto pPlayer = I::ClientEntityList->GetClientEntity(n)->As<CTFPlayer>();
if (!pPlayer || !pPlayer->IsPlayer() || ManageDormancy(pPlayer))
if (!pPlayer || !pPlayer->IsPlayer())
continue;
m_aModels[n] = FNV1A::Hash32(I::ModelInfoClient->GetModelName(pPlayer->GetModel()));
m_aGroups[EntityEnum::PlayerAll].push_back(pPlayer);
m_aGroups[pPlayer->m_iTeamNum() != m_pLocal->m_iTeamNum() ? EntityEnum::PlayerEnemy : EntityEnum::PlayerTeam].push_back(pPlayer);
ManageDormancy(pPlayer);
if (n != I::EngineClient->GetLocalPlayer())
{
bool bDormant = pPlayer->IsDormant();
if (float flOldSimTime = m_aSimTimes[n], flSimTime = m_aSimTimes[n] = pPlayer->m_flSimulationTime();
m_aDeltaTimes[n] = flSimTime != flOldSimTime)
{
m_aDeltaTimes[n] = m_aLagTimes[n] = TICKS_TO_TIME(std::clamp(TIME_TO_TICKS(flSimTime - flOldSimTime) - iLag, 1, 24));
m_aSetTicks[n] = I::GlobalVars->tickcount;
if (!bDormant)
{
m_aOrigins[n].emplace_front(pPlayer->m_vecOrigin() + Vec3(0, 0, pPlayer->GetSize().z), flSimTime);
if (m_aOrigins[n].size() > Vars::Aimbot::Projectile::VelocityAverageCount.Value)
m_aOrigins[n].pop_back();
if (pPlayer->IsAlive())
F::CheatDetection.ReportChoke(pPlayer, m_aChokes[n]);
m_aOldAngles[n] = m_aEyeAngles[n], m_aEyeAngles[n] = pPlayer->As<CTFPlayer>()->GetEyeAngles();
m_aOldAngles[n] = m_aEyeAngles[n], m_aEyeAngles[n] = pPlayer->As<CTFPlayer>()->GetEyeAngles();
}
else
m_aOrigins[n].clear();
m_aOrigins[n].emplace_front(pPlayer->m_vecOrigin() + Vec3(0, 0, pPlayer->GetSize().z), flSimTime);
if (m_aOrigins[n].size() > Vars::Aimbot::Projectile::VelocityAverageCount.Value)
m_aOrigins[n].pop_back();
if (pPlayer->IsAlive())
F::CheatDetection.ReportChoke(pPlayer, m_aChokes[n]);
}
if (!pPlayer->IsDormant())
m_aChokes[n] = I::GlobalVars->tickcount - m_aSetTicks[n];
else
{
m_aOrigins[n].clear();
if (s_mDormancy.contains(n))
m_aChokes[n] = TIME_TO_TICKS(I::GlobalVars->curtime - s_mDormancy[n].m_flLastUpdate);
}
m_aChokes[n] = I::GlobalVars->tickcount - m_aSetTicks[n];
}
}
F::Resolver.FrameStageNotify();
@@ -316,7 +321,6 @@ void CEntities::Store()
}
}
static std::unordered_map<unsigned short, DormantData> s_mDormancy = {};
void CEntities::Clear(bool bShutdown)
{
m_pLocal = nullptr;
@@ -336,7 +340,6 @@ void CEntities::Clear(bool bShutdown)
m_aAvgVelocities = {};
m_aOrigins = {};
m_aModels = {};
m_aDormancy = {};
s_mDormancy.clear();
}
}
@@ -351,16 +354,18 @@ void CEntities::ManualNetwork(const StartSoundParams_t& params)
if (!pEntity || !pEntity->IsDormant() || !pEntity->IsPlayer() && !pEntity->IsBuilding())
return;
float flDuration = 0.f;
switch (pEntity->GetClassID())
{
case ETFClassID::CTFPlayer: flDuration = 1.f; break;
case ETFClassID::CTFPlayer:
pEntity->As<CTFPlayer>()->m_vecVelocity() = (params.origin - pEntity->m_vecOrigin()) / std::min(I::GlobalVars->curtime - s_mDormancy[n].m_flLastUpdate, 1.f);
pEntity->SetAbsVelocity(pEntity->As<CTFPlayer>()->m_vecVelocity()); SetAvgVelocity(pEntity->entindex(), pEntity->As<CTFPlayer>()->m_vecVelocity());
s_mDormancy[n] = { params.origin, I::GlobalVars->curtime };
break;
case ETFClassID::CObjectSentrygun:
case ETFClassID::CObjectDispenser:
case ETFClassID::CObjectTeleporter: flDuration = 5.f; break;
case ETFClassID::CObjectTeleporter:
s_mDormancy[n] = { params.origin, I::GlobalVars->curtime };
}
if (flDuration)
s_mDormancy[n] = { params.origin, I::GlobalVars->curtime + flDuration }, m_aDormancy[n] = true;
}
bool CEntities::ManageDormancy(CBaseEntity* pEntity)
{
@@ -394,14 +399,14 @@ bool CEntities::ManageDormancy(CBaseEntity* pEntity)
if (s_mDormancy.contains(n))
{
auto& tDormancy = s_mDormancy[n];
if (tDormancy.m_flLastUpdate - I::GlobalVars->curtime > 0.f)
if (tDormancy.m_flLastUpdate + flDuration > I::GlobalVars->curtime)
pEntity->SetAbsOrigin(pEntity->m_vecOrigin() = tDormancy.m_vLocation);
else
s_mDormancy.erase(n), m_aDormancy[n] = false;
s_mDormancy.erase(n);
}
}
else if (!pEntity->IsPlayer() || pEntity->As<CTFPlayer>()->IsAlive())
s_mDormancy[n] = { pEntity->m_vecOrigin(), I::GlobalVars->curtime + flDuration }, m_aDormancy[n] = true;
s_mDormancy[n] = { pEntity->m_vecOrigin(), I::GlobalVars->curtime };
return bDormant;
}
@@ -519,7 +524,7 @@ Vec3* CEntities::GetAvgVelocity(uint16_t iIndex) { return iIndex < MAX_PLAYERS &
void CEntities::SetAvgVelocity(uint16_t iIndex, Vec3 vAvgVelocity) { if (iIndex < MAX_PLAYERS) m_aAvgVelocities[iIndex] = vAvgVelocity; }
std::deque<VelFixRecord>* CEntities::GetOrigins(uint16_t iIndex) { return iIndex < MAX_PLAYERS ? &m_aOrigins[iIndex] : nullptr; }
uint32_t CEntities::GetModel(unsigned short iIndex) { return iIndex < MAX_EDICTS ? m_aModels[iIndex] : 0; }
bool CEntities::GetDormancy(unsigned short iIndex) { return iIndex < MAX_EDICTS ? m_aDormancy[iIndex] : false; }
DormantData* CEntities::GetDormancy(unsigned short iIndex) { return s_mDormancy.contains(iIndex) ? &s_mDormancy[iIndex] : nullptr; }
int CEntities::GetPriority(int iIndex) { return m_mIPriorities[iIndex]; }
int CEntities::GetPriority(uint32_t uAccountID) { return m_mUPriorities[uAccountID]; }
+1 -2
View File
@@ -42,7 +42,6 @@ private:
std::array<Vec3, MAX_PLAYERS> m_aAvgVelocities = {};
std::array<std::deque<VelFixRecord>, MAX_PLAYERS> m_aOrigins = {};
std::array<uint32_t, MAX_EDICTS> m_aModels = {};
std::array<bool, MAX_EDICTS> m_aDormancy = {};
std::unordered_map<int, int> m_mIPriorities = {};
std::unordered_map<uint32_t, int> m_mUPriorities = {};
@@ -84,7 +83,7 @@ public:
void SetAvgVelocity(uint16_t iIndex, Vec3 vAvgVelocity);
std::deque<VelFixRecord>* GetOrigins(uint16_t iIndex);
uint32_t GetModel(unsigned short iIndex);
bool GetDormancy(unsigned short iIndex);
DormantData* GetDormancy(unsigned short iIndex);
int GetPriority(int iIndex);
int GetPriority(uint32_t uAccountID);
+2 -2
View File
@@ -320,8 +320,8 @@ NAMESPACE_BEGIN(Vars)
VA_LIST("Auto", "##Divider", "Head", "Body", "Feet", "##Divider", "Bodyaim if lethal", "Prioritize feet"),
Auto = 1 << 0, Head = 1 << 1, Body = 1 << 2, Feet = 1 << 3, BodyaimIfLethal = 1 << 4, PrioritizeFeet = 1 << 5);
CVarEnum(Modifiers, VA_LIST("Modifiers", "Projectile modifiers"), 0b0010, DROPDOWN_MULTI, nullptr,
VA_LIST("Charge weapon", "Cancel charge", "Use arm time", "Air splash", "Lob angles"),
ChargeWeapon = 1 << 0, CancelCharge = 1 << 1, UseArmTime = 1 << 2, AirSplash = 1 << 3, LobAngles = 1 << 4);
VA_LIST("Charge weapon", "Cancel charge", "Use arm time", "Air splash", "Lob angles", "Target dormant"),
ChargeWeapon = 1 << 0, CancelCharge = 1 << 1, UseArmTime = 1 << 2, AirSplash = 1 << 3, LobAngles = 1 << 4, TargetDormant = 1 << 5);
CVar(MaxSimulationTime, "Max simulation time", 1.f, SLIDER_MIN | SLIDER_PRECISION, 0.1f, 2.5f, 0.25f, "%gs");
CVar(HitChance, "Hit chance", 0.f, SLIDER_CLAMP | SLIDER_PRECISION, 0.f, 100.f, 10.f, "%g%%");
CVar(AutodetRadius, "Autodet radius", 90.f, SLIDER_CLAMP | SLIDER_PRECISION, 0.f, 100.f, 10.f, "%g%%");