-
Notifications
You must be signed in to change notification settings - Fork 34
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
[Port] Respawn Button / Кнопка Респавна #56
Conversation
Warning Rate limit exceeded@Spatison has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 20 minutes and 14 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughThe pull request introduces new localization files for the ghost respawn feature in both English and Russian, including strings that inform players about respawn mechanics, such as time remaining, maximum player limits, and rules regarding knowledge transfer from previous characters. Additionally, it removes certain localization strings in the Russian GUI file, indicating a potential simplification of the user interface related to ghost respawning. A new dependency is added to the game logic to enhance tracking of ghost return attempts. Changes
Assessment against linked issues
Possibly related PRs
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
Outside diff range and nitpick comments (1)
Content.Server/GameTicking/GameTicker.GamePreset.cs (1)
25-25
: Dependency injection looks good, but improve the comment.The dependency injection for
GhostReturnToRoundSystem
is properly set up. However, the "WD EDIT" comment is unclear. Consider using a more descriptive comment to convey the purpose of this change.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (13)
- Content.Client/Ghost/GhostSystem.cs (1 hunks)
- Content.Client/UserInterface/Systems/Ghost/GhostUIController.cs (3 hunks)
- Content.Client/UserInterface/Systems/Ghost/Widgets/GhostGui.xaml (1 hunks)
- Content.Client/UserInterface/Systems/Ghost/Widgets/GhostGui.xaml.cs (2 hunks)
- Content.Server/GameTicking/GameTicker.GamePreset.cs (3 hunks)
- Content.Server/GameTicking/GameTicker.Spawning.cs (3 hunks)
- Content.Server/_White/Ghost/GhostReturnToRoundSystem.cs (1 hunks)
- Content.Shared/Ghost/SharedGhostSystem.cs (1 hunks)
- Content.Shared/_White/CVars.cs (2 hunks)
- Resources/Locale/en-US/_white/ghost/ghost-gui.ftl (1 hunks)
- Resources/Locale/en-US/_white/ghost/ghost-respawn.ftl (1 hunks)
- Resources/Locale/ru-RU/_white/ghost/ghost-gui.ftl (1 hunks)
- Resources/Locale/ru-RU/_white/ghost/ghost-respawn.ftl (1 hunks)
Files skipped from review due to trivial changes (2)
- Resources/Locale/en-US/_white/ghost/ghost-gui.ftl
- Resources/Locale/ru-RU/_white/ghost/ghost-gui.ftl
Additional comments not posted (29)
Content.Client/UserInterface/Systems/Ghost/Widgets/GhostGui.xaml (1)
8-8
: LGTM!The addition of the "ReturnToRound" button aligns with the PR objectives to enhance the user experience by providing players with a straightforward option to respawn after their character has died. The button is correctly placed within the
BoxContainer
alongside other navigation buttons, and the localization syntax is used appropriately to ensure the button text can be translated.Resources/Locale/ru-RU/_white/ghost/ghost-respawn.ftl (7)
1-4
: LGTM!The code segment correctly handles the pluralization of the word "minute" based on the value of
$time
for the Russian language.
5-5
: LGTM!The code segment clearly conveys the message that the respawn function is not available when the number of players on the server exceeds a certain limit.
6-7
: LGTM!The code segment effectively communicates the respawn rules, emphasizing the obligation not to transfer knowledge from the previous character to the new one and mentioning the penalty for violating this rule.
8-8
: LGTM!The code segment handles the scenario when the time of death is missing and sets a default value.
9-9
: LGTM!The code segment provides clear instructions to the player to change the character in the character settings when trying to respawn as the same character.
11-14
: LGTM!The code segment correctly handles the different verb forms for logging when a player enters or attempts to enter the round after returning to the lobby with a similar name.
15-15
: LGTM!The code segment clearly logs when a player returns to the lobby.
Resources/Locale/en-US/_white/ghost/ghost-respawn.ftl (8)
1-3
: LGTM!The localization string correctly uses a selector to display the appropriate plural form of "minute" based on the value of
$time
. The Fluent syntax is followed accurately.
4-4
: LGTM!The localization string correctly conveys the message that the respawn function is not available when the number of players on the server exceeds a certain limit. The
$players
variable is used appropriately to display the number of players.
5-5
: LGTM!The localization string correctly defines the title for the window displaying the rules for returning to the round.
6-6
: LGTM!The localization string effectively communicates the rules and consequences of using the respawn feature. The use of color tags helps highlight important parts of the message, such as the agreement not to transfer knowledge and the potential ban for violating the rules. The Fluent syntax is followed correctly.
7-7
: LGTM!The localization string correctly informs the user that when there is no time of death available, a standard value is set. The message is clear and concise.
8-8
: LGTM!The localization string correctly informs the user that they cannot enter the round for the same character after respawning and suggests changing the character in the settings. The message is clear and provides a helpful suggestion to the user.
10-13
: LGTM!The localization string correctly logs a message when a player joins or tries to join the round after respawning with a similar name. It uses a selector to display the appropriate verb form based on the value of
$try
. The placeholders for the player's name, old name, and new name are used correctly. The Fluent syntax is followed accurately.
14-14
: LGTM!The localization string correctly logs a message when a user returns to the lobby. The placeholder for the user's name (
$userName
) is used appropriately. The message is clear and concise.Content.Shared/_White/CVars.cs (1)
35-41
: LGTM!The new configuration variables for ghost respawn functionality are implemented correctly:
- Variable names are clear and descriptive.
- Default values are reasonable.
- Server-only access is appropriate.
- Code follows the existing style and structure of the class.
The changes align with the PR objective of adding a respawn button in the ghost menu.
Content.Client/UserInterface/Systems/Ghost/Widgets/GhostGui.xaml.cs (2)
17-17
: LGTM!The new event
ReturnToRoundPressed
is declared correctly in theGhostGui
class. The event is public, allowing it to be subscribed from outside the class.
30-30
: LGTM!The
ReturnToRound
button is correctly subscribed to theReturnToRoundPressed
event in the constructor of theGhostGui
class. The event subscription is consistent with the other button event subscriptions in the constructor.Content.Client/UserInterface/Systems/Ghost/GhostUIController.cs (3)
123-123
: LGTM!The code change correctly subscribes the
ReturnToRound
method to handle the newReturnToRoundPressed
event of theGui
object. This is consistent with the event subscription pattern followed in theLoadGui
method.
137-137
: LGTM!The code change correctly unsubscribes the
ReturnToRound
method from theReturnToRoundPressed
event of theGui
object. This is consistent with the event unsubscription pattern followed in theUnloadGui
method and ensures proper cleanup when the GUI is unloaded.
147-150
: Verify theReturnToRound
method implementation.The
ReturnToRound
method is correctly implemented in theGhostUIController
class. It follows the pattern of other similar methods and safely calls theReturnToRound
method on the_system
object using the null-conditional operator.Please ensure that the
ReturnToRound
method is properly implemented in theGhostSystem
class to handle the respawn logic as per the PR objectives.Run the following script to verify the
ReturnToRound
method implementation:Verification successful
The
ReturnToRound
method is correctly implemented in theGhostSystem
class.The method raises a network event
GhostReturnToRoundRequest
, which aligns with the expected behavior for handling respawn logic. The implementation is consistent with the design pattern used for similar methods. No issues were found with the current implementation.
GhostSystem.cs
: TheReturnToRound
method raises theGhostReturnToRoundRequest
network event.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the implementation of the `ReturnToRound` method in the `GhostSystem` class. # Test: Search for the method declaration. Expect: The method should exist and contain the respawn logic. rg --type cs -A 10 $'void ReturnToRound\(\)'Length of output: 1418
Content.Server/_White/Ghost/GhostReturnToRoundSystem.cs (3)
24-28
: LGTM!The
Initialize
method correctly subscribes to the required events.
30-102
: LGTM!The
OnGhostReturnToRoundRequest
method correctly handles the ghost respawn request based on the provided conditions. It uses the required dependencies to get the configuration values, send chat messages, log events, and respawn the player. The method also correctly updates theDeathTime
dictionary.
104-107
: LGTM!The
ResetDeathTimes
method correctly clears theDeathTime
dictionary when the round restarts.Content.Shared/Ghost/SharedGhostSystem.cs (1)
153-154
: Clarify the purpose and usage of theGhostReturnToRoundRequest
class.The addition of the
GhostReturnToRoundRequest
class looks good. It appears to represent a network request for a ghost entity to return to the game round, based on the class name and theSerializable
andNetSerializable
attributes.However, please provide more information about the specific purpose and usage of this class. Consider adding XML documentation comments to describe the class and its intended behavior.
Also, the
WD EDIT
comments suggest that this change is specific to a particular project or fork. Is this change intended to be included in the main codebase? If so, please remove theWD EDIT
comments to avoid confusion.Content.Client/Ghost/GhostSystem.cs (1)
185-189
: LGTM!The
ReturnToRound
method is implemented correctly and follows the existing pattern of raising network events in this class. The method name clearly conveys its purpose, and the public access modifier seems appropriate if it needs to be called from outside this class.Content.Server/GameTicking/GameTicker.Spawning.cs (2)
161-216
: Respawn character name check added. LGTM!The added code block enhances the respawn system by checking if the player is attempting to respawn with the same or a similar character name. This helps prevent metagaming and confusion.
The check works as follows:
- Query all mind components with the same user ID.
- If an exact match is found, prevent the respawn and send a message to the player.
- If a high similarity (>= 85%) is found, send an admin alert and prevent the respawn.
- If a moderate similarity (>= 50%) is found, send an admin alert.
The code changes are well-structured and follow the existing coding style.
412-427
: String similarity calculation function added. Looks good!The
CalculateStringSimilarity
function calculates the similarity between two strings by comparing each character at the same position and counting the number of matching characters. The similarity percentage is then calculated as (matchingCharacters / maxLength) * 100.This simple character-by-character comparison serves the purpose of detecting most similar names. However, if more advanced similarity detection is needed in the future, consider using more sophisticated algorithms like Levenshtein distance or Jaro-Winkler distance.
ошибки линтера актуальные |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
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.
А еще merge conflict.
Переводы я не трогала, но там тоже ужас.
# Description This ports WWhiteDreamProject/wwdpublic#56 The new Respawn System is one that allows players to return themselves to the lobby after a configurable delay, while also requiring that they respawn as a different character upon returning. # TODO - [x] Finish the usual cleanup # Changelog :cl: - add: Ported a Respawn System. This system allows players to return themselves to the lobby, while also requiring that if they re-enter the round, that they must do so on a different character. --------- Co-authored-by: Spatison <[email protected]>
# Description This ports #56 The new Respawn System is one that allows players to return themselves to the lobby after a configurable delay, while also requiring that they respawn as a different character upon returning. # TODO - [x] Finish the usual cleanup # Changelog :cl: - add: Ported a Respawn System. This system allows players to return themselves to the lobby, while also requiring that if they re-enter the round, that they must do so on a different character. --------- Co-authored-by: Spatison <[email protected]> # Conflicts: # Resources/Locale/ru-RU/ghost/ghost-gui.ftl
Описание PR
Порт кнопки респавна в меню призрака.
Изменения
🆑 Spatison