Skip to content

Commit

Permalink
feat(CBaseEntity): EmitSound
Browse files Browse the repository at this point in the history
  • Loading branch information
skuzzis committed Jul 23, 2024
1 parent 4e92c89 commit f65b8e2
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions plugin_files/gamedata/signatures.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@
"windows": "48 89 5C 24 10 48 89 6C 24 18 56 57 41 56 48 83 EC 30 80 B9 A0 00 00 00 00",
"linux": "48 85 F6 0F 84 2A 2A 2A 2A 55 31 C9 48 89 E5 41 55 49 89 FD"
},
"CBaseEntity_EmitSoundParams": {
"lib": "server",
"windows": "48 8B C4 48 89 58 10 48 89 70 18 55 57 41 56 48 8D A8 08 FF FF FF",
"linux": "48 B8 2A 2A 2A 2A 2A 2A 2A 2A 55 48 89 E5 41 55 41 54 49 89 FC 53 48 89 F3"
},
"LoggingSystem_Log": {
"lib": "tier0",
"windows": "@LoggingSystem_Log",
Expand Down
4 changes: 4 additions & 0 deletions src/plugins/core/scripting/generated/GClasses1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,9 @@ GCEntitySubclassVDataBase GCBaseEntity::GetVData() {
void GCBaseEntity::Teleport(Vector value) {
((Z_CBaseEntity*)m_ptr)->Teleport(&value, nullptr, nullptr);
}
void GCBaseEntity::EmitSound(std::string sound_name, int pitch, float volume, float delay) {
((Z_CBaseEntity*)m_ptr)->EmitSound(sound_name, pitch, volume, delay);
}
GCBodyComponent GCBaseEntity::GetCBodyComponent() const {
GCBodyComponent value(*(void**)GetSchemaPtr(m_ptr, "CBaseEntity", "m_CBodyComponent"));
return value;
Expand Down Expand Up @@ -1137,6 +1140,7 @@ void SetupLuaClassCBaseEntity(LuaPlugin *plugin, lua_State *state)
.addFunction("GetVData", &GCBaseEntity::GetVData)
.addFunction("Teleport", &GCBaseEntity::Teleport)
.addFunction("EHandle", &GCBaseEntity::EHandle)
.addFunction("EmitSound", &GCBaseEntity::EmitSound)
.addFunction("ToPtr", &GCBaseEntity::ToPtr)
.addFunction("IsValid", &GCBaseEntity::IsValid)
.endClass();
Expand Down
1 change: 1 addition & 0 deletions src/plugins/core/scripting/generated/classes.h
Original file line number Diff line number Diff line change
Expand Up @@ -1727,6 +1727,7 @@ class GCBaseEntity
std::string GetClassname();
GCEntitySubclassVDataBase GetVData();
void Teleport(Vector value);
void EmitSound(std::string sound_name, int pitch, float volume, float delay);
GCBaseEntity EHandle();
GCBodyComponent GetCBodyComponent() const;
void SetCBodyComponent(GCBodyComponent value);
Expand Down
5 changes: 5 additions & 0 deletions src/sdk/entity/CBaseEntity.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,5 +168,10 @@ class Z_CBaseEntity : public CEntityInstance
g_Signatures->FetchSignature<CEntityInstance_AcceptInput>("CEntityInstance_AcceptInput")(this, pInputName, pActivator, pCaller, &variantValue, outputID);
}

void EmitSound(std::string sound_name, int pitch, float volume, float delay)
{
g_Signatures->FetchSignature<CBaseEntity_EmitSoundParams>("CBaseEntity_EmitSoundParams")(this, sound_name.c_str(), pitch, volume, delay);
}

CEntitySubclassVDataBase *GetVData() { return *(CEntitySubclassVDataBase **)((uint8 *)(m_nSubclassID()) + 4); }
};
1 change: 1 addition & 0 deletions src/signatures/Signatures.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ typedef void (*GiveNamedItem_t)(CCSPlayer_ItemServices *, const char *, int, int
typedef void (*CBasePlayerController_SetPawn)(CBasePlayerController *, CCSPlayerPawn *, bool, bool);
typedef void (*CCSPlayerPawnBase_PostThink)(CCSPlayerPawnBase *);
typedef void (*CBaseEntity_TakeDamageOld)(Z_CBaseEntity *, CTakeDamageInfo *);
typedef void (*CBaseEntity_EmitSoundParams)(Z_CBaseEntity*, const char*, int, float, float);

class Signatures
{
Expand Down

0 comments on commit f65b8e2

Please sign in to comment.