Added proofs to vehicle menu and improved waterproof feature. (#330)

- Added proofs section to vehicle menu that allows player to control damage bits. 
- Player can now drive or walk underwater with waterproof turned on.
- Added bring closest vehicle feature.
- Vehicle will not deform with collision proof on.
- Improved vehicle menu arrangement.
- Added plate changer in LSC.
- Updated LSC layout.
- Expanded wheel type feature.
- Fixed a bug where the mod section shows repetitive wheel mods.

Fixed issue #331
This commit is contained in:
aa15032261
2022-07-12 22:42:07 +08:00
committed by GitHub
parent 2d9021f0b8
commit 15ef1b874d
23 changed files with 1207 additions and 713 deletions

View File

@ -63,7 +63,7 @@ namespace big
g_vehicle_preview_service = nullptr;
}
const vehicle_preview_item& vehicle_preview_service::find_vehicle_item_by_hash(int hash)
const vehicle_preview_item& vehicle_preview_service::find_vehicle_item_by_hash(Hash hash)
{
int idx = -1;
@ -110,48 +110,49 @@ namespace big
return;
m_running = true;
g_fiber_pool->queue_job([this]
{
while (g_running && m_running && g->spawn.preview_vehicle && g_gui.m_opened)
g_fiber_pool->queue_job([this] {
while (
g_running && m_running && g_gui.m_opened &&
(g->spawn.preview_vehicle || g->clone_pv.preview_vehicle)
) {
auto location = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(self::ped, 0.f, 10.f, .5f);
if (m_current_veh == -1)
{
auto location = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(self::ped, 0.f, 10.f, .5f);
if (m_current_veh == -1)
{
m_new_model = false;
location.z = -10.f;
m_current_veh = vehicle::spawn(m_model_hash, location, 0.f, false);
ENTITY::FREEZE_ENTITY_POSITION(m_current_veh, true);
ENTITY::SET_ENTITY_ALPHA(m_current_veh, 0, 0);
ENTITY::SET_ENTITY_COLLISION(m_current_veh, false, false);
ENTITY::SET_CAN_CLIMB_ON_ENTITY(m_current_veh, false);
OBJECT::SET_OBJECT_ALLOW_LOW_LOD_BUOYANCY(m_current_veh, false);
}
else if (m_new_model)
{
entity::delete_entity(m_current_veh);
m_new_model = false;
location.z = -10.f;
m_current_veh = vehicle::spawn(m_model_hash, location, 0.f, false);
ENTITY::FREEZE_ENTITY_POSITION(m_current_veh, true);
ENTITY::SET_ENTITY_ALPHA(m_current_veh, 0, 0);
ENTITY::SET_ENTITY_COLLISION(m_current_veh, false, false);
ENTITY::SET_CAN_CLIMB_ON_ENTITY(m_current_veh, false);
OBJECT::SET_OBJECT_ALLOW_LOW_LOD_BUOYANCY(m_current_veh, false);
}
else if (m_new_model)
{
entity::delete_entity(m_current_veh);
m_current_veh = -1;
}
else
m_current_veh = -1;
}
else
{
if (const int alpha = ENTITY::GET_ENTITY_ALPHA(m_current_veh); alpha < 250)
{
if (const int alpha = ENTITY::GET_ENTITY_ALPHA(m_current_veh); alpha < 250)
{
ENTITY::SET_ENTITY_ALPHA(m_current_veh, std::min<int>(255, alpha + 10), 0);
}
ENTITY::SET_ENTITY_HEADING(m_current_veh, m_heading);
ENTITY::SET_ENTITY_COORDS(m_current_veh, location.x, location.y, location.z, 0, 0, 0, 0);
ENTITY::SET_ENTITY_ALPHA(m_current_veh, std::min<int>(255, alpha + 10), 0);
}
if (m_heading += 0.5f; m_heading > 359) m_heading = 0;
script::get_current()->yield();
ENTITY::SET_ENTITY_HEADING(m_current_veh, m_heading);
ENTITY::SET_ENTITY_COORDS(m_current_veh, location.x, location.y, location.z, 0, 0, 0, 0);
}
entity::delete_entity(m_current_veh);
m_current_veh = -1;
m_running = false;
});
if (m_heading += 0.5f; m_heading > 359) m_heading = 0;
script::get_current()->yield();
}
entity::delete_entity(m_current_veh);
m_current_veh = -1;
m_running = false;
});
}
void vehicle_preview_service::stop_preview()
@ -188,7 +189,7 @@ namespace big
continue;
}
m_hash_idx_map[item_json["SignedHash"]] = (int)m_vehicle_preview_item_arr.size();
m_hash_idx_map[item_json["Hash"]] = (int)m_vehicle_preview_item_arr.size();
m_vehicle_preview_item_arr.push_back(vehicle_preview_item(item_json));
}
}

View File

@ -35,7 +35,7 @@ namespace big
vehicle_preview_service();
~vehicle_preview_service();
const vehicle_preview_item& find_vehicle_item_by_hash(int hash);
const vehicle_preview_item& find_vehicle_item_by_hash(Hash hash);
std::vector<vehicle_preview_item>& get_vehicle_preview_item_arr();
void set_preview_vehicle(const vehicle_preview_item& item);