feat(Mobile): Added teleport into personal vehicle

This commit is contained in:
Yimura 2022-01-18 02:06:28 +01:00
parent 90bce8256d
commit 6e9fbcdf09
No known key found for this signature in database
GPG Key ID: 3D8FF4397E768682
3 changed files with 17 additions and 1 deletions

View File

@ -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 },

View File

@ -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();
}

View File

@ -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<int*>() != -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<int*>() = 0; // spawn vehicle instantly
// blocking call till vehicle is delivered
notify::busy_spinner("Delivering vehicle...", mechanic_global.at(958).as<int*>(), -1);
if (g.vehicle.pv_teleport_into)
vehicle::bring(globals::get_personal_vehicle(), ENTITY::GET_ENTITY_COORDS(PLAYER::PLAYER_PED_ID(), true));
}
}
}