feat: Keep model dimension in mind when determining spawn location (#1316)
This commit is contained in:
parent
10ebcbbdaa
commit
49235195b5
@ -31,6 +31,7 @@ namespace big
|
||||
|
||||
const auto spawn_location =
|
||||
vehicle::get_spawn_location(ctx->get_sender()->id() == self::id ? g.spawn_vehicle.spawn_inside : false,
|
||||
args[0],
|
||||
PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(ctx->get_sender()->id()));
|
||||
const auto spawn_heading = ENTITY::GET_ENTITY_HEADING(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(ctx->get_sender()->id()));
|
||||
|
||||
|
@ -40,13 +40,16 @@ namespace big::vehicle
|
||||
return speed;
|
||||
}
|
||||
|
||||
inline Vector3 get_spawn_location(bool spawn_inside, Ped ped = self::ped)
|
||||
inline Vector3 get_spawn_location(bool spawn_inside, Hash hash, Ped ped = self::ped)
|
||||
{
|
||||
float y_offset = 0;
|
||||
|
||||
if (self::veh != 0)
|
||||
{
|
||||
y_offset = 10.f;
|
||||
Vector3 min, max, result;
|
||||
MISC::GET_MODEL_DIMENSIONS(hash, &min, &max);
|
||||
result = max - min;
|
||||
y_offset = result.y;
|
||||
}
|
||||
else if (!spawn_inside)
|
||||
{
|
||||
|
@ -116,7 +116,8 @@ namespace big
|
||||
components::selectable(label, false, [&personal_veh] {
|
||||
if (g.clone_pv.spawn_clone)
|
||||
{
|
||||
Vector3 spawn_location = vehicle::get_spawn_location(g.spawn_vehicle.spawn_inside);
|
||||
Vector3 spawn_location =
|
||||
vehicle::get_spawn_location(g.spawn_vehicle.spawn_inside, personal_veh->get_hash());
|
||||
float spawn_heading = ENTITY::GET_ENTITY_HEADING(self::ped);
|
||||
|
||||
auto vehicle_idx = personal_veh->get_vehicle_idx();
|
||||
|
@ -83,7 +83,7 @@ namespace big
|
||||
components::selectable(std::vformat("SPAWN_VEHICLE_CURRENT_VEHICLE"_T, std::make_format_args(item.m_display_name)), false, [] {
|
||||
if (self::veh)
|
||||
{
|
||||
Vector3 spawn_location = vehicle::get_spawn_location(g.spawn_vehicle.spawn_inside);
|
||||
Vector3 spawn_location = vehicle::get_spawn_location(g.spawn_vehicle.spawn_inside, veh_hash);
|
||||
float spawn_heading = ENTITY::GET_ENTITY_HEADING(self::ped);
|
||||
|
||||
auto owned_mods = vehicle::get_owned_mods_from_vehicle(self::veh);
|
||||
@ -149,7 +149,8 @@ namespace big
|
||||
{
|
||||
ImGui::PushID(vehicle.m_hash);
|
||||
components::selectable(vehicle.m_display_name, false, [&vehicle] {
|
||||
const auto spawn_location = vehicle::get_spawn_location(g.spawn_vehicle.spawn_inside);
|
||||
const auto spawn_location =
|
||||
vehicle::get_spawn_location(g.spawn_vehicle.spawn_inside, vehicle.m_hash);
|
||||
const auto spawn_heading = ENTITY::GET_ENTITY_HEADING(self::ped);
|
||||
|
||||
const auto veh = vehicle::spawn(vehicle.m_hash, spawn_location, spawn_heading);
|
||||
|
Reference in New Issue
Block a user