If spectating a player who has died, and it's been >=DEATH_ANIMATION_TIME since their death, look up the next valid target and switch to them.
Also sneaking in a bot_next_team server cvar, because it was useful for testing this. Set bot_next_team to a team index to force the next bot created by bot_add to join that specific team. Default value is -1, which instead makes the bot join the player team with less players. There's also -2, which makes bot join a player team completely at random. Anecdotally, this actually fixes a parity issue with bots - before this change, they were joining player teams completely randomly, but OG NT bots follow the -1 value behaviour (which is the default now).
This PR duplicates some of the base CBasePlayer methods for client side access, to be called from the C_NEO_Player::Calc<...>View overrides. The client's also now receiving the m_flDeathTime prop for calculating the death deltatime client side for observing purposes.
Steps to repro:
Launch a CTG map
Spawn some bots in both teams
Join a team
End the warmup with mp_restartgame 1 if needed
Set mp_forcecamera 0
Suicide and start spectating other players
Use ent_fire !picker sethealth 0 to kill the current spec target and see what happens
If it targets the wrong client whilst in 1st person spec, go to chase cam for a second to update the picker target
What happens before this patch:
Can observe a dead player observing some third player
What happens after this patch:
Observing a dead client will automatically find the next valid obs target after DEATH_ANIMATION_TIME (3 seconds) since their death
Fix #336
If spectating a player who has died, and it's been
>=DEATH_ANIMATION_TIME
since their death, look up the next valid target and switch to them.Also sneaking in a
bot_next_team
server cvar, because it was useful for testing this. Setbot_next_team
to a team index to force the next bot created bybot_add
to join that specific team. Default value is-1
, which instead makes the bot join the player team with less players. There's also-2
, which makes bot join a player team completely at random. Anecdotally, this actually fixes a parity issue with bots - before this change, they were joining player teams completely randomly, but OG NT bots follow the-1
value behaviour (which is the default now).This PR duplicates some of the base
CBasePlayer
methods for client side access, to be called from theC_NEO_Player::Calc<...>View
overrides. The client's also now receiving them_flDeathTime
prop for calculating the death deltatime client side for observing purposes.Steps to repro:
mp_restartgame 1
if neededmp_forcecamera 0
ent_fire !picker sethealth 0
to kill the current spec target and see what happensWhat happens before this patch:
What happens after this patch:
DEATH_ANIMATION_TIME
(3 seconds) since their death