-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Investigate ply:Alive() #1450
Comments
Looking at the wiki it looks like a player can indeed be dead: https://wiki.facepunch.com/gmod/Player:Alive However this might be overwritten in TTT to keep spectators alive as well? |
Would a disconnected player still be "alive"? maybe this check is needed in some places? |
It seems like we do kill players in TTT2, but we respawn them in the same tick again Example: player changes to being a forced spec: TTT2/gamemodes/terrortown/gamemode/server/sv_networking.lua Lines 492 to 500 in ded4f19
|
I don't think so, because a disconnected player is a "NULL ENT" |
Stuff worth looking at:
|
So I get the hunch that there are scenarios where a player is not alive, because the wiki says |
This is all I'm able to find, here is the team updated from TTT2/gamemodes/terrortown/gamemode/server/sv_player.lua Lines 829 to 832 in ded4f19
|
It could be worth looking into the IsActive() check as well. |
But IsActive only checks IsTerror and if it is an active round. So I don't think there are many places in our code base where this could be simplified |
This is accurate, all the shuffling happens immediately after death, and in a confusingly named "respawnforround" function, in the snippet you cited: |
In our code base we sometimes check if a player is alive: https://github.com/search?q=repo%3ATTT-2%2FTTT2%20%3AAlive()&type=code
However I'm not sure there is any scenario where a player isn't alive. Spectators are counted as alive as well, therefore we differentiate with
IsTerror
andIsSpec
.This should be investigated, maybe we can get rid of all
Alive
checks. We also have quite a few places where we explicitly check the team forTEAM_TERROR
orTEAM_SPEC
. I think we should replace those withIsTerror
andIsSpec
The text was updated successfully, but these errors were encountered: