Fixed persist outfit thinking the player was showering when they were not (#2203)
* Fixed a crash emanating from mobile_service::register_vehicles if the vehicle needed to be refreshed.
This commit is contained in:
parent
b7bac4dfe1
commit
207e5457f9
@ -4,9 +4,27 @@
|
|||||||
#include "natives.hpp"
|
#include "natives.hpp"
|
||||||
#include "pointers.hpp"
|
#include "pointers.hpp"
|
||||||
#include "services/outfit/outfit_service.hpp"
|
#include "services/outfit/outfit_service.hpp"
|
||||||
|
#include "gta/enums.hpp"
|
||||||
|
|
||||||
namespace big
|
namespace big
|
||||||
{
|
{
|
||||||
|
inline bool is_taking_shower(Hash model)
|
||||||
|
{
|
||||||
|
int offset = 0;
|
||||||
|
switch (model)
|
||||||
|
{
|
||||||
|
case RAGE_JOAAT("mp_m_freemode_01"): break;
|
||||||
|
case RAGE_JOAAT("mp_f_freemode_01"):
|
||||||
|
{
|
||||||
|
offset = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: return false; //For non-normal models
|
||||||
|
}
|
||||||
|
|
||||||
|
return PED::GET_PED_DRAWABLE_VARIATION(self::ped, ComponentId::AUXILIARY) == 15 && PED::GET_PED_DRAWABLE_VARIATION(self::ped, ComponentId::TORSO) == 15 && PED::GET_PED_DRAWABLE_VARIATION(self::ped, ComponentId::LEGS) == (14 + offset);
|
||||||
|
}
|
||||||
|
|
||||||
void looped::self_persist_outfit()
|
void looped::self_persist_outfit()
|
||||||
{
|
{
|
||||||
if (g.self.persist_outfit.empty())
|
if (g.self.persist_outfit.empty())
|
||||||
@ -15,7 +33,8 @@ namespace big
|
|||||||
if (g_local_player == nullptr || PED::IS_PED_DEAD_OR_DYING(self::ped, TRUE) || STREAMING::IS_PLAYER_SWITCH_IN_PROGRESS() || DLC::GET_IS_LOADING_SCREEN_ACTIVE())
|
if (g_local_player == nullptr || PED::IS_PED_DEAD_OR_DYING(self::ped, TRUE) || STREAMING::IS_PLAYER_SWITCH_IN_PROGRESS() || DLC::GET_IS_LOADING_SCREEN_ACTIVE())
|
||||||
return; //Dead or Loading
|
return; //Dead or Loading
|
||||||
|
|
||||||
if (PED::GET_PED_DRAWABLE_VARIATION(self::ped, 5) == 0 && PED::GET_PED_DRAWABLE_VARIATION(self::ped, 4) >= 14 && PED::GET_PED_DRAWABLE_VARIATION(self::ped, 4) <= 18)
|
auto model = ENTITY::GET_ENTITY_MODEL(self::ped);
|
||||||
|
if (is_taking_shower(model))
|
||||||
return; //Showering
|
return; //Showering
|
||||||
|
|
||||||
if (g.self.persist_outfits_mis && NETWORK::NETWORK_IS_ACTIVITY_SESSION())
|
if (g.self.persist_outfits_mis && NETWORK::NETWORK_IS_ACTIVITY_SESSION())
|
||||||
@ -33,7 +52,7 @@ namespace big
|
|||||||
i >> outfit;
|
i >> outfit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (outfit.contains("model") && outfit["model"].get<uint32_t>() == ENTITY::GET_ENTITY_MODEL(self::ped))
|
if (outfit.contains("model") && outfit["model"].get<uint32_t>() == model)
|
||||||
outfit_service::apply_outfit(outfit, false);
|
outfit_service::apply_outfit(outfit, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2057,4 +2057,20 @@ enum CameraMode : int
|
|||||||
THIRD_PERSON_FAR = 2,
|
THIRD_PERSON_FAR = 2,
|
||||||
CINEMATIC = 3,
|
CINEMATIC = 3,
|
||||||
FIRST_PERSON = 4,
|
FIRST_PERSON = 4,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ComponentId : int
|
||||||
|
{
|
||||||
|
HEAD,
|
||||||
|
BEARD,
|
||||||
|
HAIR,
|
||||||
|
TORSO,
|
||||||
|
LEGS,
|
||||||
|
HANDS,
|
||||||
|
FOOT,
|
||||||
|
ACCESSORIES_NECK,
|
||||||
|
ACCESSORIES_1,
|
||||||
|
ACCESSORIES_2,
|
||||||
|
DECALS,
|
||||||
|
AUXILIARY
|
||||||
};
|
};
|
@ -358,8 +358,10 @@ namespace big
|
|||||||
it->second = veh->get_display_name();
|
it->second = veh->get_display_name();
|
||||||
m_personal_vehicles.emplace(veh->get_display_name(), std::move(veh));
|
m_personal_vehicles.emplace(veh->get_display_name(), std::move(veh));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
m_personal_vehicles[veh->get_display_name()]->set_garage();
|
{
|
||||||
|
m_personal_vehicles[veh->get_display_name()]->set_garage();
|
||||||
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user