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:
parent
1443bc0cab
commit
1088ec6d4b
@ -86,6 +86,7 @@ namespace big
|
||||
|
||||
QUEUE_JOB_BEGIN_CLAUSE()
|
||||
{
|
||||
looped::vehicle_auto_drive();
|
||||
looped::vehicle_despawn_bypass();
|
||||
looped::vehicle_drive_on_water();
|
||||
looped::vehicle_god_mode();
|
||||
|
@ -36,6 +36,7 @@ namespace big
|
||||
static void system_self_globals();
|
||||
static void system_update_pointers();
|
||||
|
||||
static void vehicle_auto_drive();
|
||||
static void vehicle_despawn_bypass();
|
||||
static void vehicle_drive_on_water();
|
||||
static void vehicle_god_mode();
|
||||
|
112
BigBaseV2/src/backend/looped/vehicle/auto_drive.cpp
Normal file
112
BigBaseV2/src/backend/looped/vehicle/auto_drive.cpp
Normal file
@ -0,0 +1,112 @@
|
||||
#include "backend/looped/looped.hpp"
|
||||
#include "natives.hpp"
|
||||
#include "util/blip.hpp"
|
||||
#include "util/entity.hpp"
|
||||
#include "gta/enums.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void looped::vehicle_auto_drive()
|
||||
{
|
||||
static Vector3 location;
|
||||
static bool running = true;
|
||||
static bool wandering = true;
|
||||
static bool ran_once = false;
|
||||
|
||||
if (g->vehicle.auto_drive_to_waypoint)
|
||||
{
|
||||
running = false;
|
||||
ran_once = true;
|
||||
|
||||
if (!blip::get_blip_location(location, (int)BlipIcons::Waypoint))
|
||||
{
|
||||
g_notification_service->push_warning("Warning", "No Waypoint found please set one first.");
|
||||
g->vehicle.auto_drive_to_waypoint = false;
|
||||
}
|
||||
else if (!self::veh)
|
||||
{
|
||||
g_notification_service->push_warning("Warning", "Please be in a car first then try again.");
|
||||
}
|
||||
else
|
||||
{
|
||||
blip::get_blip_location(location, (int)BlipIcons::Waypoint);
|
||||
|
||||
g_notification_service->push_warning("Auto Drive", "Starting Route To Destination");
|
||||
|
||||
g_notification_service->push_warning("Auto Drive", "Start driving or leave car to take back control.");
|
||||
|
||||
TASK::CLEAR_VEHICLE_TASKS_(self::veh);
|
||||
|
||||
TASK::TASK_VEHICLE_DRIVE_TO_COORD(self::ped, self::veh, location.x, location.y, location.z, (int)g->vehicle.auto_drive_speed, 5, ENTITY::GET_ENTITY_MODEL(self::veh), g->vehicle.driving_style_flags, 20, true);
|
||||
|
||||
g->vehicle.auto_drive_to_waypoint = false;
|
||||
|
||||
running = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (g->vehicle.auto_drive_wander)
|
||||
{
|
||||
ran_once = true;
|
||||
wandering = false;
|
||||
|
||||
if (!self::veh)
|
||||
{
|
||||
g_notification_service->push_warning("Warning", "Please be in a car first then try again.");
|
||||
|
||||
g->vehicle.auto_drive_wander = false;
|
||||
|
||||
TASK::CLEAR_VEHICLE_TASKS_(self::veh);
|
||||
}
|
||||
else
|
||||
{
|
||||
g->vehicle.auto_drive_wander = false;
|
||||
|
||||
TASK::CLEAR_VEHICLE_TASKS_(self::veh);
|
||||
|
||||
TASK::CLEAR_PED_TASKS(self::ped);
|
||||
|
||||
TASK::TASK_VEHICLE_DRIVE_WANDER(self::ped, self::veh, (int)g->vehicle.auto_drive_speed, g->vehicle.driving_style_flags);
|
||||
|
||||
wandering = true;
|
||||
|
||||
g_notification_service->push_warning("Starting Wondering", "Start driving or leave car to take back control.");
|
||||
}
|
||||
}
|
||||
|
||||
if (wandering && ran_once)
|
||||
{
|
||||
if (PAD::IS_CONTROL_PRESSED(0, 63) || PAD::IS_CONTROL_PRESSED(0, 64) || PAD::IS_CONTROL_PRESSED(0, 71) || PAD::IS_CONTROL_PRESSED(0, 72) || PAD::IS_CONTROL_PRESSED(0, 75) || PAD::IS_CONTROL_PRESSED(0, 76))
|
||||
{
|
||||
TASK::CLEAR_VEHICLE_TASKS_(self::veh);
|
||||
TASK::CLEAR_PED_TASKS(self::ped);
|
||||
g_notification_service->push_warning("Warning", "Wandering Stopped");
|
||||
g->vehicle.auto_drive_wander = false;
|
||||
wandering = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (running)
|
||||
{
|
||||
if (!blip::get_blip_location(location, (int)BlipIcons::Waypoint) || PAD::IS_CONTROL_PRESSED(0, 75) || PAD::IS_CONTROL_PRESSED(0, 63) || PAD::IS_CONTROL_PRESSED(0, 64))
|
||||
{
|
||||
if (!blip::get_blip_location(location, (int)BlipIcons::Waypoint))
|
||||
{
|
||||
VEHICLE::SET_VEHICLE_FORWARD_SPEED(self::veh, 8);
|
||||
}
|
||||
|
||||
g->vehicle.auto_drive_to_waypoint = false;
|
||||
|
||||
if (ran_once)
|
||||
{
|
||||
g_notification_service->push_warning("Warning", "Autodrive Stopped");
|
||||
}
|
||||
|
||||
TASK::CLEAR_VEHICLE_TASKS_(self::veh);
|
||||
TASK::CLEAR_PED_TASKS(self::ped);
|
||||
|
||||
running = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -191,7 +191,12 @@ namespace big
|
||||
bool left_side = false;
|
||||
};
|
||||
|
||||
bool auto_drive_to_waypoint = false;
|
||||
bool auto_drive_wander = false;
|
||||
int auto_drive_speed = 1;
|
||||
bool drive_on_water = false;
|
||||
int driving_style_id = 0;
|
||||
int driving_style_flags = 525116;
|
||||
bool god_mode = false;
|
||||
bool horn_boost = false;
|
||||
bool instant_brake = false;
|
||||
@ -426,6 +431,10 @@ namespace big
|
||||
this->spoofing.rockstar_id = j["spoofing"]["rockstar_id"];
|
||||
this->spoofing.username = j["spoofing"]["username"];
|
||||
|
||||
this->vehicle.auto_drive_speed = j["vehicle"]["auto_drive_speed"];
|
||||
this->vehicle.auto_drive_wander = j["vehicle"]["auto_drive_wander"];
|
||||
this->vehicle.auto_drive_to_waypoint = j["vehicle"]["auto_drive_to_waypoint"];
|
||||
this->vehicle.driving_style_id = j["vehicle"]["driving_style"];
|
||||
this->vehicle.drive_on_water = j["vehicle"]["drive_on_water"];
|
||||
this->vehicle.god_mode = j["vehicle"]["god_mode"];
|
||||
this->vehicle.horn_boost = j["vehicle"]["horn_boost"];
|
||||
@ -630,6 +639,10 @@ namespace big
|
||||
},
|
||||
{
|
||||
"vehicle", {
|
||||
{ "auto_drive_speed", this->vehicle.auto_drive_speed },
|
||||
{ "auto_drive_wander", this->vehicle.auto_drive_wander },
|
||||
{ "driving_style", this->vehicle.driving_style_id },
|
||||
{ "auto_drive_to_waypoint", this->vehicle.auto_drive_to_waypoint },
|
||||
{ "drive_on_water", this->vehicle.drive_on_water },
|
||||
{ "god_mode", this->vehicle.god_mode },
|
||||
{ "horn_boost", this->vehicle.horn_boost },
|
||||
|
@ -106,4 +106,6 @@ namespace big::vehicle
|
||||
|
||||
static constexpr char const* rgb_types[] = { "Off", "Fade", "Spasm" };
|
||||
|
||||
}
|
||||
static constexpr int driving_styles[] = { 444, 525116, 787260 };
|
||||
static constexpr char const* driving_style_names[] = { "Safe-ish", "Normal", "Hit Everything" };
|
||||
}
|
@ -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", [] {
|
||||
|
Reference in New Issue
Block a user