Skip to content

Commit

Permalink
potential mpt detector toast thingy murder me
Browse files Browse the repository at this point in the history
  • Loading branch information
Krzyhau committed Jul 29, 2023
1 parent ab5d038 commit d091b48
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions src/Modules/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "Features/Hud/StrafeHud.hpp"
#include "Features/Hud/StrafeQuality.hpp"
#include "Features/Hud/InputHud.hpp"
#include "Features/Hud/Toasts.hpp"
#include "Features/NetMessage.hpp"
#include "Features/PlayerTrace.hpp"
#include "Features/ReloadedFix.hpp"
Expand Down Expand Up @@ -291,6 +292,8 @@ DETOUR(Server::ProcessMovement, void *player, CMoveData *move) {
if (move->m_nButtons & IN_JUMP) scrollSpeedHud.OnJump(slot);
Event::Trigger<Event::PROCESS_MOVEMENT>({ slot, true });

auto startPosition = move->m_vecAbsOrigin;

auto res = Server::ProcessMovement(thisptr, player, move);

playerTrace->TweakLatestEyeOffsetForPortalShot(move, slot, false);
Expand All @@ -302,6 +305,13 @@ DETOUR(Server::ProcessMovement, void *player, CMoveData *move) {
g_playerTraceNeedsTeleport = false;
}

auto deltaPosition = (move->m_vecAbsOrigin - startPosition).Length();
bool groundedNew = SE(player)->ground_entity();

if (!grounded && groundedNew && deltaPosition > move->m_vecVelocity.Length() * 2.0f && deltaPosition > 64.0f) {
toastHud.AddToast("MPT", "MPT-viable teleportation detected.", true);
}

return res;
}

Expand Down
2 changes: 1 addition & 1 deletion src/SourceAutoRecord.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -495,4 +495,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
2 changes: 1 addition & 1 deletion src/SourceAutoRecord.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -1360,4 +1360,4 @@
<Filter>lib\SFML\System</Filter>
</None>
</ItemGroup>
</Project>
</Project>

0 comments on commit d091b48

Please sign in to comment.