Tsuey / L4D2-Community-Update

Help us shape the potential future of L4D2 vanilla.
70 stars 23 forks source link

Mission can fail after players lose control of their characters #447

Open alexiscoutinho opened 1 year ago

alexiscoutinho commented 1 year ago

Description

This is the main issue of #283. If the only human players die before the finale_win event, the mission will fail and the round will restart even if survivor bots were normally rescued. This already happens in sacrifice type finales if the only human dies in the sacrifice outro (generally if the player was already B&W), but could also theoretically happen in custom maps if, for example, a random survivor is picked to die (if there are at least 2 rescued), via kill cmd, in the outro cutscene and that unlucky one is the only human. This happens because sb_all_bot_game is set to 0 by default.

Note that the game already treats such deaths after finale_win as irrelevant (they don't even appear in the stats). While the worst offender would be to have a restart while the players are already frozen (after finale_vehicle_leaving), the same issue can also be extended to during the fade out or possibly even sooner, before the human even reaches the vehicle if all bots are already inside. This last scenario could be addressed by enabling an EndScriptedMode callback after finale_vehicle_ready to prevent a premature round end and instead check if all bots are inside the vehicle. If yes, then the outro sequence would be started.

Reproduction steps

Play The Sacrifice finale with bots and sacrifice yourself while B&W.

alexiscoutinho commented 1 year ago

@Rayman1103 What do you think about using EndScriptedMode to solve this?

Rayman1103 commented 1 year ago

@Rayman1103 What do you think about using EndScriptedMode to solve this?

I wouldn't want to rely on EndScriptedMode for this. That should only be used exclusively in Mutations.