WORKING health and ammo connections. close #229
This commit is contained in:
parent
8974006bf1
commit
8a72b2abd8
@ -180,8 +180,23 @@ using state::nodes;
|
|||||||
using state::node_good;
|
using state::node_good;
|
||||||
|
|
||||||
bool HasLowAmmo() {
|
bool HasLowAmmo() {
|
||||||
// Yes, I know m_iAmmo is a table, not an int.
|
// 0x13D = CBaseCombatWeapon::HasPrimaryAmmo()
|
||||||
return CE_INT(LOCAL_E, netvar.m_iAmmo);
|
// 190 = IsBaseCombatWeapon
|
||||||
|
// 1C1 = C_TFWeaponBase::UsesPrimaryAmmo()
|
||||||
|
int *weapon_list = (int*)((unsigned)(RAW_ENT(LOCAL_E)) + netvar.hMyWeapons);
|
||||||
|
for (int i = 0; weapon_list[i]; i++) {
|
||||||
|
int handle = weapon_list[i];
|
||||||
|
int eid = handle & 0xFFF;
|
||||||
|
if (eid >= 32 && eid <= HIGHEST_ENTITY) {
|
||||||
|
IClientEntity* weapon = g_IEntityList->GetClientEntity(eid);
|
||||||
|
if (weapon and vfunc<bool(*)(IClientEntity*)>(weapon, 190, 0)(weapon) and
|
||||||
|
vfunc<bool(*)(IClientEntity*)>(weapon, 0x1C1, 0)(weapon) and
|
||||||
|
not vfunc<bool(*)(IClientEntity*)>(weapon, 0x13D, 0)(weapon)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HasLowHealth() {
|
bool HasLowHealth() {
|
||||||
|
@ -75,6 +75,7 @@ ConVar* CreateConVar(std::string name, std::string value, std::string help) {
|
|||||||
|
|
||||||
// Function for when you want to goto a vector
|
// Function for when you want to goto a vector
|
||||||
void WalkTo(const Vector& vector) {
|
void WalkTo(const Vector& vector) {
|
||||||
|
if (CE_BAD(LOCAL_E)) return;
|
||||||
// Calculate how to get to a vector
|
// Calculate how to get to a vector
|
||||||
auto result = ComputeMove(LOCAL_E->m_vecOrigin, vector);
|
auto result = ComputeMove(LOCAL_E->m_vecOrigin, vector);
|
||||||
// Push our move to usercmd
|
// Push our move to usercmd
|
||||||
|
Reference in New Issue
Block a user