refactor(VehicleTab): Optimised auto pilot

This commit is contained in:
Yimura 2021-02-06 00:35:53 +01:00
parent ff75d05760
commit 9203f32325
No known key found for this signature in database
GPG Key ID: 54EFAD29393A6E78

View File

@ -62,9 +62,10 @@ namespace big
{ {
Vector3 location = HUD::GET_BLIP_COORDS(blipHandle); Vector3 location = HUD::GET_BLIP_COORDS(blipHandle);
// Make sure the AI can reach this // Make sure the AI can reach this
location = teleport::get_ground_at_3dcoord(location); if (teleport::load_ground_at_3dcoord(location))
TASK::TASK_VEHICLE_DRIVE_TO_COORD(PLAYER::PLAYER_PED_ID(), veh, location.x, location.y, location.z, 35.f, 0, veh, 2883620, 10.f, true);
TASK::TASK_VEHICLE_DRIVE_TO_COORD(PLAYER::PLAYER_PED_ID(), veh, location.x, location.y, location.z, 35.f, 0, veh, 2883620, 10.f, true); else
notify::above_map("Unable to find ground at location.");
} }
}QUEUE_JOB_END_CLAUSE }QUEUE_JOB_END_CLAUSE
} }
@ -73,11 +74,13 @@ namespace big
{ {
QUEUE_JOB_BEGIN_CLAUSE() QUEUE_JOB_BEGIN_CLAUSE()
{ {
Vehicle veh = PED::GET_VEHICLE_PED_IS_IN(PLAYER::PLAYER_PED_ID(), false); Ped player = PLAYER::PLAYER_PED_ID();
Vector3 location = ENTITY::GET_ENTITY_COORDS(PLAYER::PLAYER_PED_ID(), true); Vehicle veh = PED::GET_VEHICLE_PED_IS_IN(player, false);
TASK::TASK_VEHICLE_DRIVE_TO_COORD(PLAYER::PLAYER_PED_ID(), veh, location.x, location.y, location.z, 35.f, 0, veh, 2883620, 10.f, true); Vector3 location = ENTITY::GET_ENTITY_COORDS(player, true);
TASK::TASK_VEHICLE_DRIVE_TO_COORD(player, veh, location.x, location.y, location.z, 35.f, 0, veh, 2883620, 10.f, true);
}QUEUE_JOB_END_CLAUSE }QUEUE_JOB_END_CLAUSE
} }