Add Instant revive and automatic F4 for MVM

This commit is contained in:
BenCat07 2021-05-07 20:06:26 +02:00 committed by LightCat
parent 713e601117
commit 759e1a4aae
4 changed files with 39 additions and 6 deletions

View File

@ -40,6 +40,8 @@
<AutoVariable width="fill" target="killstreak.enable" label="Enable killstreak"/>
<AutoVariable width="fill" target="misc.backpack-expander.enabled" label="Expand backpack"/>
<AutoVariable width="fill" target="misc.backpack-expander.slot-count" label="Backpack slots" min="1" max="3000"/>
<AutoVariable width="fill" target="mvmtools.instant-revive" label="MVM Instant revive"/>
<AutoVariable width="fill" target="mvmtools.auto-f4" label="Auto F4"/>
</List>
</Box>
</Tab>

View File

@ -9,10 +9,10 @@
class CGameRules
{
public:
int pad0[12]; // 0 | 48 bytes | 48
int roundmode; // 48 | 4 bytes | 52
int pad1[1]; // 52 | 4 bytes | 56
int winning_team; // 56 | 4 bytes | 60
char pad2[974]; // 60 | 974 bytes | 1034
bool isPVEMode; // 1034 | 1 byte | 1035
int pad0[12]; // 0 | 48 bytes | 48
int roundmode; // 48 | 4 bytes | 52
int m_bInWaitingForPlayers; // 52 | 4 bytes | 56
int winning_team; // 56 | 4 bytes | 60
char pad2[974]; // 60 | 974 bytes | 1034
bool isPVEMode; // 1034 | 1 byte | 1035
};

View File

@ -31,6 +31,7 @@ set(files "${CMAKE_CURRENT_LIST_DIR}/AutoJoin.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Killstreak.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Misc.cpp"
"${CMAKE_CURRENT_LIST_DIR}/MiscPlayerInfo.cpp"
"${CMAKE_CURRENT_LIST_DIR}/MVMTools.cpp"
"${CMAKE_CURRENT_LIST_DIR}/NavBot.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Noisemaker.cpp"
"${CMAKE_CURRENT_LIST_DIR}/PureBypass.cpp"

30
src/hacks/MVMTools.cpp Normal file
View File

@ -0,0 +1,30 @@
#include "common.hpp"
namespace hacks::tf2::mvmtools
{
static settings::Boolean auto_revive("mvmtools.instant-revive", "false");
static settings::Boolean auto_f4("mvmtools.auto-f4", "false");
static Timer revive_timer{};
static Timer ready_timer{};
void CreateMove()
{
if (CE_INVALID(LOCAL_E))
return;
// only in MVM
if (!g_pGameRules->isPVEMode)
return;
if (auto_revive && !LOCAL_E->m_bAlivePlayer() && revive_timer.test_and_set(1000))
{
auto *kv = new KeyValues("MVM_Revive_Response");
kv->SetInt("accepted", 1);
g_IEngine->ServerCmdKeyValues(kv);
}
if (auto_f4 && g_pGameRules->roundmode == 10 && ready_timer.test_and_set(10000))
g_IEngine->ServerCmd("tournament_player_readystate 1");
}
static InitRoutine init([]() { EC::Register(EC::CreateMove, CreateMove, "mvmtools_createmove"); });
} // namespace hacks::tf2::mvmtools