Add Toggle steering assist quick action
- Added ModMenuModule::ToggleSteeringAssistAction
This commit is contained in:
parent
25610c28cd
commit
2f2dd06891
@ -704,6 +704,7 @@ echo Created $(ProjectDir)src\git.h with commit %GIT_HASH% (dirty=%GIT_DIRTY%)
|
||||
<ClInclude Include="src\modules\modmenu\quick-actions\spawn-vehicle.h" />
|
||||
<ClInclude Include="src\modules\modmenu\quick-actions\teleport.h" />
|
||||
<ClInclude Include="src\modules\modmenu\quick-actions\toggle-native-cheat.h" />
|
||||
<ClInclude Include="src\modules\modmenu\quick-actions\toggle-steering-assist.h" />
|
||||
<ClInclude Include="src\modules\modmenu\reset-binds-manager.h" />
|
||||
<ClInclude Include="src\modules\modmenu\segment-base.h" />
|
||||
<ClInclude Include="src\modules\modmenu\segment-support.h" />
|
||||
@ -939,6 +940,7 @@ echo Created $(ProjectDir)src\git.h with commit %GIT_HASH% (dirty=%GIT_DIRTY%)
|
||||
<ClCompile Include="src\modules\modmenu\quick-actions\spawn-vehicle.cpp" />
|
||||
<ClCompile Include="src\modules\modmenu\quick-actions\teleport.cpp" />
|
||||
<ClCompile Include="src\modules\modmenu\quick-actions\toggle-native-cheat.cpp" />
|
||||
<ClCompile Include="src\modules\modmenu\quick-actions\toggle-steering-assist.cpp" />
|
||||
<ClCompile Include="src\modules\modmenu\reset-binds-manager.cpp" />
|
||||
<ClCompile Include="src\modules\modmenu\root.cpp" />
|
||||
<ClCompile Include="src\modules\modmenu\segment-base.cpp" />
|
||||
|
||||
@ -170,6 +170,7 @@
|
||||
<ClCompile Include="src\events\steering-assist.cpp" />
|
||||
<ClCompile Include="src\modules\modmenu\cheats\disable-steering-assist.cpp" />
|
||||
<ClCompile Include="src\modules\modmenu\utils\get-selectable-car-lock-states.cpp" />
|
||||
<ClCompile Include="src\modules\modmenu\quick-actions\toggle-steering-assist.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="src\converters\ammo.h" />
|
||||
@ -456,6 +457,7 @@
|
||||
<ClInclude Include="src\converters\car-door-lock.h" />
|
||||
<ClInclude Include="src\converters\car-lock-state.h" />
|
||||
<ClInclude Include="src\modules\modmenu\utils\get-selectable-car-lock-states.h" />
|
||||
<ClInclude Include="src\modules\modmenu\quick-actions\toggle-steering-assist.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="GTA2.props" />
|
||||
|
||||
@ -12,3 +12,4 @@
|
||||
#include "switch-camera-mode.h"
|
||||
#include "teleport.h"
|
||||
#include "toggle-native-cheat.h"
|
||||
#include "toggle-steering-assist.h"
|
||||
|
||||
47
src/modules/modmenu/quick-actions/toggle-steering-assist.cpp
Normal file
47
src/modules/modmenu/quick-actions/toggle-steering-assist.cpp
Normal file
@ -0,0 +1,47 @@
|
||||
#include "toggle-steering-assist.h"
|
||||
#include "../cheats/disable-steering-assist.h"
|
||||
#include "../toast-manager.h"
|
||||
#include "../quick-action-registry.h"
|
||||
|
||||
static const std::string typeId = "ModMenu_ToggleSteeringAssist";
|
||||
static const std::wstring typeLabel = L"Toggle steering assist";
|
||||
|
||||
ModMenuModule::ToggleSteeringAssistAction::ToggleSteeringAssistAction()
|
||||
{
|
||||
}
|
||||
|
||||
ModMenuModule::ToggleSteeringAssistAction::~ToggleSteeringAssistAction()
|
||||
{
|
||||
}
|
||||
|
||||
const std::string& ModMenuModule::ToggleSteeringAssistAction::GetTypeId()
|
||||
{
|
||||
return typeId;
|
||||
}
|
||||
|
||||
const std::wstring& ModMenuModule::ToggleSteeringAssistAction::GetTypeLabel()
|
||||
{
|
||||
return typeLabel;
|
||||
}
|
||||
|
||||
void ModMenuModule::ToggleSteeringAssistAction::Execute()
|
||||
{
|
||||
auto* cheat = DisableSteeringAssistCheat::GetInstance();
|
||||
bool doEnable = !cheat->IsEnabled();
|
||||
cheat->SetEnabled(doEnable);
|
||||
|
||||
// enabled cheat = disabled assist
|
||||
if (doEnable) {
|
||||
ToastManager::GetInstance()->Show({ L"Steering assist disabled" });
|
||||
}
|
||||
else {
|
||||
ToastManager::GetInstance()->Show({ L"Steering assist enabled" });
|
||||
}
|
||||
}
|
||||
|
||||
const std::wstring& ModMenuModule::ToggleSteeringAssistAction::GetLabel() const
|
||||
{
|
||||
return typeLabel;
|
||||
}
|
||||
|
||||
REGISTER_QUICK_ACTION(ToggleSteeringAssistAction)
|
||||
16
src/modules/modmenu/quick-actions/toggle-steering-assist.h
Normal file
16
src/modules/modmenu/quick-actions/toggle-steering-assist.h
Normal file
@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
#include "../common.h"
|
||||
#include "../quick-action-base.h"
|
||||
|
||||
namespace ModMenuModule {
|
||||
class ToggleSteeringAssistAction : public QuickActionBase, public Core::EventListenerSupport {
|
||||
public:
|
||||
ToggleSteeringAssistAction();
|
||||
virtual ~ToggleSteeringAssistAction();
|
||||
static const std::string& GetTypeId();
|
||||
static const std::wstring& GetTypeLabel();
|
||||
|
||||
void Execute() override;
|
||||
const std::wstring& GetLabel() const override;
|
||||
};
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user