Fix T6 newcomer join eligibility after setup spawns
This commit is contained in:
@@ -20,9 +20,44 @@ init()
|
||||
level thread join_chat_listener();
|
||||
}
|
||||
|
||||
// Never reset this on death or round change. Spectator spawns do not count.
|
||||
// T6 first emits spawned_player during setup, then moves late connectors
|
||||
// into spectator mode after 0.05 seconds. Observe the settled state instead.
|
||||
// The common spawn dispatcher runs only once, so keep listening ourselves.
|
||||
join_spawn()
|
||||
{
|
||||
self endon("disconnect");
|
||||
level endon("end_game");
|
||||
level endon("game_ended");
|
||||
level endon("intermission");
|
||||
|
||||
self thread join_track_death();
|
||||
|
||||
for (;;)
|
||||
{
|
||||
self.tws_join_spawn_pending = true;
|
||||
wait 0.1;
|
||||
|
||||
if (isDefined(self.sessionstate) && self.sessionstate == "playing")
|
||||
self.tws_join_has_played = true;
|
||||
|
||||
self.tws_join_spawn_pending = false;
|
||||
if (is_true(self.tws_join_has_played))
|
||||
return;
|
||||
|
||||
self waittill("spawned_player");
|
||||
}
|
||||
}
|
||||
|
||||
// A real death during the settling window still consumes newcomer eligibility.
|
||||
// Never clear this flag on death, a round change, or a subsequent spawn.
|
||||
join_track_death()
|
||||
{
|
||||
self endon("disconnect");
|
||||
level endon("end_game");
|
||||
level endon("game_ended");
|
||||
level endon("intermission");
|
||||
|
||||
self waittill("killed_player");
|
||||
self.tws_join_has_played = true;
|
||||
}
|
||||
|
||||
@@ -51,8 +86,7 @@ join_request()
|
||||
level endon("game_ended");
|
||||
level endon("intermission");
|
||||
|
||||
// The spawn handler flag is set on first playable spawn only; spectator
|
||||
// spawns do not trigger it. Belt-and-suspenders against re-triggering.
|
||||
// Setup spawns do not consume eligibility; actual play and .join do.
|
||||
if (is_true(self.tws_join_has_played) || is_true(self.tws_join_used))
|
||||
{
|
||||
self iPrintLnBold("^3.join is only for newcomers who have not played yet");
|
||||
@@ -62,7 +96,8 @@ join_request()
|
||||
// Fail closed while the stock connection setup is still in progress.
|
||||
// T6 stock does not populate self.initialized the way T5 SP zombiemode
|
||||
// does; use sessionstate as the readiness signal.
|
||||
if (!isDefined(self.sessionstate) || self.sessionstate != "spectator")
|
||||
if (is_true(self.tws_join_spawn_pending) ||
|
||||
!isDefined(self.sessionstate) || self.sessionstate != "spectator")
|
||||
{
|
||||
self iPrintLnBold("^3.join is only available while waiting to enter the game");
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user