From 6e9fbcdf095dc692adc916cacd794e88b4bfa99a Mon Sep 17 00:00:00 2001 From: Yimura Date: Tue, 18 Jan 2022 02:06:28 +0100 Subject: [PATCH] feat(Mobile): Added teleport into personal vehicle --- BigBaseV2/src/core/globals.hpp | 3 +++ BigBaseV2/src/gui/window/main/tab_mobile.cpp | 3 ++- BigBaseV2/src/util/mobile.hpp | 12 ++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/BigBaseV2/src/core/globals.hpp b/BigBaseV2/src/core/globals.hpp index d8db4827..13431767 100644 --- a/BigBaseV2/src/core/globals.hpp +++ b/BigBaseV2/src/core/globals.hpp @@ -95,6 +95,7 @@ struct globals { bool god_mode = false; bool horn_boost = false; bool ls_customs = false; // don't save this to disk + bool pv_teleport_into = false; speedo_meter speedo_meter{}; }; @@ -177,6 +178,7 @@ struct globals { this->vehicle.god_mode = j["vehicle"]["god_mode"]; this->vehicle.horn_boost = j["vehicle"]["horn_boost"]; + this->vehicle.pv_teleport_into = j["vehicle"]["pv_teleport_into"]; this->vehicle.speedo_meter.type = (SpeedoMeter)j["vehicle"]["speedo_meter"]["type"]; this->vehicle.speedo_meter.left_side = j["vehicle"]["speedo_meter"]["left_side"]; @@ -270,6 +272,7 @@ struct globals { "vehicle", { { "god_mode", this->vehicle.god_mode }, { "horn_boost", this->vehicle.horn_boost }, + { "pv_teleport_into", this->vehicle.pv_teleport_into }, { "speedo_meter", { { "type", (int)this->vehicle.speedo_meter.type }, diff --git a/BigBaseV2/src/gui/window/main/tab_mobile.cpp b/BigBaseV2/src/gui/window/main/tab_mobile.cpp index b27e3ae1..a6f08924 100644 --- a/BigBaseV2/src/gui/window/main/tab_mobile.cpp +++ b/BigBaseV2/src/gui/window/main/tab_mobile.cpp @@ -86,13 +86,14 @@ namespace big ImGui::BeginGroup(); - if (ImGui::Button("Reload Vehicles")) + if (ImGui::Button("Load/Reload Personal Vehicles")) { QUEUE_JOB_BEGIN_CLAUSE() { g_mobile_service->register_vehicles(); }QUEUE_JOB_END_CLAUSE } + ImGui::Checkbox("Spawn in Vehicle", &g.vehicle.pv_teleport_into); ImGui::TreePop(); } diff --git a/BigBaseV2/src/util/mobile.hpp b/BigBaseV2/src/util/mobile.hpp index c2246656..31141b37 100644 --- a/BigBaseV2/src/util/mobile.hpp +++ b/BigBaseV2/src/util/mobile.hpp @@ -1,11 +1,14 @@ #pragma once #include "core/enums.hpp" +#include "globals.hpp" #include "gta_util.hpp" #include "misc.hpp" #include "natives.hpp" +#include "notify.hpp" #include "script.hpp" #include "script_global.hpp" #include "script_local.hpp" +#include "vehicle.hpp" namespace big::mobile { @@ -83,6 +86,9 @@ namespace big::mobile { inline void summon_vehicle_by_index(int veh_idx) { + if (*mechanic_global.at(958).as() != -1) + return notify::display_help_text("Mechanic is not ready to deliver a vehicle right now."); + // despawn current veh util::despawn_current_personal_vehicle(); mors_mutual::fix_index(veh_idx); @@ -98,6 +104,12 @@ namespace big::mobile GtaThread* freemode_thread = gta_util::find_script_thread(RAGE_JOAAT("freemode")); if (freemode_thread) *script_local(freemode_thread, 17437).at(176).as() = 0; // spawn vehicle instantly + + // blocking call till vehicle is delivered + notify::busy_spinner("Delivering vehicle...", mechanic_global.at(958).as(), -1); + + if (g.vehicle.pv_teleport_into) + vehicle::bring(globals::get_personal_vehicle(), ENTITY::GET_ENTITY_COORDS(PLAYER::PLAYER_PED_ID(), true)); } } } \ No newline at end of file