L L4D2node

SurvivorBot::InteractWithUsables

0x0093d550 · 1280 bytes · __cdecl

_ZN11SurvivorBot19InteractWithUsablesEP6ActionIS_E

Decompiled

undefined (1 param)

/* SurvivorBot::InteractWithUsables(Action<SurvivorBot>*) */

Action * SurvivorBot::InteractWithUsables(Action *param_1)

{
  SurvivorBot *pSVar1;
  float fVar2;
  char cVar3;
  SurvivorTeamSituation *this;
  int *piVar4;
  Vector *pVVar5;
  CNavArea *this_00;
  SurvivorUseObject *pSVar6;
  int iVar7;
  longdouble lVar8;
  SurvivorBot *in_stack_00000008;
  int in_stack_0000000c;
  undefined4 uVar9;
  int local_40 [3];
  undefined4 local_34;
  undefined4 local_30;
  undefined4 local_2c;
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  
  this = (SurvivorTeamSituation *)GetTeamSituation(in_stack_00000008);
  cVar3 = IsAvailable(in_stack_00000008);
  if ((((cVar3 != '\0') &&
       (cVar3 = SurvivorTeamSituation::IsSurvivingTeamAllBots(this), cVar3 != '\0')) &&
      (*(char *)(*(int *)(TheDirector + 0x638) + 0x111) == '\0')) &&
     (((*(int *)(*(int *)(TheDirector + 0x638) + 0x128) == 4 && (*(int *)(TheDirector + 0x1c0) < 1))
      && (cVar3 = CTerrorGameRules::IsSurvivalMode(), cVar3 == '\0')))) {
    pSVar1 = in_stack_00000008 + 0x1ab7c;
    lVar8 = (longdouble)CountdownTimer::Now();
    if (*(float *)(in_stack_00000008 + 0x1ab84) <= (float)lVar8) {
      lVar8 = (longdouble)RandomFloat(0x40400000,0x40a00000);
      fVar2 = (float)lVar8;
      lVar8 = (longdouble)CountdownTimer::Now();
      if ((float)lVar8 + fVar2 != *(float *)(in_stack_00000008 + 0x1ab84)) {
        (**(code **)(*(int *)(in_stack_00000008 + 0x1ab7c) + 4))(pSVar1,in_stack_00000008 + 0x1ab84)
        ;
        *(float *)(in_stack_00000008 + 0x1ab84) = (float)lVar8 + fVar2;
      }
      if (fVar2 != *(float *)(in_stack_00000008 + 0x1ab80)) {
        (**(code **)(*(int *)(in_stack_00000008 + 0x1ab7c) + 4))(pSVar1,in_stack_00000008 + 0x1ab80)
        ;
        *(float *)(in_stack_00000008 + 0x1ab80) = fVar2;
      }
      if ((InteractWithUsables(Action<SurvivorBot>*)::buttonStr == '\0') &&
         (iVar7 = __cxa_guard_acquire(&InteractWithUsables(Action<SurvivorBot>*)::buttonStr),
         iVar7 != 0)) {
        DAT_01011c6c = 0;
        InteractWithUsables(Action<SurvivorBot>*)::buttonStr = 0;
        DAT_01011c68 = "func_button";
        __cxa_guard_release(&InteractWithUsables(Action<SurvivorBot>*)::buttonStr);
        __cxa_atexit(CGameString::~CGameString,&InteractWithUsables(Action<SurvivorBot>*)::buttonStr
                     ,&__dso_handle);
      }
      uVar9 = *(undefined4 *)(SurvivorBotUseButtonRange._28_4_ + 0x2c);
      if (((byte)in_stack_00000008[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition((CBaseEntity *)in_stack_00000008);
      }
      if (((InteractWithUsables(Action<SurvivorBot>*)::buttonStr == 0) ||
          (iVar7 = InteractWithUsables(Action<SurvivorBot>*)::buttonStr,
          DAT_01011c6c != CGameString::gm_iSerialNumber)) &&
         (iVar7 = 0, DAT_01011c68 != (char *)0x0)) {
        AllocPooledString((char *)local_40);
        InteractWithUsables(Action<SurvivorBot>*)::buttonStr = local_40[0];
        DAT_01011c6c = CGameString::gm_iSerialNumber;
        iVar7 = local_40[0];
      }
      piVar4 = (int *)CGlobalEntityList::FindEntityByClassnameNearestFast
                                ((CGlobalEntityList *)gEntList,iVar7,
                                 (Vector *)(in_stack_00000008 + 0x2e0),uVar9);
      if (piVar4 == (int *)0x0) {
        cVar3 = CDirector::AreAllSurvivorsInFinaleArea();
        if (cVar3 == '\0') goto LAB_0093d575;
        fVar2 = *(float *)(SurvivorBotUseButtonRange._28_4_ + 0x2c);
        if (((byte)in_stack_00000008[0x14d] & 8) != 0) {
          CBaseEntity::CalcAbsolutePosition((CBaseEntity *)in_stack_00000008);
        }
        piVar4 = (int *)CGlobalEntityList::FindEntityByClassnameNearest
                                  ((CGlobalEntityList *)gEntList,"trigger_finale",
                                   (Vector *)(in_stack_00000008 + 0x2e0),fVar2);
        if (piVar4 == (int *)0x0) goto LAB_0093d575;
      }
      fVar2 = *(float *)(SurvivorBotUseButtonRange._28_4_ + 0x2c);
      pVVar5 = (Vector *)(**(code **)(*piVar4 + 0x288))(piVar4);
      this_00 = (CNavArea *)
                CNavMesh::GetNearestNavArea(TheNavMesh,pVVar5,false,fVar2 + fVar2,false,false,false)
      ;
      if (this_00 != (CNavArea *)0x0) {
        fVar2 = *(float *)(this_00 + 0x154);
        uVar9 = 0;
        lVar8 = (longdouble)CTerrorPlayer::GetFlowDistance();
        if (ABS(fVar2 - (float)lVar8) < 500.0) {
          pVVar5 = (Vector *)(**(code **)(*piVar4 + 0x288))(piVar4,uVar9);
          CNavArea::GetClosestPointOnArea(this_00,pVVar5,(Vector *)&local_34);
          cVar3 = IsReachable(in_stack_00000008,(Vector *)&local_34);
          if (cVar3 != '\0') {
            lVar8 = (longdouble)RandomFloat(0x41a00000,0x41f00000);
            fVar2 = (float)lVar8;
            lVar8 = (longdouble)CountdownTimer::Now();
            if ((float)lVar8 + fVar2 != *(float *)(in_stack_00000008 + 0x1ab84)) {
              (**(code **)(*(int *)(in_stack_00000008 + 0x1ab7c) + 4))
                        (pSVar1,in_stack_00000008 + 0x1ab84);
              *(float *)(in_stack_00000008 + 0x1ab84) = (float)lVar8 + fVar2;
            }
            if (fVar2 != *(float *)(in_stack_00000008 + 0x1ab80)) {
              (**(code **)(*(int *)(in_stack_00000008 + 0x1ab7c) + 4))
                        (pSVar1,in_stack_00000008 + 0x1ab80);
              *(float *)(in_stack_00000008 + 0x1ab80) = fVar2;
            }
            local_28 = local_34;
            local_24 = local_30;
            local_20 = local_2c;
            pSVar6 = ::operator_new(0x68);
                    /* try { // try from 0093d8d8 to 0093d8dc has its CatchHandler @ 0093da68 */
            SurvivorUseObject::SurvivorUseObject(pSVar6,piVar4,local_28,local_24,local_20);
            *(undefined4 *)param_1 = 2;
            *(SurvivorUseObject **)(param_1 + 4) = pSVar6;
            *(char **)(param_1 + 8) = "Trying to use something to help us along";
            *(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;
          }
        }
      }
    }
  }
LAB_0093d575:
  *(undefined4 *)param_1 = 0;
  *(undefined4 *)(param_1 + 4) = 0;
  *(undefined4 *)(param_1 + 8) = 0;
  return param_1;
}

SourceMod gamedata

paste into addons/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.



        

        

          

Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.

Return-type handling cheatsheet (DHookReturn)