feat(Vehicle): Add auto drive (#182)

* Should be working

* Boy am I dumb

* Fixes and added wander and other shit
This commit is contained in:
Maddy
2022-05-09 08:59:38 -04:00
committed by GitHub
parent 1443bc0cab
commit 1088ec6d4b
6 changed files with 168 additions and 3 deletions

View File

@ -1,8 +1,9 @@
#include "views/view.hpp"
#include "core/data/speedo_meters.hpp"
#include "fiber_pool.hpp"
#include "gui/handling/handling_tabs.hpp"
#include "script.hpp"
#include "util/vehicle.hpp"
#include "views/view.hpp"
namespace big
{
@ -11,7 +12,7 @@ namespace big
ImGui::Checkbox("Can Be Targeted", &g->vehicle.is_targetable);
ImGui::Checkbox("God Mode", &g->vehicle.god_mode);
ImGui::Checkbox("Horn Boost", &g->vehicle.horn_boost);
ImGui::Checkbox("Instant Brake", &g->vehicle.instant_brake);
ImGui::Checkbox("Instant Brake", &g->vehicle.instant_brake);
ImGui::Checkbox("Drive On Water", &g->vehicle.drive_on_water);
ImGui::EndGroup();
@ -39,6 +40,41 @@ namespace big
ImGui::Separator();
components::small_text("Auto Drive");
components::button("Drive To Waypoint", [] {
g->vehicle.auto_drive_to_waypoint = true;
});
components::button("Wander", [] {
g->vehicle.auto_drive_wander = true;
});
ImGui::SliderInt("Top Speed", &g->vehicle.auto_drive_speed, 1, 200);
components::button("E-Stop", [] {
QUEUE_JOB_BEGIN_CLAUSE()
{
g->vehicle.auto_drive_to_waypoint = false;
g->vehicle.auto_drive_wander = false;
VEHICLE::SET_VEHICLE_FORWARD_SPEED(self::veh, 0);
TASK::CLEAR_VEHICLE_TASKS_(self::veh);
TASK::CLEAR_PED_TASKS(self::ped);
}
QUEUE_JOB_END_CLAUSE
});
if (ImGui::ListBox("Driving Style", &g->vehicle.driving_style_id, vehicle::driving_style_names, 3))
{
g->vehicle.driving_style_flags = vehicle::driving_styles[g->vehicle.driving_style_id];
g_notification_service->push_warning("Auto Drive", fmt::format("Driving style set to {}.", vehicle::driving_style_names[g->vehicle.driving_style_id]));
}
ImGui::Separator();
components::small_text("LS Customs");
components::button("Start LS Customs", [] {