-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disable Season and TimeFlow on game ready
- Loading branch information
Showing
7 changed files
with
90 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#include "game_ready.h" | ||
|
||
#include "states.h" | ||
|
||
#include "sdk/ue/game/traffic/c_streaming_traffic_module.h" | ||
#include "sdk/ue/gfx/environmenteffects/c_gfx_environment_effects.h" | ||
|
||
#include <utils/states/machine.h> | ||
|
||
namespace MafiaMP::Core::States { | ||
GameReadyState::GameReadyState() {} | ||
|
||
GameReadyState::~GameReadyState() {} | ||
|
||
int32_t GameReadyState::GetId() const { | ||
return StateIds::GameReady; | ||
} | ||
|
||
const char *GameReadyState::GetName() const { | ||
return "GameReady"; | ||
} | ||
|
||
bool GameReadyState::OnEnter(Framework::Utils::States::Machine *) { | ||
return true; | ||
} | ||
|
||
bool GameReadyState::OnExit(Framework::Utils::States::Machine *machine) { | ||
machine->RequestNextState(StateIds::MainMenu); | ||
return true; | ||
} | ||
|
||
bool GameReadyState::OnUpdate(Framework::Utils::States::Machine *) { | ||
const auto streamingTrafficModule = SDK::ue::game::traffic::C_StreamingTrafficModule::GetInstance(); | ||
if (!streamingTrafficModule) { | ||
return false; | ||
} | ||
|
||
const auto gfxEnvironmentEffects = SDK::ue::gfx::environmenteffects::C_GfxEnvironmentEffects::GetInstance(); | ||
if (!gfxEnvironmentEffects) { | ||
return false; | ||
} | ||
const auto weatherManager = gfxEnvironmentEffects->GetWeatherManager(); | ||
if (!weatherManager) { | ||
return false; | ||
} | ||
|
||
/** | ||
* Disable traffic | ||
* | ||
* Traffic is automaticaly loaded by the game via C_StreamingTrafficModule::OpenSeason | ||
* after C_StreamMap::OpenPart("freeride") is called. | ||
* | ||
* We close the season here which disable the traffic. | ||
*/ | ||
streamingTrafficModule->CloseSeason(true); | ||
|
||
/** | ||
* Disable TimeFlow | ||
* | ||
* We give scripters the option to update the time manually. | ||
*/ | ||
weatherManager->SetUserTimeFlowSpeedMult(0); | ||
|
||
return true; | ||
} | ||
} // namespace MafiaMP::Core::States |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#pragma once | ||
|
||
#include <utils/states/state.h> | ||
|
||
namespace MafiaMP::Core::States { | ||
class GameReadyState: public Framework::Utils::States::IState { | ||
public: | ||
GameReadyState(); | ||
~GameReadyState(); | ||
|
||
virtual const char *GetName() const override; | ||
virtual int32_t GetId() const override; | ||
|
||
virtual bool OnEnter(Framework::Utils::States::Machine *) override; | ||
virtual bool OnExit(Framework::Utils::States::Machine *) override; | ||
|
||
virtual bool OnUpdate(Framework::Utils::States::Machine *) override; | ||
}; | ||
} // namespace MafiaMP::Core::States |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters