SurvivorBot::ScavengeNearbyItems
0x00940940 · 1073 bytes · __cdecl
_ZN11SurvivorBot19ScavengeNearbyItemsEP6ActionIS_E
Decompiled
undefined (1 param)
/* SurvivorBot::ScavengeNearbyItems(Action<SurvivorBot>*) */
Action * SurvivorBot::ScavengeNearbyItems(Action *param_1)
{
float fVar1;
uint uVar2;
CBaseEntity *this;
char cVar3;
int iVar4;
SurvivorTeamSituation *this_00;
CBaseEntity *this_01;
int iVar5;
SurvivorCollectObject *this_02;
undefined *puVar6;
CWeaponCSBase *this_03;
CTerrorPlayer *pCVar7;
longdouble lVar8;
SurvivorBot *in_stack_00000008;
int in_stack_0000000c;
undefined4 uVar9;
AlwaysTruePlayerRelationshipFilter local_1d [13];
cVar3 = IsAvailable(in_stack_00000008);
if ((cVar3 != '\0') &&
(((iVar4 = (**(code **)(*(int *)in_stack_00000008 + 0x52c))(), iVar4 != 0 &&
((*(byte *)(iVar4 + 0x12d) & 8) != 0)) ||
(lVar8 = (longdouble)
CTerrorPlayer::GetTimeSinceAttackedByEnemy((CTerrorPlayer *)in_stack_00000008),
2.0 <= (float)lVar8)))) {
this_00 = (SurvivorTeamSituation *)GetTeamSituation(in_stack_00000008);
cVar3 = SurvivorTeamSituation::IsAnyTeammateNearCheckpoint(this_00);
if (((cVar3 == '\0') && (iVar4 = (**(code **)(*(int *)in_stack_00000008 + 0x52c))(), iVar4 != 0)
) && ((cVar3 = CDirector::IsFinale(TheDirector), cVar3 == '\0' ||
(cVar3 = CDirector::IsFinaleVehicleReady(TheDirector), cVar3 == '\0')))) {
lVar8 = (longdouble)CountdownTimer::Now();
if ((*(float *)(in_stack_00000008 + 0x1ab78) <= (float)lVar8) ||
((*(byte *)(iVar4 + 0x12d) & 8) != 0)) {
lVar8 = (longdouble)RandomFloat(0x3f000000,0x3f800000);
fVar1 = (float)lVar8;
lVar8 = (longdouble)CountdownTimer::Now();
if ((float)lVar8 + fVar1 != *(float *)(in_stack_00000008 + 0x1ab78)) {
(**(code **)(*(int *)(in_stack_00000008 + 0x1ab70) + 4))
(in_stack_00000008 + 0x1ab70,in_stack_00000008 + 0x1ab78);
*(float *)(in_stack_00000008 + 0x1ab78) = (float)lVar8 + fVar1;
}
if (fVar1 != *(float *)(in_stack_00000008 + 0x1ab74)) {
(**(code **)(*(int *)(in_stack_00000008 + 0x1ab70) + 4))
(in_stack_00000008 + 0x1ab70,in_stack_00000008 + 0x1ab74);
*(float *)(in_stack_00000008 + 0x1ab74) = fVar1;
}
this_01 = (CBaseEntity *)FindScavengeItem(in_stack_00000008,420.0);
if ((this_01 != (CBaseEntity *)0x0) &&
(iVar5 = CDirectorItemManager::GetNavAreaForScavengeItem
(*(CDirectorItemManager **)(TheDirector + 0x62c),this_01), iVar5 != 0)
) {
if ((*(byte *)(iVar4 + 0x12d) & 8) == 0) {
fVar1 = *(float *)(iVar5 + 0x154);
lVar8 = (longdouble)CTerrorPlayer::GetFlowDistance();
if ((float)lVar8 + 250.0 < fVar1) goto LAB_0094095b;
fVar1 = *(float *)(iVar5 + 0x154);
uVar9 = 0;
lVar8 = (longdouble)CTerrorPlayer::GetFlowDistance();
if (fVar1 < (float)lVar8 - 750.0) goto LAB_0094095b;
uVar2 = *(uint *)(this_00 + 0x50);
if ((((uVar2 != 0xffffffff) &&
(puVar6 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar6 != (undefined *)0xfffffffc
)) && (*(uint *)(puVar6 + 8) == uVar2 >> 0xc)) &&
(this = *(CBaseEntity **)(puVar6 + 4), this != (CBaseEntity *)0x0)) {
fVar1 = *(float *)(SurvivorBotMaxScavengeSeparation._28_4_ + 0x2c);
if (((byte)this[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(this);
}
if (((byte)this_01[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(this_01);
}
if (fVar1 * fVar1 <
(*(float *)(this_01 + 0x2e4) - *(float *)(this + 0x2e4)) *
(*(float *)(this_01 + 0x2e4) - *(float *)(this + 0x2e4)) +
(*(float *)(this_01 + 0x2e0) - *(float *)(this + 0x2e0)) *
(*(float *)(this_01 + 0x2e0) - *(float *)(this + 0x2e0)) +
(*(float *)(this_01 + 0x2e8) - *(float *)(this + 0x2e8)) *
(*(float *)(this_01 + 0x2e8) - *(float *)(this + 0x2e8))) goto LAB_0094095b;
}
this_03 = (CWeaponCSBase *)(**(code **)(*(int *)this_01 + 0x188))(this_01,uVar9);
if (((this_03 != (CWeaponCSBase *)0x0) &&
(iVar4 = CWeaponCSBase::GetCSWpnData(this_03), *(int *)(iVar4 + 0x894) == 8)) &&
((pCVar7 = CDirectorTacticalServices::
GetSurvivorAbleToReachEntityFirst<AlwaysTruePlayerRelationshipFilter>
(*(CDirectorTacticalServices **)(TheDirector + 0x628),this_01,
local_1d,(float *)0x0), pCVar7 == (CTerrorPlayer *)0x0 ||
(cVar3 = (**(code **)(*(int *)(in_stack_00000008 + 0x4028) + 0xe0))
(in_stack_00000008 + 0x4028,pCVar7), cVar3 == '\0'))))
goto LAB_0094095b;
}
this_02 = ::operator_new(0x68);
/* try { // try from 00940ae2 to 00940ae6 has its CatchHandler @ 00940d84 */
SurvivorCollectObject::SurvivorCollectObject(this_02,this_01);
cVar3 = (**(code **)(*(int *)this_02 + 0x164))(this_02);
if (cVar3 == '\0') {
*(undefined4 *)param_1 = 2;
*(SurvivorCollectObject **)(param_1 + 4) = this_02;
*(char **)(param_1 + 8) = "Scavenging something";
*(undefined4 *)(in_stack_0000000c + 0x20) = 0;
*(undefined4 *)(in_stack_0000000c + 0x24) = 0;
*(undefined4 *)(in_stack_0000000c + 0x28) = 0;
*(undefined4 *)(in_stack_0000000c + 0x2c) = 0;
return param_1;
}
(**(code **)(*(int *)this_02 + 4))(this_02);
}
}
}
}
LAB_0094095b:
*(undefined4 *)param_1 = 0;
*(undefined4 *)(param_1 + 4) = 0;
*(undefined4 *)(param_1 + 8) = 0;
return param_1;
}
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.