Fix some issues

This commit is contained in:
vicinity-gush8 2021-12-18 13:31:48 +01:00 committed by LightCat
parent ee248ef2eb
commit 4ccc490c83
6 changed files with 81 additions and 124 deletions

View File

@ -29,6 +29,8 @@
<AutoVariable width="fill" target="zk.style.tab-button.color.selected.underline" label="Tab active underline"/> <AutoVariable width="fill" target="zk.style.tab-button.color.selected.underline" label="Tab active underline"/>
<AutoVariable width="fill" target="zk.style.tab-button.color.hover.underline" label="Tab hover underline"/> <AutoVariable width="fill" target="zk.style.tab-button.color.hover.underline" label="Tab hover underline"/>
<AutoVariable width="fill" target="zk.style.menu.color.text" label="Text"/> <AutoVariable width="fill" target="zk.style.menu.color.text" label="Text"/>
<AutoVariable width="fill" target="zk.style.tooltip.background" label="Tooltip background"/>
<AutoVariable width="fill" target="zk.style.tooltip.border" label="Tooltip border"/>
</List> </List>
</Box> </Box>
<Box padding="12 6 6 6" width="content" height="content" name="List select" x="170"> <Box padding="12 6 6 6" width="content" height="content" name="List select" x="170">

View File

@ -1502,68 +1502,33 @@ bool VischeckPredictedEntity(CachedEntity *entity)
return cd.visible; return cd.visible;
} }
static float slow_change_dist_p = 0;
static float slow_change_dist_y = 0;
// A helper function to find a user angle that isnt directly on the target // A helper function to find a user angle that isnt directly on the target
// angle, effectively slowing the aiming process // angle, effectively slowing the aiming process
void DoSlowAim(Vector &input_angle) void DoSlowAim(Vector &input_angle)
{ {
auto viewangles = current_user_cmd->viewangles; auto viewangles = current_user_cmd->viewangles;
Vector slow_delta = { 0, 0, 0 };
// Yaw // Don't bother if we're already on target
if (viewangles.y != input_angle.y) if (viewangles != input_angle)
{ {
slow_delta = input_angle - viewangles;
// Check if input angle and user angle are on opposing sides of yaw so if (slow_delta.y > 180)
// we can correct for that slow_delta.y -= 360;
bool slow_opposing = false; if (slow_delta.y < -180)
if ((input_angle.y < -90 && viewangles.y > 90) || (input_angle.y > 90 && viewangles.y < -90)) slow_delta.y += 360;
slow_opposing = true;
// Direction slow_delta /= slow_aim;
bool slow_dir = false; input_angle = viewangles + slow_delta;
if (slow_opposing)
{
if (input_angle.y > 90 && viewangles.y < -90)
slow_dir = true;
}
else if (viewangles.y > input_angle.y)
slow_dir = true;
// Speed, check if opposing. We dont get a new distance due to the // Clamp as we changed angles
// opposing sides making the distance spike, so just cheap out and reuse fClampAngle(input_angle);
// our last one.
if (!slow_opposing)
slow_change_dist_y = std::abs(viewangles.y - input_angle.y) / (int) slow_aim;
// Move in the direction of the input angle
if (slow_dir)
input_angle.y = viewangles.y - slow_change_dist_y;
else
input_angle.y = viewangles.y + slow_change_dist_y;
} }
// Pitch
if (viewangles.x != input_angle.x)
{
// Get speed
slow_change_dist_p = std::abs(viewangles.x - input_angle.x) / (int) slow_aim;
// Move in the direction of the input angle
if (viewangles.x > input_angle.x)
input_angle.x = viewangles.x - slow_change_dist_p;
else
input_angle.x = viewangles.x + slow_change_dist_p;
}
// 0.17 is a good amount in general // 0.17 is a good amount in general
slow_can_shoot = false; slow_can_shoot = false;
if (slow_change_dist_y < 0.17 && slow_change_dist_p < 0.17) if (std::abs(slow_delta.y) < 0.17 && std::abs(slow_delta.x) < 0.17)
slow_can_shoot = true; slow_can_shoot = true;
// Clamp as we changed angles
fClampAngle(input_angle);
} }
// A function that determins whether aimkey allows aiming // A function that determins whether aimkey allows aiming

View File

@ -280,6 +280,9 @@ static bool doRageBackstab()
continue; continue;
if (doSwingTraceAngle(angle, trace)) if (doSwingTraceAngle(angle, trace))
{ {
// Make sure trace hit the enemy
if ((IClientEntity *) trace.m_pEnt != g_IEntityList->GetClientEntity(ent->m_IDX))
return false;
current_user_cmd->buttons |= IN_ATTACK; current_user_cmd->buttons |= IN_ATTACK;
g_pLocalPlayer->bUseSilentAngles = true; g_pLocalPlayer->bUseSilentAngles = true;
current_user_cmd->viewangles = angle; current_user_cmd->viewangles = angle;
@ -444,8 +447,10 @@ void CreateMove()
} }
} }
static InitRoutine EC([]() { static InitRoutine EC(
EC::Register(EC::CreateMove, CreateMove, "autobackstab", EC::average); []()
EC::Register(EC::CreateMoveWarp, CreateMove, "autobackstab_w", EC::average); {
}); EC::Register(EC::CreateMove, CreateMove, "autobackstab", EC::average);
EC::Register(EC::CreateMoveWarp, CreateMove, "autobackstab_w", EC::average);
});
} // namespace hacks::tf2::autobackstab } // namespace hacks::tf2::autobackstab

View File

@ -672,28 +672,37 @@ void CreateMove()
if (!CurrentHealingTargetIDX) if (!CurrentHealingTargetIDX)
return; return;
CachedEntity *target = ENTITY(CurrentHealingTargetIDX); CachedEntity *target = ENTITY(CurrentHealingTargetIDX);
bool target_is_healing_target = HandleToIDX(CE_INT(LOCAL_W, netvar.m_hHealingTarget)) == CurrentHealingTargetIDX; bool target_is_healing_target = HandleToIDX(CE_INT(LOCAL_W, netvar.m_hHealingTarget)) == CurrentHealingTargetIDX;
auto out = target->hitboxes.GetHitbox(spine_2);
if (!target_is_healing_target || look_at_target) if (out)
{ {
auto out = target->hitboxes.GetHitbox(spine_2); if (silent)
if (out) g_pLocalPlayer->bUseSilentAngles = true;
// Follow the target using slowaim
if (target_is_healing_target && look_at_target)
{ {
if (silent) Vector angles = GetAimAtAngles(g_pLocalPlayer->v_Eye, out->center);
g_pLocalPlayer->bUseSilentAngles = true; hacks::tf2::misc_aimbot::DoSlowAim(angles);
auto angles = GetAimAtAngles(g_pLocalPlayer->v_Eye, out->center);
// If we are already healing our target, then follow the target using slowaim
if (target_is_healing_target)
hacks::tf2::misc_aimbot::DoSlowAim(angles);
current_user_cmd->viewangles = angles; current_user_cmd->viewangles = angles;
if (!target_is_healing_target && (g_GlobalVars->tickcount % 2) == 0)
current_user_cmd->buttons |= IN_ATTACK;
} }
// Set angles to new target
if (!target_is_healing_target)
current_user_cmd->viewangles = GetAimAtAngles(g_pLocalPlayer->v_Eye, out->center);
} }
int autoheal_mode = g_ICvar->FindVar("tf_medigun_autoheal")->GetInt();
// Hold down if we are currently healing our target or not healing anyone
if (autoheal_mode == 0 && (target_is_healing_target || CE_INT(LOCAL_W, netvar.m_hHealingTarget) == -1))
current_user_cmd->buttons |= IN_ATTACK;
// Press once if we are not healing our target
else if (autoheal_mode == 1 && !target_is_healing_target)
current_user_cmd->buttons |= IN_ATTACK;
if (IsVaccinator() && CE_GOOD(target) && auto_vacc) if (IsVaccinator() && CE_GOOD(target) && auto_vacc)
{ {
int opt = OptimalResistance(target, &pop); int opt = OptimalResistance(target, &pop);
@ -703,6 +712,16 @@ void CreateMove()
{ {
current_user_cmd->buttons |= IN_ATTACK2; current_user_cmd->buttons |= IN_ATTACK2;
} }
// Uber on "CHARGE ME DOCTOR!"
if (pop_uber_voice)
{
auto uber_array = std::move(called_medic);
for (auto i : uber_array)
if (i == CurrentHealingTargetIDX)
{
current_user_cmd->buttons |= IN_ATTACK2;
}
}
} }
else else
{ {

View File

@ -208,56 +208,22 @@ void DoSlowAim(Vector &input_angle, int speed)
{ {
auto viewangles = current_user_cmd->viewangles; auto viewangles = current_user_cmd->viewangles;
// Yaw // Don't bother if we're already on target
if (viewangles.y != input_angle.y) if (viewangles != input_angle)
{ {
float flChargeYawCap = re::CTFPlayerShared::CalculateChargeCap(re::CTFPlayerShared::GetPlayerShared(RAW_ENT(LOCAL_E))); Vector slow_delta = input_angle - viewangles;
flChargeYawCap *= 2.5f;
// Check if input angle and user angle are on opposing sides of yaw so if (slow_delta.y > 180)
// we can correct for that slow_delta.y -= 360;
bool slow_opposing = false; if (slow_delta.y < -180)
if ((input_angle.y < -90 && viewangles.y > 90) || (input_angle.y > 90 && viewangles.y < -90)) slow_delta.y += 360;
slow_opposing = true;
// Direction slow_delta /= speed;
bool slow_dir = false; input_angle = viewangles + slow_delta;
if (slow_opposing)
{
if (input_angle.y > 90 && viewangles.y < -90)
slow_dir = true;
}
else if (viewangles.y > input_angle.y)
slow_dir = true;
// Speed, check if opposing. We dont get a new distance due to the // Clamp as we changed angles
// opposing sides making the distance spike, so just cheap out and reuse fClampAngle(input_angle);
// our last one.
if (!slow_opposing)
slow_change_dist_y = std::abs(viewangles.y - input_angle.y) / (int) speed;
// Move in the direction of the input angle
if (slow_dir)
input_angle.y = viewangles.y - slow_change_dist_y;
else
input_angle.y = viewangles.y + slow_change_dist_y;
} }
// Pitch
if (viewangles.x != input_angle.x)
{
// Get speed
slow_change_dist_p = std::abs(viewangles.x - input_angle.x) / speed;
// Move in the direction of the input angle
if (viewangles.x > input_angle.x)
input_angle.x = viewangles.x - slow_change_dist_p;
else
input_angle.x = viewangles.x + slow_change_dist_p;
}
// Clamp as we changed angles
fClampAngle(input_angle);
} }
static void SandwichAim() static void SandwichAim()

View File

@ -47,8 +47,7 @@ settings::Boolean draw_mantissa{ "nospread.draw-info.mantissa", "false" };
settings::Boolean correct_ping{ "nospread.correct-ping", "true" }; settings::Boolean correct_ping{ "nospread.correct-ping", "true" };
settings::Boolean use_avg_latency{ "nospread.use-average-latency", "false" }; settings::Boolean use_avg_latency{ "nospread.use-average-latency", "false" };
settings::Boolean extreme_accuracy{ "nospread.use-extreme-accuracy", "false" }; settings::Boolean extreme_accuracy{ "nospread.use-extreme-accuracy", "false" };
static bool should_nospread = false; bool is_syncing = false;
bool is_syncing = false;
bool shouldNoSpread(bool _projectile) bool shouldNoSpread(bool _projectile)
{ {
@ -95,24 +94,25 @@ void CreateMove()
// Beggars check // Beggars check
if (CE_INT(LOCAL_W, netvar.iItemDefinitionIndex) == 730) if (CE_INT(LOCAL_W, netvar.iItemDefinitionIndex) == 730)
{ {
// Check if we released the barrage by releasing m1, also lock bool so people don't just release m1 and tap it again bool should_nospread = !(current_late_user_cmd->buttons & IN_ATTACK);
if (!should_nospread)
should_nospread = !(current_late_user_cmd->buttons & IN_ATTACK) && g_pLocalPlayer->bAttackLastTick;
// Check if player is charging rockets
if (!CE_INT(LOCAL_W, netvar.m_iClip1) && CE_INT(LOCAL_W, netvar.iReloadMode) == 0) if (!CE_INT(LOCAL_W, netvar.m_iClip1) && CE_INT(LOCAL_W, netvar.iReloadMode) == 0)
{
// Reset
should_nospread = false; should_nospread = false;
return;
}
// Cancel
if (!should_nospread) if (!should_nospread)
return; return;
} }
// Huntsman check // Huntsman check
else if (LOCAL_W->m_iClassID() == CL_CLASS(CTFCompoundBow)) else if (LOCAL_W->m_iClassID() == CL_CLASS(CTFCompoundBow))
{ {
if (!g_pLocalPlayer->bAttackLastTick || (current_late_user_cmd->buttons & IN_ATTACK)) bool should_nospread = !(current_late_user_cmd->buttons & IN_ATTACK);
// Check if player is charging an arrow
if (CE_FLOAT(LOCAL_W, netvar.flChargeBeginTime) == 0)
should_nospread = false;
if (!should_nospread)
return; return;
} }
// Rest of weapons // Rest of weapons