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.hover.underline" label="Tab hover underline"/>
<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>
</Box>
<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;
}
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
// angle, effectively slowing the aiming process
void DoSlowAim(Vector &input_angle)
{
auto viewangles = current_user_cmd->viewangles;
Vector slow_delta = { 0, 0, 0 };
// Yaw
if (viewangles.y != input_angle.y)
// Don't bother if we're already on target
if (viewangles != input_angle)
{
slow_delta = input_angle - viewangles;
// Check if input angle and user angle are on opposing sides of yaw so
// we can correct for that
bool slow_opposing = false;
if ((input_angle.y < -90 && viewangles.y > 90) || (input_angle.y > 90 && viewangles.y < -90))
slow_opposing = true;
if (slow_delta.y > 180)
slow_delta.y -= 360;
if (slow_delta.y < -180)
slow_delta.y += 360;
// Direction
bool slow_dir = false;
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
// opposing sides making the distance spike, so just cheap out and reuse
// 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
slow_can_shoot = false;
if (slow_change_dist_y < 0.17 && slow_change_dist_p < 0.17)
slow_can_shoot = true;
slow_delta /= slow_aim;
input_angle = viewangles + slow_delta;
// Clamp as we changed angles
fClampAngle(input_angle);
}
// 0.17 is a good amount in general
slow_can_shoot = false;
if (std::abs(slow_delta.y) < 0.17 && std::abs(slow_delta.x) < 0.17)
slow_can_shoot = true;
}
// A function that determins whether aimkey allows aiming

View File

@ -280,6 +280,9 @@ static bool doRageBackstab()
continue;
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;
g_pLocalPlayer->bUseSilentAngles = true;
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);
});
});
} // namespace hacks::tf2::autobackstab

View File

@ -673,26 +673,35 @@ void CreateMove()
return;
CachedEntity *target = ENTITY(CurrentHealingTargetIDX);
bool target_is_healing_target = HandleToIDX(CE_INT(LOCAL_W, netvar.m_hHealingTarget)) == CurrentHealingTargetIDX;
if (!target_is_healing_target || look_at_target)
{
bool target_is_healing_target = HandleToIDX(CE_INT(LOCAL_W, netvar.m_hHealingTarget)) == CurrentHealingTargetIDX;
auto out = target->hitboxes.GetHitbox(spine_2);
if (out)
{
if (silent)
g_pLocalPlayer->bUseSilentAngles = true;
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)
// Follow the target using slowaim
if (target_is_healing_target && look_at_target)
{
Vector angles = GetAimAtAngles(g_pLocalPlayer->v_Eye, out->center);
hacks::tf2::misc_aimbot::DoSlowAim(angles);
current_user_cmd->viewangles = angles;
if (!target_is_healing_target && (g_GlobalVars->tickcount % 2) == 0)
}
// 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)
{
@ -703,6 +712,16 @@ void CreateMove()
{
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
{

View File

@ -208,56 +208,22 @@ void DoSlowAim(Vector &input_angle, int speed)
{
auto viewangles = current_user_cmd->viewangles;
// Yaw
if (viewangles.y != input_angle.y)
// Don't bother if we're already on target
if (viewangles != input_angle)
{
float flChargeYawCap = re::CTFPlayerShared::CalculateChargeCap(re::CTFPlayerShared::GetPlayerShared(RAW_ENT(LOCAL_E)));
flChargeYawCap *= 2.5f;
Vector slow_delta = input_angle - viewangles;
// Check if input angle and user angle are on opposing sides of yaw so
// we can correct for that
bool slow_opposing = false;
if ((input_angle.y < -90 && viewangles.y > 90) || (input_angle.y > 90 && viewangles.y < -90))
slow_opposing = true;
if (slow_delta.y > 180)
slow_delta.y -= 360;
if (slow_delta.y < -180)
slow_delta.y += 360;
// Direction
bool slow_dir = false;
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
// opposing sides making the distance spike, so just cheap out and reuse
// 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;
}
slow_delta /= speed;
input_angle = viewangles + slow_delta;
// Clamp as we changed angles
fClampAngle(input_angle);
}
}
static void SandwichAim()

View File

@ -47,7 +47,6 @@ settings::Boolean draw_mantissa{ "nospread.draw-info.mantissa", "false" };
settings::Boolean correct_ping{ "nospread.correct-ping", "true" };
settings::Boolean use_avg_latency{ "nospread.use-average-latency", "false" };
settings::Boolean extreme_accuracy{ "nospread.use-extreme-accuracy", "false" };
static bool should_nospread = false;
bool is_syncing = false;
bool shouldNoSpread(bool _projectile)
@ -95,24 +94,25 @@ void CreateMove()
// Beggars check
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
if (!should_nospread)
should_nospread = !(current_late_user_cmd->buttons & IN_ATTACK) && g_pLocalPlayer->bAttackLastTick;
bool should_nospread = !(current_late_user_cmd->buttons & IN_ATTACK);
// Check if player is charging rockets
if (!CE_INT(LOCAL_W, netvar.m_iClip1) && CE_INT(LOCAL_W, netvar.iReloadMode) == 0)
{
// Reset
should_nospread = false;
return;
}
// Cancel
if (!should_nospread)
return;
}
// Huntsman check
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;
}
// Rest of weapons