Auto class, auto team

This commit is contained in:
nullifiedcat 2017-12-09 18:28:59 +03:00
parent 7ce39de0c3
commit 27fe90b91f
5 changed files with 14 additions and 13 deletions

View File

@ -14,6 +14,8 @@ namespace shared
namespace autojoin
{
extern CatVar auto_queue;
void Update();
void UpdateSearch();
}

View File

@ -62,11 +62,11 @@ void UpdateSearch()
}
}
Timer timer{};
void Update()
{
static Timer timer;
if (timer.test_and_set(500))
if (timer.test_and_set(500))
{
if (autojoin_team and UnassignedTeam())
{

View File

@ -848,15 +848,13 @@ index_t SelectNextNode()
bool free_move_used = false;
Timer slot_timer{};
void UpdateSlot()
{
static auto last_check = std::chrono::system_clock::now();
auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(
std::chrono::system_clock::now() - last_check)
.count();
if (CE_GOOD(LOCAL_E) && CE_GOOD(LOCAL_W) && !g_pLocalPlayer->life_state &&
ms > 1000)
if (!slot_timer.test_and_set(1000))
return;
if (CE_GOOD(LOCAL_E) && CE_GOOD(LOCAL_W) && !g_pLocalPlayer->life_state)
{
IClientEntity *weapon = RAW_ENT(LOCAL_W);
// IsBaseCombatWeapon()
@ -869,8 +867,6 @@ void UpdateSlot()
}
}
}
last_check = std::chrono::system_clock::now();
}
void UpdateWalker()

View File

@ -242,7 +242,7 @@ bool CreateMove_hook(void *thisptr, float inputSample, CUserCmd *cmd)
}
g_Settings.bInvalid = false;
// hacks::shared::autojoin::Update();
hacks::shared::autojoin::Update();
#if ENABLE_IPC == 1
static int team_joining_state = 0;

View File

@ -406,6 +406,9 @@ void Shutdown_hook(void *_this, const char *reason)
{
original(_this, reason);
}
if (hacks::shared::autojoin::auto_queue)
tfmm::abandon();
}
static CatVar resolver(CV_SWITCH, "resolver", "0", "Resolve angles");