Add stealth cheat
This commit is contained in:
@@ -37,6 +37,7 @@ static bool g_Fog_fix_enabled = false;
|
|||||||
static bool g_TimeDilation_fix_enabled = false;
|
static bool g_TimeDilation_fix_enabled = false;
|
||||||
static bool g_GodMode_fix_enabled = false;
|
static bool g_GodMode_fix_enabled = false;
|
||||||
static bool g_Invulnerable_fix_enabled = false;
|
static bool g_Invulnerable_fix_enabled = false;
|
||||||
|
static bool g_Stealth_fix_enabled = false;
|
||||||
static int g_AdditionalFOVValue = 0;
|
static int g_AdditionalFOVValue = 0;
|
||||||
static int g_CameraOffset = 0;
|
static int g_CameraOffset = 0;
|
||||||
static float g_WorldTimeDilationValue = 1.f;
|
static float g_WorldTimeDilationValue = 1.f;
|
||||||
@@ -199,6 +200,7 @@ extern "C" __declspec(dllexport) void SetFixesEnabled(GameFixes fix, bool enable
|
|||||||
if (fix == GameFixes::TimeDilation) { g_TimeDilation_fix_enabled = enabled; EnableCheats(Cheat::TimeDilation); }
|
if (fix == GameFixes::TimeDilation) { g_TimeDilation_fix_enabled = enabled; EnableCheats(Cheat::TimeDilation); }
|
||||||
if (fix == GameFixes::GodMode) { g_GodMode_fix_enabled = enabled; EnableCheats(Cheat::GodMode); }
|
if (fix == GameFixes::GodMode) { g_GodMode_fix_enabled = enabled; EnableCheats(Cheat::GodMode); }
|
||||||
if (fix == GameFixes::Invulnerable) { g_Invulnerable_fix_enabled = enabled; EnableCheats(Cheat::Invulnerability); }
|
if (fix == GameFixes::Invulnerable) { g_Invulnerable_fix_enabled = enabled; EnableCheats(Cheat::Invulnerability); }
|
||||||
|
if (fix == GameFixes::Stealth) { g_Stealth_fix_enabled = enabled; EnableCheats(Cheat::Stealth); }
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" __declspec(dllexport) void SetFOV(int fov) {
|
extern "C" __declspec(dllexport) void SetFOV(int fov) {
|
||||||
@@ -506,38 +508,41 @@ static void EnableCheats(Cheat cheat) {
|
|||||||
|
|
||||||
ULONGLONG now = GetTickCount64();
|
ULONGLONG now = GetTickCount64();
|
||||||
if (now - lastScanTick < DEFAULT_ACTORS_SCAN_BETWEEN_TICKS) return;
|
if (now - lastScanTick < DEFAULT_ACTORS_SCAN_BETWEEN_TICKS) return;
|
||||||
|
|
||||||
lastScanTick = now;
|
lastScanTick = now;
|
||||||
|
|
||||||
UWorld* world = UWorld::GetWorld();
|
UWorld* world = UWorld::GetWorld();
|
||||||
if (!world) return;
|
if (!world) return;
|
||||||
APawn* pawn = GetPawnFromWorld(world);
|
APawn* pawn = GetPawnFromWorld(world);
|
||||||
if (!pawn) return;
|
if (!pawn) return;
|
||||||
// Enemies time dilation,
|
|
||||||
|
// Enemies time dilation & stealth
|
||||||
for (int i = 0; i < world->Levels.Num(); i++) { // Loop through level to find actors
|
for (int i = 0; i < world->Levels.Num(); i++) { // Loop through level to find actors
|
||||||
ULevel* Level = world->Levels[i];
|
ULevel* Level = world->Levels[i];
|
||||||
if (!Level) continue;
|
if (!Level) continue;
|
||||||
|
|
||||||
for (int j = 0; j < Level->Actors.Num(); j++) { // Loop through actors
|
for (int j = 0; j < Level->Actors.Num(); j++) { // Loop through actors
|
||||||
AActor* actor = Level->Actors[j];
|
AActor* actor = Level->Actors[j];
|
||||||
if (!actor) continue;
|
if (!actor || actor == pawn) continue; // We don't want to affect Jacob
|
||||||
if (actor == pawn) continue; // We don't want to affect Jacob
|
if (!actor->IsA(APhxAICharacter::StaticClass())) continue; // We want to affect enemies only
|
||||||
if (!actor->IsA(ACharacter::StaticClass()) && !actor->IsA(APawn::StaticClass()))
|
|
||||||
continue; // We want to affect only enemies
|
|
||||||
|
|
||||||
actor->CustomTimeDilation = g_TimeDilation_fix_enabled ? g_AITimeDilationValue : 1.f;
|
actor->CustomTimeDilation = g_TimeDilation_fix_enabled ? g_AITimeDilationValue : 1.f;
|
||||||
|
// Stealth
|
||||||
|
APhxAICharacter* aiChar = static_cast<APhxAICharacter*>(actor);
|
||||||
|
if (!aiChar || !aiChar->SenseComponent) continue; // UPhxAISenseComponent class
|
||||||
|
aiChar->SenseComponent->EnableSensing(!g_Stealth_fix_enabled); // Enemies won't be aware of Jacob
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// God mode
|
// God mode
|
||||||
AActor* jacob = static_cast<AActor*>(pawn);
|
AActor* jacob = static_cast<AActor*>(pawn);
|
||||||
if (jacob) jacob->bCanBeDamaged = g_GodMode_fix_enabled ? false : true; // Jacob won't be hurt
|
if (jacob) jacob->bCanBeDamaged = !g_GodMode_fix_enabled; // Jacob won't be hurt
|
||||||
// Invulnerability
|
// Ignore hits
|
||||||
APhxCharacter* phxChar = GetPhxCharacterFromPawn(pawn);
|
APhxCharacter* phxChar = GetPhxCharacterFromPawn(pawn);
|
||||||
if (phxChar) phxChar->bInvulnerable = g_Invulnerable_fix_enabled ? true : false; // Make Jacob invulnerable
|
if (phxChar) phxChar->bInvulnerable = g_Invulnerable_fix_enabled; // Jacob can't be hit
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (cheat == Cheat::TimeDilation) logger->info("Time dilation cheat {}", g_TimeDilation_fix_enabled ? "enabled" : "disabled");
|
if (cheat == Cheat::TimeDilation) logger->info("Time dilation cheat {}", g_TimeDilation_fix_enabled ? "enabled" : "disabled");
|
||||||
if (cheat == Cheat::GodMode) logger->info("God mode cheat {}", g_GodMode_fix_enabled ? "enabled" : "disabled");
|
if (cheat == Cheat::GodMode) logger->info("God mode cheat {}", g_GodMode_fix_enabled ? "enabled" : "disabled");
|
||||||
if (cheat == Cheat::Invulnerability) logger->info("Ignore hits cheat {}", g_Invulnerable_fix_enabled ? "enabled" : "disabled");
|
if (cheat == Cheat::Invulnerability) logger->info("Ignore hits cheat {}", g_Invulnerable_fix_enabled ? "enabled" : "disabled");
|
||||||
|
if (cheat == Cheat::Stealth) logger->info("Stealth cheat {}", g_Stealth_fix_enabled ? "enabled" : "disabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void FogFixEnabled() {
|
static void FogFixEnabled() {
|
||||||
|
|||||||
Reference in New Issue
Block a user