Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to Fake Teleport and Fake Fake Teleport #3692

Merged
merged 3 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions ChaosMod/Components/EffectDispatchTimer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,21 @@ void EffectDispatchTimer::ResetFakeTimerPercentage()
m_FakeTimerPercentage = 0.f;
}

bool EffectDispatchTimer::IsTimerPaused() const
{
return m_PauseTimer;
}

void EffectDispatchTimer::SetTimerPaused(bool pause)
{
m_PauseTimer = pause;
}

bool EffectDispatchTimer::IsUsingDistanceBasedDispatch() const
{
return m_DistanceChaosState.EnableDistanceBasedEffectDispatch;
}

void EffectDispatchTimer::OnRun()
{
auto curTime = GetTickCount64();
Expand Down
5 changes: 5 additions & 0 deletions ChaosMod/Components/EffectDispatchTimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,10 @@ class EffectDispatchTimer : public Component
void SetFakeTimerPercentage(float percentage);
void ResetFakeTimerPercentage();

bool IsTimerPaused() const;
void SetTimerPaused(bool pause);

bool IsUsingDistanceBasedDispatch() const;

virtual void OnRun() override;
};
4 changes: 2 additions & 2 deletions ChaosMod/Components/EffectDispatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,15 +345,15 @@ void EffectDispatcher::UpdateEffects(int deltaTime)
if (!effectSharedData->OverrideEffectName.empty())
{
activeEffect.FakeName = effectSharedData->OverrideEffectName;
effectSharedData->OverrideEffectId.clear();
effectSharedData->OverrideEffectName.clear();
}

if (!effectSharedData->OverrideEffectId.empty())
{
if (g_EnabledEffects.contains(effectSharedData->OverrideEffectId))
{
auto &fakeEffect = g_EnabledEffects.at(effectSharedData->OverrideEffectId);
activeEffect.FakeName = !fakeEffect.HasCustomName() ? "" : fakeEffect.CustomName;
activeEffect.FakeName = !fakeEffect.HasCustomName() ? fakeEffect.Name : fakeEffect.CustomName;
}
else
{
Expand Down
19 changes: 15 additions & 4 deletions ChaosMod/Effects/db/Player/PlayerBlimpStrats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@

#include "Memory/Hooks/ScriptThreadRunHook.h"

static void OnStart()
#include "PlayerBlimpStrats.h"

void OnStartBlimpStrats(bool bHandleThreadBlock)
{
Hooks::EnableScriptThreadBlock();
if (bHandleThreadBlock)
Hooks::EnableScriptThreadBlock();

bool cutscenePlaying = IS_CUTSCENE_PLAYING();

Hash blimpHash = "blimp"_hash;
Expand Down Expand Up @@ -61,15 +65,22 @@ static void OnStart()
SET_PED_AS_NO_LONGER_NEEDED(&pedDave);
}

Hooks::DisableScriptThreadBlock();
if (bHandleThreadBlock)
Hooks::DisableScriptThreadBlock();

SET_VEHICLE_AS_NO_LONGER_NEEDED(&veh);
}

static void OnStart()
{
OnStartBlimpStrats(true);
}

// clang-format off
REGISTER_EFFECT(OnStart, nullptr, nullptr, EffectInfo
{
.Name = "Blimp Strats",
.Id = "player_blimp_strats",
.EffectGroupType = EffectGroupType::Teleport
}
);
);
3 changes: 3 additions & 0 deletions ChaosMod/Effects/db/Player/PlayerBlimpStrats.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#pragma once

void OnStartBlimpStrats(bool bHandleThreadBlock);
6 changes: 4 additions & 2 deletions ChaosMod/Effects/db/Player/PlayerRandomStuntJump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include "Util/Player.h"
#include "Util/Vehicle.h"

#include "PlayerRandomStuntJump.h"

struct Location
{
Vector3 coordinates;
Expand Down Expand Up @@ -47,7 +49,7 @@ CHAOS_VAR std::vector<Location> allPossibleJumps = {
{ { -958.207, -2766.583, 13.693 }, 151.829, 45.f } // 30
};

static void OnStart()
void OnStartMakeRandomStuntJump()
{
Ped playerPed = PLAYER_PED_ID();
Vehicle veh;
Expand Down Expand Up @@ -76,7 +78,7 @@ static void OnStart()
}

// clang-format off
REGISTER_EFFECT(OnStart, nullptr, nullptr, EffectInfo
REGISTER_EFFECT(OnStartMakeRandomStuntJump, nullptr, nullptr, EffectInfo
{
.Name = "Make Random Stunt Jump",
.Id = "player_tp_stunt",
Expand Down
3 changes: 3 additions & 0 deletions ChaosMod/Effects/db/Player/PlayerRandomStuntJump.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#pragma once

void OnStartMakeRandomStuntJump();
Loading