Autoheal: Try to fix #713 and improve BulletDangerValue

I really dont understand this code (OptimalResistance) so i dont expect this to work at all...

Tries to fix #713
This commit is contained in:
TotallyNotElite 2019-03-22 11:47:04 +01:00
parent 3565bba208
commit 27204159d6
3 changed files with 35 additions and 16 deletions

View File

@ -25,8 +25,6 @@
</List>
<Box padding="12 6 6 6" name="Bullet" width="content" height="content" x="170">
<List width="150">
<AutoVariable width="fill" target="autoheal.vacc.bullet.enable" label="Enable"/>
<AutoVariable width="fill" target="autoheal.vacc.bullet.min-charges" label="Min. charges" min="0" max="4"/>
<LabeledObject width="fill" label="Sniper pop">
<Select target="autoheal.vacc.bullet.sniper-pop">
<Option name="Never" value="0"/>
@ -34,6 +32,8 @@
<Option name="Any zoomed" value="2"/>
</Select>
</LabeledObject>
<AutoVariable width="fill" target="autoheal.vacc.bullet.min-charges" label="Min. charges" min="0" max="4"/>
<AutoVariable width="fill" target="autoheal.vacc.bullet.max-fov" label="Max enemy FOV" min="0" max="180"/>
</List>
</Box>
<Box padding="12 6 6 6" name="Blast" width="content" height="content" y="75">

View File

@ -133,6 +133,10 @@ public:
else
return 0.0f;
};
Vector &m_vecAngle()
{
return CE_VECTOR(this, netvar.m_angEyeAngles);
};
// Entity fields start here
EntityType m_Type()

View File

@ -6,8 +6,8 @@
*/
#include "common.hpp"
#include <hacks/FollowBot.hpp>
#include <settings/Bool.hpp>
#include "hacks/FollowBot.hpp"
#include "settings/Bool.hpp"
static settings::Bool enable{ "autoheal.enable", "false" };
static settings::Bool steamid_only{ "autoheal.steam-only", "false" };
@ -18,8 +18,8 @@ static settings::Bool share_uber{ "autoheal.uber.share", "true" };
static settings::Bool auto_vacc{ "autoheal.vacc.enable", "false" };
static settings::Bool auto_vacc_bullets{ "autoheal.vacc.bullet.enable", "true" };
static settings::Int vacc_sniper{ "autoheal.vacc.bullet.sniper-pop", "true" };
static settings::Int vacc_sniper{ "autoheal.vacc.bullet.sniper-pop", "1" };
static settings::Int vacc_sniper_fov{ "autoheal.vacc.bullet.sniper-fov", "20" };
static settings::Bool auto_vacc_fire_checking{ "autoheal.vacc.fire.enable", "true" };
static settings::Int auto_vacc_pop_if_pyro{ "autoheal.vacc.fire.pyro-pop", "1" };
@ -77,29 +77,44 @@ int ChargeCount()
// TODO Angle Checking
int BulletDangerValue(CachedEntity *patient)
{
// Find zoomed in snipers in other team
if (!vacc_sniper)
return 0;
bool any_zoomed_snipers = false;
for (int i = 1; i < 32 && i < HIGHEST_ENTITY; i++)
// Find dangerous snipers in other team
for (int i = 1; i < g_IEngine->GetMaxClients(); i++)
{
CachedEntity *ent = ENTITY(i);
if (CE_BAD(ent))
continue;
if (!ent->m_bEnemy())
if (!ent->m_bAlivePlayer() || !ent->m_bEnemy())
continue;
if (g_pPlayerResource->GetClass(ent) != tf_sniper)
continue;
if (CE_BYTE(ent, netvar.iLifeState))
continue;
if (!HasCondition<TFCond_Zoomed>(ent))
continue;
any_zoomed_snipers = true;
// TODO VisCheck from patient.
if ((int) vacc_sniper == 1)
if (!IsEntityVisible(ent, head) && !IsVectorVisible(ENTITY(m_iCurrentHealingTarget)->hitboxes.GetHitbox(head)->center, ent->hitboxes.GetHitbox(head)->center, true))
continue;
if (*vacc_sniper == 2)
{
// If vacc_sniper == 2 ("Any zoomed") then return 2
// Why would you want this?????
return 2;
}
else
{
if (IsEntityVisible(ent, head))
{
if (playerlist::AccessData(ent).state == playerlist::k_EState::RAGE)
return 2;
else
{
if (GetFov(ent->m_vecAngle(), ent->hitboxes.GetHitbox(head)->center, patient->hitboxes.GetHitbox(head)->center) < *vacc_sniper_fov)
return 2;
}
}
}
return vacc_sniper ? 2 : 1;
}
return any_zoomed_snipers;
return any_zoomed_snipers ? 1 : 0;
}
int FireDangerValue(CachedEntity *patient)