From a2c2fe09d5bcef205694652928868dd1c2e23003 Mon Sep 17 00:00:00 2001 From: Blixibon Date: Thu, 4 Nov 2021 08:45:10 -0500 Subject: [PATCH] Added sequence check and backup activity fallback to companion NPC readiness activities --- sp/src/game/server/hl2/npc_playercompanion.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sp/src/game/server/hl2/npc_playercompanion.cpp b/sp/src/game/server/hl2/npc_playercompanion.cpp index 97bc54be..97901f93 100644 --- a/sp/src/game/server/hl2/npc_playercompanion.cpp +++ b/sp/src/game/server/hl2/npc_playercompanion.cpp @@ -1650,6 +1650,19 @@ Activity CNPC_PlayerCompanion::TranslateActivityReadiness( Activity activity ) continue; } +#ifdef MAPBASE + // If we don't have the readiness activity we selected and there's no backup activity available, break the loop and return the base act. + bool bRequired; + if ( !HaveSequenceForActivity( actremap.mappedActivity ) && !HaveSequenceForActivity( Weapon_TranslateActivity( actremap.mappedActivity, &bRequired ) ) ) + { + Activity backupAct = Weapon_BackupActivity( actremap.mappedActivity, bRequired ); + if ( backupAct != actremap.mappedActivity ) + return backupAct; + else + break; + } +#endif + // We've successfully passed all criteria for remapping this return actremap.mappedActivity; }