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

Add OnClientLanguageChanged() forward #1597

Merged
merged 7 commits into from
Oct 25, 2021
Merged

Conversation

Wend4r
Copy link
Contributor

@Wend4r Wend4r commented Oct 12, 2021

This forward is needed so that plugins can perform actions on the player related to his language at OnClientLanguageLoaded() moment.

@Wend4r
Copy link
Contributor Author

Wend4r commented Oct 12, 2021

Works for CS:GO

on_client_language_loaded_test.zip

L 10/12/2021 - 17:26:00: [on_client_language_loaded_test.smx] Player Wend4r<2><STEAM_1:1:437985138><> is loaded with "ru" (russian) language

@psychonic
Copy link
Member

For consistency, this would need to be implemented for all games (even though it would be called right at connect for non-CS:GO).

@asherkin
Copy link
Member

I think this would be best as OnClientLanguageChanged and triggered via any change. Some servers disable AllowClLanguageVar and use plugins to set the language via GeoIP instead, and some run a plugin to allow the auto-detected language to be overridden and persisted via a client pref, and those need considering here (the latter is especially complex for consumers as it'll fire multiple times in quick succession if implemented as "changed", or never at all if implemented as it is currently).

As with other feature requests / changes, this could do with your use case and an analysis why this is the best and most flexible solution.

@Wend4r
Copy link
Contributor Author

Wend4r commented Oct 12, 2021

on_client_language_changed_test.zip

L 10/12/2021 - 19:04:42: [on_client_language_changed_test.smx] Player Wend4r<2><STEAM_1:1:437985138><> with "ru" (russian) language

@Wend4r Wend4r changed the title Add OnClientLanguageLoaded() forward Add OnClientLanguageChanged() forward Oct 12, 2021
Copy link
Member

@psychonic psychonic left a comment

Choose a reason for hiding this comment

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

Looks good to me. @asherkin ?

public/IPlayerHelpers.h Show resolved Hide resolved
Copy link
Member

@asherkin asherkin left a comment

Choose a reason for hiding this comment

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

The logic here all looks good to me, I think we just need the forward hooked up in CPlayer::SetLanguageId as well.

@asherkin asherkin added the hacktoberfest-accepted opt-in for hacktoberfest prs label Oct 25, 2021
Copy link
Member

@asherkin asherkin left a comment

Choose a reason for hiding this comment

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

Oh it is there, I'm blind.

@asherkin asherkin merged commit 79d594a into alliedmodders:master Oct 25, 2021
@Wend4r Wend4r deleted the patch-2 branch October 26, 2021 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest-accepted opt-in for hacktoberfest prs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants