Initial commit
This commit is contained in:
parent
3dd53cf457
commit
5853554c70
85 changed files with 767 additions and 4511 deletions
22
.github/workflows/main.yml
vendored
22
.github/workflows/main.yml
vendored
|
|
@ -29,7 +29,7 @@ jobs:
|
|||
- name: Upload Linux artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: TemplatePlugin-linux
|
||||
name: RayTracePlugin-linux
|
||||
path: build/addons
|
||||
|
||||
build-windows:
|
||||
|
|
@ -80,21 +80,21 @@ jobs:
|
|||
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
|
||||
cmake -S . -B build -A x64 -DCMAKE_BUILD_TYPE=Release ^
|
||||
-DHL2SDKCS2=%HL2SDKCS2% -DMMSOURCE_DEV=%MMSOURCE_DEV% -DCSGO_PROTO=%CSGO_PROTO%
|
||||
cmake --build build --config Release --target TemplatePlugin
|
||||
cmake --build build --config Release --target RayTracePlugin
|
||||
|
||||
- name: Strip symbols (Windows)
|
||||
run: |
|
||||
llvm-strip build/Release/TemplatePlugin.dll
|
||||
llvm-strip build/Release/RayTracePlugin.dll
|
||||
|
||||
- name: Copy addons structure
|
||||
run: |
|
||||
mkdir -p build/addons/TemplatePlugin/bin/win64
|
||||
copy build/Release/TemplatePlugin.dll build/addons/TemplatePlugin/bin/win64/
|
||||
mkdir -p build/addons/RayTracePlugin/bin/win64
|
||||
copy build/Release/RayTracePlugin.dll build/addons/RayTracePlugin/bin/win64/
|
||||
|
||||
- name: Upload Windows artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: TemplatePlugin-wwindows
|
||||
name: RayTracePlugin-wwindows
|
||||
path: build/addons
|
||||
|
||||
release:
|
||||
|
|
@ -108,26 +108,26 @@ jobs:
|
|||
- name: Download Linux artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: TemplatePlugin-linux
|
||||
name: RayTracePlugin-linux
|
||||
path: ./build/linux
|
||||
|
||||
- name: Download Windows artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: TemplatePlugin-windows
|
||||
name: RayTracePlugin-windows
|
||||
path: ./build/windows
|
||||
|
||||
- name: Archive packages
|
||||
run: |
|
||||
version="${GITHUB_REF#refs/tags/}"
|
||||
tar -czf TemplatePlugin-${version}-linux.tar.gz -C build/linux .
|
||||
tar -czf TemplatePlugin-${version}-windows.tar.gz -C build/windows .
|
||||
tar -czf RayTracePlugin-${version}-linux.tar.gz -C build/linux .
|
||||
tar -czf RayTracePlugin-${version}-windows.tar.gz -C build/windows .
|
||||
|
||||
- name: Upload release archive
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: TemplatePlugin-*.tar.gz
|
||||
file: RayTracePlugin-*.tar.gz
|
||||
tag: ${{ github.ref }}
|
||||
file_glob: true
|
||||
release_name: "${{ github.ref_name }} - Download"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
cmake_minimum_required(VERSION 3.18)
|
||||
project(TemplatePlugin C CXX ASM)
|
||||
project(RayTrace C CXX ASM)
|
||||
|
||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||
set(FUNCHOOK_BUILD_TESTS OFF CACHE BOOL "Disable building tests for funchook." FORCE)
|
||||
|
|
@ -109,13 +109,13 @@ if (LINUX)
|
|||
include(${CMAKE_SOURCE_DIR}/makefiles/linux.base.cmake)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
PREFIX ""
|
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/addons/TemplatePlugin/bin/linuxsteamrt64"
|
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/addons/RayTrace/bin/linuxsteamrt64"
|
||||
)
|
||||
elseif (WIN32)
|
||||
include(${CMAKE_SOURCE_DIR}/makefiles/windows.base.cmake)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
PREFIX ""
|
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/addons/TemplatePlugin/bin/win64"
|
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/addons/RayTrace/bin/win64"
|
||||
)
|
||||
endif()
|
||||
|
||||
|
|
|
|||
61
configs/addons/RayTrace/gamedata.json
Normal file
61
configs/addons/RayTrace/gamedata.json
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
{
|
||||
"UTIL_CreateEntityByName": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "48 83 EC 48 C6 44 24 30 00",
|
||||
"linux": "48 8D 05 ? ? ? ? 55 48 89 FA"
|
||||
}
|
||||
},
|
||||
"CBaseEntity_DispatchSpawn": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "48 89 5C 24 10 57 48 83 EC 30 48 8B DA 48 8B F9 48 85 C9",
|
||||
"linux": "48 85 FF 74 ? 55 48 89 E5 41 55 49 89 FD"
|
||||
}
|
||||
},
|
||||
"CEntityInstance_AcceptInput": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "89 5C 24 ? 48 89 74 24 ? 57 48 83 EC ? 49 8B F0 48 8B D9 48 8B 0D",
|
||||
"linux": "55 48 89 F0 48 89 E5 41 57 49 89 FF 41 56 48 8D 7D C0"
|
||||
}
|
||||
},
|
||||
"CEntitySystem_AddEntityIOEvent": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "48 89 5C 24 ? 4C 89 4C 24 ? 48 89 4C 24 ? 55 56 57 41 54 41 55 41 56 41 57 48 83 EC ? 49 8B F9",
|
||||
"linux": "55 48 89 E5 41 55 49 89 CD 41 54 49 89 FC"
|
||||
}
|
||||
},
|
||||
"CBaseModelEntity_SetModel": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "40 53 48 83 EC ? 48 8B D9 4C 8B C2 48 8B 0D ? ? ? ? 48 8D 54 24 ? 48 8B 01 FF 50 ? 48 8B 44 24 ? 48 8D 54 24 ? 48 8B CB 48 89 44 24 ? E8 ? ? ? ? 48 83 C4 ? 5B C3 CC CC CC CC CC 48 89 5C 24",
|
||||
"linux": "55 48 89 F2 48 89 E5 53 48 89 FB 48 8D 7D ? 48 83 EC ? 48 8D 05 ? ? ? ? 48 8B 30 48 8B 06 FF 50 ? 48 8B 45 ? 48 8D 75 ? 48 89 DF 48 89 45 ? E8 ? ? ? ? 48 8B 5D ? C9 C3 CC CC CC 55"
|
||||
}
|
||||
},
|
||||
"CNavPhysicsInterface_TraceShape": {
|
||||
"offsets": {
|
||||
"windows": 1,
|
||||
"linux": 5
|
||||
}
|
||||
},
|
||||
"CCSPlayer_ItemServices_RemoveWeapons": {
|
||||
"offsets": {
|
||||
"windows": 22,
|
||||
"linux": 23
|
||||
}
|
||||
},
|
||||
"CBaseEntity_CollisionRulesChanged": {
|
||||
"offsets": {
|
||||
"windows": 190,
|
||||
"linux": 190
|
||||
}
|
||||
},
|
||||
"GameEntitySystem": {
|
||||
"offsets": {
|
||||
"windows": 88,
|
||||
"linux": 80
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,403 +0,0 @@
|
|||
{
|
||||
"CNavPhysicsInterface_TraceShape": {
|
||||
"offsets": {
|
||||
"windows": 4,
|
||||
"linux": 5
|
||||
}
|
||||
},
|
||||
"CSmokeGrenadeProjectileCreateFunc": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "",
|
||||
"linux": "55 4C 89 C1 48 89 E5 41 57 49 89 FF 41 56 45 89 CE"
|
||||
}
|
||||
},
|
||||
"GameSystem_Think_CheckSteamBan": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "",
|
||||
"linux": "55 48 8D 3D ?? ?? ?? ?? BE ?? ?? ?? ?? 48 89 E5 41 57 41 56 41 55 41 54 53 48 81 EC ?? ?? ?? ?? E8 ?? ?? ?? ?? 48 85 C0 0F 84 ?? ?? ?? ?? 8B 10"
|
||||
}
|
||||
},
|
||||
"CCSGameRules__sm_mapGcBanInformation": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "",
|
||||
"linux": "48 8D 0D ?? ?? ?? ?? 48 63 51 ?? 83 FA ?? 0F 84 ?? ?? ?? ?? F7 41 ?? ?? ?? ?? ?? 74"
|
||||
}
|
||||
},
|
||||
"CServerSideClientBase_ProcessServerStatus": {
|
||||
"signatures": {
|
||||
"library": "engine2",
|
||||
"windows": "",
|
||||
"linux": "55 0F B6 56 48 8B 77 48 48 89 E5 48 8B 7F 50 E8 ? ? ? ? B8"
|
||||
}
|
||||
},
|
||||
"CBaseEntity_EmitSoundParams": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "",
|
||||
"linux": "48 B8 ? ? ? ? ? ? ? ? 55 0F 28 D0"
|
||||
}
|
||||
},
|
||||
"CBaseEntity_EmitSoundFilter": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "",
|
||||
"linux": "55 48 89 E5 53 48 89 FB 48 83 EC ? E8 ? ? ? ? 48 89 D8 48 8B 5D ? C9 C3 CC CC CC CC CC CC 48 B8"
|
||||
}
|
||||
},
|
||||
"CSoundOpGameSystem_StartSoundEvent": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "",
|
||||
"linux": "55 48 89 E5 41 57 45 89 CF 41 56 49 89 CE 41 55 41 54 45 89 C4"
|
||||
}
|
||||
},
|
||||
"CSoundOpGameSystem_SetSoundEventParam": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "",
|
||||
"linux": "55 48 89 E5 41 57 41 56 45 89 CE 41 55 45 89 C5"
|
||||
}
|
||||
},
|
||||
"CBaseEntity_StartTouch": {
|
||||
"offsets": {
|
||||
"windows": 150,
|
||||
"linux": 152
|
||||
}
|
||||
},
|
||||
"CTakeDamageInfo_Constructor": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "",
|
||||
"linux": "F3 0F 12 C0 55 49 89 F2 48 89 D6 48 89 E5 41 57 49 89 CF 41 56 41 55 4D 89 C5 41 54 4D 89 CC 53 48 89 FB 48 83 EC ? 4C 8B 75 ? 4D 85 D2"
|
||||
}
|
||||
},
|
||||
"CCSPlayer_MovementServices_ProcessMovement": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "",
|
||||
"linux": "55 48 89 E5 41 57 41 56 41 55 41 54 49 89 F4 53 48 89 FB 48 83 EC 38 48 8B 7F 30"
|
||||
}
|
||||
},
|
||||
"CBaseModelEntity_SetBodygroupByName": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "",
|
||||
"linux": "55 48 89 E5 41 55 41 89 F5 41 54 41 89 D4 53 48 89 FB 48 83 EC 08 E8"
|
||||
}
|
||||
},
|
||||
"UTIL_ClientPrintAll": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 48 83 EC ? 8B E9 49 8B D9",
|
||||
"linux": "55 48 89 E5 41 57 4D 89 CF 41 56 4D 89 C6 41 55 49 89 CD 41 54 49 89 D4 53 48 8D"
|
||||
}
|
||||
},
|
||||
"ClientPrint": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "48 85 C9 0F 84 ? ? ? ? 48 89 5C 24 ? 55",
|
||||
"linux": "55 48 8D 05 ? ? ? ? 48 89 E5 41 57 41 89 F7 31 F6"
|
||||
}
|
||||
},
|
||||
"CCSPlayerController_SwitchTeam": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "40 53 57 48 81 EC ? ? ? ? 48 8B D9 8B FA",
|
||||
"linux": "55 48 89 E5 41 54 49 89 FC 89 F7"
|
||||
}
|
||||
},
|
||||
"CCSPlayerController_ChangeTeam": {
|
||||
"offsets": {
|
||||
"windows": 106,
|
||||
"linux": 108
|
||||
}
|
||||
},
|
||||
"CCSPlayerController_Respawn": {
|
||||
"offsets": {
|
||||
"windows": 275,
|
||||
"linux": 279
|
||||
}
|
||||
},
|
||||
"CCSPlayerController_HandleCommand_JoinTeam": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "",
|
||||
"linux": "55 48 89 E5 41 57 41 56 41 55 41 54 41 89 F4 53 48 89 FB 48 81 EC ? ? ? ? 48 8D 05"
|
||||
}
|
||||
},
|
||||
"CCSPlayerController_HandleCommand_WeaponDrop": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "",
|
||||
"linux": "55 48 89 E5 41 54 49 89 F4 53 E8 ? ? ? ? 48 85 C0 74 ? 48 89 C3"
|
||||
}
|
||||
},
|
||||
"CBasePlayerController_SetPawn": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "44 88 4C 24 ? 53 57",
|
||||
"linux": "55 48 8D 87 ? ? ? ? 48 89 E5 41 57 41 56 41 89 CE 41 55 45 89 CD"
|
||||
}
|
||||
},
|
||||
"CCSPlayerPawnBase_PostThink": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "48 ? ? 55 53 56 57 41 ? 48 ? ? ? 48 ? ? ? ? ? ? 4C 89 68",
|
||||
"linux": "55 48 89 E5 41 56 41 55 41 54 53 48 89 FB 48 83 EC 40 E8 ? ? ? ? F3 0F 10 83"
|
||||
}
|
||||
},
|
||||
"CGameEventManager_Init": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "40 53 48 83 EC 20 48 8B 01 48 8B D9 FF 50 10",
|
||||
"linux": "55 48 89 E5 53 48 89 FB 48 83 EC 08 48 8B 07 FF 50 18"
|
||||
}
|
||||
},
|
||||
"GiveNamedItem": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "48 89 5C 24 ? 48 89 74 24 ? 55 57 41 55 41 56 41 57 48 8D 6C 24 ? 48 81 EC ? ? ? ? 4D 8B F9",
|
||||
"linux": "55 48 89 E5 41 57 41 56 41 55 41 54 53 48 81 EC F8 00 00 00 48 89 BD ? ? ? ? 89 95"
|
||||
}
|
||||
},
|
||||
"UTIL_Remove": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "48 85 C9 74 ? 48 8B D1 48 8B 0D ? ? ? ?",
|
||||
"linux": "48 89 FE 48 85 FF 74 ? 48 8D 05 ? ? ? ? 48"
|
||||
}
|
||||
},
|
||||
"CBaseModelEntity_SetModel": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "40 53 48 83 EC ? 48 8B D9 4C 8B C2 48 8B 0D ? ? ? ? 48 8D 54 24 ? 48 8B 01 FF 50 ? 48 8B 44 24 ? 48 8D 54 24 ? 48 8B CB 48 89 44 24 ? E8 ? ? ? ? 48 83 C4 ? 5B C3 CC CC CC CC CC 48 89 5C 24",
|
||||
"linux": "55 48 89 F2 48 89 E5 53 48 89 FB 48 8D 7D ? 48 83 EC ? 48 8D 05 ? ? ? ? 48 8B 30 48 8B 06 FF 50 ? 48 8B 45 ? 48 8D 75 ? 48 89 DF 48 89 45 ? E8 ? ? ? ? 48 8B 5D ? C9 C3 CC CC CC 55"
|
||||
}
|
||||
},
|
||||
"CCSPlayer_WeaponServices_CanUse": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "48 89 5C 24 ? 48 89 6C 24 ? 56 57 41 56 48 83 EC ? 48 8B 01 48 8B FA",
|
||||
"linux": "55 48 8D 15 ? ? ? ? 48 89 E5 41 55 41 54 49 89 FC 53 48 89 F3 48 83 EC ? 48 8B 07 48 8B 80 ? ? ? ?"
|
||||
}
|
||||
},
|
||||
"CCSPlayer_ItemServices_CanAcquire": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "44 89 44 24 ? 48 89 54 24 ? 48 89 4C 24 ? 55 53 56 57 41 55 41 56 41 57 48 8B EC",
|
||||
"linux": "55 48 89 E5 41 57 41 56 41 55 49 89 CD 41 54 49 89 FC 53 48 89 F3 48 83 EC 78"
|
||||
}
|
||||
},
|
||||
"GetCSWeaponDataFromKey": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 48 83 EC 20 33 ED 48 8B FA 8B F1",
|
||||
"linux": "55 48 89 E5 41 54 53 48 81 EC 10 01 00 00 48 85 FF"
|
||||
}
|
||||
},
|
||||
"CCSPlayer_ItemServices_GiveNamedItem": {
|
||||
"offsets": {
|
||||
"windows": 18,
|
||||
"linux": 19
|
||||
}
|
||||
},
|
||||
"CCSPlayer_ItemServices_DropActivePlayerWeapon": {
|
||||
"offsets": {
|
||||
"windows": 20,
|
||||
"linux": 21
|
||||
}
|
||||
},
|
||||
"CCSPlayer_ItemServices_RemoveWeapons": {
|
||||
"offsets": {
|
||||
"windows": 22,
|
||||
"linux": 23
|
||||
}
|
||||
},
|
||||
"CGameSceneNode_GetSkeletonInstance": {
|
||||
"offsets": {
|
||||
"windows": 8,
|
||||
"linux": 8
|
||||
}
|
||||
},
|
||||
"CCSGameRules_TerminateRound": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "48 8B C4 4C 89 48 ? 48 89 48 ? 55 56",
|
||||
"linux": "55 48 89 E5 41 57 41 56 49 89 FE 41 55 41 54 53 48 81 EC ? ? ? ? 48 8D 05 ? ? ? ? F3 0F 11 85"
|
||||
}
|
||||
},
|
||||
"CCSGameRules_FindPickerEntity": {
|
||||
"offsets": {
|
||||
"windows": 25,
|
||||
"linux": 26
|
||||
}
|
||||
},
|
||||
"CTakeDamageInfo_HitGroup": {
|
||||
"offsets": {
|
||||
"windows": 104,
|
||||
"linux": 104
|
||||
}
|
||||
},
|
||||
"UTIL_CreateEntityByName": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "48 83 EC 48 C6 44 24 30 00",
|
||||
"linux": "48 8D 05 ? ? ? ? 55 48 89 FA"
|
||||
}
|
||||
},
|
||||
"CBaseEntity_DispatchSpawn": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "48 89 5C 24 10 57 48 83 EC 30 48 8B DA 48 8B F9 48 85 C9",
|
||||
"linux": "48 85 FF 74 ? 55 48 89 E5 41 55 49 89 FD"
|
||||
}
|
||||
},
|
||||
"CEntityInstance_AcceptInput": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "89 5C 24 ? 48 89 74 24 ? 57 48 83 EC ? 49 8B F0 48 8B D9 48 8B 0D",
|
||||
"linux": "55 48 89 F0 48 89 E5 41 57 49 89 FF 41 56 48 8D 7D C0"
|
||||
}
|
||||
},
|
||||
"CEntitySystem_AddEntityIOEvent": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "48 89 5C 24 ? 4C 89 4C 24 ? 48 89 4C 24 ? 55 56 57 41 54 41 55 41 56 41 57 48 83 EC ? 49 8B F9",
|
||||
"linux": "55 48 89 E5 41 55 49 89 CD 41 54 49 89 FC"
|
||||
}
|
||||
},
|
||||
"LegacyGameEventListener": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "48 8B 15 ? ? ? ? 48 85 D2 74 ? 83 F9 ? 77 ? 48 63 C1 48 C1 E0",
|
||||
"linux": "48 8B 05 ? ? ? ? 48 85 C0 74 ? 83 FF ? 77 ? 48 63 FF 48 C1 E7 ? 48 8D 44 38"
|
||||
}
|
||||
},
|
||||
"CBasePlayerPawn_CommitSuicide": {
|
||||
"offsets": {
|
||||
"windows": 408,
|
||||
"linux": 408
|
||||
}
|
||||
},
|
||||
"CBasePlayerPawn_RemovePlayerItem": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "48 ? ? 0F 84 ? ? ? ? 48 89 5C 24 ? 57 48 ? ? ? 48 ? ? 48 ? ? E8",
|
||||
"linux": "55 48 89 E5 41 54 49 89 FC 53 48 89 F3 E8 ? ? ? ? 48 39 C3 74 ? 4C 89 E7 E8 ? ? ? ? 48 39 C3 74 ? 4C 89 E7 48 89 DE E8 ? ? ? ? 48 89 DF 5B 41 5C 5D E9 ? ? ? ? 0F 1F 44 00 00"
|
||||
}
|
||||
},
|
||||
"CBaseEntity_CollisionRulesChanged": {
|
||||
"offsets": {
|
||||
"windows": 190,
|
||||
"linux": 190
|
||||
}
|
||||
},
|
||||
"CBaseEntity_Teleport": {
|
||||
"offsets": {
|
||||
"windows": 168,
|
||||
"linux": 167
|
||||
}
|
||||
},
|
||||
"CBaseEntity_TakeDamageOld": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "4C 8B DC 56 57 48 81 EC ? ? ? ? 48 8B 41",
|
||||
"linux": "55 48 89 E5 41 57 41 56 49 89 F6 41 55 41 54 49 89 FC 53 48 89 D3 48 83 EC ?? 48 85 D2"
|
||||
}
|
||||
},
|
||||
"CBaseTrigger_StartTouch": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "40 57 41 56 48 83 EC ? 48 8B 01",
|
||||
"linux": "55 48 89 E5 41 56 41 55 49 89 F5 41 54 53 48 89 FB 48 83 EC 10 48 8B 07"
|
||||
}
|
||||
},
|
||||
"CBaseTrigger_EndTouch": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "40 53 41 55 48 83 EC 28",
|
||||
"linux": "55 BA FF FF FF FF 48 89 E5 41 57 41 56 41 55 49 89 F5 41"
|
||||
}
|
||||
},
|
||||
"GameEntitySystem": {
|
||||
"offsets": {
|
||||
"windows": 88,
|
||||
"linux": 80
|
||||
}
|
||||
},
|
||||
"GameEventManager": {
|
||||
"offsets": {
|
||||
"windows": 93,
|
||||
"linux": 93
|
||||
}
|
||||
},
|
||||
"CEntityIOOutput_FireOutputInternal": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "4C 89 4C 24 ? 48 89 4C 24 ? 53 56",
|
||||
"linux": "55 48 89 E5 41 57 49 89 FF 41 56 41 55 41 54 49 89 D4 53 48 89 F3"
|
||||
}
|
||||
},
|
||||
"IGameSystem_InitAllSystems_pFirst": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "48 8B 1D ? ? ? ? 48 85 DB 0F 84 ? ? ? ? BD",
|
||||
"linux": "4C 8B 35 ? ? ? ? 4D 85 F6 75"
|
||||
}
|
||||
},
|
||||
"CEntityResourceManifest_AddResource": {
|
||||
"offsets": {
|
||||
"windows": 2,
|
||||
"linux": 0
|
||||
}
|
||||
},
|
||||
"CheckTransmit": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "48 8B C4 4C 89 48 ? 48 89 50 ? 48 89 48 ? 55 48 8D A8",
|
||||
"linux": "55 48 89 E5 41 57 49 89 FF 41 56 48 8D 3D ? ? ? ? 41 55 41 89 D5"
|
||||
}
|
||||
},
|
||||
"CheckTransmitPlayerSlot": {
|
||||
"offsets": {
|
||||
"windows": 576,
|
||||
"linux": 576
|
||||
}
|
||||
},
|
||||
"NetworkStateChanged": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "4C 8B C2 48 8B D1 48 8B 09",
|
||||
"linux": "48 8B 07 48 85 C0 74 ? 48 8B 50 10"
|
||||
}
|
||||
},
|
||||
"SetStateChanged": {
|
||||
"offsets": {
|
||||
"windows": 25,
|
||||
"linux": 26
|
||||
}
|
||||
},
|
||||
"ISource2GameEntities::CheckTransmit": {
|
||||
"offsets": {
|
||||
"windows": 12,
|
||||
"linux": 13
|
||||
}
|
||||
},
|
||||
"Host_Say": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "44 89 4C 24 20 44 88 44 24 18",
|
||||
"linux": "55 48 89 E5 41 57 49 89 F7 41 56 41 55 41 54 4D 89 C4"
|
||||
}
|
||||
},
|
||||
"IsHearingClient": {
|
||||
"signatures": {
|
||||
"library": "engine2",
|
||||
"windows": "55 48 89 E5 41 56 41 55 41 54 53 48 89 FB 39 77",
|
||||
"linux": "55 48 89 E5 41 56 41 55 41 54 53 48 89 FB 39 77"
|
||||
}
|
||||
}
|
||||
}
|
||||
5
configs/addons/metamod/RayTrace.vdf
Normal file
5
configs/addons/metamod/RayTrace.vdf
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
"Metamod Plugin"
|
||||
{
|
||||
"alias" "RayTrace"
|
||||
"file" "addons/RayTrace/bin/linuxsteamrt64/RayTrace"
|
||||
}
|
||||
5
makefiles/metamod/RayTrace.vdf.in
Normal file
5
makefiles/metamod/RayTrace.vdf.in
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
"Metamod Plugin"
|
||||
{
|
||||
"alias" "RayTrace"
|
||||
"file" "addons/RayTrace/bin/${PROJECT_VDF_PLATFORM}/RayTrace"
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
"Metamod Plugin"
|
||||
{
|
||||
"alias" "NadeKingChallenges"
|
||||
"file" "addons/NadeKingChallenges/bin/${PROJECT_VDF_PLATFORM}/NadeKingChallenges"
|
||||
}
|
||||
|
|
@ -5,6 +5,6 @@ else()
|
|||
endif()
|
||||
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_LIST_DIR}/TemplatePlugin.vdf.in
|
||||
${PROJECT_SOURCE_DIR}/configs/addons/metamod/TemplatePlugin.vdf
|
||||
${CMAKE_CURRENT_LIST_DIR}/RayTrace.vdf.in
|
||||
${PROJECT_SOURCE_DIR}/configs/addons/metamod/RayTrace.vdf
|
||||
)
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@ endif ()
|
|||
|
||||
include_directories(
|
||||
${CMAKE_SOURCE_DIR}
|
||||
${CMAKE_SOURCE_DIR}/src
|
||||
${CMAKE_SOURCE_DIR}/public
|
||||
${SOURCESDK}
|
||||
${SOURCESDK}/thirdparty/protobuf-3.21.8/src
|
||||
${SOURCESDK}/common
|
||||
|
|
|
|||
107
public/CRayTraceInterface.h
Normal file
107
public/CRayTraceInterface.h
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
#pragma once
|
||||
#include "vector.h"
|
||||
#include "entityinstance.h"
|
||||
#include "gametrace.h"
|
||||
#include "trace.h"
|
||||
#include "cmodel.h"
|
||||
#include <optional>
|
||||
|
||||
#define RAYTRACE_INTERFACE_VERSION "CRayTraceInterface001"
|
||||
|
||||
class CBaseEntity;
|
||||
|
||||
enum class InteractionLayers : uint64_t
|
||||
{
|
||||
Solid = 0x1,
|
||||
Hitboxes = 0x2,
|
||||
Trigger = 0x4,
|
||||
Sky = 0x8,
|
||||
PlayerClip = 0x10,
|
||||
NPCClip = 0x20,
|
||||
BlockLOS = 0x40,
|
||||
BlockLight = 0x80,
|
||||
Ladder = 0x100,
|
||||
Pickup = 0x200,
|
||||
BlockSound = 0x400,
|
||||
NoDraw = 0x800,
|
||||
Window = 0x1000,
|
||||
PassBullets = 0x2000,
|
||||
WorldGeometry = 0x4000,
|
||||
Water = 0x8000,
|
||||
Slime = 0x10000,
|
||||
TouchAll = 0x20000,
|
||||
Player = 0x40000,
|
||||
NPC = 0x80000,
|
||||
Debris = 0x100000,
|
||||
Physics_Prop = 0x200000,
|
||||
NavIgnore = 0x400000,
|
||||
NavLocalIgnore = 0x800000,
|
||||
PostProcessingVolume = 0x1000000,
|
||||
UnusedLayer3 = 0x2000000,
|
||||
CarriedObject = 0x4000000,
|
||||
PushAway = 0x8000000,
|
||||
ServerEntityOnClient = 0x10000000,
|
||||
CarriedWeapon = 0x20000000,
|
||||
StaticLevel = 0x40000000,
|
||||
csgo_team1 = 0x80000000,
|
||||
csgo_team2 = 0x100000000,
|
||||
csgo_grenadeclip = 0x200000000,
|
||||
csgo_droneclip = 0x400000000,
|
||||
csgo_moveable = 0x800000000,
|
||||
csgo_opaque = 0x1000000000,
|
||||
csgo_monster = 0x2000000000,
|
||||
csgo_thrown_grenade = 0x8000000000,
|
||||
FUNPLAY_IGNORE_PLAYER = (0x8000000000ull << 1)
|
||||
};
|
||||
|
||||
inline InteractionLayers operator|(InteractionLayers a, InteractionLayers b)
|
||||
{
|
||||
return static_cast<InteractionLayers>(
|
||||
static_cast<uint64_t>(a) | static_cast<uint64_t>(b)
|
||||
);
|
||||
}
|
||||
|
||||
inline InteractionLayers& operator|=(InteractionLayers& a, InteractionLayers b)
|
||||
{
|
||||
a = a | b;
|
||||
return a;
|
||||
}
|
||||
|
||||
struct TraceOptions
|
||||
{
|
||||
std::optional<InteractionLayers> InteractsWith{static_cast<InteractionLayers>(0x2c3011)};
|
||||
std::optional<InteractionLayers> InteractsExclude{};
|
||||
bool DrawBeam{false};
|
||||
};
|
||||
|
||||
struct TraceResult
|
||||
{
|
||||
Vector EndPos{};
|
||||
CEntityInstance* HitEntity{};
|
||||
float Fraction{};
|
||||
bool AllSolid{};
|
||||
Vector Normal{};
|
||||
};
|
||||
|
||||
class CRayTraceInterface {
|
||||
public:
|
||||
virtual ~CRayTraceInterface() = default;
|
||||
|
||||
virtual std::optional<TraceResult> TraceShape(
|
||||
const Vector& origin,
|
||||
const QAngle& viewangles,
|
||||
CBaseEntity* ignorePlayer = nullptr,
|
||||
const TraceOptions* opts = nullptr) = 0;
|
||||
|
||||
virtual std::optional<TraceResult> TraceEndShape(
|
||||
const Vector& origin,
|
||||
const Vector& endOrigin,
|
||||
CBaseEntity* ignorePlayer = nullptr,
|
||||
const TraceOptions* opts = nullptr) = 0;
|
||||
|
||||
virtual std::optional<TraceResult> TraceShapeEx(
|
||||
const Vector& vecStart,
|
||||
const Vector& vecEnd,
|
||||
CTraceFilter& filterInc,
|
||||
Ray_t rayInc) = 0;
|
||||
};
|
||||
|
|
@ -1,86 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 15.09.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#pragma once
|
||||
#include <random>
|
||||
#include <string>
|
||||
#include "schema/CCSPlayerController.h"
|
||||
|
||||
namespace TemplatePlugin {
|
||||
enum class EntityType {
|
||||
None = 0,
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct EntityCustomData {
|
||||
T *Value = nullptr;
|
||||
|
||||
explicit EntityCustomData(T *v = nullptr) : Value(v) {
|
||||
}
|
||||
};
|
||||
|
||||
enum class ActionType_t {
|
||||
None = 0,
|
||||
EPush = 1,
|
||||
EPushPower = 2,
|
||||
IgnoreKnife = 3,
|
||||
FToPickup = 4,
|
||||
NoDoorFix = 5,
|
||||
};
|
||||
|
||||
struct EntityData_t {
|
||||
EntityType Type = EntityType::None;
|
||||
|
||||
std::function<void(CHandle<CEntityInstance>, CHandle<CCSPlayerController>)> OnTouch;
|
||||
std::function<void(CHandle<CEntityInstance>, CHandle<CCSPlayerController>)> OnUse;
|
||||
|
||||
std::unique_ptr<EntityCustomData<void> > CustomData;
|
||||
|
||||
CHandle<CCSPlayerController> GrabHolder = nullptr;
|
||||
float GrabDistance = 0.0f;
|
||||
|
||||
CHandle<CBaseEntity> TouchedTo = nullptr;
|
||||
int NextSoundBlockTick = 0;
|
||||
|
||||
ActionType_t ActionType = ActionType_t::None;
|
||||
|
||||
bool SkinInitialized = false;
|
||||
|
||||
void Init() {
|
||||
Type = EntityType::None;
|
||||
OnTouch = nullptr;
|
||||
OnUse = nullptr;
|
||||
CustomData.reset();
|
||||
GrabHolder = nullptr;
|
||||
GrabDistance = 0.0f;
|
||||
TouchedTo = nullptr;
|
||||
NextSoundBlockTick = 0;
|
||||
ActionType = ActionType_t::None;
|
||||
SkinInitialized = false;
|
||||
}
|
||||
};
|
||||
|
||||
struct ActionEntity {
|
||||
std::string HammerId;
|
||||
int Number = 0;
|
||||
|
||||
ActionEntity(const std::string &hammerId, int number)
|
||||
: HammerId(hammerId), Number(number) {
|
||||
}
|
||||
};
|
||||
|
||||
struct HandleHasher {
|
||||
size_t operator()(const CHandle<CBaseEntity> &h) const noexcept {
|
||||
return std::hash<int>()(h.GetEntryIndex());
|
||||
}
|
||||
};
|
||||
|
||||
struct HandleEqual {
|
||||
bool operator()(const CHandle<CBaseEntity> &a, const CHandle<CBaseEntity> &b) const noexcept {
|
||||
return a.GetEntryIndex() == b.GetEntryIndex();
|
||||
}
|
||||
};
|
||||
|
||||
inline std::unordered_map<CHandle<CBaseEntity>, EntityData_t, HandleHasher, HandleEqual> EntityData;
|
||||
}
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 12.07.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#include "PlayersData.h"
|
||||
|
||||
namespace TemplatePlugin {
|
||||
bool PlayerDataHandler::Add(uint64_t steamid, const PlayerData &data) {
|
||||
if (steamid == 0 || players_.contains(steamid)) return false;
|
||||
players_[steamid] = data;
|
||||
return true;
|
||||
}
|
||||
|
||||
PlayerData* PlayerDataHandler::TryGet(uint64_t steamid) {
|
||||
auto it = players_.find(steamid);
|
||||
return it != players_.end() ? &it->second : nullptr;
|
||||
}
|
||||
|
||||
bool PlayerDataHandler::Remove(uint64_t steamid) {
|
||||
return players_.erase(steamid) > 0;
|
||||
}
|
||||
|
||||
PlayerData& PlayerDataHandler::Ensure(uint64_t steamid) {
|
||||
return players_[steamid];
|
||||
}
|
||||
|
||||
bool PlayerDataHandler::Add(CCSPlayerController* player, const PlayerData& data) {
|
||||
if (!player) return false;
|
||||
uint64_t steamid = player->GetSteamID();
|
||||
if (steamid == 0) return false;
|
||||
return Add(steamid, data);
|
||||
}
|
||||
|
||||
PlayerData* PlayerDataHandler::TryGet(CCSPlayerController* player) {
|
||||
if (!player) return nullptr;
|
||||
uint64_t steamid = player->GetSteamID();
|
||||
return steamid ? TryGet(steamid) : nullptr;
|
||||
}
|
||||
|
||||
bool PlayerDataHandler::Remove(CCSPlayerController* player) {
|
||||
if (!player) return false;
|
||||
uint64_t steamid = player->GetSteamID();
|
||||
return steamid ? Remove(steamid) : false;
|
||||
}
|
||||
|
||||
PlayerData& PlayerDataHandler::Ensure(CCSPlayerController* player) {
|
||||
static PlayerData dummy{};
|
||||
if (!player) return dummy;
|
||||
uint64_t steamid = player->GetSteamID();
|
||||
return steamid ? Ensure(steamid) : dummy;
|
||||
}
|
||||
|
||||
void PlayerDataHandler::ClearAll() {
|
||||
players_.clear();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 12.07.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#pragma once
|
||||
#include <unordered_map>
|
||||
#include "schema/CCSPlayerController.h"
|
||||
|
||||
namespace TemplatePlugin {
|
||||
struct PlayerData {
|
||||
};
|
||||
|
||||
class PlayerDataHandler {
|
||||
public:
|
||||
static bool Add(uint64_t steamid, const PlayerData &data = {});
|
||||
static PlayerData* TryGet(uint64_t steamid);
|
||||
static bool Remove(uint64_t steamid);
|
||||
static PlayerData& Ensure(uint64_t steamid);
|
||||
|
||||
static bool Add(CCSPlayerController* player, const PlayerData& data = {});
|
||||
static PlayerData* TryGet(CCSPlayerController* player);
|
||||
static bool Remove(CCSPlayerController* player);
|
||||
static PlayerData& Ensure(CCSPlayerController* player);
|
||||
|
||||
static void ClearAll();
|
||||
|
||||
private:
|
||||
static inline std::unordered_map<uint64_t, PlayerData> players_;
|
||||
};
|
||||
}
|
||||
|
|
@ -1,51 +1,44 @@
|
|||
#include "TemplatePlugin.h"
|
||||
#include "Plugin.h"
|
||||
#include "path.h"
|
||||
#include "Shared.h"
|
||||
#include "dynlibutils/module.h"
|
||||
#include <entitysystem.h>
|
||||
#include "igameevents.h"
|
||||
#include <iserver.h>
|
||||
#include "game_system.h"
|
||||
#include "schemasystem/schemasystem.h"
|
||||
#include "schema/CCSPlayerController.h"
|
||||
#include "schema/cgameresourceserviceserver.h"
|
||||
#include "schema/plat.h"
|
||||
#include <filesystem>
|
||||
#include <cstdio>
|
||||
#include <detours.h>
|
||||
#include <fstream>
|
||||
#include <gameconfig.h>
|
||||
#include <regex>
|
||||
#include <listeners/Listeners.h>
|
||||
#include "EntityData.h"
|
||||
#include "CRayTraceInterface.h"
|
||||
#include "log.h"
|
||||
#include "PlayersData.h"
|
||||
#include "RayTrace.h"
|
||||
#include "tasks.h"
|
||||
#include "commands/Commands.h"
|
||||
#include "events/Events.h"
|
||||
#include "hooks/Hooks.h"
|
||||
#include "schema/CGameRules.h"
|
||||
|
||||
#define VERSION_STRING SEMVER " @ " GITHUB_SHA
|
||||
#define BUILD_TIMESTAMP __DATE__ " " __TIME__
|
||||
|
||||
PLUGIN_EXPOSE(Template, TemplatePlugin::g_iPlugin);
|
||||
PLUGIN_EXPOSE(RayTrace, RayTracePlugin::g_iPlugin);
|
||||
|
||||
CGameEntitySystem* GameEntitySystem()
|
||||
{
|
||||
return *reinterpret_cast<CGameEntitySystem**>((uintptr_t)(g_pGameResourceServiceServer) +
|
||||
TemplatePlugin::shared::g_pGameConfig->GetOffset("GameEntitySystem"));
|
||||
RayTracePlugin::shared::g_pGameConfig->GetOffset("GameEntitySystem"));
|
||||
}
|
||||
|
||||
class GameSessionConfiguration_t
|
||||
{
|
||||
};
|
||||
|
||||
namespace TemplatePlugin
|
||||
namespace RayTracePlugin
|
||||
{
|
||||
ITemplatePlugin g_iPlugin;
|
||||
IPlugin g_iPlugin;
|
||||
|
||||
bool ITemplatePlugin::Load(PluginId id, ISmmAPI* ismm, char* error, size_t maxlen, bool late)
|
||||
bool IPlugin::Load(PluginId id, ISmmAPI* ismm, char* error, size_t maxlen, bool late)
|
||||
{
|
||||
PLUGIN_SAVEVARS();
|
||||
|
||||
|
|
@ -84,9 +77,6 @@ namespace TemplatePlugin
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!InitGameSystems())
|
||||
return false;
|
||||
|
||||
g_SMAPI->AddListener(this, this);
|
||||
Listeners::InitListeners();
|
||||
|
||||
|
|
@ -96,11 +86,6 @@ namespace TemplatePlugin
|
|||
if (late)
|
||||
{
|
||||
shared::g_pEntitySystem = GameEntitySystem();
|
||||
shared::g_pEntitySystem->AddListenerEntity(&Detours::entityListener);
|
||||
Commands::InitCommands();
|
||||
Events::InitEvents();
|
||||
Hooks::InitHooks();
|
||||
Detours::InitHooks();
|
||||
RayTrace::Initialize();
|
||||
shared::g_bDetoursLoaded = true;
|
||||
}
|
||||
|
|
@ -109,12 +94,9 @@ namespace TemplatePlugin
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ITemplatePlugin::Unload(char* error, size_t maxlen)
|
||||
bool IPlugin::Unload(char* error, size_t maxlen)
|
||||
{
|
||||
Listeners::DestructListeners();
|
||||
Detours::ShutdownHooks();
|
||||
Detours::Shutdown();
|
||||
shared::g_pEntitySystem->RemoveListenerEntity(&Detours::entityListener);
|
||||
Tasks::Shutdown();
|
||||
|
||||
FP_INFO("<<< Unload() success! >>>");
|
||||
|
|
@ -122,12 +104,23 @@ namespace TemplatePlugin
|
|||
return true;
|
||||
}
|
||||
|
||||
const char* ITemplatePlugin::GetAuthor() { return "Slynx"; }
|
||||
const char* ITemplatePlugin::GetName() { return "TemplatePlugin"; }
|
||||
const char* ITemplatePlugin::GetDescription() { return "TemplatePlugin Metamod plugin for CS2 servers."; }
|
||||
const char* ITemplatePlugin::GetURL() { return "https://slynxdev.cz"; }
|
||||
const char* ITemplatePlugin::GetLicense() { return "GPLv3"; }
|
||||
const char* ITemplatePlugin::GetVersion() { return VERSION_STRING; }
|
||||
const char* ITemplatePlugin::GetDate() { return BUILD_TIMESTAMP; }
|
||||
const char* ITemplatePlugin::GetLogTag() { return "TemplatePlugin"; }
|
||||
void *IPlugin::OnMetamodQuery(const char *iface, int *ret) {
|
||||
if (strcmp(iface, RAYTRACE_INTERFACE_VERSION) == 0) {
|
||||
*ret = META_IFACE_OK;
|
||||
FP_INFO("CRayTraceInterface001 accessed.");
|
||||
return &RayTrace::g_CRayTrace;
|
||||
}
|
||||
|
||||
*ret = META_IFACE_FAILED;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const char* IPlugin::GetAuthor() { return "Slynx"; }
|
||||
const char* IPlugin::GetName() { return "RayTrace"; }
|
||||
const char* IPlugin::GetDescription() { return "RayTrace Metamod plugin for CS2 servers."; }
|
||||
const char* IPlugin::GetURL() { return "https://slynxdev.cz"; }
|
||||
const char* IPlugin::GetLicense() { return "GPLv3"; }
|
||||
const char* IPlugin::GetVersion() { return VERSION_STRING; }
|
||||
const char* IPlugin::GetDate() { return BUILD_TIMESTAMP; }
|
||||
const char* IPlugin::GetLogTag() { return "RayTrace"; }
|
||||
}
|
||||
|
|
@ -5,13 +5,14 @@
|
|||
#include <ISmmPlugin.h>
|
||||
#include "entitysystem.h"
|
||||
|
||||
namespace TemplatePlugin
|
||||
namespace RayTracePlugin
|
||||
{
|
||||
class ITemplatePlugin : public ISmmPlugin, public IMetamodListener
|
||||
class IPlugin : public ISmmPlugin, public IMetamodListener
|
||||
{
|
||||
public:
|
||||
bool Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late) override;
|
||||
bool Unload(char *error, size_t maxlen) override;
|
||||
void *OnMetamodQuery(const char *iface, int *ret) override;
|
||||
const char *GetAuthor() override;
|
||||
const char *GetName() override;
|
||||
const char *GetDescription() override;
|
||||
|
|
@ -22,7 +23,7 @@ namespace TemplatePlugin
|
|||
const char *GetLogTag() override;
|
||||
};
|
||||
|
||||
extern ITemplatePlugin g_iPlugin;
|
||||
extern IPlugin g_iPlugin;
|
||||
}
|
||||
|
||||
#endif //_INCLUDE_METAMOD_SOURCE_STUB_PLUGIN_H_
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
#include "colors.h"
|
||||
#include "log.h"
|
||||
|
||||
namespace TemplatePlugin::RayTrace
|
||||
namespace RayTracePlugin::RayTrace
|
||||
{
|
||||
using TraceShapeFn = bool(*)(void* pThis,
|
||||
Ray_t& ray,
|
||||
|
|
|
|||
114
src/RayTrace.h
114
src/RayTrace.h
|
|
@ -4,72 +4,12 @@
|
|||
//
|
||||
#pragma once
|
||||
#include <optional>
|
||||
#include <cstdint>
|
||||
#include "vector.h"
|
||||
#include "gametrace.h"
|
||||
#include "trace.h"
|
||||
#include "cmodel.h"
|
||||
#include "schema/CBaseEntity.h"
|
||||
#include "CRayTraceInterface.h"
|
||||
|
||||
namespace TemplatePlugin::RayTrace
|
||||
namespace RayTracePlugin::RayTrace
|
||||
{
|
||||
enum class InteractionLayers : uint64_t
|
||||
{
|
||||
Solid = 0x1,
|
||||
Hitboxes = 0x2,
|
||||
Trigger = 0x4,
|
||||
Sky = 0x8,
|
||||
PlayerClip = 0x10,
|
||||
NPCClip = 0x20,
|
||||
BlockLOS = 0x40,
|
||||
BlockLight = 0x80,
|
||||
Ladder = 0x100,
|
||||
Pickup = 0x200,
|
||||
BlockSound = 0x400,
|
||||
NoDraw = 0x800,
|
||||
Window = 0x1000,
|
||||
PassBullets = 0x2000,
|
||||
WorldGeometry = 0x4000,
|
||||
Water = 0x8000,
|
||||
Slime = 0x10000,
|
||||
TouchAll = 0x20000,
|
||||
Player = 0x40000,
|
||||
NPC = 0x80000,
|
||||
Debris = 0x100000,
|
||||
Physics_Prop = 0x200000,
|
||||
NavIgnore = 0x400000,
|
||||
NavLocalIgnore = 0x800000,
|
||||
PostProcessingVolume = 0x1000000,
|
||||
UnusedLayer3 = 0x2000000,
|
||||
CarriedObject = 0x4000000,
|
||||
PushAway = 0x8000000,
|
||||
ServerEntityOnClient = 0x10000000,
|
||||
CarriedWeapon = 0x20000000,
|
||||
StaticLevel = 0x40000000,
|
||||
csgo_team1 = 0x80000000,
|
||||
csgo_team2 = 0x100000000,
|
||||
csgo_grenadeclip = 0x200000000,
|
||||
csgo_droneclip = 0x400000000,
|
||||
csgo_moveable = 0x800000000,
|
||||
csgo_opaque = 0x1000000000,
|
||||
csgo_monster = 0x2000000000,
|
||||
csgo_thrown_grenade = 0x8000000000,
|
||||
FUNPLAY_IGNORE_PLAYER = (0x8000000000ull << 1)
|
||||
};
|
||||
|
||||
inline InteractionLayers operator|(InteractionLayers a, InteractionLayers b)
|
||||
{
|
||||
return static_cast<InteractionLayers>(
|
||||
static_cast<uint64_t>(a) | static_cast<uint64_t>(b)
|
||||
);
|
||||
}
|
||||
|
||||
inline InteractionLayers& operator|=(InteractionLayers& a, InteractionLayers b)
|
||||
{
|
||||
a = a | b;
|
||||
return a;
|
||||
}
|
||||
|
||||
class CTraceFilterEx : public CTraceFilter
|
||||
{
|
||||
public:
|
||||
|
|
@ -87,23 +27,6 @@ namespace TemplatePlugin::RayTrace
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
struct TraceOptions
|
||||
{
|
||||
std::optional<InteractionLayers> InteractsWith{static_cast<InteractionLayers>(0x2c3011)};
|
||||
std::optional<InteractionLayers> InteractsExclude{};
|
||||
bool DrawBeam{false};
|
||||
};
|
||||
|
||||
struct TraceResult
|
||||
{
|
||||
Vector EndPos{};
|
||||
CEntityInstance* HitEntity{};
|
||||
float Fraction{};
|
||||
bool AllSolid{};
|
||||
Vector Normal{};
|
||||
};
|
||||
|
||||
bool Initialize();
|
||||
|
||||
std::optional<TraceResult> TraceShape(
|
||||
|
|
@ -123,4 +46,37 @@ namespace TemplatePlugin::RayTrace
|
|||
const Vector& vecEnd,
|
||||
CTraceFilter& filterInc,
|
||||
Ray_t rayInc);
|
||||
|
||||
class CRayTrace : public CRayTraceInterface
|
||||
{
|
||||
public:
|
||||
std::optional<TraceResult> TraceShape(
|
||||
const Vector& origin,
|
||||
const QAngle& viewangles,
|
||||
CBaseEntity* ignorePlayer,
|
||||
const TraceOptions* opts) override
|
||||
{
|
||||
return RayTrace::TraceShape(origin, viewangles, ignorePlayer, opts);
|
||||
}
|
||||
|
||||
std::optional<TraceResult> TraceEndShape(
|
||||
const Vector& origin,
|
||||
const Vector& endOrigin,
|
||||
CBaseEntity* ignorePlayer,
|
||||
const TraceOptions* opts) override
|
||||
{
|
||||
return RayTrace::TraceEndShape(origin, endOrigin, ignorePlayer, opts);
|
||||
}
|
||||
|
||||
std::optional<TraceResult> TraceShapeEx(
|
||||
const Vector& vecStart,
|
||||
const Vector& vecEnd,
|
||||
CTraceFilter& filterInc,
|
||||
Ray_t rayInc) override
|
||||
{
|
||||
return RayTrace::TraceShapeEx(vecStart, vecEnd, filterInc, rayInc);
|
||||
}
|
||||
};
|
||||
|
||||
inline CRayTrace g_CRayTrace;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
#include <sourcehook/sourcehook.h>
|
||||
#include <sourcehook/sourcehook_impl.h>
|
||||
|
||||
namespace TemplatePlugin::shared
|
||||
namespace RayTracePlugin::shared
|
||||
{
|
||||
ICvar* g_pCVar = nullptr;
|
||||
IServerGameDLL* g_pServer = nullptr;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
class CGameEntitySystem;
|
||||
|
||||
namespace TemplatePlugin::shared
|
||||
namespace RayTracePlugin::shared
|
||||
{
|
||||
extern ICvar* g_pCVar;
|
||||
extern IServerGameDLL* g_pServer;
|
||||
|
|
@ -45,11 +45,10 @@ namespace TemplatePlugin::shared
|
|||
extern int GetTickCount();
|
||||
extern float GetGameFrameTime();
|
||||
|
||||
extern bool g_bHasTicked;
|
||||
extern bool g_bDetoursLoaded;
|
||||
}
|
||||
|
||||
#undef SH_GLOB_SHPTR
|
||||
#define SH_GLOB_SHPTR TemplatePlugin::shared::source_hook
|
||||
#define SH_GLOB_SHPTR RayTracePlugin::shared::source_hook
|
||||
#undef SH_GLOB_PLUGPTR
|
||||
#define SH_GLOB_PLUGPTR TemplatePlugin::shared::source_hook_pluginid
|
||||
#define SH_GLOB_PLUGPTR RayTracePlugin::shared::source_hook_pluginid
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
#include <cmath>
|
||||
#include <chrono>
|
||||
|
||||
namespace TemplatePlugin {
|
||||
namespace RayTracePlugin {
|
||||
struct colors {
|
||||
float r, g, b, a;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 21.11.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#include "Commands.h"
|
||||
#include <detours.h>
|
||||
|
||||
namespace TemplatePlugin::Commands
|
||||
{
|
||||
void InitCommands()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 21.11.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#pragma once
|
||||
#include "detourtypes.h"
|
||||
|
||||
namespace TemplatePlugin::Commands
|
||||
{
|
||||
void InitCommands();
|
||||
}
|
||||
369
src/detours.cpp
369
src/detours.cpp
|
|
@ -1,369 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 09.07.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#include <funchook/include/funchook.h>
|
||||
#include <igameevents.h>
|
||||
#include <sourcehook.h>
|
||||
#include <cstring>
|
||||
#include <unordered_set>
|
||||
#include "schema/CCSPlayerController.h"
|
||||
#include "detours.h"
|
||||
|
||||
#include <Shared.h>
|
||||
#include <TemplatePlugin.h>
|
||||
|
||||
#include "log.h"
|
||||
|
||||
namespace TemplatePlugin {
|
||||
SH_DECL_HOOK2(IGameEventManager2, FireEvent, SH_NOATTRIB, 0, bool, IGameEvent*, bool);
|
||||
SH_DECL_HOOK3_void(ICvar, DispatchConCommand, SH_NOATTRIB, 0, ConCommandRef, const CCommandContext&,
|
||||
const CCommand&);
|
||||
|
||||
namespace Detours {
|
||||
std::vector<std::unique_ptr<ConCommand> > registeredCommands;
|
||||
static std::unordered_map<std::string, std::vector<CommandEntry> > consoleListeners;
|
||||
static std::unordered_map<std::string, std::vector<EventEntry> > gameEvents;
|
||||
static EventManager eventManager;
|
||||
static std::vector<IGameEvent *> eventStack;
|
||||
static std::vector<EntityEventHandler> entitySpawnedListeners;
|
||||
static std::vector<EntityEventHandler> entityCreatedListeners;
|
||||
static std::vector<EntityEventHandler> entityDeletedListeners;
|
||||
static std::vector<EntityParentChangedHandler> entityParentChangerListeners;
|
||||
static std::unordered_set<std::string> registeredNames;
|
||||
static std::unordered_map<std::string, CommandHandler> commandCallbacks;
|
||||
struct OutputHookKey {
|
||||
CEntityInstance *entity;
|
||||
std::string output;
|
||||
HookMode mode;
|
||||
|
||||
bool operator==(const OutputHookKey &o) const noexcept {
|
||||
return entity == o.entity && output == o.output && mode == o.mode;
|
||||
}
|
||||
};
|
||||
|
||||
struct OutputHookKeyHasher {
|
||||
size_t operator()(const OutputHookKey &k) const noexcept {
|
||||
return std::hash<void *>{}(k.entity) ^ (std::hash<std::string>{}(k.output) << 1)
|
||||
^ (std::hash<int>{}(static_cast<int>(k.mode)) << 2);
|
||||
}
|
||||
};
|
||||
static std::unordered_map<OutputHookKey, std::vector<EntityOutputHandler>, OutputHookKeyHasher>
|
||||
g_entityOutputHooks;
|
||||
|
||||
void ConCommandRouter(const CCommandContext &ctx, const CCommand &args) {
|
||||
if (args.ArgC() < 1)
|
||||
return;
|
||||
|
||||
std::string name = args.Arg(0);
|
||||
auto it = commandCallbacks.find(name);
|
||||
if (it == commandCallbacks.end())
|
||||
return;
|
||||
|
||||
(void) it->second(ctx, args, HookMode::Post);
|
||||
}
|
||||
|
||||
void RegisterChatListener(const std::string &name,
|
||||
const std::function<void(const CCommandContext &, const CCommand &, HookMode)> &
|
||||
handler) {
|
||||
CommandHandler nativeHandler = WrapVoidHandler(handler);
|
||||
|
||||
RegisterConsoleListener(name, nativeHandler, HookMode::Pre);
|
||||
RegisterConsoleListener("/" + name, nativeHandler, HookMode::Pre);
|
||||
RegisterConsoleListener("!" + name, nativeHandler, HookMode::Pre);
|
||||
}
|
||||
|
||||
void RegisterConsoleCommand(const std::string &name,
|
||||
const std::function<void(const CCommandContext &, const CCommand &, HookMode)> &
|
||||
handler) {
|
||||
CommandHandler nativeHandler = WrapVoidHandler(handler);
|
||||
|
||||
if (shared::g_pCVar && shared::g_pCVar->FindConCommand(name.c_str()).IsValidRef()) {
|
||||
RegisterConsoleListener(name, nativeHandler, HookMode::Pre);
|
||||
RegisterConsoleListener("/" + name, nativeHandler, HookMode::Pre);
|
||||
RegisterConsoleListener("!" + name, nativeHandler, HookMode::Pre);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!registeredNames.contains(name)) {
|
||||
auto cmd = std::make_unique<ConCommand>(
|
||||
name.c_str(),
|
||||
ConCommandRouter,
|
||||
("Registered command: " + name).c_str(),
|
||||
FCVAR_NONE
|
||||
);
|
||||
registeredCommands.push_back(std::move(cmd));
|
||||
registeredNames.insert(name);
|
||||
}
|
||||
|
||||
RegisterConsoleListener(name, nativeHandler, HookMode::Pre);
|
||||
RegisterConsoleListener("/" + name, nativeHandler, HookMode::Pre);
|
||||
RegisterConsoleListener("!" + name, nativeHandler, HookMode::Pre);
|
||||
}
|
||||
|
||||
void InitHooks() {
|
||||
SH_ADD_HOOK(IGameEventManager2, FireEvent, shared::g_pGameEventManager, Detours::OnFireEvent, false);
|
||||
SH_ADD_HOOK(IGameEventManager2, FireEvent, shared::g_pGameEventManager, Detours::OnFireEventPost, true);
|
||||
SH_ADD_HOOK(ICvar, DispatchConCommand, shared::g_pCVar, Hook_DispatchConCommand, false);
|
||||
}
|
||||
|
||||
void ShutdownHooks() {
|
||||
SH_REMOVE_HOOK(IGameEventManager2, FireEvent, shared::g_pGameEventManager, Detours::OnFireEvent, false);
|
||||
SH_REMOVE_HOOK(IGameEventManager2, FireEvent, shared::g_pGameEventManager, Detours::OnFireEventPost, true);
|
||||
SH_REMOVE_HOOK(ICvar, DispatchConCommand, shared::g_pCVar, Hook_DispatchConCommand, false);
|
||||
}
|
||||
|
||||
void RegisterConsoleListener(const std::string &name, CommandHandler handler, HookMode mode) {
|
||||
consoleListeners[name].push_back({handler, mode});
|
||||
}
|
||||
|
||||
void RegisterGameEvent(const std::string &name, GameEventHandler handler, HookMode mode) {
|
||||
gameEvents[name].push_back({handler, mode});
|
||||
if (!shared::g_pGameEventManager->FindListener(&eventManager, name.c_str()))
|
||||
{
|
||||
shared::g_pGameEventManager->AddListener(&eventManager, name.c_str(), true);
|
||||
}
|
||||
}
|
||||
|
||||
void EventManager::FireGameEvent(IGameEvent* pEvent) {}
|
||||
|
||||
void RegisterEntityListener(EntityEventHandler handler, EntityEventType type) {
|
||||
switch (type) {
|
||||
case EntityEventType::ENTITY_SPAWNED:
|
||||
entitySpawnedListeners.push_back(handler);
|
||||
break;
|
||||
case EntityEventType::ENTITY_CREATED:
|
||||
entityCreatedListeners.push_back(handler);
|
||||
break;
|
||||
case EntityEventType::ENTITY_DELETED:
|
||||
entityDeletedListeners.push_back(handler);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void *FindModuleSignature(const DynLibUtils::CModule& module, const char *name) {
|
||||
return module.FindPattern(
|
||||
shared::g_pGameConfig->GetSignature(name)
|
||||
);
|
||||
}
|
||||
|
||||
HookResult DispatchConsoleListener(const CCommandContext &ctx, const CCommand &args, HookMode mode) {
|
||||
std::string name = args.Arg(0);
|
||||
std::transform(name.begin(), name.end(), name.begin(),
|
||||
[](unsigned char c) { return static_cast<char>(std::tolower(c)); });
|
||||
|
||||
auto it = consoleListeners.find(name);
|
||||
if (it == consoleListeners.end())
|
||||
return HookResult::Continue;
|
||||
|
||||
HookResult result = HookResult::Continue;
|
||||
|
||||
for (const auto &entry: it->second) {
|
||||
if (entry.mode != mode)
|
||||
continue;
|
||||
|
||||
HookResult thisResult = entry.handler(ctx, args, mode);
|
||||
|
||||
if (thisResult == HookResult::Stop)
|
||||
return HookResult::Stop;
|
||||
|
||||
if (thisResult == HookResult::Handled && mode == HookMode::Pre)
|
||||
return HookResult::Handled;
|
||||
|
||||
if (static_cast<int>(thisResult) > static_cast<int>(result))
|
||||
result = thisResult;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool DispatchGameEvent(IGameEvent *event, HookMode mode, bool &dontBroadcast) {
|
||||
const char *name = event->GetName();
|
||||
auto it = gameEvents.find(name);
|
||||
if (it == gameEvents.end())
|
||||
return true;
|
||||
|
||||
EventOverride override{dontBroadcast};
|
||||
|
||||
for (const auto &hook: it->second) {
|
||||
if (hook.mode != mode)
|
||||
continue;
|
||||
|
||||
HookResult result = hook.handler(event, mode, override);
|
||||
|
||||
if (result == HookResult::Handled || result == HookResult::Stop)
|
||||
return false;
|
||||
}
|
||||
|
||||
dontBroadcast = override.dontBroadcast;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void DispatchEntitySpawn(CEntityInstance *ent) {
|
||||
for (auto &fn: entitySpawnedListeners) {
|
||||
fn(ent);
|
||||
}
|
||||
}
|
||||
|
||||
void DispatchEntityCreate(CEntityInstance *ent) {
|
||||
for (auto &fn: entityCreatedListeners) {
|
||||
fn(ent);
|
||||
}
|
||||
}
|
||||
|
||||
void DispatchEntityDelete(CEntityInstance *ent) {
|
||||
for (auto &fn: entityDeletedListeners) {
|
||||
fn(ent);
|
||||
}
|
||||
}
|
||||
|
||||
void HookSingleEntityOutput(CEntityInstance *entity,
|
||||
const std::string &outputName,
|
||||
EntityOutputHandler handler,
|
||||
HookMode mode) {
|
||||
g_entityOutputHooks[{entity, outputName, mode}].push_back(std::move(handler));
|
||||
}
|
||||
|
||||
void UnhookSingleEntityOutput(CEntityInstance *entity,
|
||||
const std::string &outputName,
|
||||
EntityOutputHandler handler,
|
||||
HookMode mode) {
|
||||
auto key = OutputHookKey{entity, outputName, mode};
|
||||
auto it = g_entityOutputHooks.find(key);
|
||||
if (it == g_entityOutputHooks.end()) return;
|
||||
|
||||
auto &vec = it->second;
|
||||
vec.erase(std::remove_if(vec.begin(), vec.end(),
|
||||
[&](const EntityOutputHandler &h) {
|
||||
return h.target<void>() == handler.target<void>();
|
||||
}),
|
||||
vec.end());
|
||||
|
||||
if (vec.empty())
|
||||
g_entityOutputHooks.erase(it);
|
||||
}
|
||||
|
||||
HookResult DispatchEntityOutput(CEntityIOOutput *output,
|
||||
const char *name,
|
||||
CEntityInstance *activator,
|
||||
CEntityInstance *caller,
|
||||
const CVariant *value,
|
||||
float delay,
|
||||
HookMode mode) {
|
||||
HookResult result = HookResult::Continue;
|
||||
|
||||
for (auto &[key, handlers]: g_entityOutputHooks) {
|
||||
if (key.entity != caller) continue;
|
||||
if (key.output != name) continue;
|
||||
if (key.mode != mode) continue;
|
||||
|
||||
for (auto &fn: handlers) {
|
||||
HookResult r = fn(output, name, activator, caller, value, delay);
|
||||
if (r == HookResult::Stop) return HookResult::Stop;
|
||||
if (static_cast<int>(r) > static_cast<int>(result))
|
||||
result = r;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool OnFireEvent(IGameEvent *event, bool bDontBroadcast) {
|
||||
if (!event)
|
||||
RETURN_META_VALUE(MRES_IGNORED, false);
|
||||
|
||||
bool localDontBroadcast = bDontBroadcast;
|
||||
if (!DispatchGameEvent(event, HookMode::Pre, localDontBroadcast))
|
||||
RETURN_META_VALUE(MRES_SUPERCEDE, false);
|
||||
|
||||
if (IGameEvent *copy = shared::g_pGameEventManager->DuplicateEvent(event)) eventStack.push_back(copy);
|
||||
|
||||
if (localDontBroadcast != bDontBroadcast)
|
||||
RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, true, &IGameEventManager2::FireEvent,
|
||||
(event, localDontBroadcast));
|
||||
|
||||
RETURN_META_VALUE(MRES_IGNORED, true);
|
||||
}
|
||||
|
||||
bool OnFireEventPost(IGameEvent *event, bool bDontBroadcast) {
|
||||
if (!event)
|
||||
RETURN_META_VALUE(MRES_IGNORED, false);
|
||||
|
||||
if (!eventStack.empty()) {
|
||||
IGameEvent *copy = eventStack.back();
|
||||
eventStack.pop_back();
|
||||
|
||||
bool dummy = bDontBroadcast;
|
||||
DispatchGameEvent(copy, HookMode::Post, dummy);
|
||||
shared::g_pGameEventManager->FreeEvent(copy);
|
||||
}
|
||||
|
||||
RETURN_META_VALUE(MRES_IGNORED, true);
|
||||
}
|
||||
|
||||
void Hook_DispatchConCommand(ConCommandRef, const CCommandContext &ctx, const CCommand &args) {
|
||||
if (args.ArgC() >= 2) {
|
||||
const char *cmd = args.Arg(0);
|
||||
const char *msg = args.Arg(1);
|
||||
|
||||
if (V_strcmp(cmd, "say") == 0 || V_strcmp(cmd, "say_team") == 0) {
|
||||
std::string message = msg;
|
||||
|
||||
if (message.size() >= 2 && message.front() == '"' && message.back() == '"')
|
||||
message = message.substr(1, message.size() - 2);
|
||||
|
||||
if (!message.empty() && (message[0] == '!' || message[0] == '/')) {
|
||||
std::string cleaned = message.substr(1);
|
||||
|
||||
CCommand parsed;
|
||||
parsed.Tokenize(cleaned.c_str());
|
||||
|
||||
if (parsed.ArgC() > 0) {
|
||||
HookResult r = DispatchConsoleListener(ctx, parsed, HookMode::Pre);
|
||||
if (r != HookResult::Stop)
|
||||
DispatchConsoleListener(ctx, parsed, HookMode::Post);
|
||||
}
|
||||
|
||||
RETURN_META(MRES_SUPERCEDE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HookResult result = DispatchConsoleListener(ctx, args, HookMode::Pre);
|
||||
|
||||
if (result == HookResult::Handled || result == HookResult::Stop)
|
||||
RETURN_META(MRES_SUPERCEDE);
|
||||
|
||||
DispatchConsoleListener(ctx, args, HookMode::Post);
|
||||
}
|
||||
|
||||
void Shutdown() {
|
||||
consoleListeners.clear();
|
||||
shared::g_pGameEventManager->RemoveListener(&eventManager);
|
||||
gameEvents.clear();
|
||||
entitySpawnedListeners.clear();
|
||||
entityCreatedListeners.clear();
|
||||
entityDeletedListeners.clear();
|
||||
entityParentChangerListeners.clear();
|
||||
commandCallbacks.clear();
|
||||
registeredNames.clear();
|
||||
registeredCommands.clear();
|
||||
for (auto hook: hookHandles) {
|
||||
if (!hook) continue;
|
||||
|
||||
int rc = funchook_uninstall(hook, 0);
|
||||
if (rc != 0) {
|
||||
FP_ERROR("Failed to uninstall hook: {}", rc);
|
||||
}
|
||||
|
||||
rc = funchook_destroy(hook);
|
||||
if (rc != 0) {
|
||||
FP_ERROR("Failed to destroy hook: {}", rc);
|
||||
}
|
||||
}
|
||||
hookHandles.clear();
|
||||
signatureHooks.clear();
|
||||
shared::g_pEntitySystem->RemoveListenerEntity(&entityListener);
|
||||
}
|
||||
}
|
||||
}
|
||||
293
src/detours.h
293
src/detours.h
|
|
@ -1,293 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 20.06.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include <any>
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <igameevents.h>
|
||||
#include <convar.h>
|
||||
#include <features.h>
|
||||
#include <ISmmPlugin.h>
|
||||
#include <TemplatePlugin.h>
|
||||
#include <funchook/include/funchook.h>
|
||||
#include <type_traits>
|
||||
#include "detourtypes.h"
|
||||
#include "entitysystem.h"
|
||||
#include "log.h"
|
||||
#include "dynlibutils/module.h"
|
||||
|
||||
namespace TemplatePlugin::Detours
|
||||
{
|
||||
struct CommandEntry
|
||||
{
|
||||
CommandHandler handler;
|
||||
HookMode mode;
|
||||
};
|
||||
|
||||
struct EventEntry
|
||||
{
|
||||
GameEventHandler handler;
|
||||
HookMode mode;
|
||||
};
|
||||
|
||||
class EventManager : public IGameEventListener2
|
||||
{
|
||||
void FireGameEvent(IGameEvent* pEvent) override;
|
||||
};
|
||||
|
||||
static std::unordered_map<std::string, std::vector<SignatureEntry>> signatureHooks;
|
||||
static std::mutex signatureHooksMutex;
|
||||
static std::vector<funchook_t*> hookHandles;
|
||||
extern std::unordered_map<std::string, std::any> overriddenReturns;
|
||||
extern std::mutex overriddenReturnsMutex;
|
||||
|
||||
void Shutdown();
|
||||
|
||||
void InitHooks();
|
||||
|
||||
void ShutdownHooks();
|
||||
|
||||
bool OnFireEvent(IGameEvent* event, bool bDontBroadcast);
|
||||
|
||||
bool OnFireEventPost(IGameEvent* event, bool bDontBroadcast);
|
||||
|
||||
void ConCommandRouter(const CCommandContext& ctx, const CCommand& args);
|
||||
|
||||
void Hook_DispatchConCommand(ConCommandRef, const CCommandContext&, const CCommand&);
|
||||
|
||||
void RegisterConsoleListener(const std::string& name, CommandHandler handler, HookMode mode = HookMode::Post);
|
||||
|
||||
void RegisterChatListener(const std::string& name,
|
||||
const std::function<void(const CCommandContext&, const CCommand&, HookMode)>& handler);
|
||||
|
||||
void RegisterConsoleCommand(const std::string& name,
|
||||
const std::function<void(const CCommandContext&, const CCommand&,
|
||||
HookMode)>& handler);
|
||||
|
||||
void RegisterGameEvent(const std::string& name, GameEventHandler handler, HookMode mode = HookMode::Post);
|
||||
|
||||
void RegisterEntityListener(EntityEventHandler handler, EntityEventType type);
|
||||
|
||||
inline void RegisterSignatureHandler(const std::string& name,
|
||||
SignatureHandler handler,
|
||||
HookMode mode = HookMode::Post)
|
||||
{
|
||||
std::scoped_lock lock(signatureHooksMutex);
|
||||
signatureHooks[name].push_back({handler, mode});
|
||||
}
|
||||
|
||||
void* FindModuleSignature(const DynLibUtils::CModule& module, const char* name);
|
||||
|
||||
template <typename T>
|
||||
inline void* ToVoidArg(T&& v)
|
||||
{
|
||||
return const_cast<void*>(reinterpret_cast<const void*>(&v));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline void* ToVoidArg(T* v)
|
||||
{
|
||||
return const_cast<void*>(reinterpret_cast<const void*>(v));
|
||||
}
|
||||
|
||||
template <typename Fn, typename... Args>
|
||||
auto DispatchSignatureCall(const std::string& name, Fn original, Args... args)
|
||||
-> decltype(original(args...))
|
||||
{
|
||||
using Ret = decltype(original(args...));
|
||||
std::vector<SignatureEntry> hooksCopy;
|
||||
|
||||
{
|
||||
std::scoped_lock lock(signatureHooksMutex);
|
||||
auto it = signatureHooks.find(name);
|
||||
if (it != signatureHooks.end())
|
||||
hooksCopy = it->second;
|
||||
}
|
||||
|
||||
void* argArray[] = {ToVoidArg(args)...};
|
||||
constexpr size_t argCount = sizeof...(Args);
|
||||
void* self = argCount > 0 ? argArray[0] : nullptr;
|
||||
|
||||
bool skipOriginal = false;
|
||||
bool allowReturnOverride = false;
|
||||
|
||||
if constexpr (!std::is_void_v<Ret>)
|
||||
{
|
||||
Ret result{};
|
||||
DynamicHook hook{argArray, argCount, self, &result};
|
||||
|
||||
// --- PRE hooks ---
|
||||
for (auto& entry : hooksCopy)
|
||||
{
|
||||
if (entry.mode != HookMode::Pre) continue;
|
||||
HookResult r = entry.handler(&hook, HookMode::Pre);
|
||||
if (r == HookResult::Stop) return result;
|
||||
if (r == HookResult::Handled)
|
||||
{
|
||||
skipOriginal = true;
|
||||
return result;
|
||||
}
|
||||
if (r == HookResult::Changed) allowReturnOverride = true;
|
||||
}
|
||||
|
||||
// --- Originál ---
|
||||
if (!skipOriginal && original)
|
||||
{
|
||||
if (!(allowReturnOverride && hook.returnOverridden))
|
||||
{
|
||||
result = original(args...);
|
||||
}
|
||||
}
|
||||
|
||||
// --- POST hooks ---
|
||||
for (auto& entry : hooksCopy)
|
||||
{
|
||||
if (entry.mode != HookMode::Post) continue;
|
||||
HookResult r = entry.handler(&hook, HookMode::Post);
|
||||
if (r == HookResult::Stop) break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
DynamicHook hook{argArray, argCount, self, nullptr};
|
||||
|
||||
// --- PRE hooks ---
|
||||
for (auto& entry : hooksCopy)
|
||||
{
|
||||
if (entry.mode != HookMode::Pre) continue;
|
||||
HookResult r = entry.handler(&hook, HookMode::Pre);
|
||||
if (r == HookResult::Stop) return;
|
||||
if (r == HookResult::Handled)
|
||||
{
|
||||
skipOriginal = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// --- Originál ---
|
||||
if (!skipOriginal && original)
|
||||
{
|
||||
original(args...);
|
||||
}
|
||||
|
||||
// --- POST hooks ---
|
||||
for (auto& entry : hooksCopy)
|
||||
{
|
||||
if (entry.mode != HookMode::Post) continue;
|
||||
HookResult r = entry.handler(&hook, HookMode::Post);
|
||||
if (r == HookResult::Stop) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename R, typename... Args>
|
||||
void RegisterSignatureDetour(
|
||||
const std::string& sigName,
|
||||
DynLibUtils::CModule module,
|
||||
R (**ppOriginal)(Args...),
|
||||
SignatureHandler handler,
|
||||
HookMode mode
|
||||
)
|
||||
{
|
||||
std::scoped_lock lock(signatureHooksMutex);
|
||||
|
||||
auto it = signatureHooks.find(sigName);
|
||||
if (it != signatureHooks.end())
|
||||
{
|
||||
it->second.push_back({handler, mode});
|
||||
return;
|
||||
}
|
||||
|
||||
void* addr = FindModuleSignature(std::move(module), sigName.c_str());
|
||||
if (!addr)
|
||||
{
|
||||
FP_ERROR("Failed to find signature for '{}'", sigName);
|
||||
return;
|
||||
}
|
||||
|
||||
*ppOriginal = reinterpret_cast<R(*)(Args...)>(addr);
|
||||
SignatureStorage<R(*)(Args...)>::name = sigName;
|
||||
|
||||
auto detour = [](Args... args) -> R
|
||||
{
|
||||
auto orig = SignatureStorage<R(*)(Args...)>::original;
|
||||
return DispatchSignatureCall(SignatureStorage<R(*)(Args...)>::name, orig, args...);
|
||||
};
|
||||
|
||||
auto hook = funchook_create();
|
||||
using FnType = R(*)(Args...);
|
||||
|
||||
if (funchook_prepare(
|
||||
hook,
|
||||
reinterpret_cast<void**>(ppOriginal),
|
||||
reinterpret_cast<void*>(static_cast<FnType>(detour))
|
||||
) != 0 ||
|
||||
funchook_install(hook, 0) != 0)
|
||||
{
|
||||
FP_ERROR("Failed to hook '{}'", sigName);
|
||||
return;
|
||||
}
|
||||
|
||||
SignatureStorage<R(*)(Args...)>::original = *ppOriginal;
|
||||
|
||||
signatureHooks[sigName] = {};
|
||||
signatureHooks[sigName].push_back({handler, mode});
|
||||
hookHandles.push_back(hook);
|
||||
}
|
||||
|
||||
HookResult DispatchConsoleListener(const CCommandContext& ctx, const CCommand& args, HookMode mode);
|
||||
|
||||
bool DispatchGameEvent(IGameEvent* event, HookMode mode, bool& dontBroadcast);
|
||||
|
||||
void DispatchEntitySpawn(CEntityInstance* entity);
|
||||
|
||||
void DispatchEntityCreate(CEntityInstance* entity);
|
||||
|
||||
void DispatchEntityDelete(CEntityInstance* entity);
|
||||
|
||||
class CEntityListener : public IEntityListener
|
||||
{
|
||||
void OnEntitySpawned(CEntityInstance* pEntity) override { DispatchEntitySpawn(pEntity); }
|
||||
void OnEntityCreated(CEntityInstance* pEntity) override { DispatchEntityCreate(pEntity); }
|
||||
void OnEntityDeleted(CEntityInstance* pEntity) override { DispatchEntityDelete(pEntity); }
|
||||
|
||||
void OnEntityParentChanged(CEntityInstance* pEntity, CEntityInstance* pNewParent) override
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
void HookSingleEntityOutput(CEntityInstance* entity,
|
||||
const std::string& outputName,
|
||||
EntityOutputHandler handler,
|
||||
HookMode mode = HookMode::Post);
|
||||
|
||||
void UnhookSingleEntityOutput(CEntityInstance* entity,
|
||||
const std::string& outputName,
|
||||
EntityOutputHandler handler,
|
||||
HookMode mode = HookMode::Post);
|
||||
|
||||
HookResult DispatchEntityOutput(CEntityIOOutput* output,
|
||||
const char* name,
|
||||
CEntityInstance* activator,
|
||||
CEntityInstance* caller,
|
||||
const CVariant* value,
|
||||
float delay,
|
||||
HookMode mode);
|
||||
|
||||
inline CEntityListener entityListener;
|
||||
|
||||
inline CommandHandler WrapVoidHandler(
|
||||
const std::function<void(const CCommandContext&, const CCommand&, HookMode)>& fn)
|
||||
{
|
||||
return [fn](const CCommandContext& ctx, const CCommand& args, HookMode mode) -> HookResult
|
||||
{
|
||||
fn(ctx, args, mode);
|
||||
return HookResult::Continue;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
#include <convar.h>
|
||||
#include <string>
|
||||
|
||||
namespace TemplatePlugin
|
||||
namespace RayTracePlugin
|
||||
{
|
||||
class CBaseEntity;
|
||||
class CTakeDamageInfo;
|
||||
|
|
|
|||
|
|
@ -1,13 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 21.11.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#include "Events.h"
|
||||
#include <detours.h>
|
||||
|
||||
namespace TemplatePlugin::Events
|
||||
{
|
||||
void InitEvents()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 21.11.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#pragma once
|
||||
#include "detourtypes.h"
|
||||
|
||||
namespace TemplatePlugin::Events
|
||||
{
|
||||
void InitEvents();
|
||||
}
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 21.09.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#include "Shared.h"
|
||||
#include "game_system.h"
|
||||
#include <tier0/vprof.h>
|
||||
|
||||
#include "log.h"
|
||||
#include "dynlibutils/module.h"
|
||||
|
||||
CBaseGameSystemFactory** CBaseGameSystemFactory::sm_pFirst = nullptr;
|
||||
|
||||
CGameSystem g_GameSystem;
|
||||
IGameSystemFactory* CGameSystem::sm_Factory = nullptr;
|
||||
|
||||
IEntityResourceManifest* m_exportResourceManifest = nullptr;
|
||||
|
||||
// This mess is needed to get the pointer to sm_pFirst so we can insert game systems
|
||||
bool InitGameSystems()
|
||||
{
|
||||
DynLibUtils::CModule libserver(TemplatePlugin::shared::g_pServer);
|
||||
|
||||
auto result = libserver.FindPattern(TemplatePlugin::shared::g_pGameConfig->GetSignature("IGameSystem_InitAllSystems_pFirst"));
|
||||
if (!result)
|
||||
{
|
||||
FP_ERROR("Failed to find IGameSystem_InitAllSystems_pFirst!");
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t* ptr = reinterpret_cast<uint8_t*>(result.GetPtr()) + 3;
|
||||
uint32 offset = *(uint32*)ptr;
|
||||
ptr += 4;
|
||||
|
||||
CBaseGameSystemFactory::sm_pFirst = (CBaseGameSystemFactory**)(ptr + offset);
|
||||
CGameSystem::sm_Factory = new CGameSystemStaticFactory<CGameSystem>("Template_GameSystem", &g_GameSystem);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
GS_EVENT_MEMBER(CGameSystem, BuildGameSessionManifest)
|
||||
{
|
||||
IEntityResourceManifest* pResourceManifest = msg->m_pResourceManifest;
|
||||
|
||||
m_exportResourceManifest = pResourceManifest;
|
||||
}
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 21.09.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "entitysystem.h"
|
||||
#include "igamesystemfactory.h"
|
||||
|
||||
bool InitGameSystems();
|
||||
|
||||
class CGameSystem : public CBaseGameSystem
|
||||
{
|
||||
public:
|
||||
GS_EVENT(BuildGameSessionManifest);
|
||||
|
||||
void Shutdown() override
|
||||
{
|
||||
delete sm_Factory;
|
||||
}
|
||||
|
||||
void SetGameSystemGlobalPtrs(void* pValue) override
|
||||
{
|
||||
if (sm_Factory) sm_Factory->SetGlobalPtr(pValue);
|
||||
}
|
||||
|
||||
bool DoesGameSystemReallocate() override { return sm_Factory->ShouldAutoAdd(); }
|
||||
|
||||
static IGameSystemFactory* sm_Factory;
|
||||
};
|
||||
|
|
@ -4,9 +4,9 @@
|
|||
//
|
||||
#include "gameconfig.h"
|
||||
#include <fstream>
|
||||
#include <TemplatePlugin.h>
|
||||
#include <Plugin.h>
|
||||
|
||||
namespace TemplatePlugin
|
||||
namespace RayTracePlugin
|
||||
{
|
||||
CGameConfig::CGameConfig(const std::string& path) { m_sPath = path; }
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
#undef snprintf
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
namespace TemplatePlugin {
|
||||
namespace RayTracePlugin {
|
||||
class CGameConfig
|
||||
{
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -1,18 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 21.11.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#include "Hooks.h"
|
||||
#include "detours.h"
|
||||
#include "log.h"
|
||||
#include "PlayersData.h"
|
||||
#include "PluginData.h"
|
||||
#include "schema/CCSPlayerController.h"
|
||||
#include "schema/CUserCmd.h"
|
||||
|
||||
namespace TemplatePlugin::Hooks
|
||||
{
|
||||
void InitHooks()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 21.11.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#pragma once
|
||||
#include "detourtypes.h"
|
||||
|
||||
namespace TemplatePlugin::Hooks
|
||||
{
|
||||
void InitHooks();
|
||||
}
|
||||
|
|
@ -3,20 +3,16 @@
|
|||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#include "Listeners.h"
|
||||
#include <detours.h>
|
||||
#include <RayTrace.h>
|
||||
#include <Shared.h>
|
||||
#include <tasks.h>
|
||||
#include <commands/Commands.h>
|
||||
#include <dynlibutils/module.h>
|
||||
#include <events/Events.h>
|
||||
#include <schema/CGameRules.h>
|
||||
|
||||
class GameSessionConfiguration_t
|
||||
{
|
||||
};
|
||||
|
||||
namespace TemplatePlugin::Listeners {
|
||||
namespace RayTracePlugin::Listeners {
|
||||
SourceHooks sourceHooks;
|
||||
|
||||
SH_DECL_HOOK3_void(IServerGameDLL, GameFrame, SH_NOATTRIB, 0, bool, bool, bool);
|
||||
|
|
@ -50,12 +46,6 @@ namespace TemplatePlugin::Listeners {
|
|||
Tasks::Tick(simulating);
|
||||
if (!shared::getGlobalVars())
|
||||
return;
|
||||
|
||||
shared::g_bHasTicked = true;
|
||||
|
||||
if (CCSGameRules::FindGameRules())
|
||||
CCSGameRules::FindGameRules()->m_bGameRestart =
|
||||
CCSGameRules::FindGameRules()->m_flRestartRoundTime < shared::GetCurrentTime();
|
||||
}
|
||||
|
||||
void SourceHooks::Hook_StartupServer(const GameSessionConfiguration_t& config,
|
||||
|
|
@ -64,18 +54,9 @@ namespace TemplatePlugin::Listeners {
|
|||
if (!shared::g_bDetoursLoaded)
|
||||
{
|
||||
shared::g_pEntitySystem = GameEntitySystem();
|
||||
shared::g_pEntitySystem->AddListenerEntity(&Detours::entityListener);
|
||||
Commands::InitCommands();
|
||||
Events::InitEvents();
|
||||
Detours::InitHooks();
|
||||
RayTrace::Initialize();
|
||||
shared::g_bDetoursLoaded = true;
|
||||
}
|
||||
if (shared::g_bHasTicked)
|
||||
{
|
||||
Tasks::RemoveMapChangeTimers();
|
||||
}
|
||||
shared::g_bHasTicked = false;
|
||||
}
|
||||
|
||||
int SourceHooks::Hook_LoadEventsFromFile(const char* filename, bool bSearchAll)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
#include <sourcehook.h>
|
||||
#include <iserver.h>
|
||||
|
||||
namespace TemplatePlugin::Listeners {
|
||||
namespace RayTracePlugin::Listeners {
|
||||
void InitListeners();
|
||||
|
||||
void DestructListeners();
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
namespace TemplatePlugin {
|
||||
namespace RayTracePlugin {
|
||||
std::shared_ptr<spdlog::logger> Log::m_FP_logger;
|
||||
|
||||
void Log::Init() {
|
||||
|
|
@ -28,13 +28,13 @@ namespace TemplatePlugin {
|
|||
auto color_sink = std::make_shared<spdlog::sinks::stderr_color_sink_mt>();
|
||||
color_sink->set_pattern("%^[%T.%e] %n: %v%$");
|
||||
|
||||
auto file_sink = std::make_shared<spdlog::sinks::basic_file_sink_mt>("TemplatePlugin.log", true);
|
||||
auto file_sink = std::make_shared<spdlog::sinks::basic_file_sink_mt>("RayTrace.log", true);
|
||||
file_sink->set_pattern("[%T.%e] [%^%l%$] %n: %v");
|
||||
|
||||
sinks.emplace_back(color_sink);
|
||||
sinks.emplace_back(file_sink);
|
||||
|
||||
m_FP_logger = std::make_shared<spdlog::logger>("TemplatePlugin", sinks.begin(), sinks.end());
|
||||
m_FP_logger = std::make_shared<spdlog::logger>("RayTrace", sinks.begin(), sinks.end());
|
||||
register_logger(m_FP_logger);
|
||||
m_FP_logger->set_level(spdlog::level::trace);
|
||||
m_FP_logger->flush_on(spdlog::level::info);
|
||||
|
|
@ -43,7 +43,7 @@ namespace TemplatePlugin {
|
|||
}
|
||||
|
||||
void Log::Close() {
|
||||
spdlog::drop("TemplatePlugin");
|
||||
spdlog::drop("RayTrace");
|
||||
m_FP_logger.reset();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
14
src/log.h
14
src/log.h
|
|
@ -7,7 +7,7 @@
|
|||
#include <memory>
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
namespace TemplatePlugin {
|
||||
namespace RayTracePlugin {
|
||||
class Log {
|
||||
public:
|
||||
static void Init();
|
||||
|
|
@ -20,9 +20,9 @@ namespace TemplatePlugin {
|
|||
};
|
||||
}
|
||||
|
||||
#define FP_TRACE(fmt, ...) ::TemplatePlugin::Log::GetLogger()->trace("- [ " fmt " ] -", ##__VA_ARGS__)
|
||||
#define FP_DEBUG(fmt, ...) ::TemplatePlugin::Log::GetLogger()->debug("- [ " fmt " ] -", ##__VA_ARGS__)
|
||||
#define FP_INFO(fmt, ...) ::TemplatePlugin::Log::GetLogger()->info("- [ " fmt " ] -", ##__VA_ARGS__)
|
||||
#define FP_WARN(fmt, ...) ::TemplatePlugin::Log::GetLogger()->warn("- [ " fmt " ] -", ##__VA_ARGS__)
|
||||
#define FP_ERROR(fmt, ...) ::TemplatePlugin::Log::GetLogger()->error("- [ " fmt " ] -", ##__VA_ARGS__)
|
||||
#define FP_CRITICAL(fmt, ...) ::TemplatePlugin::Log::GetLogger()->critical("- [ " fmt " ] -", ##__VA_ARGS__)
|
||||
#define FP_TRACE(fmt, ...) ::RayTracePlugin::Log::GetLogger()->trace("- [ " fmt " ] -", ##__VA_ARGS__)
|
||||
#define FP_DEBUG(fmt, ...) ::RayTracePlugin::Log::GetLogger()->debug("- [ " fmt " ] -", ##__VA_ARGS__)
|
||||
#define FP_INFO(fmt, ...) ::RayTracePlugin::Log::GetLogger()->info("- [ " fmt " ] -", ##__VA_ARGS__)
|
||||
#define FP_WARN(fmt, ...) ::RayTracePlugin::Log::GetLogger()->warn("- [ " fmt " ] -", ##__VA_ARGS__)
|
||||
#define FP_ERROR(fmt, ...) ::RayTracePlugin::Log::GetLogger()->error("- [ " fmt " ] -", ##__VA_ARGS__)
|
||||
#define FP_CRITICAL(fmt, ...) ::RayTracePlugin::Log::GetLogger()->critical("- [ " fmt " ] -", ##__VA_ARGS__)
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
#include <string>
|
||||
#include "Shared.h"
|
||||
|
||||
namespace TemplatePlugin::Paths {
|
||||
namespace RayTracePlugin::Paths {
|
||||
static std::string gameDirectory;
|
||||
|
||||
inline std::string GameDirectory() {
|
||||
|
|
@ -20,10 +20,10 @@ namespace TemplatePlugin::Paths {
|
|||
return gameDirectory;
|
||||
}
|
||||
|
||||
inline std::string GetRootDirectory() { return GameDirectory() + "/addons/TemplatePlugin"; }
|
||||
inline std::string GetRootDirectory() { return GameDirectory() + "/addons/RayTracePlugin"; }
|
||||
inline std::string EnginePath() { return GameDirectory() + "../bin/linuxsteamrt64/libengine2.so"; }
|
||||
inline std::string Tier0Path() { return GameDirectory() + "../bin/linuxsteamrt64/libtier0.so"; }
|
||||
inline std::string ServerPath() { return GameDirectory() + "/bin/linuxsteamrt64/libserver.so"; }
|
||||
inline std::string SchemaSystemPath() { return GameDirectory() + "../bin/linuxsteamrt64/libschemasystem.so"; }
|
||||
inline std::string VScriptPath() { return GameDirectory() + "../bin/linuxsteamrt64/libvscript.so"; }
|
||||
} // namespace TemplatePlugin::Paths
|
||||
} // namespace RayTracePlugin::Paths
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 10.07.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#include "prints.h"
|
||||
#include "PlayersData.h"
|
||||
#include <igameeventsystem.h>
|
||||
#include <regex>
|
||||
#include <networksystem/inetworkmessages.h>
|
||||
#include "usermessages.pb.h"
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
namespace TemplatePlugin::Prints
|
||||
{
|
||||
std::string ReplaceColorTags(const std::string &input) {
|
||||
static const std::vector<std::pair<std::string, std::string> > tags = {
|
||||
{"[[DEFAULT]]", "\x01"}, {"[[DARKRED]]", "\x02"}, {"[[LIGHTPURPLE]]", "\x03"}, {"[[GREEN]]", "\x04"},
|
||||
{"[[OLIVE]]", "\x05"}, {"[[LIME]]", "\x06"}, {"[[RED]]", "\x07"}, {"[[GREY]]", "\x08"},
|
||||
{"[[YELLOW]]", "\x09"}, {"[[SILVER]]", "\x0A"}, {"[[BLUE]]", "\x0B"}, {"[[DARKBLUE]]", "\x0C"},
|
||||
{"[[ORANGE]]", "\x10"}, {"[[PURPLE]]", "\x0E"}
|
||||
};
|
||||
|
||||
std::string result = input;
|
||||
for (const auto &[tag, code]: tags) {
|
||||
size_t pos;
|
||||
while ((pos = result.find(tag)) != std::string::npos)
|
||||
result.replace(pos, tag.length(), code);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string ReplaceFormatTags(const std::string &input) {
|
||||
std::string result = ReplaceColorTags(input);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void ChatToPlayer(CCSPlayerController* player, const std::string& msg)
|
||||
{
|
||||
if (!player || !player->CheckValid())
|
||||
return;
|
||||
|
||||
ClientPrintNative(player->GetPlayerSlot(), HudDestination::Chat, ReplaceColorTags(" " + msg).c_str());
|
||||
}
|
||||
|
||||
void ClientPrintNative(CPlayerSlot slot, HudDestination dest, const char* msg)
|
||||
{
|
||||
INetworkMessageInternal* pNetMsg = shared::g_pNetworkMessages->FindNetworkMessagePartial("TextMsg");
|
||||
auto data = pNetMsg->AllocateMessage()->ToPB<CUserMessageTextMsg>();
|
||||
data->set_dest(static_cast<google::protobuf::uint32>(dest));
|
||||
data->add_param(msg);
|
||||
|
||||
CPlayerBitVec recipients;
|
||||
recipients.Set(slot.Get());
|
||||
|
||||
shared::g_pGameEventSystem->PostEventAbstract(
|
||||
CSplitScreenSlot(-1), false, ABSOLUTE_PLAYER_LIMIT,
|
||||
reinterpret_cast<const uint64*>(recipients.Base()), pNetMsg, data,
|
||||
0, BUF_RELIABLE
|
||||
);
|
||||
|
||||
delete data;
|
||||
}
|
||||
}
|
||||
35
src/prints.h
35
src/prints.h
|
|
@ -1,35 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 10.07.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "schema/CCSPlayerController.h"
|
||||
#include "log.h"
|
||||
|
||||
namespace TemplatePlugin::Prints
|
||||
{
|
||||
enum class HudDestination : int
|
||||
{
|
||||
Center = 1,
|
||||
Alert = 2,
|
||||
Chat = 3
|
||||
};
|
||||
|
||||
void ClientPrintNative(CPlayerSlot slot, HudDestination dest, const char* msg);
|
||||
|
||||
std::string ReplaceColorTags(const std::string& input);
|
||||
|
||||
std::string ReplaceFormatTags(const std::string &input);
|
||||
|
||||
template<typename... Args>
|
||||
std::string FormatMessage(fmt::format_string<Args...> fmtStr, Args &&... args) {
|
||||
std::string formatted = fmt::format(fmtStr, std::forward<Args>(args)...);
|
||||
return ReplaceFormatTags(formatted);
|
||||
}
|
||||
|
||||
inline const char* PrefixCl() { return "[[DARKRED]][!][[DEFAULT]] "; }
|
||||
|
||||
void ChatToPlayer(CCSPlayerController* player, const std::string& msg);
|
||||
}
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 26.06.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#pragma once
|
||||
#include "CBaseEntity.h"
|
||||
#include "globaltypes.h"
|
||||
#include "CBaseModelEntity.h"
|
||||
|
||||
namespace
|
||||
TemplatePlugin
|
||||
{
|
||||
class IChoreoServices
|
||||
{
|
||||
DECLARE_SCHEMA_CLASS(IChoreoServices)
|
||||
};
|
||||
|
||||
class PhysicsRagdollPose_t
|
||||
{
|
||||
DECLARE_SCHEMA_CLASS(PhysicsRagdollPose_t)
|
||||
|
||||
SCHEMA_FIELD_POINTER(CUtlVector<CTransform>, m_Transforms)
|
||||
SCHEMA_FIELD(CHandle<CBaseEntity>, m_hOwner)
|
||||
SCHEMA_FIELD(bool, m_bSetFromDebugHistory)
|
||||
};
|
||||
|
||||
class CBaseAnimGraph : public CBaseModelEntity
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CBaseAnimGraph)
|
||||
|
||||
SCHEMA_FIELD(bool, m_bInitiallyPopulateInterpHistory)
|
||||
SCHEMA_FIELD(IChoreoServices *, m_pChoreoServices)
|
||||
SCHEMA_FIELD(bool, m_bAnimGraphUpdateEnabled)
|
||||
SCHEMA_FIELD(float, m_flMaxSlopeDistance)
|
||||
SCHEMA_FIELD(Vector, m_vLastSlopeCheckPos)
|
||||
SCHEMA_FIELD(bool, m_bAnimationUpdateScheduled)
|
||||
SCHEMA_FIELD(Vector, m_vecForce)
|
||||
SCHEMA_FIELD(int32, m_nForceBone)
|
||||
SCHEMA_FIELD(PhysicsRagdollPose_t, m_RagdollPose)
|
||||
SCHEMA_FIELD(bool, m_bRagdollEnabled)
|
||||
SCHEMA_FIELD(bool, m_bRagdollClientSide)
|
||||
SCHEMA_FIELD(CTransform, m_xParentedRagdollRootInEntitySpace)
|
||||
};
|
||||
}
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 07.11.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#pragma once
|
||||
#include "CBaseTrigger.h"
|
||||
#include "globaltypes.h"
|
||||
|
||||
namespace
|
||||
TemplatePlugin
|
||||
{
|
||||
class locksound_t
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(locksound_t);
|
||||
|
||||
SCHEMA_FIELD_POINTER(char, sLockedSound)
|
||||
SCHEMA_FIELD_POINTER(char, sUnlockedSound)
|
||||
SCHEMA_FIELD(float, flwaitSound)
|
||||
};
|
||||
|
||||
class CBaseButton : public CBaseToggle
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CBaseButton);
|
||||
|
||||
SCHEMA_FIELD(QAngle, m_angMoveEntitySpace)
|
||||
SCHEMA_FIELD(bool, m_fStayPushed)
|
||||
SCHEMA_FIELD(bool, m_fRotating)
|
||||
SCHEMA_FIELD(locksound_t, m_ls)
|
||||
SCHEMA_FIELD_POINTER(char, m_sUseSound)
|
||||
SCHEMA_FIELD_POINTER(char, m_sLockedSound)
|
||||
SCHEMA_FIELD_POINTER(char, m_sUnlockedSound)
|
||||
SCHEMA_FIELD_POINTER(char, m_sOverrideAnticipationName)
|
||||
SCHEMA_FIELD(bool, m_bLocked)
|
||||
SCHEMA_FIELD(bool, m_bDisabled)
|
||||
SCHEMA_FIELD(float, m_flUseLockedTime)
|
||||
SCHEMA_FIELD(bool, m_bSolidBsp)
|
||||
SCHEMA_FIELD(CEntityIOOutput, m_OnDamaged)
|
||||
SCHEMA_FIELD(CEntityIOOutput, m_OnPressed)
|
||||
SCHEMA_FIELD(CEntityIOOutput, m_OnUseLocked)
|
||||
SCHEMA_FIELD(CEntityIOOutput, m_OnIn)
|
||||
SCHEMA_FIELD(CEntityIOOutput, m_OnOut)
|
||||
SCHEMA_FIELD(int32, m_nState)
|
||||
SCHEMA_FIELD(CHandle<CEntityInstance>, m_hConstraint)
|
||||
SCHEMA_FIELD(CHandle<CEntityInstance>, m_hConstraintParent)
|
||||
SCHEMA_FIELD(bool, m_bForceNpcExclude)
|
||||
SCHEMA_FIELD_POINTER(char, m_sGlowEntity)
|
||||
SCHEMA_FIELD(CHandle<CBaseModelEntity>, m_glowEntity)
|
||||
SCHEMA_FIELD(bool, m_usable)
|
||||
SCHEMA_FIELD_POINTER(char, m_szDisplayText)
|
||||
};
|
||||
}
|
||||
|
|
@ -9,20 +9,19 @@
|
|||
#include "schemasystem.h"
|
||||
#include "ccollisionproperty.h"
|
||||
#include "globaltypes.h"
|
||||
#include "ctakedamageinfo.h"
|
||||
#include "virtual.h"
|
||||
#include "dynlibutils/module.h"
|
||||
#include "Shared.h"
|
||||
#include "ehandle.h"
|
||||
|
||||
namespace
|
||||
TemplatePlugin
|
||||
using namespace RayTracePlugin;
|
||||
|
||||
using UTIL_CreateEntityByName_t = CEntityInstance* (*)(const char* /*name*/, int /*forceEdictIndex*/);
|
||||
inline UTIL_CreateEntityByName_t g_UTIL_CreateEntityByName = nullptr;
|
||||
|
||||
template <typename T>
|
||||
inline T* UTIL_CreateEntityByName(const char* name)
|
||||
{
|
||||
using UTIL_CreateEntityByName_t = CEntityInstance* (*)(const char* /*name*/, int /*forceEdictIndex*/);
|
||||
inline UTIL_CreateEntityByName_t g_UTIL_CreateEntityByName = nullptr;
|
||||
|
||||
template <typename T>
|
||||
inline T* UTIL_CreateEntityByName(const char* name)
|
||||
{
|
||||
if (!g_UTIL_CreateEntityByName)
|
||||
{
|
||||
UTIL_CreateEntityByName_t addr = DynLibUtils::CModule(shared::g_pServer).FindPattern(
|
||||
|
|
@ -34,11 +33,11 @@ TemplatePlugin
|
|||
g_UTIL_CreateEntityByName = addr;
|
||||
}
|
||||
return reinterpret_cast<T*>(g_UTIL_CreateEntityByName(name, -1));
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline std::vector<T*> UTIL_FindAllEntitiesByDesignerName(const char* designerName)
|
||||
{
|
||||
template <typename T>
|
||||
inline std::vector<T*> UTIL_FindAllEntitiesByDesignerName(const char* designerName)
|
||||
{
|
||||
std::vector<T*> results;
|
||||
|
||||
if (!designerName || !shared::g_pEntitySystem)
|
||||
|
|
@ -57,10 +56,10 @@ TemplatePlugin
|
|||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
}
|
||||
|
||||
inline CEntityInstance* UTIL_GetEntityByIndex(int index)
|
||||
{
|
||||
inline CEntityInstance* UTIL_GetEntityByIndex(int index)
|
||||
{
|
||||
if (!shared::g_pEntitySystem) return nullptr;
|
||||
CEntityIdentity* pEntity = shared::g_pEntitySystem->m_EntityList.m_pFirstActiveEntity;
|
||||
|
||||
|
|
@ -71,10 +70,10 @@ TemplatePlugin
|
|||
};
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
inline CEntityInstance* UTIL_FindEntityByClassname(const char* name)
|
||||
{
|
||||
inline CEntityInstance* UTIL_FindEntityByClassname(const char* name)
|
||||
{
|
||||
if (!shared::g_pEntitySystem) return nullptr;
|
||||
CEntityIdentity* pEntity = shared::g_pEntitySystem->m_EntityList.m_pFirstActiveEntity;
|
||||
|
||||
|
|
@ -85,10 +84,10 @@ TemplatePlugin
|
|||
};
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
inline CEntityInstance* UTIL_FindEntityByEHandle(CEntityInstance* pFind)
|
||||
{
|
||||
inline CEntityInstance* UTIL_FindEntityByEHandle(CEntityInstance* pFind)
|
||||
{
|
||||
if (!shared::g_pEntitySystem) return nullptr;
|
||||
CEntityIdentity* pEntity = shared::g_pEntitySystem->m_EntityList.m_pFirstActiveEntity;
|
||||
|
||||
|
|
@ -99,23 +98,23 @@ TemplatePlugin
|
|||
};
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
typedef void (*CEntityInstance_AcceptInput_t)(CEntityInstance* pThis, const char* pInputName,
|
||||
typedef void (*CEntityInstance_AcceptInput_t)(CEntityInstance* pThis, const char* pInputName,
|
||||
CEntityInstance* pActivator, CEntityInstance* pCaller,
|
||||
const variant_t& pValue, int nOutputID, void* pUnk1);
|
||||
inline CEntityInstance_AcceptInput_t g_CEntityInstance_AcceptInput = nullptr;
|
||||
inline CEntityInstance_AcceptInput_t g_CEntityInstance_AcceptInput = nullptr;
|
||||
|
||||
typedef void (*CEntitySystem_AddEntityIOEvent_t)(CEntitySystem* pEntitySystem, CEntityInstance* pThis,
|
||||
typedef void (*CEntitySystem_AddEntityIOEvent_t)(CEntitySystem* pEntitySystem, CEntityInstance* pThis,
|
||||
const char* pInputName, CEntityInstance* pActivator,
|
||||
CEntityInstance* pCaller, const variant_t& pValue, float delay,
|
||||
int nOutputID, void* pUnk1, void* pUnk2);
|
||||
inline CEntitySystem_AddEntityIOEvent_t g_CEntitySystem_AddEntityIOEvent = nullptr;
|
||||
inline CEntitySystem_AddEntityIOEvent_t g_CEntitySystem_AddEntityIOEvent = nullptr;
|
||||
|
||||
|
||||
class CGameSceneNode
|
||||
{
|
||||
public:
|
||||
class CGameSceneNode
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CGameSceneNode)
|
||||
|
||||
SCHEMA_FIELD(CEntityInstance*, m_pOwner);
|
||||
|
|
@ -170,43 +169,43 @@ TemplatePlugin
|
|||
|
||||
return mat;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
class CBodyComponent
|
||||
{
|
||||
public:
|
||||
class CBodyComponent
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CBodyComponent)
|
||||
|
||||
SCHEMA_FIELD(CGameSceneNode *, m_pSceneNode);
|
||||
};
|
||||
};
|
||||
|
||||
class CModelState
|
||||
{
|
||||
public:
|
||||
class CModelState
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CModelState)
|
||||
|
||||
SCHEMA_FIELD(CUtlSymbolLarge, m_ModelName)
|
||||
|
||||
SCHEMA_FIELD(uint64, m_MeshGroupMask)
|
||||
};
|
||||
};
|
||||
|
||||
class CSkeletonInstance : public CGameSceneNode
|
||||
{
|
||||
public:
|
||||
class CSkeletonInstance : public CGameSceneNode
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CSkeletonInstance)
|
||||
|
||||
SCHEMA_FIELD(CModelState, m_modelState)
|
||||
};
|
||||
};
|
||||
|
||||
class CEntitySubclassVDataBase
|
||||
{
|
||||
public:
|
||||
class CEntitySubclassVDataBase
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CEntitySubclassVDataBase)
|
||||
};
|
||||
};
|
||||
|
||||
class CBaseEntity : public CEntityInstance
|
||||
{
|
||||
public:
|
||||
class CBaseEntity : public CEntityInstance
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CBaseEntity)
|
||||
|
||||
SCHEMA_FIELD(float32, m_flSimulationTime)
|
||||
|
|
@ -451,35 +450,34 @@ TemplatePlugin
|
|||
variant_t(value), flDelay, 0,
|
||||
0LL, 0LL);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
class CBodyComponentSkeletonInstance : public CBodyComponent
|
||||
{
|
||||
public:
|
||||
class CBodyComponentSkeletonInstance : public CBodyComponent
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CBodyComponentSkeletonInstance);
|
||||
};
|
||||
};
|
||||
|
||||
class CBaseAnimGraphController
|
||||
{
|
||||
public:
|
||||
class CBaseAnimGraphController
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS_INLINE(CBaseAnimGraphController);
|
||||
|
||||
SCHEMA_FIELD(float, m_flPlaybackRate);
|
||||
};
|
||||
};
|
||||
|
||||
class CBodyComponentBaseAnimGraph : public CBodyComponentSkeletonInstance
|
||||
{
|
||||
public:
|
||||
class CBodyComponentBaseAnimGraph : public CBodyComponentSkeletonInstance
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CBodyComponentBaseAnimGraph);
|
||||
|
||||
SCHEMA_FIELD(CBaseAnimGraphController, m_animationController);
|
||||
};
|
||||
};
|
||||
|
||||
class SpawnPoint : public CBaseEntity
|
||||
{
|
||||
public:
|
||||
class SpawnPoint : public CBaseEntity
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(SpawnPoint);
|
||||
|
||||
SCHEMA_FIELD(bool, m_bEnabled);
|
||||
};
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 07.11.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#pragma once
|
||||
#include "CBaseTrigger.h"
|
||||
#include "globaltypes.h"
|
||||
|
||||
namespace
|
||||
TemplatePlugin
|
||||
{
|
||||
class CBaseFilter : public CBaseEntity
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CBaseFilter);
|
||||
|
||||
SCHEMA_FIELD(bool, m_bNegated)
|
||||
SCHEMA_FIELD(CEntityIOOutput, m_OnPass)
|
||||
SCHEMA_FIELD(CEntityIOOutput, m_OnFail)
|
||||
};
|
||||
}
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 26.06.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#pragma once
|
||||
#include "CBaseModelEntity.h"
|
||||
#include "CBasePlayerPawn.h"
|
||||
#include "globaltypes.h"
|
||||
|
||||
namespace TemplatePlugin {
|
||||
class CBaseGrenade : public CBaseModelEntity
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CBaseGrenade);
|
||||
SCHEMA_FIELD(CHandle<CCSPlayerPawn>, m_hThrower);
|
||||
SCHEMA_FIELD(float, m_flDamage);
|
||||
SCHEMA_FIELD(float, m_DmgRadius);
|
||||
};
|
||||
|
||||
class CBaseCSGrenadeProjectile : public CBaseGrenade
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CBaseCSGrenadeProjectile);
|
||||
};
|
||||
|
||||
class CSmokeGrenadeProjectile : public CBaseCSGrenadeProjectile
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CSmokeGrenadeProjectile);
|
||||
SCHEMA_FIELD(Vector, m_vSmokeColor);
|
||||
SCHEMA_FIELD(int, m_nSmokeEffectTickBegin);
|
||||
};
|
||||
}
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
#include "globaltypes.h"
|
||||
|
||||
namespace
|
||||
TemplatePlugin
|
||||
RayTracePlugin
|
||||
{
|
||||
class CBaseModelEntity : public CBaseEntity
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,83 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 26.06.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#pragma once
|
||||
#include "ehandle.h"
|
||||
#include "CCSPlayerPawn.h"
|
||||
|
||||
namespace TemplatePlugin
|
||||
{
|
||||
enum class PlayerConnectedState : uint32_t
|
||||
{
|
||||
PlayerNeverConnected = 0xFFFFFFFF,
|
||||
PlayerConnected = 0x0,
|
||||
PlayerConnecting = 0x1,
|
||||
PlayerReconnecting = 0x2,
|
||||
PlayerDisconnecting = 0x3,
|
||||
PlayerDisconnected = 0x4,
|
||||
PlayerReserved = 0x5,
|
||||
};
|
||||
|
||||
class CBasePlayerController : public CBaseEntity
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CBasePlayerController);
|
||||
|
||||
SCHEMA_FIELD(CHandle<CBasePlayerPawn>, m_hPawn)
|
||||
|
||||
SCHEMA_FIELD_POINTER(char, m_iszPlayerName)
|
||||
|
||||
SCHEMA_FIELD(PlayerConnectedState, m_iConnected)
|
||||
|
||||
SCHEMA_FIELD(uint32_t, m_iDesiredFOV);
|
||||
|
||||
SCHEMA_FIELD_POINTER(uint64_t, m_steamID)
|
||||
|
||||
SCHEMA_FIELD_POINTER(bool, m_bIsHLTV)
|
||||
|
||||
CBasePlayerPawn* GetPawn() { return m_hPawn.Get(); }
|
||||
const char* GetPlayerName() { return m_iszPlayerName(); }
|
||||
|
||||
void SetPlayerName(const std::string& name)
|
||||
{
|
||||
std::strncpy(m_iszPlayerName(), name.c_str(), 128);
|
||||
m_iszPlayerName()[127] = '\0';
|
||||
}
|
||||
|
||||
int GetPlayerSlot() { return GetEntityIndex().Get() - 1; }
|
||||
bool IsConnected() { return m_iConnected() == PlayerConnectedState::PlayerConnected; }
|
||||
|
||||
uint64_t GetSteamID() { return *m_steamID(); }
|
||||
void SetSteamID(uint64_t id) { *m_steamID() = id; }
|
||||
|
||||
bool GetIsHLTV() { return *m_bIsHLTV(); }
|
||||
void SetIsHLTV(bool value) { *m_bIsHLTV() = value; }
|
||||
|
||||
uint64_t& SteamID() { return *m_steamID(); }
|
||||
bool& IsHLTV() { return *m_bIsHLTV(); }
|
||||
|
||||
using CBasePlayerController_SetPawn_t = void(*)(CBasePlayerController* pController, CCSPlayerPawn* pPawn,
|
||||
bool a3, bool a4, bool a5, bool a6);
|
||||
|
||||
void SetPawn(CCSPlayerPawn* pawn)
|
||||
{
|
||||
if (!pawn) return;
|
||||
|
||||
CBasePlayerController_SetPawn_t CBasePlayerController_SetPawn = nullptr;
|
||||
|
||||
if (!CBasePlayerController_SetPawn)
|
||||
{
|
||||
CBasePlayerController_SetPawn_t addr = addr =
|
||||
DynLibUtils::CModule(shared::g_pServer)
|
||||
.FindPattern(shared::g_pGameConfig->GetSignature("CBasePlayerController_SetPawn"))
|
||||
.RCast<CBasePlayerController_SetPawn_t>();
|
||||
if (!addr)
|
||||
return;
|
||||
CBasePlayerController_SetPawn = addr;
|
||||
}
|
||||
|
||||
CBasePlayerController_SetPawn(this, pawn, true, false, false, false);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -1,76 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 26.06.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#pragma once
|
||||
#include "CBaseEntity.h"
|
||||
#include "CBaseModelEntity.h"
|
||||
#include "services.h"
|
||||
|
||||
namespace TemplatePlugin {
|
||||
enum class Hull_t : uint32
|
||||
{
|
||||
HULL_HUMAN = 0,
|
||||
HULL_SMALL_CENTERED = 1,
|
||||
HULL_WIDE_HUMAN = 2,
|
||||
HULL_TINY = 3,
|
||||
HULL_MEDIUM = 4,
|
||||
HULL_TINY_CENTERED = 5,
|
||||
HULL_LARGE = 6,
|
||||
HULL_LARGE_CENTERED = 7,
|
||||
HULL_MEDIUM_TALL = 8,
|
||||
HULL_SMALL = 9,
|
||||
NUM_HULLS = 10,
|
||||
HULL_NONE = 11,
|
||||
};
|
||||
|
||||
class CMovementStatsProperty
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CMovementStatsProperty);
|
||||
|
||||
SCHEMA_FIELD(uint32, m_nUseCounter);
|
||||
SCHEMA_FIELD(void*, m_emaMovementDirection);
|
||||
};
|
||||
|
||||
class CBaseCombatCharacter : public CBaseModelEntity
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CBaseCombatCharacter);
|
||||
|
||||
SCHEMA_FIELD(bool, m_bForceServerRagdoll);
|
||||
SCHEMA_FIELD_POINTER(CUtlVector<CHandle<CEconWearable>>, m_hMyWearables)
|
||||
SCHEMA_FIELD(float, m_impactEnergyScale);
|
||||
SCHEMA_FIELD(bool, m_bApplyStressDamage);
|
||||
SCHEMA_FIELD(bool, m_bDeathEventsDispatched);
|
||||
SCHEMA_FIELD(CUtlString, m_strRelationships);
|
||||
SCHEMA_FIELD(Hull_t, m_eHull);
|
||||
SCHEMA_FIELD(uint32, m_nNavHullIdx);
|
||||
SCHEMA_FIELD(CMovementStatsProperty, m_movementStats);
|
||||
};
|
||||
|
||||
class CBasePlayerPawn : public CBaseCombatCharacter
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CBasePlayerPawn);
|
||||
|
||||
SCHEMA_FIELD(CCSPlayer_MovementServices*, m_pMovementServices)
|
||||
SCHEMA_FIELD(CCSPlayer_WeaponServices*, m_pWeaponServices)
|
||||
SCHEMA_FIELD(CCSPlayer_ItemServices*, m_pItemServices)
|
||||
SCHEMA_FIELD(CPlayer_ObserverServices*, m_pObserverServices)
|
||||
SCHEMA_FIELD(CPlayer_CameraServices*, m_pCameraServices)
|
||||
SCHEMA_FIELD(CHandle<CBasePlayerController>, m_hController)
|
||||
SCHEMA_FIELD(QAngle, v_angle)
|
||||
SCHEMA_FIELD(QAngle, v_anglePrevious)
|
||||
SCHEMA_FIELD(uint32, m_iHideHUD)
|
||||
SCHEMA_FIELD(bool, m_fInitHUD)
|
||||
|
||||
void CommitSuicide(bool bExplode, bool bForce)
|
||||
{
|
||||
static int offset = shared::g_pGameConfig->GetOffset("CBasePlayerPawn_CommitSuicide");
|
||||
CALL_VIRTUAL(void, offset, this, bExplode, bForce);
|
||||
}
|
||||
|
||||
CBasePlayerController *GetController() { return m_hController.Get(); }
|
||||
};
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 31.10.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#pragma once
|
||||
#include "CBaseEntity.h"
|
||||
#include "globaltypes.h"
|
||||
#include "CBaseAnimGraph.h"
|
||||
|
||||
namespace
|
||||
TemplatePlugin
|
||||
{
|
||||
class CBaseProp : public CBaseAnimGraph
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CBaseProp)
|
||||
|
||||
SCHEMA_FIELD(bool, m_bModelOverrodeBlockLOS)
|
||||
SCHEMA_FIELD(int, m_iShapeType)
|
||||
SCHEMA_FIELD(bool, m_bConformToCollisionBounds)
|
||||
SCHEMA_FIELD(CTransform, m_mPreferredCatchTransform)
|
||||
};
|
||||
}
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 26.06.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "CBaseModelEntity.h"
|
||||
#include "schemasystem.h"
|
||||
|
||||
#define SF_TRIG_PUSH_ONCE 0x80
|
||||
|
||||
namespace TemplatePlugin {
|
||||
enum TOGGLE_STATE : uint32_t
|
||||
{
|
||||
TS_AT_TOP = 0,
|
||||
TS_AT_BOTTOM = 1,
|
||||
TS_GOING_UP = 2,
|
||||
TS_GOING_DOWN = 3,
|
||||
DOOR_OPEN = 0,
|
||||
DOOR_CLOSED = 1,
|
||||
DOOR_OPENING = 2,
|
||||
DOOR_CLOSING = 3,
|
||||
};
|
||||
|
||||
class CBaseToggle : public CBaseModelEntity
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CBaseToggle);
|
||||
SCHEMA_FIELD(TOGGLE_STATE, m_toggle_state)
|
||||
SCHEMA_FIELD(float32, m_flMoveDistance)
|
||||
SCHEMA_FIELD(float32, m_flWait)
|
||||
SCHEMA_FIELD(float32, m_flLip)
|
||||
SCHEMA_FIELD(bool, m_bAlwaysFireBlockedOutputs)
|
||||
SCHEMA_FIELD(Vector, m_vecPosition1)
|
||||
SCHEMA_FIELD(Vector, m_vecPosition2)
|
||||
SCHEMA_FIELD(QAngle, m_vecMoveAng)
|
||||
SCHEMA_FIELD(QAngle, m_vecAngle1)
|
||||
SCHEMA_FIELD(QAngle, m_vecAngle2)
|
||||
SCHEMA_FIELD(float32, m_flHeight)
|
||||
SCHEMA_FIELD(CEntityHandle, m_hActivator)
|
||||
SCHEMA_FIELD(Vector, m_vecFinalDest)
|
||||
SCHEMA_FIELD(QAngle, m_vecFinalAngle)
|
||||
SCHEMA_FIELD(int32, m_movementType)
|
||||
SCHEMA_FIELD(CUtlSymbolLarge, m_sMaster)
|
||||
};
|
||||
|
||||
class CBaseTrigger : public CBaseToggle
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CBaseTrigger);
|
||||
SCHEMA_FIELD(CEntityIOOutput, m_OnStartTouch);
|
||||
SCHEMA_FIELD(CEntityIOOutput, m_OnStartTouchAll);
|
||||
SCHEMA_FIELD(CEntityIOOutput, m_OnEndTouch);
|
||||
SCHEMA_FIELD(CEntityIOOutput, m_OnEndTouchAll);
|
||||
SCHEMA_FIELD(CEntityIOOutput, m_OnTouching);
|
||||
SCHEMA_FIELD(CEntityIOOutput, m_OnTouchingEachEntity);
|
||||
SCHEMA_FIELD(CEntityIOOutput, m_OnNotTouching);
|
||||
SCHEMA_FIELD_POINTER(CUtlVector<CHandle<CBaseEntity>>, m_hTouchingEntities)
|
||||
SCHEMA_FIELD(CUtlSymbolLarge, m_iFilterName)
|
||||
SCHEMA_FIELD(CEntityHandle, m_hFilter)
|
||||
SCHEMA_FIELD(bool, m_bDisabled);
|
||||
SCHEMA_FIELD(bool, m_bUseAsyncQueries);
|
||||
};
|
||||
|
||||
class CTriggerMultiple : public CBaseTrigger
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CTriggerMultiple);
|
||||
SCHEMA_FIELD(CEntityIOOutput, m_OnTrigger);
|
||||
};
|
||||
|
||||
class CBombTarget : public CBaseTrigger
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CBombTarget);
|
||||
|
||||
SCHEMA_FIELD(bool, m_bIsBombSiteB);
|
||||
};
|
||||
}
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 01.11.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#pragma once
|
||||
#include "CBaseEntity.h"
|
||||
#include "globaltypes.h"
|
||||
#include "CBaseProp.h"
|
||||
|
||||
namespace
|
||||
TemplatePlugin
|
||||
{
|
||||
class CPropDataComponent : public CEntityComponent
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CPropDataComponent)
|
||||
|
||||
SCHEMA_FIELD(float, m_flDmgModBullet)
|
||||
SCHEMA_FIELD(float, m_flDmgModClub)
|
||||
SCHEMA_FIELD(float, m_flDmgModExplosive)
|
||||
SCHEMA_FIELD(float, m_flDmgModFire)
|
||||
SCHEMA_FIELD_POINTER(char, m_iszPhysicsDamageTableName)
|
||||
SCHEMA_FIELD_POINTER(char, m_iszBasePropData)
|
||||
SCHEMA_FIELD(int32, m_nInteractions)
|
||||
SCHEMA_FIELD(bool, m_bSpawnMotionDisabled)
|
||||
SCHEMA_FIELD(int32, m_nDisableTakePhysicsDamageSpawnFlag)
|
||||
SCHEMA_FIELD(int32, m_nMotionDisabledSpawnFlag)
|
||||
};
|
||||
|
||||
enum BreakableContentsType_t : uint
|
||||
{
|
||||
BC_DEFAULT = 0x0,
|
||||
BC_EMPTY = 0x1,
|
||||
BC_PROP_GROUP_OVERRIDE = 0x2,
|
||||
BC_PARTICLE_SYSTEM_OVERRIDE = 0x3,
|
||||
};
|
||||
|
||||
enum PerformanceMode_t : uint
|
||||
{
|
||||
PM_NORMAL = 0x0,
|
||||
PM_NO_GIBS = 0x1,
|
||||
};
|
||||
|
||||
class CBreakableProp : public CBaseProp
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CBreakableProp);
|
||||
|
||||
SCHEMA_FIELD(CPropDataComponent, m_CPropDataComponent)
|
||||
SCHEMA_FIELD(CEntityIOOutput, m_OnStartDeath)
|
||||
SCHEMA_FIELD(CEntityIOOutput, m_OnBreak)
|
||||
SCHEMA_FIELD(CEntityIOOutput, m_OnTakeDamage)
|
||||
SCHEMA_FIELD(float, m_impactEnergyScale)
|
||||
SCHEMA_FIELD(int32, m_iMinHealthDmg)
|
||||
SCHEMA_FIELD(QAngle, m_preferredCarryAngles)
|
||||
SCHEMA_FIELD(float, m_flPressureDelay)
|
||||
SCHEMA_FIELD(float, m_flDefBurstScale)
|
||||
SCHEMA_FIELD(Vector, m_vDefBurstOffset)
|
||||
SCHEMA_FIELD(CHandle<CBaseEntity>, m_hBreaker)
|
||||
SCHEMA_FIELD(PerformanceMode_t, m_PerformanceMode)
|
||||
SCHEMA_FIELD(float, m_flPreventDamageBeforeTime)
|
||||
SCHEMA_FIELD(BreakableContentsType_t, m_BreakableContentsType)
|
||||
SCHEMA_FIELD_POINTER(char, m_strBreakableContentsPropGroupOverride)
|
||||
SCHEMA_FIELD_POINTER(char, m_strBreakableContentsParticleOverride)
|
||||
SCHEMA_FIELD(bool, m_bHasBreakPiecesOrCommands)
|
||||
SCHEMA_FIELD(float, m_explodeDamage)
|
||||
SCHEMA_FIELD(float, m_explodeRadius)
|
||||
SCHEMA_FIELD(float, m_explosionDelay)
|
||||
SCHEMA_FIELD_POINTER(char, m_explosionBuildupSound)
|
||||
SCHEMA_FIELD_POINTER(char, m_explosionCustomEffect)
|
||||
SCHEMA_FIELD_POINTER(char, m_explosionCustomSound)
|
||||
SCHEMA_FIELD_POINTER(char, m_explosionModifier)
|
||||
SCHEMA_FIELD(CHandle<CBasePlayerPawn>, m_hPhysicsAttacker)
|
||||
SCHEMA_FIELD(float, m_flLastPhysicsInfluenceTime)
|
||||
SCHEMA_FIELD(float, m_flDefaultFadeScale)
|
||||
SCHEMA_FIELD(CHandle<CBaseEntity>, m_hLastAttacker)
|
||||
SCHEMA_FIELD_POINTER(char, m_iszPuntSound)
|
||||
SCHEMA_FIELD(bool, m_bUsePuntSound)
|
||||
SCHEMA_FIELD(bool, m_bOriginalBlockLOS)
|
||||
};
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 26.06.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#pragma once
|
||||
#include <entity2/entityidentity.h>
|
||||
#include "CGameRules.h"
|
||||
#include "schemasystem.h"
|
||||
|
||||
namespace TemplatePlugin {
|
||||
class CC4
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CC4);
|
||||
|
||||
SCHEMA_FIELD(GameTime_t, m_fArmedTime);
|
||||
};
|
||||
}
|
||||
|
|
@ -1,727 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 26.06.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#pragma once
|
||||
#include <colors.h>
|
||||
#include <detourtypes.h>
|
||||
#include <tasks.h>
|
||||
#include <vectorextends.h>
|
||||
#include "CBasePlayerController.h"
|
||||
#include "serversideclient.h"
|
||||
#include "services.h"
|
||||
#include "Shared.h"
|
||||
#include "RayTrace.h"
|
||||
|
||||
namespace TemplatePlugin {
|
||||
extern CServerSideClient* GetClientBySlot(CPlayerSlot slot);
|
||||
|
||||
class CCSPlayerController : public CBasePlayerController
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CCSPlayerController);
|
||||
|
||||
SCHEMA_FIELD(CCSPlayerController_InGameMoneyServices*, m_pInGameMoneyServices);
|
||||
|
||||
SCHEMA_FIELD(CCSPlayerController_ActionTrackingServices*, m_pActionTrackingServices);
|
||||
|
||||
SCHEMA_FIELD(CCSPlayerController_InventoryServices*, m_pInventoryServices);
|
||||
|
||||
SCHEMA_FIELD(uint32_t, m_iPing);
|
||||
|
||||
SCHEMA_FIELD(CUtlSymbolLarge, m_szClan);
|
||||
|
||||
SCHEMA_FIELD_POINTER(char, m_szClanName) // char m_szClanName[32]
|
||||
SCHEMA_FIELD(bool, m_bEverFullyConnected);
|
||||
|
||||
SCHEMA_FIELD(bool, m_bPawnIsAlive);
|
||||
|
||||
SCHEMA_FIELD(int32_t, m_nDisconnectionTick);
|
||||
|
||||
SCHEMA_FIELD(CHandle<CCSPlayerPawn>, m_hPlayerPawn);
|
||||
|
||||
SCHEMA_FIELD(int32, m_DesiredObserverMode);
|
||||
|
||||
SCHEMA_FIELD(int16_t, m_nPawnCharacterDefIndex);
|
||||
|
||||
SCHEMA_FIELD(CHandle<CCSPlayerPawnBase>, m_hObserverPawn);
|
||||
|
||||
SCHEMA_FIELD(CHandle<CCSPlayerController>, m_hOriginalControllerOfCurrentPawn);
|
||||
|
||||
SCHEMA_FIELD(uint32_t, m_iPawnHealth);
|
||||
|
||||
SCHEMA_FIELD(int32_t, m_iPawnArmor);
|
||||
|
||||
SCHEMA_FIELD(int32_t, m_iScore);
|
||||
|
||||
SCHEMA_FIELD(int32_t, m_iRoundScore);
|
||||
|
||||
SCHEMA_FIELD(int32_t, m_iRoundsWon);
|
||||
|
||||
SCHEMA_FIELD(int32_t, m_iMVPs);
|
||||
|
||||
SCHEMA_FIELD(float, m_flSmoothedPing);
|
||||
|
||||
SCHEMA_FIELD(GameTime_t, m_flForceTeamTime);
|
||||
|
||||
SCHEMA_FIELD(int32_t, m_iCompetitiveRanking);
|
||||
|
||||
SCHEMA_FIELD(int8_t, m_iCompetitiveRankType);
|
||||
|
||||
SCHEMA_FIELD(int32_t, m_iCompetitiveWins);
|
||||
|
||||
SCHEMA_FIELD(byte, m_iPendingTeamNum);
|
||||
|
||||
SCHEMA_FIELD(byte, m_bTeamChanged);
|
||||
|
||||
SCHEMA_FIELD(byte, m_bInSwitchTeam);
|
||||
|
||||
static CCSPlayerController* FromUserId(int userid)
|
||||
{
|
||||
for (int i = 0; i < shared::getGlobalVars()->maxClients; ++i)
|
||||
{
|
||||
CCSPlayerController* controller = FromSlot(i);
|
||||
if (!controller)
|
||||
continue;
|
||||
|
||||
int iUserId = shared::g_pEngine->GetPlayerUserId(i).Get();
|
||||
if (userid == iUserId) return controller;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static CCSPlayerController* FromPawn(CCSPlayerPawn* pawn)
|
||||
{
|
||||
return reinterpret_cast<CCSPlayerController*>(pawn->m_hController().Get());
|
||||
}
|
||||
|
||||
static CCSPlayerController* FromIndex(int iIndex)
|
||||
{
|
||||
return static_cast<CCSPlayerController*>(shared::g_pEntitySystem->
|
||||
GetEntityInstance(CEntityIndex(iIndex)));
|
||||
}
|
||||
|
||||
static CCSPlayerController* FromSlot(int iSlot)
|
||||
{
|
||||
return static_cast<CCSPlayerController*>(shared::g_pEntitySystem->
|
||||
GetEntityInstance(CEntityIndex(iSlot + 1)));
|
||||
}
|
||||
|
||||
static CCSPlayerController* FromSteamId(uint64 steamid)
|
||||
{
|
||||
for (int i = 0; i < shared::getGlobalVars()->maxClients; ++i)
|
||||
{
|
||||
CCSPlayerController* controller = FromSlot(i);
|
||||
if (!controller)
|
||||
continue;
|
||||
|
||||
if (steamid == controller->GetSteamID()) return controller;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CServerSideClient* GetServerSideClient()
|
||||
{
|
||||
return GetClientBySlot(GetPlayerSlot());
|
||||
}
|
||||
|
||||
CCSPlayerPawn* GetPlayerPawn()
|
||||
{
|
||||
if (auto handle = m_hPlayerPawn(); handle.IsValid())
|
||||
return handle.Get();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CCSPlayerPawn* GetObserverPawn()
|
||||
{
|
||||
if (auto handle = m_hObserverPawn(); handle.IsValid())
|
||||
return static_cast<CCSPlayerPawn*>(handle.Get());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool IsBot() { return GetSteamID() == 0; }
|
||||
|
||||
void ChangeTeam(CsTeam iTeam)
|
||||
{
|
||||
CALL_VIRTUAL(void, shared::g_pGameConfig->GetOffset("CCSPlayerController_ChangeTeam"), this,
|
||||
static_cast<byte>(iTeam));
|
||||
}
|
||||
|
||||
static std::string CsTeamToString(CsTeam team)
|
||||
{
|
||||
switch (team)
|
||||
{
|
||||
case CsTeam::None: return "None";
|
||||
case CsTeam::Spectator: return "Spectator";
|
||||
case CsTeam::Terrorist: return "Terrorist";
|
||||
case CsTeam::CounterTerrorist: return "CounterTerrorist";
|
||||
default: return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
CsTeam Team()
|
||||
{
|
||||
byte teamNum = GetTeam();
|
||||
if (teamNum < static_cast<byte>(CsTeam::None) || teamNum > static_cast<byte>(CsTeam::CounterTerrorist))
|
||||
return CsTeam::None;
|
||||
|
||||
return static_cast<CsTeam>(teamNum);
|
||||
}
|
||||
|
||||
void Respawn()
|
||||
{
|
||||
CCSPlayerPawn* pPawn = GetPlayerPawn();
|
||||
if (!pPawn || m_bPawnIsAlive)
|
||||
return;
|
||||
|
||||
SetPawn(pPawn);
|
||||
CALL_VIRTUAL(void, shared::g_pGameConfig->GetOffset("CCSPlayerController_Respawn"), this);
|
||||
}
|
||||
|
||||
bool CheckValid(bool alive = false)
|
||||
{
|
||||
CCSPlayerPawn* pawn = GetPlayerPawn();
|
||||
|
||||
if (IsBot() || GetIsHLTV() || GetSteamID() <= 0 || !IsConnected() || !pawn)
|
||||
return false;
|
||||
|
||||
if (alive && !m_bPawnIsAlive())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void TakeFakeDamage(CCSPlayerController* attacker, int damage)
|
||||
{
|
||||
static CBaseEntity_TakeDamageOld_t s_TakeDamageOld = nullptr;
|
||||
|
||||
if (!s_TakeDamageOld)
|
||||
{
|
||||
CBaseEntity_TakeDamageOld_t addr =
|
||||
DynLibUtils::CModule(shared::g_pServer)
|
||||
.FindPattern(shared::g_pGameConfig->GetSignature("CBaseEntity_TakeDamageOld"))
|
||||
.RCast<CBaseEntity_TakeDamageOld_t>();
|
||||
|
||||
if (!addr) return;
|
||||
s_TakeDamageOld = addr;
|
||||
}
|
||||
|
||||
if (!CheckValid(true) || !attacker || !attacker->CheckValid())
|
||||
return;
|
||||
|
||||
auto* victimPawn = GetPlayerPawn();
|
||||
if (!victimPawn) return;
|
||||
|
||||
auto* attackerPawn = attacker->GetPlayerPawn();
|
||||
if (!attackerPawn) return;
|
||||
|
||||
const size_t infoSize = schema::GetClassSize("CTakeDamageInfo");
|
||||
const size_t resultSize = schema::GetClassSize("CTakeDamageResult");
|
||||
|
||||
auto* infoMem = std::malloc(infoSize);
|
||||
auto* resultMem = std::malloc(resultSize);
|
||||
|
||||
if (!infoMem || !resultMem)
|
||||
{
|
||||
std::free(infoMem);
|
||||
std::free(resultMem);
|
||||
return;
|
||||
}
|
||||
|
||||
std::memset(infoMem, 0, infoSize);
|
||||
std::memset(resultMem, 0, resultSize);
|
||||
|
||||
CAttackerInfo attackerInfo(attacker);
|
||||
std::memcpy(reinterpret_cast<std::uint8_t*>(infoMem) + 0x98, &attackerInfo, sizeof(CAttackerInfo));
|
||||
|
||||
auto* info = reinterpret_cast<CTakeDamageInfo*>(infoMem);
|
||||
auto* result = reinterpret_cast<CTakeDamageResult*>(resultMem);
|
||||
|
||||
info->m_hInflictor() = attackerPawn->GetHandle();
|
||||
info->m_hAttacker() = attackerPawn->GetHandle();
|
||||
info->m_flDamage() = static_cast<float>(damage);
|
||||
info->m_flFriendlyFireDamageReductionRatio() = static_cast<float>(0);
|
||||
info->m_bInTakeDamageFlow() = true;
|
||||
info->m_bitsDamageType() = DMG_GENERIC;
|
||||
|
||||
result->m_pOriginatingInfo() = info;
|
||||
result->m_nDamageDealt() = damage;
|
||||
result->m_nHealthLost() = damage;
|
||||
result->m_flPreModifiedDamage() = static_cast<float>(damage);
|
||||
result->m_nTotalledDamageDealt() = damage;
|
||||
result->m_nTotalledHealthLost() = damage;
|
||||
result->m_bWasDamageSuppressed() = false;
|
||||
|
||||
s_TakeDamageOld(victimPawn, info, result);
|
||||
|
||||
std::free(infoMem);
|
||||
std::free(resultMem);
|
||||
}
|
||||
|
||||
void Kick(ENetworkDisconnectionReason reason)
|
||||
{
|
||||
if (!CheckValid()) return;
|
||||
|
||||
CPlayerSlot slot = CPlayerSlot(GetPlayerSlot());
|
||||
|
||||
Tasks::NextFrame([slot, reason]
|
||||
{
|
||||
shared::g_pEngine->DisconnectClient(
|
||||
slot, reason);
|
||||
});
|
||||
}
|
||||
|
||||
PlayerConnectedState GetConnectedState() { return m_iConnected(); }
|
||||
|
||||
CSPlayerState GetPawnState()
|
||||
{
|
||||
CCSPlayerPawnBase* pPawn = static_cast<CCSPlayerPawnBase*>(GetPawn());
|
||||
if (!pPawn)
|
||||
return STATE_WELCOME;
|
||||
|
||||
return pPawn->m_iPlayerState();
|
||||
}
|
||||
|
||||
CSPlayerState GetPlayerPawnState()
|
||||
{
|
||||
CCSPlayerPawn* pPawn = GetPlayerPawn();
|
||||
if (!pPawn)
|
||||
return STATE_WELCOME;
|
||||
|
||||
return pPawn->m_iPlayerState();
|
||||
}
|
||||
|
||||
CBaseEntity* GetObserverTarget()
|
||||
{
|
||||
auto pPawn = GetPawn();
|
||||
|
||||
if (!pPawn)
|
||||
return nullptr;
|
||||
|
||||
return pPawn->m_pObserverServices->m_hObserverTarget().Get();
|
||||
}
|
||||
|
||||
// --- HEALTH & ARMOR ---
|
||||
int GetHealth()
|
||||
{
|
||||
if (!CheckValid(true)) return 0;
|
||||
auto pawn = GetPlayerPawn();
|
||||
return pawn->m_iHealth;
|
||||
}
|
||||
|
||||
void SetHealth(int health)
|
||||
{
|
||||
if (!CheckValid(true) || health <= 0) return;
|
||||
auto pawn = GetPlayerPawn();
|
||||
pawn->m_iHealth = health;
|
||||
m_iPawnHealth = health;
|
||||
if (health > pawn->m_iMaxHealth)
|
||||
pawn->m_iMaxHealth = health;
|
||||
}
|
||||
|
||||
void AddHealth(int delta)
|
||||
{
|
||||
if (!CheckValid(true) || delta <= 0) return;
|
||||
auto pawn = GetPlayerPawn();
|
||||
pawn->m_iHealth += delta;
|
||||
m_iPawnHealth += delta;
|
||||
}
|
||||
|
||||
void SetMaxHealth(int maxHp)
|
||||
{
|
||||
if (!CheckValid(true) || maxHp <= 0) return;
|
||||
auto pawn = GetPlayerPawn();
|
||||
pawn->m_iMaxHealth = maxHp;
|
||||
}
|
||||
|
||||
void SetArmor(int armor, bool helmet = false)
|
||||
{
|
||||
if (!CheckValid(true) || armor < 0) return;
|
||||
auto pawn = GetPlayerPawn();
|
||||
pawn->m_ArmorValue = armor;
|
||||
m_iPawnArmor = armor;
|
||||
if (helmet && pawn->m_pItemServices)
|
||||
pawn->m_pItemServices->m_bHasHelmet = true;
|
||||
}
|
||||
|
||||
void AddArmor(int delta)
|
||||
{
|
||||
if (!CheckValid(true) || delta <= 0) return;
|
||||
auto pawn = GetPlayerPawn();
|
||||
pawn->m_ArmorValue() += delta;
|
||||
m_iPawnArmor() += delta;
|
||||
}
|
||||
|
||||
// --- WEAPONS ---
|
||||
std::vector<CCSWeaponBase*> GetWeapons()
|
||||
{
|
||||
std::vector<CCSWeaponBase*> weapons;
|
||||
auto pawn = GetPlayerPawn();
|
||||
if (!pawn || !pawn->m_pWeaponServices() || !pawn->m_pWeaponServices()->m_hMyWeapons())
|
||||
return weapons;
|
||||
|
||||
const auto& myWeapons = *pawn->m_pWeaponServices()->m_hMyWeapons();
|
||||
|
||||
for (int i = 0; i < myWeapons.Count(); ++i)
|
||||
{
|
||||
const auto& handle = myWeapons[i];
|
||||
if (!handle.IsValid()) continue;
|
||||
|
||||
if (auto* weapon = static_cast<CCSWeaponBase*>(handle.Get()))
|
||||
{
|
||||
weapons.push_back(weapon);
|
||||
}
|
||||
}
|
||||
|
||||
return weapons;
|
||||
}
|
||||
|
||||
CCSWeaponBase* GetWeaponByDefIndex(int defIndex)
|
||||
{
|
||||
for (auto* base : GetWeapons())
|
||||
{
|
||||
if (base->m_AttributeManager().m_Item().m_iItemDefinitionIndex() == defIndex)
|
||||
return base;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CCSWeaponBase* GetWeaponBySlot(gear_slot_t slot)
|
||||
{
|
||||
for (auto* base : GetWeapons())
|
||||
{
|
||||
if (base->GetWeaponVData() && base->GetWeaponVData()->m_GearSlot() == slot)
|
||||
return base;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CCSWeaponBase* GetWeaponByName(const std::string& weaponName)
|
||||
{
|
||||
for (auto* base : GetWeapons())
|
||||
{
|
||||
if (base->GetDesignerName() == weaponName)
|
||||
return base;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool HasWeaponByName(const std::string& weaponName)
|
||||
{
|
||||
return GetWeaponByName(weaponName) != nullptr;
|
||||
}
|
||||
|
||||
bool HasWeaponInSlot(gear_slot_t slot)
|
||||
{
|
||||
return GetWeaponBySlot(slot) != nullptr;
|
||||
}
|
||||
|
||||
std::string GetWeaponNameBySlot(gear_slot_t slot)
|
||||
{
|
||||
if (auto* w = GetWeaponBySlot(slot))
|
||||
{
|
||||
return w->GetDesignerName();
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
void DropWeaponByName(const std::string& weaponName)
|
||||
{
|
||||
auto pawn = GetPlayerPawn();
|
||||
if (!pawn || !pawn->m_pWeaponServices()) return;
|
||||
|
||||
if (auto* weapon = GetWeaponByName(weaponName))
|
||||
{
|
||||
pawn->m_pWeaponServices()->m_hActiveWeapon() = CHandle<CBaseEntity>(weapon);
|
||||
pawn->m_pItemServices()->DropActiveWeapon(weapon);
|
||||
}
|
||||
}
|
||||
|
||||
// --- POSITION / AIM ---
|
||||
Vector GetEyePosition()
|
||||
{
|
||||
auto pawn = GetPlayerPawn();
|
||||
if (!pawn) return {0, 0, 0};
|
||||
Vector origin = pawn->GetAbsOrigin();
|
||||
Vector offset = pawn->m_vecViewOffset();
|
||||
return {origin.x, origin.y, origin.z + offset.z};
|
||||
}
|
||||
|
||||
CBaseEntity* GetAimEntity(bool includePlayers = false)
|
||||
{
|
||||
if (!CheckValid(true))
|
||||
return nullptr;
|
||||
|
||||
auto* pawn = GetPlayerPawn();
|
||||
if (!pawn)
|
||||
return nullptr;
|
||||
|
||||
QAngle eyeAngles = pawn->GetEyeAngles();
|
||||
Vector eyePos = GetEyePosition();
|
||||
|
||||
RayTrace::TraceOptions opts{};
|
||||
if (!includePlayers)
|
||||
opts.InteractsExclude = RayTrace::InteractionLayers::Player;
|
||||
|
||||
auto result = RayTrace::TraceShape(
|
||||
eyePos,
|
||||
eyeAngles,
|
||||
pawn,
|
||||
&opts
|
||||
);
|
||||
|
||||
return result.has_value()
|
||||
? static_cast<CBaseEntity*>(result->HitEntity)
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
struct AimPositionResult
|
||||
{
|
||||
bool Hit{false};
|
||||
Vector Origin{};
|
||||
Vector Normal{};
|
||||
};
|
||||
|
||||
AimPositionResult GetAimPositionEx(bool includePlayers = true)
|
||||
{
|
||||
AimPositionResult result{};
|
||||
|
||||
if (!CheckValid(true))
|
||||
return result;
|
||||
|
||||
auto* pawn = GetPlayerPawn();
|
||||
if (!pawn)
|
||||
return result;
|
||||
|
||||
QAngle eyeAngles = pawn->GetEyeAngles();
|
||||
Vector eyePos = GetEyePosition();
|
||||
|
||||
Vector forward{};
|
||||
AngleVectors(eyeAngles, &forward, nullptr, nullptr);
|
||||
|
||||
Vector origin = eyePos + forward * 15.0f;
|
||||
|
||||
RayTrace::TraceOptions opts{};
|
||||
if (!includePlayers)
|
||||
opts.InteractsExclude = RayTrace::InteractionLayers::Player;
|
||||
|
||||
auto traceResult = RayTrace::TraceShape(
|
||||
eyePos,
|
||||
eyeAngles,
|
||||
pawn,
|
||||
&opts
|
||||
);
|
||||
|
||||
if (traceResult.has_value())
|
||||
{
|
||||
result.Hit = true;
|
||||
result.Origin = traceResult->EndPos;
|
||||
result.Normal = traceResult->Normal;
|
||||
return result;
|
||||
}
|
||||
|
||||
result.Hit = false;
|
||||
result.Origin = origin + forward * 8192.0f;
|
||||
return result;
|
||||
}
|
||||
|
||||
Vector GetAimPosition(bool includePlayers = true)
|
||||
{
|
||||
if (!CheckValid(true))
|
||||
return {0, 0, 0};
|
||||
|
||||
auto* pawn = GetPlayerPawn();
|
||||
if (!pawn)
|
||||
return {0, 0, 0};
|
||||
|
||||
QAngle eyeAngles = pawn->GetEyeAngles();
|
||||
Vector eyePos = GetEyePosition();
|
||||
|
||||
Vector forward{};
|
||||
AngleVectors(eyeAngles, &forward, nullptr, nullptr);
|
||||
|
||||
Vector origin = eyePos + forward * 15.0f;
|
||||
|
||||
RayTrace::TraceOptions opts{};
|
||||
if (!includePlayers)
|
||||
opts.InteractsExclude = RayTrace::InteractionLayers::Player;
|
||||
|
||||
auto traceResult = RayTrace::TraceShape(
|
||||
eyePos,
|
||||
eyeAngles,
|
||||
pawn,
|
||||
&opts
|
||||
);
|
||||
|
||||
if (traceResult.has_value())
|
||||
{
|
||||
return traceResult->EndPos;
|
||||
}
|
||||
|
||||
return origin + forward * 8192.0f;
|
||||
}
|
||||
|
||||
bool IsPlayerInSightRange(CCSPlayerController* target,
|
||||
float distance = 0.0f, float angle = 90.0f, bool heightCheck = true,
|
||||
bool negativeAngle = false)
|
||||
{
|
||||
if (!CheckValid(true) || !target->CheckValid(true) || GetPlayerPawn()->GetAbsOrigin().IsZero() ||
|
||||
target->GetPlayerPawn()->GetAbsOrigin().IsZero())
|
||||
return false;
|
||||
|
||||
float resultDistance = 0;
|
||||
auto playerEyeAngles = GetPlayerPawn()->GetEyeAngles();
|
||||
playerEyeAngles.x = 0.0f;
|
||||
playerEyeAngles.z = 0.0f;
|
||||
Vector angleVector;
|
||||
AngleVectors(playerEyeAngles, &angleVector, nullptr, nullptr);
|
||||
angleVector = VectorExtends::Normalize(angleVector);
|
||||
|
||||
if (negativeAngle)
|
||||
angleVector = VectorExtends::NegateVector(angleVector);
|
||||
|
||||
auto playerOrigin = GetPlayerPawn()->GetAbsOrigin();
|
||||
auto targetOrigin = target->GetPlayerPawn()->GetAbsOrigin();
|
||||
|
||||
if (heightCheck && distance > 0.0f)
|
||||
resultDistance = VectorExtends::Distance(playerOrigin, targetOrigin);
|
||||
|
||||
if (distance > 0.0f)
|
||||
{
|
||||
if (resultDistance > distance)
|
||||
return false;
|
||||
}
|
||||
|
||||
playerOrigin.z = 0.0f;
|
||||
targetOrigin.z = 0.0f;
|
||||
|
||||
auto targetVector = VectorExtends::MakeVectorFromPoints(playerOrigin, targetOrigin);
|
||||
targetVector = VectorExtends::Normalize(targetVector);
|
||||
auto resultAngle = VectorExtends::RadToDeg(
|
||||
VectorExtends::ArcCosine(VectorExtends::GetVectorDotProduct(targetVector, angleVector)));
|
||||
|
||||
if (resultAngle > angle / 2)
|
||||
return false;
|
||||
|
||||
if (distance > 0.0f)
|
||||
{
|
||||
if (!heightCheck)
|
||||
resultDistance = VectorExtends::Distance(playerOrigin, targetOrigin);
|
||||
return resultDistance <= distance;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void TeleportTo(CCSPlayerController* target)
|
||||
{
|
||||
if (!CheckValid(true) || !target || !target->CheckValid(true)) return;
|
||||
|
||||
auto pawn = GetPlayerPawn();
|
||||
auto tpawn = target->GetPlayerPawn();
|
||||
if (!pawn || !tpawn) return;
|
||||
|
||||
Vector origin = tpawn->GetAbsOrigin();
|
||||
QAngle rot = tpawn->GetAbsRotation();
|
||||
Vector vel = tpawn->GetAbsVelocity();
|
||||
|
||||
pawn->Teleport(&origin, &rot, &vel);
|
||||
}
|
||||
|
||||
void TeleportPlayer(CCSPlayerController* target)
|
||||
{
|
||||
CCSPlayerPawn* myPawn = GetPlayerPawn();
|
||||
CCSPlayerPawn* targetPawn = target ? target->GetPlayerPawn() : nullptr;
|
||||
|
||||
if (!myPawn || !targetPawn)
|
||||
return;
|
||||
|
||||
const Vector& origin = targetPawn->GetAbsOrigin();
|
||||
const QAngle& rotation = targetPawn->GetAbsRotation();
|
||||
const Vector& velocity = targetPawn->GetAbsVelocity();
|
||||
|
||||
myPawn->Teleport(&origin, &rotation, &velocity);
|
||||
}
|
||||
|
||||
void SetPlayerRenderColor(int a = 255, int r = 255, int g = 255, int b = 255)
|
||||
{
|
||||
CCSPlayerPawn* pawn = GetPlayerPawn();
|
||||
if (!pawn) return;
|
||||
|
||||
pawn->m_clrRender() = Color(r, g, b, a);
|
||||
}
|
||||
|
||||
void SetPlayerInvisible(int alpha = 0)
|
||||
{
|
||||
if (alpha < 0) alpha = 0;
|
||||
if (alpha > 255) alpha = 255;
|
||||
|
||||
CCSPlayerPawn* pawn = GetPlayerPawn();
|
||||
if (!pawn)
|
||||
return;
|
||||
|
||||
SetPlayerRenderColor(alpha);
|
||||
|
||||
if (auto weaponServices = pawn->m_pWeaponServices())
|
||||
{
|
||||
CHandle<CBasePlayerWeapon> activeWeapon = weaponServices->m_hActiveWeapon();
|
||||
if (activeWeapon && activeWeapon.IsValid())
|
||||
{
|
||||
auto* weapon = activeWeapon.Get();
|
||||
weapon->m_clrRender() = colors(255, 255, 255, alpha).ToValveColor();
|
||||
weapon->m_flShadowStrength() = 0.0f;
|
||||
}
|
||||
|
||||
if (auto myWeapons = weaponServices->m_hMyWeapons())
|
||||
{
|
||||
FOR_EACH_VEC(*myWeapons, i)
|
||||
{
|
||||
const CHandle<CBasePlayerWeapon>& handle = (*myWeapons)[i];
|
||||
if (!handle.IsValid() || !handle.Get())
|
||||
continue;
|
||||
|
||||
auto* weapon = handle.Get();
|
||||
weapon->m_clrRender() = colors(255, 255, 255, 0).ToValveColor();
|
||||
weapon->m_flShadowStrength() = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SetPlayerVisible()
|
||||
{
|
||||
CCSPlayerPawn* pawn = GetPlayerPawn();
|
||||
if (!pawn)
|
||||
return;
|
||||
|
||||
SetPlayerRenderColor();
|
||||
|
||||
if (auto weaponServices = pawn->m_pWeaponServices())
|
||||
{
|
||||
CHandle<CBasePlayerWeapon> activeWeapon = weaponServices->m_hActiveWeapon();
|
||||
if (activeWeapon && activeWeapon.IsValid())
|
||||
{
|
||||
auto* weapon = activeWeapon.Get();
|
||||
weapon->m_clrRender() = colors(255, 255, 255, 255).ToValveColor();
|
||||
weapon->m_flShadowStrength() = 1.0f;
|
||||
}
|
||||
|
||||
if (auto myWeapons = weaponServices->m_hMyWeapons())
|
||||
{
|
||||
FOR_EACH_VEC(*myWeapons, i)
|
||||
{
|
||||
const CHandle<CBasePlayerWeapon>& handle = (*myWeapons)[i];
|
||||
if (!handle.IsValid() || !handle.Get())
|
||||
continue;
|
||||
|
||||
auto* weapon = handle.Get();
|
||||
weapon->m_clrRender() = colors(255, 255, 255, 255).ToValveColor();
|
||||
weapon->m_flShadowStrength() = 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -1,141 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 26.06.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#pragma once
|
||||
#include "ehandle.h"
|
||||
#include "CBasePlayerPawn.h"
|
||||
#include "services.h"
|
||||
#include "CCSWeaponBase.h"
|
||||
|
||||
namespace TemplatePlugin {
|
||||
enum CSPlayerState
|
||||
{
|
||||
STATE_ACTIVE = 0x0,
|
||||
STATE_WELCOME = 0x1,
|
||||
STATE_PICKINGTEAM = 0x2,
|
||||
STATE_PICKINGCLASS = 0x3,
|
||||
STATE_DEATH_ANIM = 0x4,
|
||||
STATE_DEATH_WAIT_FOR_KEY = 0x5,
|
||||
STATE_OBSERVER_MODE = 0x6,
|
||||
STATE_GUNGAME_RESPAWN = 0x7,
|
||||
STATE_DORMANT = 0x8,
|
||||
NUM_PLAYER_STATES = 0x9,
|
||||
};
|
||||
|
||||
class CCSPlayerController;
|
||||
|
||||
struct EntitySpottedState_t
|
||||
{
|
||||
private:
|
||||
[[maybe_unused]] std::uint8_t __pad0000[ 0x8 ]; // 0x0
|
||||
public:
|
||||
// MNetworkEnable
|
||||
// MNetworkChangeCallback "OnIsSpottedChanged"
|
||||
bool m_bSpotted; // 0x8
|
||||
private:
|
||||
[[maybe_unused]] std::uint8_t __pad0009[ 0x3 ]; // 0x9
|
||||
public:
|
||||
// MNetworkEnable
|
||||
// MNetworkChangeCallback "OnIsSpottedChanged"
|
||||
std::uint32_t m_bSpottedByMask[2]; // 0xc
|
||||
};
|
||||
|
||||
class CTouchExpansionComponent : public CEntityComponent
|
||||
{
|
||||
DECLARE_SCHEMA_CLASS(CTouchExpansionComponent)
|
||||
};
|
||||
|
||||
class CCSPlayerPawnBase : public CBasePlayerPawn {
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CCSPlayerPawnBase);
|
||||
|
||||
SCHEMA_FIELD(CTouchExpansionComponent, m_CTouchExpansionComponent)
|
||||
SCHEMA_FIELD(GameTime_t, m_blindUntilTime)
|
||||
SCHEMA_FIELD(GameTime_t, m_blindStartTime)
|
||||
SCHEMA_FIELD(CSPlayerState, m_iPlayerState)
|
||||
SCHEMA_FIELD(bool, m_bRespawning)
|
||||
SCHEMA_FIELD(GameTime_t, m_fImmuneToGunGameDamageTime)
|
||||
SCHEMA_FIELD(bool, m_bGunGameImmunity)
|
||||
SCHEMA_FIELD(float, m_fMolotovDamageTime)
|
||||
SCHEMA_FIELD(bool, m_bHasMovedSinceSpawn)
|
||||
SCHEMA_FIELD(int32, m_iNumSpawns)
|
||||
SCHEMA_FIELD(float, m_flIdleTimeSinceLastAction)
|
||||
SCHEMA_FIELD(float, m_fNextRadarUpdateTime)
|
||||
SCHEMA_FIELD(float, m_flFlashDuration)
|
||||
SCHEMA_FIELD(float, m_flFlashMaxAlpha)
|
||||
SCHEMA_FIELD(float, m_flProgressBarStartTime)
|
||||
SCHEMA_FIELD(int32, m_iProgressBarDuration)
|
||||
SCHEMA_FIELD(bool, m_wasNotKilledNaturally)
|
||||
SCHEMA_FIELD(bool, m_bCommittingSuicideOnTeamChange)
|
||||
SCHEMA_FIELD(CHandle<CCSPlayerController>, m_hOriginalController)
|
||||
};
|
||||
|
||||
enum CSPlayerBlockingUseAction_t : uint
|
||||
{
|
||||
k_CSPlayerBlockingUseAction_None = 0x0,
|
||||
k_CSPlayerBlockingUseAction_DefusingDefault = 0x1,
|
||||
k_CSPlayerBlockingUseAction_DefusingWithKit = 0x2,
|
||||
k_CSPlayerBlockingUseAction_HostageGrabbing = 0x3,
|
||||
k_CSPlayerBlockingUseAction_HostageDropping = 0x4,
|
||||
k_CSPlayerBlockingUseAction_MapLongUseEntity_Pickup = 0x5,
|
||||
k_CSPlayerBlockingUseAction_MapLongUseEntity_Place = 0x6,
|
||||
k_CSPlayerBlockingUseAction_MaxCount = 0x7,
|
||||
};
|
||||
|
||||
class CCSPlayerPawn : public CCSPlayerPawnBase
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CCSPlayerPawn);
|
||||
|
||||
SCHEMA_FIELD(CEconItemView, m_EconGloves)
|
||||
SCHEMA_FIELD(uint8, m_nEconGlovesChanged)
|
||||
SCHEMA_FIELD(uint16, m_nCharacterDefIndex)
|
||||
SCHEMA_FIELD(CUtlString, m_strVOPrefix)
|
||||
SCHEMA_FIELD(float, m_flVelocityModifier)
|
||||
SCHEMA_FIELD(CCSPlayer_ActionTrackingServices*, m_pActionTrackingServices)
|
||||
SCHEMA_FIELD(QAngle, m_angEyeAngles)
|
||||
SCHEMA_FIELD(GameTime_t, m_flHealthShotBoostExpirationTime)
|
||||
SCHEMA_FIELD(int32, m_ArmorValue)
|
||||
SCHEMA_FIELD(bool, m_bInBuyZone)
|
||||
SCHEMA_FIELD(bool, m_bInBombZone);
|
||||
SCHEMA_FIELD(EntitySpottedState_t, m_entitySpottedState)
|
||||
SCHEMA_FIELD(bool, m_bIsScoped)
|
||||
SCHEMA_FIELD(int, m_aimPunchTickBase)
|
||||
SCHEMA_FIELD(float, m_aimPunchTickFraction)
|
||||
SCHEMA_FIELD(QAngle, m_aimPunchAngle)
|
||||
SCHEMA_FIELD(QAngle, m_aimPunchAngleVel)
|
||||
SCHEMA_FIELD(CSPlayerBlockingUseAction_t, m_iBlockingUseActionInProgress);
|
||||
|
||||
uint8 GetCollisionGroup()
|
||||
{
|
||||
return m_Collision().m_collisionAttribute().m_nCollisionGroup();
|
||||
}
|
||||
|
||||
void SetCollisionGroup(uint8 nCollisionGroup = COLLISION_GROUP_DEBRIS)
|
||||
{
|
||||
m_Collision().m_CollisionGroup() = nCollisionGroup;
|
||||
m_Collision().m_collisionAttribute().m_nCollisionGroup() = nCollisionGroup;
|
||||
CollisionRulesChanged();
|
||||
}
|
||||
|
||||
QAngle GetEyeAngles() {
|
||||
return m_angEyeAngles.Get();
|
||||
}
|
||||
};
|
||||
|
||||
class CCSGO_TeamPreviewCharacterPosition: public CBaseEntity
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CCSGO_TeamPreviewCharacterPosition);
|
||||
|
||||
SCHEMA_FIELD(int32, m_nVariant);
|
||||
SCHEMA_FIELD(int32, m_nRandom);
|
||||
SCHEMA_FIELD(int32, m_nOrdinal);
|
||||
SCHEMA_FIELD(CUtlString, m_sWeaponName);
|
||||
SCHEMA_FIELD(uint64, m_xuid);
|
||||
SCHEMA_FIELD_POINTER(CEconItemView, m_agentItem);
|
||||
SCHEMA_FIELD_POINTER(CEconItemView, m_glovesItem);
|
||||
SCHEMA_FIELD_POINTER(CEconItemView, m_weaponItem);
|
||||
};
|
||||
}
|
||||
|
|
@ -1,232 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 26.06.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "CBaseEntity.h"
|
||||
#include "virtual.h"
|
||||
|
||||
namespace TemplatePlugin {
|
||||
enum gear_slot_t : uint32_t
|
||||
{
|
||||
GEAR_SLOT_INVALID = 0xffffffff,
|
||||
GEAR_SLOT_RIFLE = 0x0,
|
||||
GEAR_SLOT_PISTOL = 0x1,
|
||||
GEAR_SLOT_KNIFE = 0x2,
|
||||
GEAR_SLOT_GRENADES = 0x3,
|
||||
GEAR_SLOT_C4 = 0x4,
|
||||
GEAR_SLOT_RESERVED_SLOT6 = 0x5,
|
||||
GEAR_SLOT_RESERVED_SLOT7 = 0x6,
|
||||
GEAR_SLOT_RESERVED_SLOT8 = 0x7,
|
||||
GEAR_SLOT_RESERVED_SLOT9 = 0x8,
|
||||
GEAR_SLOT_RESERVED_SLOT10 = 0x9,
|
||||
GEAR_SLOT_RESERVED_SLOT11 = 0xa,
|
||||
GEAR_SLOT_BOOSTS = 0xb,
|
||||
GEAR_SLOT_UTILITY = 0xc,
|
||||
GEAR_SLOT_COUNT = 0xd,
|
||||
GEAR_SLOT_FIRST = 0x0,
|
||||
GEAR_SLOT_LAST = 0xc,
|
||||
};
|
||||
|
||||
enum CSWeaponType : uint32_t
|
||||
{
|
||||
WEAPONTYPE_KNIFE = 0,
|
||||
WEAPONTYPE_PISTOL = 1,
|
||||
WEAPONTYPE_SUBMACHINEGUN = 2,
|
||||
WEAPONTYPE_RIFLE = 3,
|
||||
WEAPONTYPE_SHOTGUN = 4,
|
||||
WEAPONTYPE_SNIPER_RIFLE = 5,
|
||||
WEAPONTYPE_MACHINEGUN = 6,
|
||||
WEAPONTYPE_C4 = 7,
|
||||
WEAPONTYPE_TASER = 8,
|
||||
WEAPONTYPE_GRENADE = 9,
|
||||
WEAPONTYPE_EQUIPMENT = 10,
|
||||
WEAPONTYPE_STACKABLEITEM = 11,
|
||||
WEAPONTYPE_UNKNOWN = 12,
|
||||
};
|
||||
|
||||
enum CSWeaponCategory : uint32_t
|
||||
{
|
||||
WEAPONCATEGORY_OTHER = 0,
|
||||
WEAPONCATEGORY_MELEE = 1,
|
||||
WEAPONCATEGORY_SECONDARY = 2,
|
||||
WEAPONCATEGORY_SMG = 3,
|
||||
WEAPONCATEGORY_RIFLE = 4,
|
||||
WEAPONCATEGORY_HEAVY = 5,
|
||||
WEAPONCATEGORY_COUNT = 6,
|
||||
};
|
||||
|
||||
class CAttributeManager
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS_INLINE(CAttributeManager);
|
||||
SCHEMA_FIELD_POINTER(CUtlVector<CAttributeManager>, m_CachedResults);
|
||||
};
|
||||
|
||||
class CEconItemAttribute
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS_INLINE(CEconItemAttribute);
|
||||
SCHEMA_FIELD(uint16_t, m_iAttributeDefinitionIndex);
|
||||
SCHEMA_FIELD(float32, m_flValue);
|
||||
SCHEMA_FIELD(float32, m_flInitialValue);
|
||||
SCHEMA_FIELD(int32, m_nRefundableCurrency);
|
||||
SCHEMA_FIELD(bool, m_bSetBonus);
|
||||
};
|
||||
|
||||
class CAttributeList
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS_INLINE(CAttributeList);
|
||||
SCHEMA_FIELD_POINTER(CUtlVector<CEconItemAttribute>, m_Attributes)
|
||||
SCHEMA_FIELD(CAttributeManager*, m_pManager);
|
||||
};
|
||||
|
||||
class CEconItemView
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS_INLINE(CEconItemView);
|
||||
|
||||
SCHEMA_FIELD(uint16, m_iItemDefinitionIndex)
|
||||
SCHEMA_FIELD(int32, m_iEntityQuality)
|
||||
SCHEMA_FIELD(uint32, m_iEntityLevel)
|
||||
SCHEMA_FIELD(uint64_t, m_iItemID)
|
||||
SCHEMA_FIELD(uint32, m_iItemIDHigh)
|
||||
SCHEMA_FIELD(uint32, m_iItemIDLow)
|
||||
SCHEMA_FIELD(uint32, m_iAccountID)
|
||||
SCHEMA_FIELD(uint32, m_iInventoryPosition)
|
||||
SCHEMA_FIELD(bool, m_bInitialized)
|
||||
SCHEMA_FIELD(CAttributeList, m_AttributeList)
|
||||
SCHEMA_FIELD(CAttributeList, m_NetworkedDynamicAttributes)
|
||||
SCHEMA_FIELD_POINTER(char, m_szCustomName)
|
||||
SCHEMA_FIELD_POINTER(char, m_szCustomNameOverride)
|
||||
};
|
||||
|
||||
class CAttributeContainer
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS_INLINE(CAttributeContainer);
|
||||
|
||||
SCHEMA_FIELD(CEconItemView, m_Item)
|
||||
};
|
||||
|
||||
class CEconEntity : public CBaseModelEntity
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CEconEntity)
|
||||
|
||||
SCHEMA_FIELD(CAttributeContainer, m_AttributeManager)
|
||||
SCHEMA_FIELD(uint32, m_OriginalOwnerXuidLow)
|
||||
SCHEMA_FIELD(uint32, m_OriginalOwnerXuidHigh)
|
||||
SCHEMA_FIELD(int32, m_nFallbackPaintKit)
|
||||
SCHEMA_FIELD(int32, m_nFallbackSeed)
|
||||
SCHEMA_FIELD(float, m_flFallbackWear)
|
||||
SCHEMA_FIELD(int32, m_nFallbackStatTrak)
|
||||
};
|
||||
|
||||
class CEconWearable : public CEconEntity
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CEconWearable)
|
||||
|
||||
SCHEMA_FIELD(int32, m_nForceSkin)
|
||||
SCHEMA_FIELD(bool, m_bAlwaysAllow)
|
||||
};
|
||||
|
||||
class CBasePlayerWeaponVData : public CEntitySubclassVDataBase
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CBasePlayerWeaponVData)
|
||||
SCHEMA_FIELD(int, m_iMaxClip1)
|
||||
SCHEMA_FIELD(int, m_iMaxClip2)
|
||||
SCHEMA_FIELD(int, m_iDefaultClip1)
|
||||
};
|
||||
|
||||
class CCSWeaponBaseVData : public CBasePlayerWeaponVData
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CCSWeaponBaseVData)
|
||||
|
||||
SCHEMA_FIELD(CSWeaponType, m_WeaponType);
|
||||
SCHEMA_FIELD(CSWeaponCategory, m_WeaponCategory);
|
||||
SCHEMA_FIELD(gear_slot_t, m_GearSlot)
|
||||
SCHEMA_FIELD(int, m_nPrice)
|
||||
SCHEMA_FIELD(CUtlString, m_szName)
|
||||
SCHEMA_FIELD(int, m_nPrimaryReserveAmmoMax)
|
||||
SCHEMA_FIELD(int, m_nSecondaryReserveAmmoMax)
|
||||
SCHEMA_FIELD(int, m_nDamage)
|
||||
};
|
||||
|
||||
class CBasePlayerWeapon : public CEconEntity
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CBasePlayerWeapon)
|
||||
|
||||
SCHEMA_FIELD(int, m_nNextPrimaryAttackTick);
|
||||
SCHEMA_FIELD(float, m_flNextPrimaryAttackTickRatio);
|
||||
SCHEMA_FIELD(int, m_nNextSecondaryAttackTick);
|
||||
SCHEMA_FIELD(float, m_flNextSecondaryAttackTickRatio);
|
||||
|
||||
SCHEMA_FIELD(int32_t, m_iClip1);
|
||||
SCHEMA_FIELD(int32_t, m_iClip2);
|
||||
SCHEMA_FIELD_POINTER(int, m_pReserveAmmo);
|
||||
|
||||
CCSWeaponBaseVData* GetWeaponVData() { return (CCSWeaponBaseVData*)GetVData(); }
|
||||
|
||||
const char* GetWeaponClassname() noexcept
|
||||
{
|
||||
const char* pszClassname = GetClassname();
|
||||
if (V_StringHasPrefixCaseSensitive(pszClassname, "item_"))
|
||||
return pszClassname;
|
||||
|
||||
switch (m_AttributeManager().m_Item().m_iItemDefinitionIndex)
|
||||
{
|
||||
case 23:
|
||||
return "weapon_mp5sd";
|
||||
case 41:
|
||||
return "weapon_knifegg";
|
||||
case 42:
|
||||
return "weapon_knife";
|
||||
case 59:
|
||||
return "weapon_knife_t";
|
||||
case 60:
|
||||
return "weapon_m4a1_silencer";
|
||||
case 61:
|
||||
return "weapon_usp_silencer";
|
||||
case 63:
|
||||
return "weapon_cz75a";
|
||||
case 64:
|
||||
return "weapon_revolver";
|
||||
default:
|
||||
return pszClassname;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class CCSWeaponBase : public CBasePlayerWeapon
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CCSWeaponBase)
|
||||
|
||||
SCHEMA_FIELD(bool, m_bInReload);
|
||||
SCHEMA_FIELD(bool, m_bReloadVisuallyComplete);
|
||||
SCHEMA_FIELD(bool, m_bRequireUseToTouch);
|
||||
SCHEMA_FIELD(float, m_flDroppedAtTime);
|
||||
SCHEMA_FIELD(float, m_fAccuracyPenalty);
|
||||
SCHEMA_FIELD(float, m_flRecoilIndex);
|
||||
SCHEMA_FIELD(int, m_iRecoilIndex);
|
||||
};
|
||||
|
||||
class CWeaponBaseItem : public CCSWeaponBase
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CWeaponBaseItem)
|
||||
};
|
||||
|
||||
class CCSWeaponBaseGun : public CCSWeaponBase
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CCSWeaponBaseGun)
|
||||
};
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 26.06.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#pragma once
|
||||
#include "CBaseEntity.h"
|
||||
|
||||
namespace TemplatePlugin {
|
||||
enum class ChickenActivity : uint32_t {
|
||||
IDLE = 0x0,
|
||||
SQUAT = 0x1,
|
||||
WALK = 0x2,
|
||||
RUN = 0x3,
|
||||
GLIDE = 0x4,
|
||||
LAND = 0x5,
|
||||
PANIC = 0x6
|
||||
};
|
||||
|
||||
class CChicken : public CBaseEntity
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CChicken)
|
||||
|
||||
SCHEMA_FIELD(ChickenActivity, m_currentActivity)
|
||||
};
|
||||
}
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 01.11.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#pragma once
|
||||
#include "CBaseEntity.h"
|
||||
#include "globaltypes.h"
|
||||
#include "CBreakableProp.h"
|
||||
|
||||
namespace
|
||||
TemplatePlugin
|
||||
{
|
||||
enum AnimLoopMode_t : uint
|
||||
{
|
||||
ANIM_LOOP_MODE_INVALID = 0xFFFFFFFF,
|
||||
ANIM_LOOP_MODE_NOT_LOOPING = 0x0,
|
||||
ANIM_LOOP_MODE_LOOPING = 0x1,
|
||||
ANIM_LOOP_MODE_USE_SEQUENCE_SETTINGS = 0x2,
|
||||
ANIM_LOOP_MODE_COUNT = 0x3,
|
||||
};
|
||||
|
||||
class CDynamicProp : public CBreakableProp
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CDynamicProp);
|
||||
|
||||
SCHEMA_FIELD(bool, m_bCreateNavObstacle)
|
||||
SCHEMA_FIELD(bool, m_bNavObstacleUpdatesOverridden)
|
||||
SCHEMA_FIELD(bool, m_bUseHitboxesForRenderBox)
|
||||
SCHEMA_FIELD(bool, m_bUseAnimGraph)
|
||||
SCHEMA_FIELD(CEntityIOOutput, m_pOutputAnimBegun)
|
||||
SCHEMA_FIELD(CEntityIOOutput, m_pOutputAnimOver)
|
||||
SCHEMA_FIELD(CEntityIOOutput, m_pOutputAnimLoopCycleOver)
|
||||
SCHEMA_FIELD(CEntityIOOutput, m_OnAnimReachedStart)
|
||||
SCHEMA_FIELD(CEntityIOOutput, m_OnAnimReachedEnd)
|
||||
SCHEMA_FIELD_POINTER(char, m_iszIdleAnim)
|
||||
SCHEMA_FIELD(AnimLoopMode_t, m_nIdleAnimLoopMode)
|
||||
SCHEMA_FIELD(bool, m_bRandomizeCycle)
|
||||
SCHEMA_FIELD(bool, m_bStartDisabled)
|
||||
SCHEMA_FIELD(bool, m_bFiredStartEndOutput)
|
||||
SCHEMA_FIELD(bool, m_bForceNpcExclude)
|
||||
SCHEMA_FIELD(bool, m_bCreateNonSolid)
|
||||
SCHEMA_FIELD(bool, m_bIsOverrideProp)
|
||||
SCHEMA_FIELD(int32, m_iInitialGlowState)
|
||||
SCHEMA_FIELD(int32, m_nGlowRange)
|
||||
SCHEMA_FIELD(int32, m_nGlowRangeMin)
|
||||
SCHEMA_FIELD(Color, m_glowColor)
|
||||
SCHEMA_FIELD(int32, m_nGlowTeam)
|
||||
};
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 26.06.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "CBaseEntity.h"
|
||||
#include"schemasystem.h"
|
||||
|
||||
#define SF_TRIG_PUSH_ONCE 0x80
|
||||
|
||||
namespace TemplatePlugin {
|
||||
class CEnvEntityMaker : public CBaseEntity
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CEnvEntityMaker);
|
||||
|
||||
SCHEMA_FIELD(CUtlSymbolLarge, m_iszTemplate)
|
||||
};
|
||||
}
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 07.11.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
#pragma once
|
||||
#include "CBaseModelEntity.h"
|
||||
#include "globaltypes.h"
|
||||
|
||||
namespace
|
||||
TemplatePlugin
|
||||
{
|
||||
enum BrushSolidities_e : uint
|
||||
{
|
||||
BRUSHSOLID_TOGGLE,
|
||||
BRUSHSOLID_NEVER,
|
||||
BRUSHSOLID_ALWAYS,
|
||||
};
|
||||
|
||||
class CFuncBrush : public CBaseModelEntity
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CFuncBrush);
|
||||
SCHEMA_FIELD(BrushSolidities_e, m_iSolidity)
|
||||
SCHEMA_FIELD(int, m_iDisabled)
|
||||
SCHEMA_FIELD(bool, m_bSolidBsp)
|
||||
SCHEMA_FIELD_POINTER(char, m_iszExcludedClass)
|
||||
SCHEMA_FIELD(bool, m_bInvertExclusion)
|
||||
SCHEMA_FIELD(bool, m_bScriptedMovement)
|
||||
};
|
||||
}
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 07.11.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
#pragma once
|
||||
#include "CBaseModelEntity.h"
|
||||
#include "globaltypes.h"
|
||||
|
||||
namespace
|
||||
TemplatePlugin
|
||||
{
|
||||
class CFuncVPhysicsClip : public CBaseModelEntity
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CFuncVPhysicsClip);
|
||||
SCHEMA_FIELD(int, m_bDisabled)
|
||||
};
|
||||
}
|
||||
|
|
@ -1,125 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 26.06.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#pragma once
|
||||
#include <platform.h>
|
||||
#include "CBaseEntity.h"
|
||||
|
||||
namespace TemplatePlugin {
|
||||
enum class RoundEndReason : uint32_t
|
||||
{
|
||||
Unknown = 0x0u,
|
||||
TargetBombed = 0x1u,
|
||||
TerroristsEscaped = 0x4u,
|
||||
CTsPreventEscape = 0x5u,
|
||||
EscapingTerroristsNeutralized = 0x6u,
|
||||
BombDefused = 0x7u,
|
||||
CTsWin = 0x8u,
|
||||
TerroristsWin = 0x9u,
|
||||
RoundDraw = 0xAu,
|
||||
AllHostageRescued = 0xBu,
|
||||
TargetSaved = 0xCu,
|
||||
HostagesNotRescued = 0xDu,
|
||||
TerroristsNotEscaped = 0xEu,
|
||||
GameCommencing = 0x10u,
|
||||
|
||||
TerroristsSurrender = 0x11u,
|
||||
CTsSurrender = 0x12u,
|
||||
|
||||
TerroristsPlanted = 0x13u,
|
||||
CTsReachedHostage = 0x14u,
|
||||
SurvivalWin = 0x15u,
|
||||
SurvivalDraw = 0x16u,
|
||||
|
||||
TerroristsPlanned = 0x13u
|
||||
};
|
||||
|
||||
class CGameRules
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CGameRules)
|
||||
};
|
||||
|
||||
class CCSGameModeRules_Deathmatch : public CGameRules
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CCSGameModeRules_Deathmatch)
|
||||
|
||||
SCHEMA_FIELD(GameTime_t, m_flDMBonusStartTime);
|
||||
SCHEMA_FIELD(float32, m_flDMBonusTimeLength);
|
||||
SCHEMA_FIELD(CUtlString, m_sDMBonusWeapon);
|
||||
};
|
||||
|
||||
class CCSGameRules;
|
||||
|
||||
class CCSGameRulesProxy : public CBaseEntity
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CCSGameRulesProxy)
|
||||
|
||||
SCHEMA_FIELD(CCSGameRules *, m_pGameRules);
|
||||
};
|
||||
|
||||
class CCSGameRules : public CGameRules
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CCSGameRules)
|
||||
|
||||
SCHEMA_FIELD(float, m_fMatchStartTime);
|
||||
SCHEMA_FIELD(float, m_flGameStartTime);
|
||||
SCHEMA_FIELD(int, m_totalRoundsPlayed);
|
||||
SCHEMA_FIELD(float, m_fRoundStartTime);
|
||||
SCHEMA_FIELD(float, m_flRestartRoundTime);
|
||||
SCHEMA_FIELD_POINTER(int, m_nEndMatchMapGroupVoteOptions)
|
||||
SCHEMA_FIELD(int, m_nEndMatchMapVoteWinner);
|
||||
SCHEMA_FIELD(int, m_iRoundTime);
|
||||
SCHEMA_FIELD(bool, m_bWarmupPeriod);
|
||||
SCHEMA_FIELD(float, m_fWarmupPeriodEnd);
|
||||
SCHEMA_FIELD(float, m_fWarmupPeriodStart);
|
||||
SCHEMA_FIELD(GamePhase, m_gamePhase);
|
||||
SCHEMA_FIELD(bool, m_bGameRestart);
|
||||
SCHEMA_FIELD(bool, m_bBombPlanted);
|
||||
SCHEMA_FIELD(int32_t, m_totaArenaoundsPlayed);
|
||||
SCHEMA_FIELD(int32_t, m_nOvertimePlaying);
|
||||
SCHEMA_FIELD(bool, m_bBuyTimeEnded);
|
||||
SCHEMA_FIELD(bool, m_bTCantBuy);
|
||||
SCHEMA_FIELD(bool, m_bCTCantBuy);
|
||||
SCHEMA_FIELD(bool, m_bSwitchingTeamsAtRoundReset);
|
||||
SCHEMA_FIELD(int, m_iRoundEndWinnerTeam);
|
||||
SCHEMA_FIELD(CUtlString, m_sRoundEndMessage);
|
||||
SCHEMA_FIELD(CUtlString, m_sRoundEndFunFactToken);
|
||||
SCHEMA_FIELD(bool, m_bIsValveDS);
|
||||
SCHEMA_FIELD(bool, m_bIsQuestEligible);
|
||||
SCHEMA_FIELD(int32, m_iSpectatorSlotCount);
|
||||
SCHEMA_FIELD(float, m_fWarmupNextChatNoticeTime);
|
||||
SCHEMA_FIELD_POINTER(CUtlVector<SpawnPoint*>, m_CTSpawnPoints);
|
||||
SCHEMA_FIELD_POINTER(CUtlVector<SpawnPoint*>, m_TerroristSpawnPoints);
|
||||
|
||||
using TerminateRoundFn = void(*)(CCSGameRules*, RoundEndReason, float, void*, uint8_t);
|
||||
TerminateRoundFn s_pTerminateRound = nullptr;
|
||||
|
||||
void TerminateRound(float delay, RoundEndReason roundEndReason) {
|
||||
if (!s_pTerminateRound) {
|
||||
TerminateRoundFn addr = DynLibUtils::CModule(shared::g_pServer).FindPattern(
|
||||
shared::g_pGameConfig->GetSignature("CCSGameRules_TerminateRound")).RCast<TerminateRoundFn>();
|
||||
|
||||
if (!addr)
|
||||
return;
|
||||
|
||||
s_pTerminateRound = addr;
|
||||
}
|
||||
s_pTerminateRound(this, roundEndReason, delay, nullptr, 0);
|
||||
}
|
||||
|
||||
static CCSGameRules* FindGameRules()
|
||||
{
|
||||
auto entities = UTIL_FindAllEntitiesByDesignerName<CCSGameRulesProxy>("cs_gamerules");
|
||||
if (entities.empty())
|
||||
return nullptr;
|
||||
|
||||
auto* proxy = entities.front();
|
||||
return proxy ? proxy->m_pGameRules() : nullptr;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 26.06.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "CBaseModelEntity.h"
|
||||
|
||||
namespace TemplatePlugin {
|
||||
class CParticleSystem : public CBaseModelEntity
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CParticleSystem);
|
||||
|
||||
SCHEMA_FIELD(bool, m_bActive)
|
||||
SCHEMA_FIELD(bool, m_bStartActive)
|
||||
SCHEMA_FIELD(bool, m_bFrozen)
|
||||
SCHEMA_FIELD(float32, m_flFreezeTransitionDuration)
|
||||
SCHEMA_FIELD(int32, m_nStopType)
|
||||
SCHEMA_FIELD(bool, m_bAnimateDuringGameplayPause)
|
||||
SCHEMA_FIELD(CUtlSymbolLarge, m_iszEffectName)
|
||||
SCHEMA_FIELD(int, m_nTintCP)
|
||||
SCHEMA_FIELD(GameTime_t, m_flStartTime)
|
||||
SCHEMA_FIELD_POINTER(Color, m_clrTint)
|
||||
SCHEMA_FIELD_POINTER(CHandle<CBaseEntity>, m_hControlPointEnts)
|
||||
};
|
||||
|
||||
class CEnvParticleGlow : public CParticleSystem
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CEnvParticleGlow);
|
||||
|
||||
SCHEMA_FIELD(float, m_flAlphaScale)
|
||||
SCHEMA_FIELD(float, m_flRadiusScale)
|
||||
SCHEMA_FIELD(float, m_flSelfIllumScale)
|
||||
SCHEMA_FIELD_POINTER(Color, m_ColorTint)
|
||||
};
|
||||
}
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 09.11.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#pragma once
|
||||
#include "CBaseEntity.h"
|
||||
#include "globaltypes.h"
|
||||
|
||||
namespace TemplatePlugin
|
||||
{
|
||||
class CPhysExplosion : public CBaseEntity
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CPhysExplosion);
|
||||
|
||||
SCHEMA_FIELD(bool, m_bExplodeOnSpawn)
|
||||
SCHEMA_FIELD(float, m_flMagnitude)
|
||||
SCHEMA_FIELD(float, m_flDamage)
|
||||
SCHEMA_FIELD(float, m_radius)
|
||||
SCHEMA_FIELD_POINTER(char, m_targetEntityName)
|
||||
SCHEMA_FIELD(float, m_flInnerRadius)
|
||||
SCHEMA_FIELD(float, m_flPushScale)
|
||||
SCHEMA_FIELD(bool, m_bConvertToDebrisWhenPossible)
|
||||
SCHEMA_FIELD(bool, m_bAffectInvulnerableEnts)
|
||||
SCHEMA_FIELD(CEntityIOOutput, m_OnPushedPlayer)
|
||||
};
|
||||
}
|
||||
|
|
@ -1,70 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 01.11.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#pragma once
|
||||
#include "CBaseEntity.h"
|
||||
#include "globaltypes.h"
|
||||
#include "CBreakableProp.h"
|
||||
|
||||
namespace
|
||||
TemplatePlugin
|
||||
{
|
||||
enum DynamicContinuousContactBehavior_t : byte
|
||||
{
|
||||
DYNAMIC_CONTINUOUS_ALLOW_IF_REQUESTED_BY_OTHER_BODY = 0x0,
|
||||
DYNAMIC_CONTINUOUS_ALWAYS = 0x1,
|
||||
DYNAMIC_CONTINUOUS_NEVER = 0x2,
|
||||
};
|
||||
|
||||
enum CPhysicsPropCrateType_t : uint
|
||||
{
|
||||
CRATE_SPECIFIC_ITEM = 0x0,
|
||||
CRATE_TYPE_COUNT = 0x1,
|
||||
};
|
||||
|
||||
class CPhysicsProp : public CBreakableProp
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CPhysicsProp);
|
||||
|
||||
SCHEMA_FIELD(CEntityIOOutput, m_MotionEnabled)
|
||||
SCHEMA_FIELD(CEntityIOOutput, m_OnAwakened)
|
||||
SCHEMA_FIELD(CEntityIOOutput, m_OnAwake)
|
||||
SCHEMA_FIELD(CEntityIOOutput, m_OnAsleep)
|
||||
SCHEMA_FIELD(CEntityIOOutput, m_OnPlayerUse)
|
||||
SCHEMA_FIELD(CEntityIOOutput, m_OnOutOfWorld)
|
||||
SCHEMA_FIELD(CEntityIOOutput, m_OnPlayerPickup)
|
||||
SCHEMA_FIELD(bool, m_bForceNavIgnore)
|
||||
SCHEMA_FIELD(bool, m_bNoNavmeshBlocker)
|
||||
SCHEMA_FIELD(bool, m_bForceNpcExclude)
|
||||
SCHEMA_FIELD(float, m_massScale)
|
||||
SCHEMA_FIELD(float, m_buoyancyScale)
|
||||
SCHEMA_FIELD(int32, m_damageType)
|
||||
SCHEMA_FIELD(int32, m_damageToEnableMotion)
|
||||
SCHEMA_FIELD(float, m_flForceToEnableMotion)
|
||||
SCHEMA_FIELD(bool, m_bThrownByPlayer)
|
||||
SCHEMA_FIELD(bool, m_bDroppedByPlayer)
|
||||
SCHEMA_FIELD(bool, m_bTouchedByPlayer)
|
||||
SCHEMA_FIELD(bool, m_bFirstCollisionAfterLaunch)
|
||||
SCHEMA_FIELD(bool, m_bHasBeenAwakened)
|
||||
SCHEMA_FIELD(bool, m_bIsOverrideProp)
|
||||
SCHEMA_FIELD(float, m_flLastBurn)
|
||||
SCHEMA_FIELD(DynamicContinuousContactBehavior_t, m_nDynamicContinuousContactBehavior)
|
||||
SCHEMA_FIELD(float, m_fNextCheckDisableMotionContactsTime)
|
||||
SCHEMA_FIELD(int32, m_iInitialGlowState)
|
||||
SCHEMA_FIELD(int32, m_nGlowRange)
|
||||
SCHEMA_FIELD(int32, m_nGlowRangeMin)
|
||||
SCHEMA_FIELD(Color, m_glowColor)
|
||||
SCHEMA_FIELD(bool, m_bShouldAutoConvertBackFromDebris)
|
||||
SCHEMA_FIELD(bool, m_bMuteImpactEffects)
|
||||
SCHEMA_FIELD(bool, m_bAcceptDamageFromHeldObjects)
|
||||
SCHEMA_FIELD(bool, m_bEnableUseOutput)
|
||||
SCHEMA_FIELD(CPhysicsPropCrateType_t, m_CrateType)
|
||||
SCHEMA_FIELD_POINTER(char, m_strItemClass)
|
||||
SCHEMA_FIELD_POINTER(int32, m_nItemCount)
|
||||
SCHEMA_FIELD(bool, m_bRemovableForAmmoBalancing)
|
||||
SCHEMA_FIELD(bool, m_bAwake)
|
||||
SCHEMA_FIELD(bool, m_bAttachedToReferenceFrame)
|
||||
};
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 26.06.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#pragma once
|
||||
#include "CBaseModelEntity.h"
|
||||
#include "globaltypes.h"
|
||||
|
||||
namespace TemplatePlugin {
|
||||
class CPlantedC4 : public CBaseModelEntity
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CPlantedC4)
|
||||
|
||||
SCHEMA_FIELD(GameTime_t, m_flC4Blow);
|
||||
SCHEMA_FIELD(GameTime_t, m_flDefuseCountDown);
|
||||
};
|
||||
}
|
||||
|
|
@ -1,74 +0,0 @@
|
|||
/**
|
||||
* =============================================================================
|
||||
* CS2Fixes
|
||||
* Copyright (C) 2023-2025 Source2ZE
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, version 3.0, as published by the
|
||||
* Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CBaseModelEntity.h"
|
||||
|
||||
namespace TemplatePlugin {
|
||||
enum class PointWorldTextJustifyHorizontal_t : uint32_t
|
||||
{
|
||||
POINT_WORLD_TEXT_JUSTIFY_HORIZONTAL_LEFT = 0x0,
|
||||
POINT_WORLD_TEXT_JUSTIFY_HORIZONTAL_CENTER = 0x1,
|
||||
POINT_WORLD_TEXT_JUSTIFY_HORIZONTAL_RIGHT = 0x2,
|
||||
};
|
||||
|
||||
enum class PointWorldTextJustifyVertical_t : uint32_t
|
||||
{
|
||||
POINT_WORLD_TEXT_JUSTIFY_VERTICAL_BOTTOM = 0x0,
|
||||
POINT_WORLD_TEXT_JUSTIFY_VERTICAL_CENTER = 0x1,
|
||||
POINT_WORLD_TEXT_JUSTIFY_VERTICAL_TOP = 0x2,
|
||||
};
|
||||
|
||||
enum class PointWorldTextReorientMode_t : uint32_t
|
||||
{
|
||||
POINT_WORLD_TEXT_REORIENT_NONE = 0x0,
|
||||
POINT_WORLD_TEXT_REORIENT_AROUND_UP = 0x1,
|
||||
};
|
||||
|
||||
class CPointWorldText : public CBaseModelEntity
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CPointWorldText)
|
||||
|
||||
SCHEMA_FIELD_POINTER(char, m_messageText) // char m_messageText[512]
|
||||
SCHEMA_FIELD_POINTER(char, m_FontName) // char m_FontName[64]
|
||||
SCHEMA_FIELD_POINTER(char, m_BackgroundMaterialName) // char m_BackgroundMaterialName[64]
|
||||
|
||||
SCHEMA_FIELD(bool, m_bEnabled)
|
||||
SCHEMA_FIELD(bool, m_bFullbright)
|
||||
SCHEMA_FIELD(float, m_flWorldUnitsPerPx)
|
||||
SCHEMA_FIELD(float, m_flFontSize)
|
||||
SCHEMA_FIELD(float, m_flDepthOffset)
|
||||
SCHEMA_FIELD(bool, m_bDrawBackground)
|
||||
SCHEMA_FIELD(float, m_flBackgroundBorderWidth)
|
||||
SCHEMA_FIELD(float, m_flBackgroundBorderHeight)
|
||||
SCHEMA_FIELD(float, m_flBackgroundWorldToUV)
|
||||
SCHEMA_FIELD(Color, m_Color)
|
||||
|
||||
SCHEMA_FIELD(PointWorldTextJustifyHorizontal_t, m_nJustifyHorizontal)
|
||||
SCHEMA_FIELD(PointWorldTextJustifyVertical_t, m_nJustifyVertical)
|
||||
SCHEMA_FIELD(PointWorldTextReorientMode_t, m_nReorientMode)
|
||||
|
||||
void SetMessage(const char* sMessage)
|
||||
{
|
||||
V_strncpy(m_messageText, sMessage, 512);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 26.06.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#pragma once
|
||||
#include "CBaseEntity.h"
|
||||
#include "globaltypes.h"
|
||||
#include "CBaseModelEntity.h"
|
||||
|
||||
namespace TemplatePlugin {
|
||||
class CSkyCamera : public CBaseEntity
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CSkyCamera)
|
||||
SCHEMA_FIELD(CUtlStringToken, m_skyboxSlotToken);
|
||||
};
|
||||
|
||||
class CEnvSky : public CBaseModelEntity
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CEnvSky)
|
||||
|
||||
SCHEMA_FIELD(int, m_hSkyMaterial)
|
||||
SCHEMA_FIELD(int, m_hSkyMaterialLightingOnly)
|
||||
SCHEMA_FIELD(Color, m_vTintColor)
|
||||
SCHEMA_FIELD(float32, m_flBrightnessScale)
|
||||
};
|
||||
}
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 23.08.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#pragma once
|
||||
#include "CBaseEntity.h"
|
||||
|
||||
namespace TemplatePlugin {
|
||||
class CSoundEventEntity : public CBaseEntity {
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CSoundEventEntity)
|
||||
SCHEMA_FIELD(bool, m_bStartOnSpawn);
|
||||
|
||||
SCHEMA_FIELD(bool, m_bToLocalPlayer);
|
||||
|
||||
SCHEMA_FIELD(bool, m_bStopOnNew);
|
||||
|
||||
SCHEMA_FIELD(bool, m_bSaveRestore);
|
||||
|
||||
SCHEMA_FIELD(bool, m_bSavedIsPlaying);
|
||||
|
||||
SCHEMA_FIELD(float32, m_flSavedElapsedTime);
|
||||
|
||||
SCHEMA_FIELD(CUtlSymbolLarge, m_iszSourceEntityName);
|
||||
|
||||
SCHEMA_FIELD(CUtlSymbolLarge, m_iszAttachmentName);
|
||||
|
||||
SCHEMA_FIELD(char, m_onGUIDChanged);
|
||||
|
||||
SCHEMA_FIELD(CEntityIOOutput, m_onSoundFinished);
|
||||
|
||||
SCHEMA_FIELD(float32, m_flClientCullRadius);
|
||||
|
||||
SCHEMA_FIELD(CUtlSymbolLarge, m_iszSoundName);
|
||||
|
||||
SCHEMA_FIELD(CEntityHandle, m_hSource);
|
||||
|
||||
SCHEMA_FIELD(int32, m_nEntityIndexSelection);
|
||||
};
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 26.06.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#pragma once
|
||||
#include "CBaseEntity.h"
|
||||
|
||||
namespace TemplatePlugin {
|
||||
class CTeam : public CBaseEntity
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CTeam)
|
||||
|
||||
SCHEMA_FIELD(int32_t, m_iScore);
|
||||
};
|
||||
}
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
#include <Shared.h>
|
||||
|
||||
namespace
|
||||
TemplatePlugin
|
||||
RayTracePlugin
|
||||
{
|
||||
std::list<std::shared_ptr<CTimerBase>> g_timers;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
#define TIMERFLAG_MAP (1 << 0) // Only valid for this map, cancels on map change
|
||||
#define TIMERFLAG_ROUND (1 << 1) // Only valid for this round, cancels on new round
|
||||
|
||||
namespace TemplatePlugin {
|
||||
namespace RayTracePlugin {
|
||||
class CTimerBase
|
||||
{
|
||||
protected:
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 26.06.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "CBaseTrigger.h"
|
||||
#include "schemasystem.h"
|
||||
|
||||
#define SF_TRIG_PUSH_ONCE 0x80
|
||||
|
||||
namespace TemplatePlugin {
|
||||
class CTriggerPush : public CBaseTrigger
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CTriggerPush);
|
||||
|
||||
SCHEMA_FIELD(Vector, m_vecPushDirEntitySpace)
|
||||
SCHEMA_FIELD(bool, m_bTriggerOnStartTouch)
|
||||
};
|
||||
}
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include "CBaseEntity.h"
|
||||
|
||||
namespace TemplatePlugin {
|
||||
namespace RayTracePlugin {
|
||||
struct VPhysicsCollisionAttribute_t
|
||||
{
|
||||
DECLARE_SCHEMA_CLASS_INLINE(VPhysicsCollisionAttribute_t)
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include "TemplatePlugin.h"
|
||||
#include "Plugin.h"
|
||||
|
||||
class CGameEntitySystem;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,53 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 23.09.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#include "ctakedamageinfo.h"
|
||||
#include "dynlibutils/module.h"
|
||||
#include "CCSPlayerController.h"
|
||||
#include <Shared.h>
|
||||
|
||||
namespace
|
||||
TemplatePlugin
|
||||
{
|
||||
CAttackerInfo::CAttackerInfo(CEntityInstance* attacker)
|
||||
{
|
||||
NeedInit = false;
|
||||
IsWorld = true;
|
||||
IsPawn = false;
|
||||
Attacker = attacker ? attacker->m_pEntity->GetRefEHandle().ToInt() : 0;
|
||||
|
||||
if (!attacker || (attacker->m_pEntity && attacker->m_pEntity->m_designerName.String() !=
|
||||
"cs_player_controller"))
|
||||
return;
|
||||
|
||||
if (auto* controller = static_cast<CCSPlayerController*>(attacker))
|
||||
{
|
||||
IsWorld = false;
|
||||
IsPawn = true;
|
||||
AttackerUserId = static_cast<unsigned short>(shared::g_pEngine->GetPlayerUserId(controller->GetPlayerSlot()).Get());
|
||||
TeamNum = controller->m_iTeamNum();
|
||||
TeamChecked = controller->m_iTeamNum();
|
||||
}
|
||||
}
|
||||
|
||||
HitGroup_t CTakeDamageInfo::GetHitGroup() const
|
||||
{
|
||||
const int off = shared::g_pGameConfig->GetOffset("CTakeDamageInfo_HitGroup");
|
||||
if (off <= 0)
|
||||
return HitGroup_t::HITGROUP_INVALID;
|
||||
|
||||
const uintptr_t base = reinterpret_cast<uintptr_t>(this);
|
||||
|
||||
const uintptr_t v4 = *reinterpret_cast<const uintptr_t*>(base + off);
|
||||
if (!v4)
|
||||
return HitGroup_t::HITGROUP_INVALID;
|
||||
|
||||
const uintptr_t v1 = *reinterpret_cast<const uintptr_t*>(v4 + 16);
|
||||
if (!v1)
|
||||
return HitGroup_t::HITGROUP_GENERIC;
|
||||
|
||||
const int32_t group = *reinterpret_cast<const int32_t*>(v1 + 56);
|
||||
return static_cast<HitGroup_t>(group);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
//
|
||||
// Created by Michal Přikryl on 23.09.2025.
|
||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||
//
|
||||
#pragma once
|
||||
#include <public/mathlib/vector.h>
|
||||
#include "ehandle.h"
|
||||
#include "schemasystem.h"
|
||||
#include "globaltypes.h"
|
||||
|
||||
namespace
|
||||
TemplatePlugin
|
||||
{
|
||||
class CBaseEntity;
|
||||
class CTakeDamageInfo;
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct CAttackerInfo
|
||||
{
|
||||
bool NeedInit = true; // 0x0
|
||||
bool IsPawn = false; // 0x1
|
||||
bool IsWorld = false; // 0x2
|
||||
std::uint8_t pad_3[1] = {}; // vyrovnání na 4 bajty
|
||||
std::uint32_t Attacker = 0; // 0x4
|
||||
std::uint16_t AttackerUserId = 0; // 0x8
|
||||
std::uint8_t pad_A[2] = {}; // vyrovnání na 0xC
|
||||
int TeamChecked = -1; // 0x0C
|
||||
int TeamNum = -1; // 0x10
|
||||
|
||||
CAttackerInfo() = default;
|
||||
explicit CAttackerInfo(CEntityInstance* attacker);
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
struct CTakeDamageInfoContainer
|
||||
{
|
||||
CTakeDamageInfo* pInfo;
|
||||
};
|
||||
|
||||
class CTakeDamageInfo
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CTakeDamageInfo)
|
||||
|
||||
SCHEMA_FIELD(Vector, m_vecDamageForce);
|
||||
SCHEMA_FIELD(Vector, m_vecDamagePosition);
|
||||
SCHEMA_FIELD(Vector, m_vecReportedPosition);
|
||||
SCHEMA_FIELD(Vector, m_vecDamageDirection);
|
||||
SCHEMA_FIELD(CHandle<CBaseEntity>, m_hInflictor);
|
||||
SCHEMA_FIELD(CHandle<CBaseEntity>, m_hAttacker);
|
||||
SCHEMA_FIELD(CHandle<CBaseEntity>, m_hAbility);
|
||||
SCHEMA_FIELD(float, m_flDamage);
|
||||
SCHEMA_FIELD(float, m_flTotalledDamage);
|
||||
SCHEMA_FIELD(int32_t, m_bitsDamageType);
|
||||
SCHEMA_FIELD(int32_t, m_iDamageCustom);
|
||||
SCHEMA_FIELD(int8_t, m_iAmmoType);
|
||||
SCHEMA_FIELD(float, m_flOriginalDamage);
|
||||
SCHEMA_FIELD(bool, m_bShouldBleed);
|
||||
SCHEMA_FIELD(bool, m_bShouldSpark);
|
||||
SCHEMA_FIELD(TakeDamageFlags_t, m_nDamageFlags);
|
||||
SCHEMA_FIELD_POINTER(char, m_sDamageSourceName);
|
||||
SCHEMA_FIELD(HitGroup_t, m_iHitGroupId);
|
||||
SCHEMA_FIELD(int32_t, m_nNumObjectsPenetrated);
|
||||
SCHEMA_FIELD(float, m_flFriendlyFireDamageReductionRatio);
|
||||
SCHEMA_FIELD(bool, m_bInTakeDamageFlow);
|
||||
|
||||
HitGroup_t GetHitGroup() const;
|
||||
};
|
||||
|
||||
class CTakeDamageResult
|
||||
{
|
||||
public:
|
||||
DECLARE_SCHEMA_CLASS(CTakeDamageResult)
|
||||
|
||||
SCHEMA_FIELD(CTakeDamageInfo*, m_pOriginatingInfo)
|
||||
SCHEMA_FIELD(int32, m_nHealthLost)
|
||||
SCHEMA_FIELD(int32, m_nHealthBefore)
|
||||
SCHEMA_FIELD(int32, m_nDamageDealt)
|
||||
SCHEMA_FIELD(float32, m_flPreModifiedDamage)
|
||||
SCHEMA_FIELD(int32, m_nTotalledHealthLost)
|
||||
SCHEMA_FIELD(int32, m_nTotalledDamageDealt)
|
||||
SCHEMA_FIELD(bool, m_bWasDamageSuppressed)
|
||||
};
|
||||
}
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
// CBitVec<16384> *m_pTransmitEdict;
|
||||
// };
|
||||
|
||||
namespace TemplatePlugin {
|
||||
namespace RayTracePlugin {
|
||||
enum CSRoundEndReason {
|
||||
TargetBombed = 1, /**< Target Successfully Bombed! */
|
||||
VIPEscaped, /**< The VIP has escaped! - Doesn't exist on CS:GO */
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#endif
|
||||
|
||||
namespace
|
||||
TemplatePlugin
|
||||
RayTracePlugin
|
||||
{
|
||||
using SchemaKeyValueMap_t = std::map<uint32_t, SchemaKey>;
|
||||
using SchemaTableMap_t = std::map<uint32_t, SchemaKeyValueMap_t>;
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
#undef schema
|
||||
|
||||
namespace
|
||||
TemplatePlugin
|
||||
RayTracePlugin
|
||||
{
|
||||
struct SchemaKey
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
#include <netmessages.pb.h>
|
||||
|
||||
namespace
|
||||
TemplatePlugin
|
||||
RayTracePlugin
|
||||
{
|
||||
class CHLTVServer;
|
||||
class INetMessage;
|
||||
|
|
|
|||
|
|
@ -24,13 +24,15 @@
|
|||
#include <platform.h>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "schemasystem.h"
|
||||
|
||||
#define AMMO_OFFSET_HEGRENADE 13
|
||||
#define AMMO_OFFSET_FLASHBANG 14
|
||||
#define AMMO_OFFSET_SMOKEGRENADE 15
|
||||
#define AMMO_OFFSET_MOLOTOV 16
|
||||
#define AMMO_OFFSET_DECOY 17
|
||||
|
||||
namespace TemplatePlugin {
|
||||
namespace RayTracePlugin {
|
||||
class CCSPlayerController;
|
||||
class CCSPlayerPawn;
|
||||
extern bool g_bAwsChangingTeam;
|
||||
|
|
@ -214,16 +216,6 @@ namespace TemplatePlugin {
|
|||
SCHEMA_FIELD(bool, m_bIsPickingUpItemWithUse)
|
||||
|
||||
SCHEMA_FIELD(bool, m_bPickedUpWeapon)
|
||||
|
||||
void DropWeapon(CBasePlayerWeapon *pWeapon, Vector *pVecTarget = nullptr, Vector *pVelocity = nullptr) {
|
||||
static int offset = shared::g_pGameConfig->GetOffset("CCSPlayer_WeaponServices_DropWeapon");
|
||||
CALL_VIRTUAL(void, offset, this, pWeapon, pVecTarget, pVelocity);
|
||||
}
|
||||
|
||||
void SelectItem(CBasePlayerWeapon *pWeapon, int unk1 = 0) {
|
||||
static int offset = shared::g_pGameConfig->GetOffset("CCSPlayer_WeaponServices_SelectItem");
|
||||
CALL_VIRTUAL(void, offset, this, pWeapon, unk1);
|
||||
}
|
||||
};
|
||||
|
||||
class CCSPlayerController_ActionTrackingServices : public CPlayerControllerComponent {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include <cstdint>
|
||||
|
||||
namespace TemplatePlugin
|
||||
namespace RayTracePlugin
|
||||
{
|
||||
template <typename T, typename... Args>
|
||||
inline T CallVFunc(void* base, int index, Args... args)
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
#include <mutex>
|
||||
#include <queue>
|
||||
|
||||
namespace TemplatePlugin {
|
||||
namespace RayTracePlugin {
|
||||
double universal_time = 0.0;
|
||||
double last_tick_time = 0.0;
|
||||
double timer_next_think = 0.0;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include <functional>
|
||||
|
||||
namespace TemplatePlugin {
|
||||
namespace RayTracePlugin {
|
||||
using TimerCallback = std::function<void()>;
|
||||
|
||||
enum TimerFlags {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
#include <algorithm>
|
||||
#include <vector.h>
|
||||
|
||||
namespace TemplatePlugin::VectorExtends
|
||||
namespace RayTracePlugin::VectorExtends
|
||||
{
|
||||
inline const Vector VectorZero{0.0f, 0.0f, 0.0f};
|
||||
inline const QAngle RotationZero{0.0f, 0.0f, 0.0f};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue