auto sticky!!!

This commit is contained in:
nullifiedcat 2016-12-02 20:42:06 +03:00
parent b7988243cf
commit bc91c94b3e
3 changed files with 82 additions and 0 deletions

View File

@ -0,0 +1,51 @@
/*
* AutoSticky.cpp
*
* Created on: Dec 2, 2016
* Author: nullifiedcat
*/
#include "AutoSticky.h"
#include "../entity.h"
#include "../interfaces.h"
#include "../entitycache.h"
#include "../helpers.h"
#include "../fixsdk.h"
#include <icliententitylist.h>
#include <icliententity.h>
const char* AutoSticky::GetName() {
return "AUTO-STICKY";
}
// TODO scottish cyclops
AutoSticky::AutoSticky() {
this->v_bBuildings = CreateConVar("u_sticky_buildings", "1", "Stickies detonate at enemies' buildings");
this->v_bEnabled = CreateConVar("u_sticky_enabled", "1", "Enable stickybot");
this->v_bScottish = CreateConVar("u_sticky_scottish", "0", "Enable stickybot scottish resistance compatability");
}
bool AutoSticky::ShouldDetonate(IClientEntity* bomb) {
for (int i = 0; i < gEntityCache.m_nMax; i++) {
CachedEntity* ent = gEntityCache.GetEntity(i);
if (ent->m_iClassID != ClassID::CTFPlayer && !(this->v_bBuildings->GetBool() && IsBuilding(ent->m_pEntity))) return false;
if (ent->m_iTeam == GetEntityValue<int>(bomb, eoffsets.iTeamNum)) return false;
if (ent->m_pEntity->GetAbsOrigin().DistToSqr(bomb->GetAbsOrigin())) return false;
return true;
}
return false;
}
bool AutoSticky::CreateMove(void*, float, CUserCmd* cmd) {
for (int i = 0; i < gEntityCache.m_nMax; i++) {
CachedEntity* ent = gEntityCache.GetEntity(i);
if (ent->m_iClassID != ClassID::CTFGrenadePipebombProjectile) return true;
}
return true;
}
void AutoSticky::PaintTraverse(void*, unsigned int, bool, bool) {
}

View File

@ -0,0 +1,28 @@
/*
* AutoSticky.h
*
* Created on: Dec 2, 2016
* Author: nullifiedcat
*/
#ifndef HACKS_AUTOSTICKY_H_
#define HACKS_AUTOSTICKY_H_
#include "IHack.h"
class IClientEntity;
class AutoSticky {
public:
DECLARE_HACK_METHODS();
AutoSticky();
bool ShouldDetonate(IClientEntity* bomb);
ConVar* v_bEnabled;
ConVar* v_bBuildings;
ConVar* v_bScottish;
ConVar* v_flDetonateDistance;
};
DECLARE_HACK_SINGLETON(AutoSticky);
#endif /* HACKS_AUTOSTICKY_H_ */

View File

@ -20,6 +20,9 @@ typedef unsigned int uint32;
bool CreateMove(void*, float, CUserCmd*); \
void PaintTraverse(void*, unsigned int, bool, bool);
#define DECLARE_HACK_SINGLETON(x) \
x* g_ph##x = 0;
class IHack {
public:
inline virtual ~IHack() {};