L L4D2node

SurvivorBot::L4D1_InteractWithUsables

0x0093c950 · 852 bytes · __cdecl

_ZN11SurvivorBot24L4D1_InteractWithUsablesEP6ActionIS_E

Decompiled

undefined (1 param)

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

Action * SurvivorBot::L4D1_InteractWithUsables(Action *param_1)

{
  SurvivorBot *pSVar1;
  undefined4 uVar2;
  float fVar3;
  char cVar4;
  CPropMountedGun *this;
  SurvivorApproachMinigun *this_00;
  int iVar5;
  longdouble lVar6;
  SurvivorBot *in_stack_00000008;
  int in_stack_0000000c;
  int local_20 [4];
  
  cVar4 = IsAvailable(in_stack_00000008);
  if (cVar4 != '\0') {
    pSVar1 = in_stack_00000008 + 0x1ab7c;
    lVar6 = (longdouble)CountdownTimer::Now();
    if (*(float *)(in_stack_00000008 + 0x1ab84) <= (float)lVar6) {
      lVar6 = (longdouble)RandomFloat(0x40400000,0x40a00000);
      fVar3 = (float)lVar6;
      lVar6 = (longdouble)CountdownTimer::Now();
      if ((float)lVar6 + fVar3 != *(float *)(in_stack_00000008 + 0x1ab84)) {
        (**(code **)(*(int *)(in_stack_00000008 + 0x1ab7c) + 4))(pSVar1,in_stack_00000008 + 0x1ab84)
        ;
        *(float *)(in_stack_00000008 + 0x1ab84) = (float)lVar6 + fVar3;
      }
      if (fVar3 != *(float *)(in_stack_00000008 + 0x1ab80)) {
        (**(code **)(*(int *)(in_stack_00000008 + 0x1ab7c) + 4))(pSVar1,in_stack_00000008 + 0x1ab80)
        ;
        *(float *)(in_stack_00000008 + 0x1ab80) = fVar3;
      }
      if ((L4D1_InteractWithUsables(Action<SurvivorBot>*)::buttonStr == '\0') &&
         (iVar5 = __cxa_guard_acquire(&L4D1_InteractWithUsables(Action<SurvivorBot>*)::buttonStr),
         iVar5 != 0)) {
        DAT_01011c5c = 0;
        L4D1_InteractWithUsables(Action<SurvivorBot>*)::buttonStr = 0;
        DAT_01011c58 = "prop_mounted_machine_gun";
        __cxa_guard_release(&L4D1_InteractWithUsables(Action<SurvivorBot>*)::buttonStr);
        __cxa_atexit(CGameString::~CGameString,
                     &L4D1_InteractWithUsables(Action<SurvivorBot>*)::buttonStr,&__dso_handle);
      }
      uVar2 = *(undefined4 *)(SurvivorBotUseButtonRange._28_4_ + 0x2c);
      if (((byte)in_stack_00000008[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition((CBaseEntity *)in_stack_00000008);
      }
      if (((L4D1_InteractWithUsables(Action<SurvivorBot>*)::buttonStr == 0) ||
          (iVar5 = L4D1_InteractWithUsables(Action<SurvivorBot>*)::buttonStr,
          DAT_01011c5c != CGameString::gm_iSerialNumber)) &&
         (iVar5 = 0, DAT_01011c58 != (char *)0x0)) {
        AllocPooledString((char *)local_20);
        L4D1_InteractWithUsables(Action<SurvivorBot>*)::buttonStr = local_20[0];
        DAT_01011c5c = CGameString::gm_iSerialNumber;
        iVar5 = local_20[0];
      }
      this = (CPropMountedGun *)
             CGlobalEntityList::FindEntityByClassnameNearestFast
                       ((CGlobalEntityList *)gEntList,iVar5,in_stack_00000008 + 0x2e0,uVar2);
      if (((this != (CPropMountedGun *)0x0) &&
          (cVar4 = IsReachable(in_stack_00000008,(CBaseEntity *)this), cVar4 != '\0')) &&
         (cVar4 = CPropMountedGun::IsOccupied(this), cVar4 == '\0')) {
        lVar6 = (longdouble)RandomFloat(0x41a00000,0x41f00000);
        fVar3 = (float)lVar6;
        lVar6 = (longdouble)CountdownTimer::Now();
        if ((float)lVar6 + fVar3 != *(float *)(in_stack_00000008 + 0x1ab84)) {
          (**(code **)(*(int *)(in_stack_00000008 + 0x1ab7c) + 4))
                    (pSVar1,in_stack_00000008 + 0x1ab84);
          *(float *)(in_stack_00000008 + 0x1ab84) = (float)lVar6 + fVar3;
        }
        if (fVar3 != *(float *)(in_stack_00000008 + 0x1ab80)) {
          (**(code **)(*(int *)(in_stack_00000008 + 0x1ab7c) + 4))
                    (pSVar1,in_stack_00000008 + 0x1ab80);
          *(float *)(in_stack_00000008 + 0x1ab80) = fVar3;
        }
        this_00 = ::operator_new(0x5c);
                    /* try { // try from 0093cb9b to 0093cb9f has its CatchHandler @ 0093ccaf */
        SurvivorApproachMinigun::SurvivorApproachMinigun(this_00,(CBaseEntity *)this);
        *(undefined4 *)param_1 = 2;
        *(SurvivorApproachMinigun **)(param_1 + 4) = this_00;
        *(char **)(param_1 + 8) = "Trying to approach and use a minigun";
        *(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;
      }
    }
  }
  *(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)