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] Better Character Examine #269

Merged
merged 4 commits into from
Mar 3, 2025

Conversation

Vaaankas
Copy link
Contributor

@Vaaankas Vaaankas commented Mar 3, 2025

Описание PR

Меняет описание в меню осмотра, добавляет список надетых вещей.
Логирует список в чат игроку при включённой настройке.


Медиа

изображение
изображение
изображение


Изменения

🆑 vanx

  • add: Добавлено отображение надетых вещей при осмотре и логирование в чат при включённой настройке.

@Vaaankas Vaaankas requested a review from Remuchi as a code owner March 3, 2025 14:50
Copy link
Contributor

coderabbitai bot commented Mar 3, 2025

Warning

Rate limit exceeded

@Vaaankas has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 1 minutes and 35 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

📥 Commits

Reviewing files that changed from the base of the PR and between c58e775 and e5228a7.

📒 Files selected for processing (2)
  • Content.Server/_White/Examine/ExaminableCharacterSystem.cs (1 hunks)
  • Resources/Prototypes/Entities/Mobs/Player/silicon_base.yml (2 hunks)

Walkthrough

В пул-реквесте внесены изменения в несколько подсистем. Добавлен новый публичный метод в IdentitySystem для получения имени сущности, а также реализованы новый компонент и система для осмотра персонажей с методами и обработкой событий. Логика осмотра в системах SharedHandsSystem.Interactions и SharedHumanoidAppearanceSystem дополнена поддержкой self-aware локализации и изменёнными приоритетами вызовов. Кроме того, добавлены два новые файла локализации (англ. и рус.) с набором строк для сообщений осмотра, а также обновлён YAML-конфиг сущностей мобов с добавлением нового компонента.

Changes

Файл Изменения
Content.Server/.../IdentitySystem.cs Добавлен метод GetEntityIdentity(EntityUid uid) для получения названия сущности через GetIdentityName.
Content.Server/_White/Examine/ExaminableCharacterComponent.cs
Content.Server/_White/Examine/ExaminableCharacterSystem.cs
Добавлен новый компонент ExaminableCharacterComponent и система ExaminableCharacterSystem с методами Initialize и HandleExamine для обработки событий осмотра персонажей.
Content.Shared/Hands/EntitySystems/SharedHandsSystem.Interactions.cs
Content.Shared/Humanoid/SharedHumanoidAppearanceSystem.cs
Изменена логика осмотра: добавлено условие для self-aware осмотра, изменены приоритеты вызова (PushGroup с 99 и PushText с 100) и форматирование выводимых строк.
Resources/Locale/en-US/_white/examine/examine.ftl
Resources/Locale/ru-RU/_white/examine/examine.ftl
Добавлены новые локализационные строки для системы осмотра, включая ключи для self-aware сообщений и различные части тела/элементы экипировки.
Resources/Prototypes/Entities/Mobs/Species/base.yml В описание сущности мобов добавлен новый компонент типа ExaminableCharacter после компонента TTS, с соответствующим комментариями.

Suggested labels

Changes: C#, Changes: Localization, Changes: YML, Status: Needs Review

Suggested reviewers

  • Remuchi
  • DVOniksWyvern

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?

❤️ Share
🪧 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.
  • @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
Contributor

@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: 1

🧹 Nitpick comments (2)
Resources/Locale/ru-RU/_white/examine/examine.ftl (1)

13-13: Возможная опечатка в фразе
В строке 13 перед POSS-ADJ($ent) присутствует буква «н», которая выглядит лишней и может сбивать с толку при чтении. Рекомендуется убрать её для улучшения читаемости.

- jumpsuit-examine = - [bold]{$item}[/bold], надетый на н{POSS-ADJ($ent)}.
+ jumpsuit-examine = - [bold]{$item}[/bold], надетый на {POSS-ADJ($ent)}.
Resources/Locale/en-US/_white/examine/examine.ftl (1)

47-47: Потенциальная неточность при использовании INDEFINITE($age)
Фраза «You are { INDEFINITE($age) } { $age } { $species }» может создавать некорректные сочетания артикля и числа, например «You are an 25 Human». Рекомендуется заменить на более предсказуемую форму, например «You are { $age } year(s) old { $species }» или другую локализацию по контексту.

- humanoid-appearance-component-examine-selfaware = You are { INDEFINITE($age) } { $age } { $species }.
+ humanoid-appearance-component-examine-selfaware = You are { $age } year(s) old { $species }.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between feccf10 and c58e775.

📒 Files selected for processing (8)
  • Content.Server/IdentityManagement/IdentitySystem.cs (1 hunks)
  • Content.Server/_White/Examine/ExaminableCharacterComponent.cs (1 hunks)
  • Content.Server/_White/Examine/ExaminableCharacterSystem.cs (1 hunks)
  • Content.Shared/Hands/EntitySystems/SharedHandsSystem.Interactions.cs (1 hunks)
  • Content.Shared/Humanoid/SharedHumanoidAppearanceSystem.cs (1 hunks)
  • Resources/Locale/en-US/_white/examine/examine.ftl (1 hunks)
  • Resources/Locale/ru-RU/_white/examine/examine.ftl (1 hunks)
  • Resources/Prototypes/Entities/Mobs/Species/base.yml (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • Content.Server/_White/Examine/ExaminableCharacterComponent.cs
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: Test Packaging
  • GitHub Check: YAML Linter
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: YAML map schema validator
🔇 Additional comments (7)
Content.Server/IdentityManagement/IdentitySystem.cs (1)

85-93: Хороший подход к API для получения личности сущности

Метод хорошо инкапсулирует получение имени идентичности через существующие методы системы.

Resources/Prototypes/Entities/Mobs/Species/base.yml (1)

248-248: Компонент ExaminableCharacter добавлен успешно

Компонент правильно добавлен в прототип BaseMobSpecies, что позволит всем видам мобов иметь функционал осмотра персонажа.

Content.Shared/Hands/EntitySystems/SharedHandsSystem.Interactions.cs (1)

214-222: Хорошая реализация адаптивных локализационных ключей

Код корректно определяет случай самоосмотра и изменяет ключ локализации для показа правильного сообщения. Установка высокого приоритета (99) обеспечивает правильный порядок вывода сообщений при осмотре.

Content.Shared/Humanoid/SharedHumanoidAppearanceSystem.cs (1)

128-135: Корректная обработка локализации с учётом самоосмотра

Код выбирает соответствующий ключ локализации в зависимости от того, осматривает ли персонаж сам себя или другое существо. Установка приоритета 100 для текста осмотра обеспечивает его первостепенное отображение.

Обратите внимание на то, что приоритет здесь (100) выше, чем в системе осмотра рук (99). Это правильно, если необходимо всегда отображать информацию о расе перед списком предметов.

Resources/Locale/ru-RU/_white/examine/examine.ftl (1)

1-5: Начальные строки выглядят корректно
Проблем с форматированием или смыслом здесь не обнаружено.

Content.Server/_White/Examine/ExaminableCharacterSystem.cs (1)

28-112: Общая реализация системы осмотра
Логика при сравнении args.Examiner и args.Examined для определения selfaware-состояния выглядит корректной. Система учитывает наличие предметов в экипированных слотах, динамически формируя вывод. Приоритет и условие вывода информации, если слотах что-то есть, кажутся разумными. В целом реализация масштабируема и хорошо читается.

Resources/Locale/en-US/_white/examine/examine.ftl (1)

1-5: Начальный набор строк
Начальные фразы выглядят достаточно ясно, оформление и placeholders кажутся корректными.

@RedFoxIV
Copy link
Contributor

RedFoxIV commented Mar 3, 2025

Пиздец меню раздувает, а там снизу кнопочки так-то важные есть.

@Vaaankas
Copy link
Contributor Author

Vaaankas commented Mar 3, 2025

Пиздец меню раздувает, а там снизу кнопочки так-то важные есть.

потом их уберу тоже

canseenothingloc += "-selfaware";

var canseenothing = Loc.GetString(canseenothingloc, ("ent", uid));
logLines.Add($"[color=DarkGray][font size=10]{canseenothing}[/font][/color]");
Copy link
Contributor

Choose a reason for hiding this comment

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

цвет и размер шрифта отсюда убери и перенеси в локализацию

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ладно

{
args.PushMarkup(Loc.GetString(locKey, locUser, locItems));
args.PushMarkup("- " + Loc.GetString(locKey, locUser, locItems)); // "-" for better formatting
Copy link
Contributor

Choose a reason for hiding this comment

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

В файлах локализации уже проставлены чёрточки в начале, может быть, эта уже лишняя?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

не лишняя, для удобства чтения, но мб уберу

if (selfaware)
{
canseeloc += "-selfaware";
nameloc += "-selfaware";
Copy link
Contributor

Choose a reason for hiding this comment

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

:(

slotLabel += "examine";

if (selfaware)
slotLabel += "-selfaware";
Copy link
Contributor

Choose a reason for hiding this comment

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

:(

string canseenothingloc = "examine-can-see-nothing";

if (selfaware)
canseenothingloc += "-selfaware";
Copy link
Contributor

Choose a reason for hiding this comment

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

:(


if (priority < 13) // If nothing is worn dont show
{
args.PushMarkup($"[font size=10]{cansee}[/font]", 14);
Copy link
Contributor

Choose a reason for hiding this comment

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

теги в локализацию

{
var item = Loc.GetString(slotLabel, ("item", metaData.EntityName), ("ent", uid));
args.PushMarkup($"[font size=10]{item}[/font]", priority);
logLines.Add($"[color=DarkGray][font size=10]{item}[/font][/color]");
Copy link
Contributor

Choose a reason for hiding this comment

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

теги в локализацию

logLines.Add($"[color=DarkGray][font size=10]{name}[/font][/color]");

var cansee = Loc.GetString(canseeloc, ("ent", uid));
logLines.Add($"[color=DarkGray][font size=10]{cansee}[/font][/color]");
Copy link
Contributor

Choose a reason for hiding this comment

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

теги в локализацию

using (args.PushGroup(nameof(HandsComponent)))
// WWDP examine
if (args.Examiner == args.Examined) // Use the selfaware locale when inspecting yourself
locKey += "-selfaware";
Copy link
Contributor

Choose a reason for hiding this comment

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

:(

if (args.Examiner == args.Examined) // Use the selfaware locale when examining yourself
locale += "-selfaware";

args.PushText(Loc.GetString(locale, ("user", identity), ("age", age), ("species", species)), 100); // priority for examine
Copy link
Contributor

Choose a reason for hiding this comment

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

const string locale = "humanoid-appearance-component-examine";
const string localeself = locale+"-selfaware";
Loc.GetString(args.SelfExamine ? locale : localeself, ...

и так во всех остальных таких местах

в ивент добавь public bool SelfExamine => Examiner == Examined;.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

аээээ чё так усложнять ладно

@DVOniksWyvern DVOniksWyvern merged commit 19ed51f into WWhiteDreamProject:master Mar 3, 2025
7 of 9 checks passed
@RedFoxIV
Copy link
Contributor

RedFoxIV commented Mar 3, 2025

:(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants