Skip to content
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

TargetID: Make ttt_idenfity_body_woconfirm replicated; move and clean up additional ConVars surrounding corpses/ragdolls #1692

Merged
merged 7 commits into from
Dec 9, 2024

Conversation

Wryyyong
Copy link
Contributor

@Wryyyong Wryyyong commented Dec 6, 2024

In #1684, targetid.HUDDrawTargetIDRagdolls was updated to check if the ttt_idenfity_body_woconfirm ConVar was enabled to determine what hint gets displayed.

Problem is, this ConVar only exists on the server, and the TargetID library is entirely clientside. This resulted in Lua errors being thrown on every frame the function was called and managed to reach that check.

This PR adds a GlobalBool and ChangeCallback for ttt_idenfity_body_woconfirm, and updates the check to use it instead of a nonexistent ConVar object. It also adds a ChangeCallback for ttt2_confirm_team, and changes its initial SetGlobal call to grab its name from its ConVar object to be consistent with the other GlobalVars in SyncGlobals.

This PR adds an additional table to the CORPSE namespace for the purpose of storing ConVar objects related to corpses and bodysearching. The following CreateConVar calls have been moved from sv_main:

  • ttt_idenfity_body_woconfirm (to sh_corpse, with FCVAR_REPLICATED added)
  • ttt2_confirm_team (to sv_corpse)
  • ttt2_confirm_killlist (to sv_corpse)

I've also moved the CreateConVar calls for ttt_announce_body_found and ttt_ragdoll_collide into the new table for consistency, and so scripts for other parts of the gamemode can access the ConVar objects directly without having to store their own separate copies (or calling GetConVar repeatedly). I've also already adjusted all existing checks for these ConVars across the gamemode accordingly.

The changelog entry is worded the way it is because I just can't think of any other way to describe the results of the changes without going into a level of detail that'd be unnecessary for an end-user, but still useful information for addon developers.

Copy link
Member

@Histalek Histalek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First of all thanks for catching my mistake! That's what i get for only testing locally i suppose

As Tim somewhat started the review i'll leave it to him unless he tells me otherwise :)

@Wryyyong Wryyyong changed the title TargetID: Add/Update GlobalVars and ChangeCallbacks for ttt_idenfity_body_woconfirm and ttt2_confirm_team TargetID: Make ttt_idenfity_body_woconfirm replicated; move and clean up additional ConVars surrounding corpses/ragdolls Dec 7, 2024
@Wryyyong
Copy link
Contributor Author

Wryyyong commented Dec 7, 2024

I've updated the title and description of the PR to more accurately describe its new goal(s). I'll also quickly update the changelog entry as well, for good measure.

Copy link
Member

@TimGoll TimGoll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that looks really good - thank you!

@Histalek Histalek merged commit 02bd8ec into TTT-2:master Dec 9, 2024
4 checks passed
Histalek pushed a commit that referenced this pull request Dec 10, 2024
…an up additional ConVars surrounding corpses/ragdolls (#1692)

In #1684, `targetid.HUDDrawTargetIDRagdolls` was updated to check if the
`ttt_idenfity_body_woconfirm` ConVar was enabled to determine what hint
gets displayed.

Problem is, this ConVar only exists on the server, and the TargetID
library is entirely clientside. This resulted in Lua errors being thrown
on every frame the function was called and managed to reach that check.

This PR adds an additional table to the `CORPSE` namespace for the
purpose of storing ConVar objects related to corpses and bodysearching.
The following `CreateConVar` calls have been moved from `sv_main`:
- `ttt_idenfity_body_woconfirm` (to `sh_corpse`, with `FCVAR_REPLICATED`
added)
- `ttt2_confirm_team` (to `sv_corpse`)
- `ttt2_confirm_killlist` (to `sv_corpse`)

I've also moved the `CreateConVar` calls for `ttt_announce_body_found`
and `ttt_ragdoll_collide` into the new table for consistency, and so
scripts for other parts of the gamemode can access the ConVar objects
directly without having to store their own separate copies (or calling
`GetConVar` repeatedly). I've also already adjusted all existing checks
for these ConVars across the gamemode accordingly.

The changelog entry is worded the way it is because I just can't think
of any other way to describe the results of the changes without going
into a level of detail that'd be unnecessary for an end-user, but still
useful information for addon developers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants