
* refactor: Use self globals * refactor: Use gui::components * fix(Vehicle Preview): Addresses #119 Previewed vehicle set to unclimbable Only preview when hovered on vehicle * fix(Infinite Clip): Disabling it now works * fix(No Ragdoll): Disabling it now works Removed unnecessary calls to natives (0xB128377056A54E2A should be enough) * fix(Spawn): Wrong footer placement * fix self globals file name typo * refactor(Mobile): Clear ped tasks when set conditions are met Only clear ped tasks if pv_teleport_into bool is true and ped is in a vehicle * feat(Weapons): Remove current weapon * refactor: Added missing variable in calls to self globals * refactor: Utilize usage of ControllerInputs * fix(Vehicle Fly): uninitialized local variable 'ped' used * refactor(No Ragdoll, Infinite Clip): Only run on boolean change. * refactor(Infinite Ammo): Simplified code * refactor: Utilize ControllerInputs in other areas of code * refactor: Utilize ControllerInputs in other areas of code
115 lines
3.7 KiB
C++
115 lines
3.7 KiB
C++
#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()
|
|
{
|
|
Vehicle vehicle = self::veh;
|
|
Ped ped = self::ped;
|
|
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 (!vehicle)
|
|
{
|
|
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_(vehicle);
|
|
|
|
TASK::TASK_VEHICLE_DRIVE_TO_COORD(ped, vehicle, location.x, location.y, location.z,
|
|
static_cast<float>(g->vehicle.auto_drive_speed), 5, ENTITY::GET_ENTITY_MODEL(vehicle), 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 (!vehicle)
|
|
{
|
|
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_(vehicle);
|
|
}
|
|
else
|
|
{
|
|
g->vehicle.auto_drive_wander = false;
|
|
|
|
TASK::CLEAR_VEHICLE_TASKS_(vehicle);
|
|
|
|
TASK::CLEAR_PED_TASKS(ped);
|
|
|
|
TASK::TASK_VEHICLE_DRIVE_WANDER(ped, vehicle, static_cast<float>(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, (int)ControllerInputs::INPUT_VEH_MOVE_LEFT_ONLY) || PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_MOVE_RIGHT_ONLY) || PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_ACCELERATE) || PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_BRAKE) || PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_EXIT) || PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_HANDBRAKE))
|
|
{
|
|
TASK::CLEAR_VEHICLE_TASKS_(vehicle);
|
|
TASK::CLEAR_PED_TASKS(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, (int)ControllerInputs::INPUT_VEH_MOVE_LEFT_ONLY) || PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_MOVE_RIGHT_ONLY) || PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_ACCELERATE) || PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_BRAKE) || PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_EXIT) || PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_HANDBRAKE))
|
|
{
|
|
if (!blip::get_blip_location(location, (int)BlipIcons::Waypoint))
|
|
{
|
|
VEHICLE::SET_VEHICLE_FORWARD_SPEED(vehicle, 8);
|
|
}
|
|
|
|
g->vehicle.auto_drive_to_waypoint = false;
|
|
|
|
if (ran_once)
|
|
{
|
|
g_notification_service->push_warning("Warning", "Autodrive Stopped");
|
|
}
|
|
|
|
TASK::CLEAR_VEHICLE_TASKS_(vehicle);
|
|
TASK::CLEAR_PED_TASKS(ped);
|
|
|
|
running = false;
|
|
}
|
|
}
|
|
}
|
|
} |