Skip to content

Commit 5a83445

Browse files
committed
adding events, expanding old events.
1 parent 4e5f057 commit 5a83445

File tree

12 files changed

+217
-24
lines changed

12 files changed

+217
-24
lines changed

CS2Fixes.sln

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 17
4-
VisualStudioVersion = 17.3.32825.248
4+
VisualStudioVersion = 17.12.35707.178
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CS2Fixes", "CS2Fixes.vcxproj", "{2A734041-5881-4EA1-BF05-46F361443AF3}"
77
EndProject
@@ -26,6 +26,6 @@ Global
2626
HideSolutionNode = FALSE
2727
EndGlobalSection
2828
GlobalSection(ExtensibilityGlobals) = postSolution
29-
SolutionGuid = {12C11272-4784-4DD0-A905-B564ECADA421}
29+
SolutionGuid = {B6F3ACAE-5F98-35F2-85C4-16713E0FC2A2}
3030
EndGlobalSection
3131
EndGlobal

CS2Fixes.vcxproj

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,13 @@
7373
<PropertyGroup Label="UserMacros" />
7474
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
7575
<TargetName>cs2fixes</TargetName>
76-
<LibraryPath>sdk\lib\public\win64;vendor/funchook/lib;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64)</LibraryPath>
76+
<LibraryPath>sdk\lib\public\win64;vendor/funchook/lib;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);vendor/nlohmann;vendor</LibraryPath>
7777
<OutDir>$(SolutionDir)/build/package/addons/cs2fixes/bin/win64/</OutDir>
7878
<IntDir>$(SolutionDir)/build/$(ShortProjectName)\$(Platform)\$(Configuration)\</IntDir>
7979
</PropertyGroup>
8080
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
8181
<TargetName>cs2fixes</TargetName>
82-
<LibraryPath>sdk\lib\public\win64;vendor/funchook/lib;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64)</LibraryPath>
82+
<LibraryPath>sdk\lib\public\win64;vendor/nlohmann;vendor/funchook/lib;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64)</LibraryPath>
8383
<OutDir>$(SolutionDir)/package/addons/cs2fixes/bin/win64/</OutDir>
8484
</PropertyGroup>
8585
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
@@ -125,7 +125,7 @@
125125
<PrecompiledHeader>NotUsing</PrecompiledHeader>
126126
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
127127
<LanguageStandard>stdcpp20</LanguageStandard>
128-
<AdditionalIncludeDirectories>protobuf/generated;src/utils;src/cs2_sdk;sdk/public;sdk/public/tier0;sdk/game/shared;sdk/game/server;sdk/public/tier1;sdk/public/mathlib;minhook/include;../metamod-source/core;../metamod-source/core/sourcehook;vendor/subhook;vendor/funchook/include;sdk/public/entity2;sdk/public/game/server;sdk/thirdparty/protobuf-3.21.8/src;$(SolutionDir);vendor/funchook/lib;C:/Python312/include;vendor/pybind11/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
128+
<AdditionalIncludeDirectories>protobuf/generated;src/utils;src/cs2_sdk;sdk/public;sdk/public/tier0;sdk/game/shared;sdk/game/server;sdk/public/tier1;sdk/public/mathlib;minhook/include;../metamod-source/core;../metamod-source/core/sourcehook;vendor/subhook;vendor/funchook/include;sdk/public/entity2;sdk/public/game/server;sdk/thirdparty/protobuf-3.21.8/src;$(SolutionDir);vendor/funchook/lib;C:/Python312/include;vendor/pybind11/include;vendor/nlohmann/;%(AdditionalIncludeDirectories);../vendor/nlohmann/;../menu_system/public;../menu_system/public/imenusystem</AdditionalIncludeDirectories>
129129
<UndefinePreprocessorDefinitions>%(UndefinePreprocessorDefinitions)</UndefinePreprocessorDefinitions>
130130
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
131131
<MultiProcessorCompilation>true</MultiProcessorCompilation>
@@ -151,7 +151,7 @@
151151
<PrecompiledHeader>NotUsing</PrecompiledHeader>
152152
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
153153
<LanguageStandard>stdcpp20</LanguageStandard>
154-
<AdditionalIncludeDirectories>protobuf/generated;src/utils;src/cs2_sdk;sdk/public;sdk/public/tier0;sdk/game/shared;sdk/game/server;sdk/public/tier1;sdk/public/mathlib;minhook/include;../metamod-source/core;../metamod-source/core/sourcehook;vendor/subhook;vendor/funchook/include;sdk/public/entity2;sdk/public/game/server;sdk/thirdparty/protobuf-3.21.8/src;$(SolutionDir);vendor/funchook/lib;C:/Python312/include;vendor/pybind11/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
154+
<AdditionalIncludeDirectories>protobuf/generated;src/utils;src/cs2_sdk;sdk/public;sdk/public/tier0;sdk/game/shared;sdk/game/server;sdk/public/tier1;sdk/public/mathlib;minhook/include;../metamod-source/core;../metamod-source/core/sourcehook;vendor/subhook;vendor/funchook/include;sdk/public/entity2;sdk/public/game/server;sdk/thirdparty/protobuf-3.21.8/src;$(SolutionDir);vendor/funchook/lib;C:/Python312/include;vendor/pybind11/include;vendor/nlohmann/;vendor;%(AdditionalIncludeDirectories);../vendor/nlohmann/</AdditionalIncludeDirectories>
155155
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
156156
<UndefinePreprocessorDefinitions>%(UndefinePreprocessorDefinitions)</UndefinePreprocessorDefinitions>
157157
<MultiProcessorCompilation>true</MultiProcessorCompilation>
@@ -163,7 +163,7 @@
163163
<GenerateDebugInformation>true</GenerateDebugInformation>
164164
<EnableUAC>false</EnableUAC>
165165
<AdditionalDependencies>interfaces.lib;mathlib.lib;tier0.lib;tier1.lib;psapi.lib;funchook.lib;distorm.lib;steam_api64.lib;vendor/protobuf-lib/Release/libprotobuf.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
166-
<AdditionalLibraryDirectories>sdk/lib/public/win64;vendor/funchook/lib/Release;/NODEFAULTLIB;%(AdditionalLibraryDirectories);C:/Python312/libs</AdditionalLibraryDirectories>
166+
<AdditionalLibraryDirectories>sdk/lib/public/win64;vendor/funchook/lib/Release;/NODEFAULTLIB;%(AdditionalLibraryDirectories);C:/Python312/libs;vendor/nlohmann/</AdditionalLibraryDirectories>
167167
<ShowProgress>
168168
</ShowProgress>
169169
</Link>
@@ -172,6 +172,7 @@
172172
</PostBuildEvent>
173173
</ItemDefinitionGroup>
174174
<ItemGroup>
175+
<ClCompile Include="src\adventuremenu.cpp" />
175176
<ClCompile Include="src\adventuremod.cpp" />
176177
<ClCompile Include="src\buttonwatch.cpp" />
177178
<ClCompile Include="protobuf\generated\cs_usercmd.pb.cc" />
@@ -226,6 +227,7 @@
226227
<ClCompile Include="src\utils\plat_win.cpp" />
227228
</ItemGroup>
228229
<ItemGroup>
230+
<ClInclude Include="src\adventuremenu.h" />
229231
<ClInclude Include="src\adventuremod.h" />
230232
<ClInclude Include="src\buttonwatch.h" />
231233
<ClInclude Include="src\adminsystem.h" />

CS2Fixes.vcxproj.filters

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,9 @@
191191
<ClCompile Include="src\adventuremod.cpp">
192192
<Filter>Source Files</Filter>
193193
</ClCompile>
194+
<ClCompile Include="src\adventuremenu.cpp">
195+
<Filter>Source Files</Filter>
196+
</ClCompile>
194197
</ItemGroup>
195198
<ItemGroup>
196199
<ClInclude Include="src\mempatch.h">
@@ -418,5 +421,8 @@
418421
<ClInclude Include="src\adventuremod.h">
419422
<Filter>Header Files</Filter>
420423
</ClInclude>
424+
<ClInclude Include="src\adventuremenu.h">
425+
<Filter>Header Files</Filter>
426+
</ClInclude>
421427
</ItemGroup>
422428
</Project>

CS2Fixes.vcxproj.user

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
44
<LocalDebuggerCommand>E:/CS2Server\cs2\game\bin\win64\cs2.exe</LocalDebuggerCommand>
5-
<LocalDebuggerCommandArguments>-dedicated -usercon +game_type 0 +game_mode 1 +map de_dust2 -maxplayers_override 64</LocalDebuggerCommandArguments>
5+
<LocalDebuggerCommandArguments>-dedicated</LocalDebuggerCommandArguments>
66
<LocalDebuggerWorkingDirectory>E:/CS2Server\cs2\game\bin\win64</LocalDebuggerWorkingDirectory>
77
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
88
</PropertyGroup>
99
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
1010
<LocalDebuggerCommand>E:/CS2Server\cs2\game\bin\win64\cs2.exe</LocalDebuggerCommand>
11-
<LocalDebuggerCommandArguments>-dedicated -usercon +game_type 0 +game_mode 1 +map de_dust2 -maxplayers_override 64 +login CS2ModServer )+:b9h:S4SZcQuE</LocalDebuggerCommandArguments>
11+
<LocalDebuggerCommandArguments>-insecure -language english -window -dedicated -usercon +game_type 0 +game_mode 1 +map de_dust2 -maxplayers_override 64 +login CS2ModServer )+:b9h:S4SZcQuE</LocalDebuggerCommandArguments>
1212
<LocalDebuggerWorkingDirectory>E:/CS2Server\cs2\game\bin\win64</LocalDebuggerWorkingDirectory>
1313
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
1414
</PropertyGroup>

PyPlugins/pyplugins.ini

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,23 @@
3737
## python capture 'OnClientUltimate' but not as game event
3838

3939
#tests/TestOnAllPluginsLoaded.py
40-
#MenuSystem by Wend4r python interface to CS2Fixes.
40+
##MenuSystem by Wend4r python interface to CS2Fixes.
4141
##When a player connects UpdatePlayerItems is called by CPP which requests Python to send the players' info
4242
##When a player opens a menu by '!menu' display that info and if stale, update it.
4343

44-
tests/TestPyMySQL.py
45-
#Check for Database or Add
46-
#Check for Table or Add
47-
#Check for Connecting Player or Add
48-
#Count kills for Player
49-
#Print killcount
44+
#tests/TestPyMySQL.py
45+
##Check for Database or Add
46+
##Check for Table or Add
47+
##Check for Connecting Player or Add
48+
##Count kills for Player
49+
##Print killcount
50+
51+
52+
Adventure/Adventure.py
53+
5054

5155
###################tests/TestEffects.py
52-
## Here we go, time to make some nifty effects, pokeball go!
56+
## Here we go, time to make some nifty effects
5357
## playsound
5458
## create sprite
5559

@@ -58,4 +62,3 @@ tests/TestPyMySQL.py
5862
###################SampleEvents.py
5963
###################ManyRaces/AdventureTest.py
6064

61-
###################Adventure/Adventure.py

cfg/cs2fixes/cs2fixes.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Feature cvars
22
cs2f_commands_enable 1 // Whether to enable chat commands
3-
cs2f_admin_commands_enable 0 // Whether to enable admin chat commands
3+
cs2f_admin_commands_enable 1 // Whether to enable admin chat commands
44
cs2f_admin_immunity 0 // Mode for which admin immunity system targetting allows: 0 - strictly lower, 1 - equal to or lower, 2 - ignore immunity levels
55
cs2f_weapons_enable 0 // Whether to enable weapon commands
66
cs2f_stopsound_enable 0 // Whether to enable stopsound

configs/maplist.jsonc.example

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,32 @@
4848
"max_players": 20,
4949
"groups": [ "MyFirstGroup", "MySecondGroup" ] // A map can be in multiple groups
5050
}
51+
"de_ancient":{"enabled": true},
52+
"de_train":{"enabled": true},
53+
"de_vertigo":{"enabled": true},
54+
"de_anubis":{"enabled": true},
55+
"de_nuke":{"enabled": true},
56+
"de_inferno":{"enabled": true},
57+
"cs_italy":{"enabled": true},
58+
"cs_office":{"enabled": true},
59+
"ze_my_first_ze_map": {
60+
"enabled": true,
61+
"workshop_id": 123,
62+
"min_players": 30,
63+
"cooldown": 2
64+
},
65+
"ze_my_second_ze_map": {
66+
"enabled": true,
67+
"workshop_id": 456,
68+
"min_players": 5,
69+
"max_players": 10,
70+
"cooldown": 3
71+
},
72+
"ze_my_third_ze_map": {
73+
"enabled": true,
74+
"workshop_id": 789,
75+
"max_players": 20,
76+
"cooldown": 1
77+
}
5178
}
5279
}

src/PyModule.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ PYBIND11_EMBEDDED_MODULE(Source2Py, m) {
4141
//py::init<const char*>(((std::string*)s)->c_str());
4242
return GameEventKeySymbol_t(((std::string*)s)->c_str());
4343
}))
44-
45-
;
44+
;
4645
}
4746

4847
//IGameEvent player_hurt

src/PyPlugin.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,33 @@ namespace Source2Py {
9797
PyRuntime::ExecuteObjectMethod(m_PluginObject, "OnPlayerDeath", event);
9898
}
9999

100+
void PyPlugin::PyPlayerDeathNew(
101+
IGameEvent* event,
102+
CPlayerSlot killerSlot,
103+
uint64_t killerSteam,
104+
CPlayerSlot victimSlot,
105+
uint64_t victimSteam,
106+
CPlayerSlot assisterSlot,
107+
uint64_t assisterSteam,
108+
bool suicide)
109+
{
110+
PyRuntime::ExecuteObjectMethod(m_PluginObject, "OnPlayerDeath", event, killerSlot, killerSteam, victimSlot, victimSteam, assisterSlot, assisterSteam, suicide);
111+
}
112+
void PyPlugin::PyBombPlanted(IGameEvent* event, int slot, int site)
113+
{
114+
PyRuntime::ExecuteObjectMethod(m_PluginObject, "OnBombPlanted", event, slot, site);
115+
}
116+
117+
void PyPlugin::PyBombDefused(IGameEvent* event, int slot, int site)
118+
{
119+
PyRuntime::ExecuteObjectMethod(m_PluginObject, "OnBombDefused", event, slot, site);
120+
}
121+
122+
void PyPlugin::PyBombExploded(IGameEvent* event, int slot, int site)
123+
{
124+
PyRuntime::ExecuteObjectMethod(m_PluginObject, "OnBombExploded", event, slot, site);
125+
}
126+
100127
void PyPlugin::PyPlayerSpawn(int playerSlot)
101128
{
102129
PyRuntime::ExecuteObjectMethod(m_PluginObject, "OnPlayerSpawn", playerSlot);

src/PyPlugin.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,25 @@ namespace Source2Py {
3434
void PyClientUltimate(int playerSlot);
3535

3636
void PyPlayerHurt(IGameEvent* event);
37+
38+
//event, killerslot, killersteam, victimslot, victimsteam, assistorslot, assistorsteam, suicide
39+
void PyPlayerDeathNew(
40+
IGameEvent* event,
41+
CPlayerSlot killerSlot,
42+
uint64_t killerSteam,
43+
CPlayerSlot victimSlot,
44+
uint64_t victimSteam,
45+
CPlayerSlot assisterSlot,
46+
uint64_t assisterSteam,
47+
bool suicide
48+
);
3749
void PyPlayerDeath(IGameEvent* event);
50+
3851

52+
void PyBombPlanted(IGameEvent* event, int slot, int site);
53+
void PyBombDefused(IGameEvent* event, int slot, int site);
54+
void PyBombExploded(IGameEvent* event, int slot, int site);
55+
3956
void PyPlayerJump(int playerSlot);
4057
void PyPlayerAirborn(int playerSlot);
4158
void PyPlayerLand(int playerSlot);

0 commit comments

Comments
 (0)