CBaseEntity::ModifyOrAppendCriteria
0x006139f0 · 622 bytes · __thiscall
_ZN11CBaseEntity22ModifyOrAppendCriteriaER14AI_CriteriaSet
Decompiled
undefined (2 params)
/* CBaseEntity::ModifyOrAppendCriteria(AI_CriteriaSet&) */
void __thiscall CBaseEntity::ModifyOrAppendCriteria(CBaseEntity *this,AI_CriteriaSet *param_1)
{
byte *pbVar1;
int *piVar2;
undefined4 uVar3;
char *pcVar4;
int iVar5;
int iVar6;
char *pcVar7;
CBaseEntity *this_00;
double dVar8;
uVar3 = RandomInt(0,100);
pcVar4 = (char *)UTIL_VarArgs("%d",uVar3);
AI_CriteriaSet::AppendCriteria(param_1,"randomnum",pcVar4,1.0);
pcVar4 = *(char **)(gpGlobals + 0x3c);
if (pcVar4 == (char *)0x0) {
pcVar4 = "";
}
AI_CriteriaSet::AppendCriteria(param_1,"map",pcVar4,1.0);
pcVar4 = *(char **)(this + 0x7c);
if (pcVar4 == (char *)0x0) {
pcVar4 = "";
}
AI_CriteriaSet::AppendCriteria(param_1,"classname",pcVar4,1.0);
pcVar4 = "";
if (*(char **)(this + 0x154) != (char *)0x0) {
pcVar4 = *(char **)(this + 0x154);
}
AI_CriteriaSet::AppendCriteria(param_1,"name",pcVar4,1.0);
pcVar4 = (char *)UTIL_VarArgs("%i",*(undefined4 *)(this + 0x100));
AI_CriteriaSet::AppendCriteria(param_1,"health",pcVar4,1.0);
iVar5 = (**(code **)(*(int *)this + 0x1fc))(this);
dVar8 = 0.0;
if (0 < iVar5) {
iVar5 = *(int *)(this + 0x100);
iVar6 = (**(code **)(*(int *)this + 0x1fc))(this);
dVar8 = (double)((float)iVar5 / (float)iVar6);
}
pcVar4 = (char *)UTIL_VarArgs("%.3f",dVar8);
AI_CriteriaSet::AppendCriteria(param_1,"healthfrac",pcVar4,1.0);
iVar5 = 0;
while( true ) {
iVar6 = GlobalEntity_GetNumGlobals();
if (iVar6 <= iVar5) break;
pcVar4 = (char *)GlobalEntity_GetName(iVar5);
uVar3 = GlobalEntity_GetState(iVar5);
pcVar7 = (char *)UTIL_VarArgs("%i",uVar3);
AI_CriteriaSet::AppendCriteria(param_1,pcVar4,pcVar7,1.0);
iVar5 = iVar5 + 1;
}
AppendContextToCriteria(this,param_1,"");
if (*(int *)(hl2_episodic._28_4_ + 0x30) != 0) {
AI_CriteriaSet::AppendCriteria(param_1,"episodic","1",1.0);
}
pbVar1 = *(byte **)(gpGlobals + 0x58);
if (((pbVar1 != (byte *)0x0) && ((*pbVar1 & 2) == 0)) &&
(piVar2 = *(int **)(pbVar1 + 0xc), piVar2 != (int *)0x0)) {
iVar5 = (**(code **)(*piVar2 + 0x18))(piVar2);
if (iVar5 != 0) {
this_00 = (CBaseEntity *)__dynamic_cast(iVar5,&typeinfo,&CWorld::typeinfo,0);
if (this_00 != (CBaseEntity *)0x0) {
AppendContextToCriteria(this_00,param_1,"world");
}
}
}
return;
}
SourceMod gamedata
paste intoaddons/sourcemod/gamedata/<your_plugin>.txt
used as the SourceMod key — change to fit your plugin's convention
SourceMod library name (server / engine / matchmaking)
Just a Signatures{} block, ready to drop into a gamedata
file. Wire it up in your plugin however you like - SDKCall, DHooks,
raw memory ops, or anything else.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.