Merge remote-tracking branch 'origin/testing' into testing
This commit is contained in:
commit
44f5206e38
@ -28,6 +28,9 @@ extern settings::Bool crypt_chat;
|
||||
extern settings::Bool nolerp;
|
||||
extern settings::Bool no_zoom;
|
||||
extern settings::Bool disable_visuals;
|
||||
extern settings::Int print_r;
|
||||
extern settings::Int print_g;
|
||||
extern settings::Int print_b;
|
||||
|
||||
void SetCanshootStatus();
|
||||
extern bool CanShootException;
|
||||
|
@ -38,3 +38,6 @@ settings::Bool clean_screenshots{ "visual.clean-screenshots", "false" };
|
||||
settings::Bool nolerp{ "misc.no-lerp", "false" };
|
||||
settings::Bool no_zoom{ "remove.scope", "false" };
|
||||
settings::Bool disable_visuals{ "visual.disable", "false" };
|
||||
settings::Int print_r{ "print.rgb.r", "183" };
|
||||
settings::Int print_g{ "print.rgb.b", "27" };
|
||||
settings::Int print_b{ "print.rgb.g", "139" };
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include "common.hpp"
|
||||
#include "hack.hpp"
|
||||
#include "MiscTemporary.hpp"
|
||||
|
||||
settings::Bool log_to_console{ "hack.log-console", "false" };
|
||||
|
||||
@ -51,7 +52,7 @@ void logging::Info(const char *fmt, ...)
|
||||
if (!hack::shutdown)
|
||||
{
|
||||
if (*log_to_console)
|
||||
g_ICvar->ConsolePrintf("CAT: %s \n", result.get());
|
||||
g_ICvar->ConsoleColorPrintf(Color(*print_r, *print_g, *print_b, 255), "CAT: %s \n", result.get());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -297,6 +297,7 @@ void DoResistSwitching()
|
||||
}
|
||||
|
||||
int force_healing_target{ 0 };
|
||||
unsigned steamid = 0;
|
||||
static CatCommand heal_steamid("autoheal_heal_steamid", "Heals a player with SteamID", [](const CCommand &args) {
|
||||
if (args.ArgC() < 2)
|
||||
{
|
||||
@ -382,7 +383,7 @@ void UpdateData()
|
||||
if (reset_cd[i].test_and_set(10000))
|
||||
data[i] = {};
|
||||
CachedEntity *ent = ENTITY(i);
|
||||
if (CE_GOOD(ent))
|
||||
if (CE_GOOD(ent) && ent->m_bAlivePlayer())
|
||||
{
|
||||
int health = ent->m_iHealth();
|
||||
if (data[i].last_damage > g_GlobalVars->curtime)
|
||||
@ -395,7 +396,7 @@ void UpdateData()
|
||||
data[i].accum_damage_start = 0.0f;
|
||||
}
|
||||
const int last_health = data[i].last_health;
|
||||
if (health != last_health)
|
||||
if (health != last_health && health <= g_pPlayerResource->GetMaxHealth(ent))
|
||||
{
|
||||
reset_cd[i].update();
|
||||
data[i].last_health = health;
|
||||
@ -523,7 +524,7 @@ void CreateMove()
|
||||
current_user_cmd->buttons |= IN_ATTACK2;
|
||||
}
|
||||
}
|
||||
if (!force_healing_target && !enable)
|
||||
if (!force_healing_target && !steamid && !enable)
|
||||
return;
|
||||
if (GetWeaponMode() != weapon_medigun)
|
||||
return;
|
||||
@ -532,10 +533,27 @@ void CreateMove()
|
||||
CachedEntity *target = ENTITY(force_healing_target);
|
||||
if (CE_GOOD(target))
|
||||
{
|
||||
Vector out;
|
||||
GetHitbox(target, 7, out);
|
||||
AimAt(g_pLocalPlayer->v_Eye, out, current_user_cmd);
|
||||
current_user_cmd->buttons |= IN_ATTACK;
|
||||
if (target->player_info.friendsID != steamid)
|
||||
force_healing_target = 0;
|
||||
else
|
||||
{
|
||||
Vector out;
|
||||
GetHitbox(target, 7, out);
|
||||
AimAt(g_pLocalPlayer->v_Eye, out, current_user_cmd);
|
||||
current_user_cmd->buttons |= IN_ATTACK;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (steamid)
|
||||
{
|
||||
for (auto i = 0; i < g_IEngine->GetMaxClients(); i++)
|
||||
{
|
||||
CachedEntity *ent = ENTITY(i);
|
||||
if (ent->player_info.friendsID == steamid)
|
||||
{
|
||||
force_healing_target = steamid;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!enable)
|
||||
@ -587,8 +605,13 @@ void CreateMove()
|
||||
|
||||
void rvarCallback(settings::VariableBase<int> &var, int after)
|
||||
{
|
||||
if (after < 0)
|
||||
if (!after)
|
||||
{
|
||||
force_healing_target = 0;
|
||||
steamid = 0;
|
||||
return;
|
||||
}
|
||||
steamid = after;
|
||||
for (int i = 1; i <= 32 && i < HIGHEST_ENTITY; i++)
|
||||
{
|
||||
CachedEntity *ent = ENTITY(i);
|
||||
@ -603,8 +626,13 @@ void rvarCallback(settings::VariableBase<int> &var, int after)
|
||||
}
|
||||
}
|
||||
}
|
||||
void LevelInit()
|
||||
{
|
||||
force_healing_target = 0;
|
||||
}
|
||||
static InitRoutine Init([]() {
|
||||
steam_var.installChangeCallback(rvarCallback);
|
||||
EC::Register(EC::CreateMove, CreateMove, "autoheal", EC::average);
|
||||
EC::Register(EC::LevelInit, LevelInit, "autoheal_lvlinit", EC::average);
|
||||
});
|
||||
} // namespace hacks::tf::autoheal
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
#include "common.hpp"
|
||||
#include "hack.hpp"
|
||||
#include "MiscTemporary.hpp"
|
||||
|
||||
static settings::Bool autojoin_team{ "autojoin.team", "false" };
|
||||
static settings::Int autojoin_class{ "autojoin.class", "0" };
|
||||
@ -131,7 +132,7 @@ void onShutdown()
|
||||
tfmm::startQueue();
|
||||
}
|
||||
|
||||
static CatCommand get_steamid("print_steamid", "Prints your SteamID", []() { g_ICvar->ConsolePrintf("%u\n", g_ISteamUser->GetSteamID().GetAccountID()); });
|
||||
static CatCommand get_steamid("print_steamid", "Prints your SteamID", []() { g_ICvar->ConsoleColorPrintf(Color(*print_r, *print_g, *print_b, 255), "%u\n", g_ISteamUser->GetSteamID().GetAccountID()); });
|
||||
|
||||
static InitRoutine init([]() {
|
||||
EC::Register(EC::CreateMove, update, "cm_autojoin", EC::average);
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <thread>
|
||||
|
||||
#include <MiscTemporary.hpp>
|
||||
/*
|
||||
Created on 29.07.18.
|
||||
*/
|
||||
@ -17,14 +17,14 @@ static void getAndSortAllConfigs();
|
||||
static CatCommand cat("cat", "", [](const CCommand &args) {
|
||||
if (args.ArgC() < 3)
|
||||
{
|
||||
g_ICvar->ConsolePrintf("Usage: cat <set/get> <variable> [value]\n");
|
||||
g_ICvar->ConsoleColorPrintf(Color(*print_r, *print_g, *print_b, 255), "Usage: cat <set/get> <variable> [value]\n");
|
||||
return;
|
||||
}
|
||||
|
||||
auto variable = settings::Manager::instance().lookup(args.Arg(2));
|
||||
if (variable == nullptr)
|
||||
{
|
||||
g_ICvar->ConsolePrintf("Variable not found: %s\n", args.Arg(2));
|
||||
g_ICvar->ConsoleColorPrintf(Color(*print_r, *print_g, *print_b, 255), "Variable not found: %s\n", args.Arg(2));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -32,21 +32,21 @@ static CatCommand cat("cat", "", [](const CCommand &args) {
|
||||
{
|
||||
if (args.ArgC() < 4)
|
||||
{
|
||||
g_ICvar->ConsolePrintf("Usage: cat <set> <variable> <value>\n");
|
||||
g_ICvar->ConsoleColorPrintf(Color(*print_r, *print_g, *print_b, 255), "Usage: cat <set> <variable> <value>\n");
|
||||
return;
|
||||
}
|
||||
variable->fromString(args.Arg(3));
|
||||
g_ICvar->ConsolePrintf("%s = \"%s\"\n", args.Arg(2), variable->toString().c_str());
|
||||
g_ICvar->ConsoleColorPrintf(Color(*print_r, *print_g, *print_b, 255), "%s = \"%s\"\n", args.Arg(2), variable->toString().c_str());
|
||||
return;
|
||||
}
|
||||
else if (!strcmp(args.Arg(1), "get"))
|
||||
{
|
||||
g_ICvar->ConsolePrintf("%s = \"%s\"\n", args.Arg(2), variable->toString().c_str());
|
||||
g_ICvar->ConsoleColorPrintf(Color(*print_r, *print_g, *print_b, 255), "%s = \"%s\"\n", args.Arg(2), variable->toString().c_str());
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_ICvar->ConsolePrintf("Usage: cat <set/get> <variable> <value>\n");
|
||||
g_ICvar->ConsoleColorPrintf(Color(*print_r, *print_g, *print_b, 255), "Usage: cat <set/get> <variable> <value>\n");
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "core/logging.hpp"
|
||||
#include "interfaces.hpp"
|
||||
#include "icvar.h"
|
||||
#include "MiscTemporary.hpp"
|
||||
|
||||
settings::SettingsWriter::SettingsWriter(settings::Manager &manager) : manager(manager)
|
||||
{
|
||||
@ -23,7 +24,7 @@ bool settings::SettingsWriter::saveTo(std::string path, bool only_changed)
|
||||
if (!stream || stream.bad() || !stream.is_open() || stream.fail())
|
||||
{
|
||||
logging::Info("cat_save: FATAL! FAILED to create stream!");
|
||||
g_ICvar->ConsolePrintf("CAT: cat_save: Can't create config file!\n");
|
||||
g_ICvar->ConsoleColorPrintf(Color(*print_r, *print_g, *print_b, 255), "CAT: cat_save: Can't create config file!\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -46,11 +47,11 @@ bool settings::SettingsWriter::saveTo(std::string path, bool only_changed)
|
||||
}
|
||||
if (!stream || stream.bad() || stream.fail())
|
||||
{
|
||||
g_ICvar->ConsolePrintf("CAT: cat_save: Failed to save config!\n");
|
||||
g_ICvar->ConsoleColorPrintf(Color(*print_r, *print_g, *print_b, 255), "CAT: cat_save: Failed to save config!\n");
|
||||
logging::Info("cat_save: FATAL! Stream bad!");
|
||||
}
|
||||
else
|
||||
g_ICvar->ConsolePrintf("CAT: cat_save: Successfully saved config!\n");
|
||||
g_ICvar->ConsoleColorPrintf(Color(*print_r, *print_g, *print_b, 255), "CAT: cat_save: Successfully saved config!\n");
|
||||
stream.close();
|
||||
if (stream.fail())
|
||||
logging::Info("cat_save: FATAL! Stream bad (2)!");
|
||||
@ -99,7 +100,7 @@ bool settings::SettingsReader::loadFrom(std::string path)
|
||||
if (stream.fail())
|
||||
{
|
||||
logging::Info("cat_load: Can't access file!");
|
||||
g_ICvar->ConsolePrintf("CAT: cat_load: File doesn't exist / can't open file!\n");
|
||||
g_ICvar->ConsoleColorPrintf(Color(*print_r, *print_g, *print_b, 255), "CAT: cat_load: File doesn't exist / can't open file!\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -114,12 +115,12 @@ bool settings::SettingsReader::loadFrom(std::string path)
|
||||
if (stream.fail() && !stream.eof())
|
||||
{
|
||||
logging::Info("cat_load: FATAL: Read failed!");
|
||||
g_ICvar->ConsolePrintf("CAT: cat_load: Failed to read config!\n");
|
||||
g_ICvar->ConsoleColorPrintf(Color(*print_r, *print_g, *print_b, 255), "CAT: cat_load: Failed to read config!\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
logging::Info("cat_load: Read Success!");
|
||||
g_ICvar->ConsolePrintf("CAT: cat_load: Successfully loaded config!\n");
|
||||
g_ICvar->ConsoleColorPrintf(Color(*print_r, *print_g, *print_b, 255), "CAT: cat_load: Successfully loaded config!\n");
|
||||
finishString(true);
|
||||
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user