From f65b8e252bc838bdb6c4e480e9d4c13b8bdd67d3 Mon Sep 17 00:00:00 2001 From: skuzzis <61626661+skuzzis@users.noreply.github.com> Date: Tue, 23 Jul 2024 13:42:04 +0000 Subject: [PATCH] feat(CBaseEntity): EmitSound --- plugin_files/gamedata/signatures.json | 5 +++++ src/plugins/core/scripting/generated/GClasses1.cpp | 4 ++++ src/plugins/core/scripting/generated/classes.h | 1 + src/sdk/entity/CBaseEntity.h | 5 +++++ src/signatures/Signatures.h | 1 + 5 files changed, 16 insertions(+) diff --git a/plugin_files/gamedata/signatures.json b/plugin_files/gamedata/signatures.json index 6e2bb6b3..0bef00e2 100644 --- a/plugin_files/gamedata/signatures.json +++ b/plugin_files/gamedata/signatures.json @@ -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", diff --git a/src/plugins/core/scripting/generated/GClasses1.cpp b/src/plugins/core/scripting/generated/GClasses1.cpp index 5a158d91..a5f913d0 100644 --- a/src/plugins/core/scripting/generated/GClasses1.cpp +++ b/src/plugins/core/scripting/generated/GClasses1.cpp @@ -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; @@ -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(); diff --git a/src/plugins/core/scripting/generated/classes.h b/src/plugins/core/scripting/generated/classes.h index d402f3e1..84a81762 100644 --- a/src/plugins/core/scripting/generated/classes.h +++ b/src/plugins/core/scripting/generated/classes.h @@ -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); diff --git a/src/sdk/entity/CBaseEntity.h b/src/sdk/entity/CBaseEntity.h index 7f17befc..16487ae4 100644 --- a/src/sdk/entity/CBaseEntity.h +++ b/src/sdk/entity/CBaseEntity.h @@ -168,5 +168,10 @@ class Z_CBaseEntity : public CEntityInstance g_Signatures->FetchSignature("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")(this, sound_name.c_str(), pitch, volume, delay); + } + CEntitySubclassVDataBase *GetVData() { return *(CEntitySubclassVDataBase **)((uint8 *)(m_nSubclassID()) + 4); } }; \ No newline at end of file diff --git a/src/signatures/Signatures.h b/src/signatures/Signatures.h index 823628e2..7054d2a2 100644 --- a/src/signatures/Signatures.h +++ b/src/signatures/Signatures.h @@ -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 {