Skip to content

Commit 06a3768

Browse files
authored
Merge pull request #81 from lopezloo/bugfix/warpPedIntoVehicle-tasks
Improve task reset in warpPedIntoVehicle
2 parents e85353e + 786a68b commit 06a3768

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

Client/mods/deathmatch/logic/CClientPed.cpp

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,6 +1391,26 @@ void CClientPed::WarpIntoVehicle ( CClientVehicle* pVehicle, unsigned int uiSeat
13911391
SetSunbathing ( false );
13921392
KillAnimation ();
13931393

1394+
if ( m_pPlayerPed )
1395+
{
1396+
// Fall tasks
1397+
KillTask ( TASK_PRIORITY_EVENT_RESPONSE_TEMP );
1398+
// Swim tasks
1399+
KillTask ( TASK_PRIORITY_EVENT_RESPONSE_NONTEMP );
1400+
// Jump & vehicle enter/exit & custom animation tasks
1401+
KillTask ( TASK_PRIORITY_PRIMARY );
1402+
1403+
KillTaskSecondary ( TASK_SECONDARY_ATTACK );
1404+
1405+
// check we aren't in the fall and get up task
1406+
CTask * pTaskPhysicalResponse = m_pTaskManager->GetTask ( TASK_PRIORITY_PHYSICAL_RESPONSE );
1407+
// check our physical response task
1408+
if ( pTaskPhysicalResponse && strcmp ( pTaskPhysicalResponse->GetTaskName ( ), "TASK_COMPLEX_FALL_AND_GET_UP" ) == 0 )
1409+
{
1410+
m_pTaskManager->RemoveTask ( TASK_PRIORITY_PHYSICAL_RESPONSE );
1411+
}
1412+
}
1413+
13941414
// Eventually remove us from a previous vehicle
13951415
RemoveFromVehicle ();
13961416
//m_uiOccupyingSeat = uiSeat;
@@ -4138,17 +4158,6 @@ void CClientPed::InternalWarpIntoVehicle ( CVehicle* pGameVehicle )
41384158
{
41394159
if ( m_pPlayerPed )
41404160
{
4141-
// Reset whatever task
4142-
m_pTaskManager->RemoveTask ( TASK_PRIORITY_PRIMARY );
4143-
4144-
// check we aren't in the fall and get up task
4145-
CTask * pTaskPhysicalResponse = m_pTaskManager->GetTask ( TASK_PRIORITY_PHYSICAL_RESPONSE );
4146-
// check our physical response task
4147-
if ( pTaskPhysicalResponse && strcmp ( pTaskPhysicalResponse->GetTaskName ( ), "TASK_COMPLEX_FALL_AND_GET_UP" ) == 0 )
4148-
{
4149-
m_pTaskManager->RemoveTask ( TASK_PRIORITY_PHYSICAL_RESPONSE );
4150-
}
4151-
41524161
// Create a task to warp the player in and execute it
41534162
CTaskSimpleCarSetPedInAsDriver* pInTask = g_pGame->GetTasks ()->CreateTaskSimpleCarSetPedInAsDriver ( pGameVehicle );
41544163
if ( pInTask )

0 commit comments

Comments
 (0)