Fixed KERS boost not being handled by vehicle_boost_behavior. (#1922)
This commit is contained in:
parent
ee364cd684
commit
e1c0f97cd3
@ -3,7 +3,7 @@ include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
gtav_classes
|
||||
GIT_REPOSITORY https://github.com/Yimura/GTAV-Classes.git
|
||||
GIT_TAG 468161a36d95a355d9783eef5b245f3f1542e2bb
|
||||
GIT_TAG 9da68ec82769c684068023c00ac5e5acd7836c97
|
||||
GIT_PROGRESS TRUE
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
|
@ -9,21 +9,36 @@ namespace big
|
||||
{
|
||||
auto* const vehicle = g_local_player->m_vehicle;
|
||||
|
||||
if (vehicle && VEHICLE::GET_HAS_ROCKET_BOOST(self::veh))
|
||||
bool is_rocket = VEHICLE::GET_HAS_ROCKET_BOOST(self::veh);
|
||||
bool is_kers = VEHICLE::GET_VEHICLE_HAS_KERS(self::veh);
|
||||
|
||||
if (vehicle && (is_rocket || is_kers))
|
||||
{
|
||||
if (g.vehicle.boost_behavior == eBoostBehaviors::INSTANT_REFIL && (vehicle->m_boost == 0.f || !vehicle->m_boost_state))// Instant Refill
|
||||
if (g.vehicle.boost_behavior == eBoostBehaviors::INSTANT_REFIL) // Instant Refill
|
||||
{
|
||||
if (is_rocket && (vehicle->m_boost == 0.f || !vehicle->m_boost_state))
|
||||
{
|
||||
vehicle->m_boost_allow_recharge = true;
|
||||
vehicle->m_boost = 3.f;
|
||||
}
|
||||
else if (g.vehicle.boost_behavior == eBoostBehaviors::INFINITE_BOOST)// Infinite Boost
|
||||
else if (is_kers && vehicle->m_kers_boost == 0.f)
|
||||
{
|
||||
vehicle->m_kers_boost = vehicle->m_kers_boost_max;
|
||||
}
|
||||
}
|
||||
else if (g.vehicle.boost_behavior == eBoostBehaviors::INFINITE_BOOST)// Infinite
|
||||
{
|
||||
vehicle->m_boost_allow_recharge = true;
|
||||
vehicle->m_boost = 3.f;
|
||||
vehicle->m_kers_boost = vehicle->m_kers_boost_max - 0.01f;
|
||||
}
|
||||
else if (g.vehicle.boost_behavior == eBoostBehaviors::HOLD_FOR_INFINITE)
|
||||
else if (g.vehicle.boost_behavior == eBoostBehaviors::HOLD_FOR_INFINITE) //Hold for Boost
|
||||
{
|
||||
if (vehicle->m_boost_state && PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_ROCKET_BOOST))
|
||||
if (PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_ROCKET_BOOST) || PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_FLY_BOOST))
|
||||
{
|
||||
if (is_rocket)
|
||||
{
|
||||
if (vehicle->m_boost_state)
|
||||
{
|
||||
vehicle->m_boost_allow_recharge = true;
|
||||
vehicle->m_boost = 3.f;
|
||||
@ -33,6 +48,12 @@ namespace big
|
||||
vehicle->m_boost_state = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
vehicle->m_kers_boost = vehicle->m_kers_boost_max - 0.01f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,8 +10,32 @@ namespace big
|
||||
|
||||
virtual void on_tick() override
|
||||
{
|
||||
if (VEHICLE::GET_DOES_VEHICLE_HAVE_DAMAGE_DECALS(self::veh))
|
||||
vehicle::repair(self::veh);
|
||||
auto veh = self::veh;
|
||||
if (!ENTITY::IS_ENTITY_A_VEHICLE(veh) || !entity::take_control_of(veh, 0))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (VEHICLE::GET_DOES_VEHICLE_HAVE_DAMAGE_DECALS(veh))
|
||||
{
|
||||
if (VEHICLE::IS_VEHICLE_BUMPER_BOUNCING(veh, TRUE) || VEHICLE::GET_VEHICLE_NUM_OF_BROKEN_OFF_PARTS(veh) > 0)
|
||||
{
|
||||
VEHICLE::SET_VEHICLE_FIXED(veh);
|
||||
}
|
||||
|
||||
if (!VEHICLE::IS_VEHICLE_WINDOW_INTACT(veh, 7)) //Rear window
|
||||
VEHICLE::FIX_VEHICLE_WINDOW(veh, 7);
|
||||
|
||||
int clan_logo_counter = GRAPHICS::DOES_VEHICLE_HAVE_CREW_EMBLEM(veh, 0) * 10;
|
||||
GRAPHICS::REMOVE_DECALS_FROM_VEHICLE(veh);
|
||||
while (clan_logo_counter-- > 0 && !GRAPHICS::DOES_VEHICLE_HAVE_CREW_EMBLEM(veh, 0))
|
||||
{
|
||||
vehicle_helper::add_clan_logo_to_vehicle(veh, self::ped);
|
||||
script::get_current()->yield(10ms);
|
||||
}
|
||||
|
||||
VEHICLE::SET_VEHICLE_DEFORMATION_FIXED(veh);
|
||||
VEHICLE::SET_VEHICLE_DIRT_LEVEL(veh, 0.f);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -161,7 +161,6 @@ namespace big::vehicle
|
||||
}
|
||||
|
||||
VEHICLE::SET_VEHICLE_FIXED(veh);
|
||||
VEHICLE::SET_VEHICLE_DEFORMATION_FIXED(veh);
|
||||
VEHICLE::SET_VEHICLE_DIRT_LEVEL(veh, 0.f);
|
||||
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user