-
Notifications
You must be signed in to change notification settings - Fork 25
Role change events for Custom Roles #109
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
base: master
Are you sure you want to change the base?
Role change events for Custom Roles #109
Conversation
|
Added checks on player death to prevent the report window from showing if the role has abilities involving respawning |
|
Heyo! Just letting you, unfortunately I won't be able to look at this until sometime next week possibly. |
BadgerCode
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heyo!
Sorry for the delay on this.
So this is changing a few things for TT2/CR TTT
- Handle role changes during the round for CR TTT
- Log role changes during the round for CR TTT
- If a player in TTT2/CR TTT is respawning, don't get them to respond to reports
I've left some comments.
| --Instant Respawn Cases | ||
| timer.Simple(1, function() | ||
| if ply:Alive() then return end | ||
| end) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't do anything?
|
|
||
| net.Start("DL_Death") | ||
| net.Send(ply) | ||
| end) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could simplify this function to always wait 5 seconds before requesting that the dead player replies to their reports.
| --if CR_VERSION then | ||
| Damagelog:EventHook("TTTPlayerRoleChanged") | ||
| Damagelog:EventHook("TTTPlayerRoleChangedByItem") | ||
| Damagelog:EventHook("TTTPlayerSpawnForRound") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will these cause problems for the regular TTT or TTT2 gamemodes?
| net.Start("DL_Delayed") | ||
| net.Send(ply) | ||
|
|
||
| timer.Create("RDM_RespawnDelay_" .. ply:SteamID64(), 5, 1, function() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would 5 seconds be long enough for the respawn mechanics?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately role respawns vary and are often controlled by cvars so a flat 5 second timer may not work.
I'm not completely clear on what this is doing so I can't offer advice, really.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe instead, we should look at closing the report window if a player is respawned (and the round is active).
This way, no matter how long it takes for them to be respawned, the report window won't get in the way.
If they've already started typing out a response, we should probably keep track of it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I'm commonly seeing, there are 3 kinds of role respawns,
Instant: Has an effect on death and usually doesn't state the respawning state during that small timeframe(Swapper)
Delayed: Respawns on a timer which usually doesn't last more than 5 +1 seconds (Zombie)
Conditional: Only respawns when a condition is fulfilled, which can range from happening instantly or never (Parasite)
The checks cover the first 2, while conditional has only 5-second grace before having to respond to reports.
Revert "Role respawn"
Answer prompt

Can also be used as a base to add TTT2's events
Currently needs a method to not load the events if appropriate custom TTT gamemode are not active
When log events are being parsed at client, a check is performed to update the local role table if the event was a role change and to continue parsing with the update.
For player deathlogs that do not receive the full round log, they instead receive a recent role table relative to the oldest event of the deathlog.
Deathscenes are not affected as they already gather player's current roles during the moment instead of referring to the table, it is unknown how feasible it is to implement role change within a deathscene.