Skip to content

Commit

Permalink
Merge pull request #88 from Pietrodjaowjao/main
Browse files Browse the repository at this point in the history
Make speedboost not hardcoded values
  • Loading branch information
scp222thj authored Jun 3, 2024
2 parents 3daf41b + acf77b1 commit fdb6b4d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 26 deletions.
23 changes: 0 additions & 23 deletions src/Cheats/MalumCheats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,29 +180,6 @@ public static void teleportCursorCheat()
}
}

public static void speedBoostCheat()
{
// try-catch to avoid some errors I was reciving in the logs related to this cheat

try{

// PlayerControl.LocalPlayer.MyPhysics.Speed is the base speed of a player
// Among Us uses this value with the associated game setting to calculate the TrueSpeed of the player

if(CheatToggles.speedBoost){

PlayerControl.LocalPlayer.MyPhysics.Speed = 2.5f * 2;

}else{

// By default, Speed is always 2.5f, but this needs a better implementation since hard-coding values isn't great
PlayerControl.LocalPlayer.MyPhysics.Speed = 2.5f;

}

}catch{}
}

public static void noClipCheat()
{
try{
Expand Down
2 changes: 1 addition & 1 deletion src/Patches/OtherPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public static void Postfix(HatManager __instance){
}

[HarmonyPatch(typeof(StatsManager), nameof(StatsManager.BanMinutesLeft), MethodType.Getter)]
public static class StatsManager_BanMinutesLeft
public static class StatsManager_BanMinutesLeft_Getter
{
// Prefix patch of Getter method for StatsManager.BanMinutesLeft to remove disconnect penalty
public static void Postfix(StatsManager __instance, ref int __result)
Expand Down
22 changes: 20 additions & 2 deletions src/Patches/PlayerPhysicsPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public static void Postfix(PlayerPhysics __instance)
MalumESP.seeGhostsCheat(__instance);

MalumCheats.noClipCheat();
MalumCheats.speedBoostCheat();
MalumCheats.murderAllCheat();
MalumCheats.teleportCursorCheat();
MalumCheats.completeMyTasksCheat();
Expand All @@ -37,4 +36,23 @@ public static void Postfix(PlayerPhysics __instance)
}
}
}
}
}

[HarmonyPatch(typeof(PlayerPhysics), nameof(PlayerPhysics.SetNormalizedVelocity))]
public static class PlayerPhysics_SetNormalizedVelocity
{
public static bool Prefix(PlayerPhysics __instance, Vector2 direction)
{
if (CheatToggles.speedBoost){
float cheatSpeed = 2f;

float actualSpeed = PlayerControl.LocalPlayer.MyPhysics.Speed * PlayerControl.LocalPlayer.MyPhysics.SpeedMod;

PlayerControl.LocalPlayer.MyPhysics.body.velocity = direction * actualSpeed * cheatSpeed;

return false;
}

return true;
}
}

0 comments on commit fdb6b4d

Please sign in to comment.