feat(VehiclePreview): Stop preview on spawn
This commit is contained in:
parent
dac6cf8cc6
commit
a4f00f70b3
@ -46,7 +46,7 @@ namespace big
|
|||||||
|
|
||||||
g_fiber_pool->queue_job([this]
|
g_fiber_pool->queue_job([this]
|
||||||
{
|
{
|
||||||
while (g_running && g->spawn.preview_vehicle && g_gui.m_opened)
|
while (g_running && m_running && g->spawn.preview_vehicle && g_gui.m_opened)
|
||||||
{
|
{
|
||||||
auto location = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(PLAYER::PLAYER_PED_ID(), 2.5f, 2.5f, .5f);
|
auto location = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(PLAYER::PLAYER_PED_ID(), 2.5f, 2.5f, .5f);
|
||||||
if (m_current_veh == -1)
|
if (m_current_veh == -1)
|
||||||
@ -99,6 +99,11 @@ namespace big
|
|||||||
g_thread_pool->push([this] { preview_loop(); });
|
g_thread_pool->push([this] { preview_loop(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void vehicle_preview_service::stop_preview()
|
||||||
|
{
|
||||||
|
m_running = false;
|
||||||
|
}
|
||||||
|
|
||||||
void vehicle_preview_service::load()
|
void vehicle_preview_service::load()
|
||||||
{
|
{
|
||||||
std::ifstream file(m_vehicle_file.get_path());
|
std::ifstream file(m_vehicle_file.get_path());
|
||||||
|
@ -26,6 +26,7 @@ namespace big
|
|||||||
void preview_loop();
|
void preview_loop();
|
||||||
|
|
||||||
void set_preview_vehicle(const nlohmann::json& item);
|
void set_preview_vehicle(const nlohmann::json& item);
|
||||||
|
void stop_preview();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void load();
|
void load();
|
||||||
|
@ -75,6 +75,7 @@ namespace big
|
|||||||
vehicle::max_vehicle(veh);
|
vehicle::max_vehicle(veh);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_vehicle_preview_service->stop_preview();
|
||||||
});
|
});
|
||||||
|
|
||||||
if (g->spawn.preview_vehicle && ImGui::IsItemHovered())
|
if (g->spawn.preview_vehicle && ImGui::IsItemHovered())
|
||||||
|
Reference in New Issue
Block a user