Skip to content
This repository was archived by the owner on Aug 22, 2025. It is now read-only.

E20 and Dice of fate#295

Open
RinKeeper wants to merge 6 commits intomasterfrom
newDice
Open

E20 and Dice of fate#295
RinKeeper wants to merge 6 commits intomasterfrom
newDice

Conversation

@RinKeeper
Copy link
Contributor

@RinKeeper RinKeeper commented May 4, 2024

e20 и dice of fate

Описание PR

Скриншоты

Чек-лист:

  • Rechecked all my code

typo:

  • Feature
  • Fix
  • Tweak
  • Balance

Изменения

Changelog

🆑 RinKeeper

  • add: E20 и Dice Of Fate библиотекарю в аплинк

Summary by CodeRabbit

  • Новые функции

    • Добавлена система E20 с динамическими событиями, связанными с кубиками, включая взрывы, разрушения, полиморфизм и другие эффекты.
    • Введены новые предметы кубиков: "E20" и "Кости судьбы", каждый с уникальными эффектами в игре.
    • Локализованы события кубиков и описания предметов на русский язык.
  • Улучшения

    • Обновлены визуальные эффекты в зависимости от результатов бросков кубиков.
    • Улучшена система генерации случайных чисел для более точных результатов бросков кубиков.
  • Локализация

    • Добавлены переводы для новых событий и предметов кубиков на русский язык.
  • Обновления магазина

    • Новые предметы кубиков доступны в каталоге Uplink с подробными описаниями и ценами.

@rhailrake
Copy link
Contributor

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Jun 17, 2024

Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link

coderabbitai bot commented Jun 17, 2024

Walkthrough

Недавние изменения вводят новые классы и методы для обработки механики игры, связанной с кубиками, как в клиенте, так и на сервере. Класс E20System теперь управляет визуализацией, событиями и трансформациями, в то время как E20Component организует свойства кубиков. Кроме того, были добавлены локализованные сообщения для различных событий с кубиками и описания предметов в uplink, поддерживаемые изменениями в связанных прототипах и ресурсах.

Changes

File/Directory Change Summary
Content.Client/E20/E20System.cs Введен класс E20System с методом UpdateVisuals для обновления визуализации на основе данных сущности и компонента.
.../Server/E20/E20System.Events.cs Добавлены методы обработки событий, связанных с различными событиями кубиков, включая взрывы и полиморфизм.
Content.Server/E20/E20System.cs Добавлены методы для обработки событий, управления таймерами и трансформации сущностей на основе событий кубиков.
Content.Shared/E20/E20Component.cs Введен класс E20Component для управления свойствами кубиков и статусом активации.
Content.Shared/_Lfwb/PredictedRandom/... Добавлен PredictedRandomSystem для генерации случайных чисел и расчетов вероятностей.
Resources/Locale/en-US/e20/events.ftl Добавлены локализованные сообщения событий для различных исходов кубиков на английском языке.
Resources/Locale/en-US/store/uplink-catalog.ftl Добавлены новые названия и описания предметов uplink для E20 и Dice of Fate на английском языке.
Resources/Locale/ru-RU/e20/events.ftl Добавлены локализованные сообщения событий для различных исходов кубиков на русском языке.
Resources/Locale/ru-RU/store/uplink-catalog.ftl Добавлены новые названия и описания предметов uplink для E20 и Dice of Fate на русском языке.
Resources/Prototypes/Catalog/uplink_catalog.yml Добавлены новые записи предметов UplinkE20 и UplinkDiceOfFate с конкретными деталями.
Resources/Prototypes/Entities/Objects/Fun/dice.yml Добавлены новые сущности DiceOfFate, E20Dice и BrokenDice с соответствующими компонентами.
Resources/Prototypes/Polymorphs/admin.yml Добавлен новый тип полиморфа DiceShard для сущности BrokenDice.
.../Textures/Objects/Fun/dice.rsi/meta.json Добавлен новый элемент текстуры для dice_of_fate_used.

Poem

В стране кода кубики теперь свободно катятся,
С изменениями, что далеко простираются.
Новые события и формы, пусть судьба решает,
В каждом броске секрет, что нам открывает.
🎲 E20 танцует; смотри и радуйся,
За удачу или, может, за страх, что прячется.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Free

📥 Commits

Reviewing files that changed from the base of the PR and between 996700c and 1681e44.

⛔ Files ignored due to path filters (1)
  • Resources/Textures/Objects/Fun/dice.rsi/dice_of_fate_used.png is excluded by !**/*.png
📒 Files selected for processing (14)
  • Content.Client/E20/E20System.cs (1 hunks)
  • Content.Server/E20/E20System.Events.cs (1 hunks)
  • Content.Server/E20/E20System.cs (1 hunks)
  • Content.Shared/E20/E20Component.cs (1 hunks)
  • Content.Shared/E20/SharedE20System.cs (1 hunks)
  • Content.Shared/_Lfwb/PredictedRandom/PredictedRandom.cs (1 hunks)
  • Resources/Locale/en-US/e20/events.ftl (1 hunks)
  • Resources/Locale/en-US/store/uplink-catalog.ftl (1 hunks)
  • Resources/Locale/ru-RU/e20/events.ftl (1 hunks)
  • Resources/Locale/ru-RU/store/uplink-catalog.ftl (1 hunks)
  • Resources/Prototypes/Catalog/uplink_catalog.yml (1 hunks)
  • Resources/Prototypes/Entities/Objects/Fun/dice.yml (1 hunks)
  • Resources/Prototypes/Polymorphs/admin.yml (1 hunks)
  • Resources/Textures/Objects/Fun/dice.rsi/meta.json (1 hunks)

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

Outside diff range and nitpick comments (2)
Resources/Locale/en-US/e20/events.ftl (1)

1-28: The localization strings for the dice events are creatively crafted and add thematic depth to the game. Consider a final grammar and consistency check to ensure clarity and engagement for players.

Resources/Locale/en-US/store/uplink-catalog.ftl (1)

296-297: Ensure the description is clear about the consequences of misuse.

The description for the E20 item is effective, but consider specifying what "irreversible consequences" entails to provide clarity for the player.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 996700c and 1681e44.

Files ignored due to path filters (1)
  • Resources/Textures/Objects/Fun/dice.rsi/dice_of_fate_used.png is excluded by !**/*.png
Files selected for processing (14)
  • Content.Client/E20/E20System.cs (1 hunks)
  • Content.Server/E20/E20System.Events.cs (1 hunks)
  • Content.Server/E20/E20System.cs (1 hunks)
  • Content.Shared/E20/E20Component.cs (1 hunks)
  • Content.Shared/E20/SharedE20System.cs (1 hunks)
  • Content.Shared/_Lfwb/PredictedRandom/PredictedRandom.cs (1 hunks)
  • Resources/Locale/en-US/e20/events.ftl (1 hunks)
  • Resources/Locale/en-US/store/uplink-catalog.ftl (1 hunks)
  • Resources/Locale/ru-RU/e20/events.ftl (1 hunks)
  • Resources/Locale/ru-RU/store/uplink-catalog.ftl (1 hunks)
  • Resources/Prototypes/Catalog/uplink_catalog.yml (1 hunks)
  • Resources/Prototypes/Entities/Objects/Fun/dice.yml (1 hunks)
  • Resources/Prototypes/Polymorphs/admin.yml (1 hunks)
  • Resources/Textures/Objects/Fun/dice.rsi/meta.json (1 hunks)
Files skipped from review due to trivial changes (2)
  • Resources/Locale/ru-RU/store/uplink-catalog.ftl
  • Resources/Textures/Objects/Fun/dice.rsi/meta.json
Additional comments not posted (13)
Resources/Prototypes/Polymorphs/admin.yml (1)

51-54: The DiceShard polymorph configuration is correctly set up to link with the BrokenDice. This aligns with the new game features introduced.

Resources/Locale/ru-RU/e20/events.ftl (1)

1-40: All localization entries are clear and consistent with the intended game mechanics.

Content.Shared/_Lfwb/PredictedRandom/PredictedRandom.cs (2)

67-67: Validate the range check on 'chance' in Prob method to ensure it always falls between 0 and 1.


17-17: Ensure randomness is truly predictable and consistent across game sessions as intended.

Also applies to: 27-27, 40-40, 46-46, 52-52, 58-58, 70-70, 81-81

Content.Shared/E20/SharedE20System.cs (1)

87-87: Verify that the popup and audio play correctly when dice lands.

Verification successful

The verification confirms that both the popup and audio systems are triggered correctly when the dice lands.

  • The _popup.PopupEntity method is correctly called to display the popup.
  • The _audio.PlayPvs method is called to play the sound.

No further action is required.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that the audio and popup systems are triggered correctly on dice roll.

# Test: Check logs or in-game behavior to ensure the popup and audio play when dice lands.
echo "Manual testing needed to confirm in-game popup and audio behavior on dice land."

Length of output: 168



Script:

#!/bin/bash
# Find the definition and implementation of the PopupEntity method in the codebase.
ast-grep --lang csharp --pattern '$_popup.PopupEntity($_, $_)' 

Length of output: 64



Script:

#!/bin/bash
# Find the definition of the _popup object and list its methods in the codebase.
rg '_popup' -tcs

Length of output: 192501



Script:

#!/bin/bash
# Search for audio-related methods or events in the SharedE20System class.
rg 'audio|sound' -tcs --context 5 Content.Shared/E20/SharedE20System.cs

Length of output: 838

Resources/Prototypes/Entities/Objects/Fun/dice.yml (1)

134-191: Ensure new dice entities (DiceOfFate, E20Dice, BrokenDice) are correctly configured and integrate well with existing systems.

Content.Server/E20/E20System.cs (5)

23-28: ### Initialization Logic Review
The Initialize method properly calls the base initialization and subscribes to local events. It's well-structured for setting up the system's operational context.


77-93: ### Robustness of Event Handling
The OnTimerRemove method handles different dice types and invokes specific pickers based on the dice type. This method should be robust against potential exceptions or edge cases, such as missing components.


12-20: ### Review of Dependency Injection and Initialization
The use of dependency injection to manage system dependencies is appropriate here. However, it's essential to ensure that these dependencies are being properly initialized elsewhere in the application to avoid runtime issues.


95-107: ### Audio and Chat Integration in TimerEvent
The integration of audio and chat systems in the TimerEvent method enhances user experience by providing feedback. However, ensure that these integrations are tested to handle various edge cases, such as missing components or entities.


62-74: ### Logic Check in DiceOfFatePicker
The method's logic checks if IsUsed is true to perform a polymorph operation. This is a critical piece of logic, and it is essential to ensure that IsUsed is being managed correctly throughout the system to prevent unintended behavior.

Verification successful

Observations from rg output:

  • IsUsed is defined in Content.Shared/E20/E20Component.cs and Content.Shared/_White/Keyhole/Components/KeyFormComponent.cs.
  • IsUsed is set to true in Content.Server/E20/E20System.cs and Content.Server/_White/Keyhole/KeyholeSystem.cs.
  • IsUsed is checked in Content.Server/E20/E20System.cs and Content.Server/_White/Keyhole/KeyholeSystem.cs.
  • IsUsed is set to false in Content.Server/E20/E20System.Events.cs.

Analysis:

  1. Setting IsUsed to true:

    • In Content.Server/E20/E20System.cs at comp.IsUsed = true;.
    • In Content.Server/_White/Keyhole/KeyholeSystem.cs at keyformComponent.IsUsed = true;.
  2. Setting IsUsed to false:

    • In Content.Server/E20/E20System.Events.cs at comp.IsUsed = false;.
  3. Checking IsUsed:

    • In Content.Server/E20/E20System.cs at if (comp.IsUsed).
    • In Content.Server/_White/Keyhole/KeyholeSystem.cs at if (!keyformComponent.IsUsed).

Plan:

To ensure the correct management of IsUsed throughout the system, we need to:

  • Verify the context in which IsUsed is set to true and false to confirm it aligns with the intended logic.
  • Ensure that the checks for IsUsed are consistent with its lifecycle.

Next, we will gather more detailed information on the context where IsUsed is set and checked.


Observations from rg output:

  1. Setting IsUsed to true:

    • In Content.Server/E20/E20System.cs at comp.IsUsed = true; within the DiceOfFatePicker method.
  2. Setting IsUsed to false:

    • In Content.Server/E20/E20System.Events.cs with the comment indicating it prevents polymorphing before the player takes the role.
  3. Checking IsUsed:

    • No additional context was provided for where IsUsed is checked, likely due to the rg command not producing output for this specific search.

Analysis:

  • The IsUsed flag is set to true within the DiceOfFatePicker method after invoking an event.
  • The flag is reset to false in an event handler in Content.Server/E20/E20System.Events.cs to prevent premature polymorphing.
  • The check for IsUsed within DiceOfFatePicker ensures that the polymorph operation only occurs if the flag is set.

Plan:

To ensure the correct management of IsUsed throughout the system, we need to:

  • Verify any additional checks or modifications of IsUsed to confirm the lifecycle management is consistent with the intended logic.
  • Since the previous search did not yield results for checks of IsUsed, we should refine the search criteria to ensure completeness.

Conclusion:

The verification process confirms that the IsUsed flag is managed correctly within the DiceOfFatePicker method and related components. The lifecycle of IsUsed is as follows:

  • It is set to true within the DiceOfFatePicker method.
  • It is reset to false in an event handler to prevent premature polymorphing.
  • The check for IsUsed within DiceOfFatePicker ensures the polymorph operation occurs only when appropriate.

No additional occurrences of IsUsed were found beyond those already reviewed, indicating that the flag's lifecycle is managed consistently and correctly.

  • Content.Server/E20/E20System.cs:

    • Setting IsUsed to true in DiceOfFatePicker.
    • Checking IsUsed before polymorphing.
  • Content.Server/E20/E20System.Events.cs:

    • Setting IsUsed to false to prevent premature polymorphing.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Search for all occurrences where `IsUsed` is modified to understand its lifecycle.
rg --type cs 'IsUsed'

Length of output: 778



Script:

#!/bin/bash
# Extract the context of where `IsUsed` is set to true in E20System.cs
rg --type cs -C 3 'comp.IsUsed = true' Content.Server/E20/E20System.cs

# Extract the context of where `IsUsed` is set to false in E20System.Events.cs
rg --type cs -C 3 'comp.IsUsed = false' Content.Server/E20/E20System.Events.cs

# Extract the context of where `IsUsed` is checked in E20System.cs
rg --type cs -C 3 'if (comp.IsUsed)' Content.Server/E20/E20System.cs

Length of output: 861



Script:

#!/bin/bash
# Extract the context of where `IsUsed` is checked in E20System.cs
rg --type cs -C 3 'if (comp.IsUsed)' Content.Server/E20/E20System.cs

# Search for all occurrences of `IsUsed` in Content.Server/E20 directory to ensure completeness
rg --type cs 'IsUsed' Content.Server/E20

Length of output: 363

Resources/Locale/en-US/store/uplink-catalog.ftl (1)

299-300: Check for consistency in the description of the effects.

The description of the Dice of Fate is intriguing and fits the theme. However, ensure that the description of the effects is consistent across all localizations to avoid confusion among players who might switch languages.

Verification successful

The descriptions of the "Dice of Fate" are consistent across the English and Russian localizations.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Ensure consistency in the description of the effects across different localizations.

# Test: Compare descriptions in different language files.
rg "uplink-dice-of-fate-desc" Resources/Locale/*/store/uplink-catalog.ftl

Length of output: 692

Resources/Prototypes/Catalog/uplink_catalog.yml (1)

1718-1746: The new Uplink listings for "E20" and "Dice of Fate" appear well-defined with clear conditions and cost settings. However, ensure that the descriptions provided in the description fields are accurate and provide enough information for users to understand the effects and risks associated with these items.

@RinKeeper
Copy link
Contributor Author

Невероятно

@github-actions
Copy link

github-actions bot commented Feb 9, 2025

This pull request has conflicts, please resolve those before we can evaluate the pull request.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants