Skip to content

Refactor Plant Analyzer UI#2789

Open
Inconnu1337 wants to merge 2 commits into
AdventureTimeSS14:masterfrom
Inconnu1337:botanic-qol
Open

Refactor Plant Analyzer UI#2789
Inconnu1337 wants to merge 2 commits into
AdventureTimeSS14:masterfrom
Inconnu1337:botanic-qol

Conversation

@Inconnu1337
Copy link
Copy Markdown
Collaborator

Описание PR

Рефактор серверной системы анализатора растений, рефактор UI

  • Исправлены захардкоженные газы
  • Добавлена локализация для реагентов
  • UI был переработан и теперь выглядит значительно лучше и информативнее
  • Длительность дуафтера у сканера растений снижена до 3 секунд для обычного анализатора и до 0.5 секунд для продвинутого
  • Добавлено реалтайм обновление UI
  • Исправлено закрытие UI при переключении руки

Почему / Баланс

Анализатор растений был неудобным в использовании. Quality of Life :D

Уменьшение времени сканирования делает процесс менее раздражающим

Техническая информация

  • Изменения были протестированы на локальном сервере, и всё работает отлично.
  • PR закончен и требует просмотра изменений.

Предикт - миф, ботаника серверная💔💔💔💔💔💔💔💔💔💔💔💔💔💔💔💔💔💔💔💔💔

Медиа

image

Чейнджлог

🆑 Inconnu

  • tweak: Рефактор Анализатора Растений и его интерфейса, улучшен внешний вид интерфейса.
  • tweak: Снижено время сканирования растений до 3 секунд для обычного и 0.5 секунд для продвинутого.
  • add: Добавлено реалтайм обновление интерфейса Анализатора Растений

Large refactor of the Plant Analyzer
@github-actions github-actions Bot added size/M Status: Needs Review Changes: UI Изменение интерфейса Changes: Localization Изменение локализации and removed Status: Needs Review size/M labels May 18, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 18, 2026

Review Change Stack

Warning

Rate limit exceeded

@Inconnu1337 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 43 minutes and 31 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ 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.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d5ed907e-de0d-4213-8538-051b8976d045

📥 Commits

Reviewing files that changed from the base of the PR and between 224513b and aa87d36.

📒 Files selected for processing (2)
  • Content.Client/ADT/PlantAnalyzer/UI/PlantAnalyzerBoundUserInterface.cs
  • Content.Client/ADT/PlantAnalyzer/UI/PlantAnalyzerWindow.xaml.cs

Walkthrough

Это полная переработка системы Plant Analyzer с переходом от режима «продвинутого сканирования» к модели периодического обновления UI. Ключевые изменения: DTO-модель заменяет GasFlags на массивы Gas[], сервер-компонент переходит с Settings-структуры на отдельные поля состояния (ScanDelay, UpdateInterval, NextUpdate, ScannedEntity), система добавляет Update-цикл для периодического обновления и упрощает взаимодействие, а клиент переделывает XAML-макет с группировкой по секциям и переписывает логику отображения данных через прототипы для локализации.

Suggested labels

Changes: UI, Changes: Localization, Status: Needs Review, size/M, S: Untriaged

Suggested reviewers

  • Unlumy
  • jungarikjan
  • Ratyyy
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed Название полностью отражает основное изменение в pull request — рефактор UI анализатора растений, что соответствует основному содержанию изменений.
Description check ✅ Passed Описание полностью соответствует changeset: описывает рефактор серверной системы и UI, исправления газов, локализацию, улучшения интерфейса, снижение времени сканирования и добавление реалтайм обновлений.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
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: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
Content.Server/ADT/Botany/Systems/PlantAnalyzerSystem.cs (1)

1-14: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Нарушен алфавитный порядок using директив.

Content.Shared.ADT.PlantAnalyzer (строка 8) должен располагаться перед Content.Shared.DoAfter (строка 6), так как ADT идёт раньше DoAfter в алфавитном порядке.

🔧 Исправленный порядок using
 using System.Linq;
 using Content.Server.ADT.Botany.Components;
 using Content.Server.Botany;
 using Content.Server.Botany.Components;
 using Content.Server.PowerCell;
+using Content.Shared.ADT.PlantAnalyzer;
 using Content.Shared.DoAfter;
 using Content.Shared.Interaction;
-using Content.Shared.ADT.PlantAnalyzer;
 using Robust.Server.GameObjects;
 using Robust.Shared.Audio.Systems;
 using Robust.Shared.Player;
 using Robust.Shared.Prototypes;
 using Robust.Shared.Timing;

As per coding guidelines: "И ещё смотри за тем чтобы using был в алфавитном порядке в наших /ADT/ системах и компонентах".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Content.Server/ADT/Botany/Systems/PlantAnalyzerSystem.cs` around lines 1 -
14, The using directives in PlantAnalyzerSystem.cs are not alphabetized: move
Content.Shared.ADT.PlantAnalyzer so it appears before Content.Shared.DoAfter and
ensure all using statements in the file are sorted in strict alphabetical order
(e.g., System.* then Content.* blocks), updating the top-of-file usings around
the PlantAnalyzerSystem, PlantAnalyzer and DoAfter references to restore correct
ordering.
🧹 Nitpick comments (2)
Content.Server/ADT/Botany/Components/PlantAnalyzerComponent.cs (1)

7-27: 💤 Low value

Рекомендуется добавить /// <summary> документацию к классу компонента.

Согласно рекомендациям проекта, важные классы и компоненты должны иметь XML-документацию для улучшения читаемости и поддержки кода.

📝 Предложение по добавлению документации
 namespace Content.Server.ADT.Botany.Components;

+/// <summary>
+///     Компонент анализатора растений. Хранит настройки сканирования и состояние текущего сканируемого объекта.
+/// </summary>
 [RegisterComponent, AutoGenerateComponentPause]
 public sealed partial class PlantAnalyzerComponent : Component
 {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Content.Server/ADT/Botany/Components/PlantAnalyzerComponent.cs` around lines
7 - 27, Добавьте XML-документацию /// <summary> ... </summary> над объявлением
класса PlantAnalyzerComponent, кратко описав его назначение (например:
"Компонент, отвечающий за сканирование и анализ растений, содержит настройки
интервалов сканирования и ссылку на сканируемую сущность"), и при необходимости
добавьте отдельные <summary> для ключевых полей (ScanDelay, UpdateInterval,
NextUpdate, ScannedEntity, DoAfter, ScanningEndSound) чтобы объяснить их роль и
единицы измерения.
Content.Server/ADT/Botany/Systems/PlantAnalyzerSystem.cs (1)

17-25: 💤 Low value

Рекомендуется добавить /// <summary> документацию к системе.

📝 Предложение по добавлению документации
 namespace Content.Server.ADT.Botany.Systems;

+/// <summary>
+///     Система анализатора растений. Обрабатывает сканирование семян и растений,
+///     периодически обновляет UI с информацией о генетических данных.
+/// </summary>
 public sealed class PlantAnalyzerSystem : EntitySystem
 {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Content.Server/ADT/Botany/Systems/PlantAnalyzerSystem.cs` around lines 17 -
25, Add an XML documentation summary for the PlantAnalyzerSystem class to
explain its purpose and responsibilities; insert a /// <summary> ... </summary>
comment immediately above the public sealed class PlantAnalyzerSystem
declaration describing that this system handles plant analysis functionality
(dependencies: IGameTiming, IPrototypeManager, PowerCellSystem,
SharedAudioSystem, SharedDoAfterSystem, UserInterfaceSystem) and any high-level
behavior it provides.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Content.Client/ADT/PlantAnalyzer/UI/PlantAnalyzerBoundUserInterface.cs`:
- Around line 35-40: Unsubscribe the Close handler from the window before
calling Close in Dispose so you don't get reentrant calls: inside Dispose(bool
disposing) when disposing is true, check _window != null, call _window.OnClose
-= Close to remove the subscription that was added earlier (from _window.OnClose
+= Close), then call _window.Close(); keep the rest of Dispose logic intact
(including base.Dispose) and mirror the pattern used in other classes like
StorageBoundUserInterface/VendingMachineBoundUserInterface.

In `@Content.Client/ADT/PlantAnalyzer/UI/PlantAnalyzerWindow.xaml.cs`:
- Around line 42-47: Когда target равен null, помимо скрытия вкладок и
предупреждений нужно очистить заголовок и повтор (убрать старые значения): в
блоке, где проверяется "if (target is null)" (в PlantAnalyzerWindow.xaml.cs),
установить пустые/дефолтные значения для элементов PlantName и Repeat (или
вызвать метод сброса заголовка, если он есть) перед return, чтобы старые данные
не отображались вместе с NoData.Visible.

---

Outside diff comments:
In `@Content.Server/ADT/Botany/Systems/PlantAnalyzerSystem.cs`:
- Around line 1-14: The using directives in PlantAnalyzerSystem.cs are not
alphabetized: move Content.Shared.ADT.PlantAnalyzer so it appears before
Content.Shared.DoAfter and ensure all using statements in the file are sorted in
strict alphabetical order (e.g., System.* then Content.* blocks), updating the
top-of-file usings around the PlantAnalyzerSystem, PlantAnalyzer and DoAfter
references to restore correct ordering.

---

Nitpick comments:
In `@Content.Server/ADT/Botany/Components/PlantAnalyzerComponent.cs`:
- Around line 7-27: Добавьте XML-документацию /// <summary> ... </summary> над
объявлением класса PlantAnalyzerComponent, кратко описав его назначение
(например: "Компонент, отвечающий за сканирование и анализ растений, содержит
настройки интервалов сканирования и ссылку на сканируемую сущность"), и при
необходимости добавьте отдельные <summary> для ключевых полей (ScanDelay,
UpdateInterval, NextUpdate, ScannedEntity, DoAfter, ScanningEndSound) чтобы
объяснить их роль и единицы измерения.

In `@Content.Server/ADT/Botany/Systems/PlantAnalyzerSystem.cs`:
- Around line 17-25: Add an XML documentation summary for the
PlantAnalyzerSystem class to explain its purpose and responsibilities; insert a
/// <summary> ... </summary> comment immediately above the public sealed class
PlantAnalyzerSystem declaration describing that this system handles plant
analysis functionality (dependencies: IGameTiming, IPrototypeManager,
PowerCellSystem, SharedAudioSystem, SharedDoAfterSystem, UserInterfaceSystem)
and any high-level behavior it provides.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 955c0737-fd44-4551-8f48-08fc709fc9a6

📥 Commits

Reviewing files that changed from the base of the PR and between 837d655 and 224513b.

📒 Files selected for processing (8)
  • Content.Client/ADT/PlantAnalyzer/UI/PlantAnalyzerBoundUserInterface.cs
  • Content.Client/ADT/PlantAnalyzer/UI/PlantAnalyzerWindow.xaml
  • Content.Client/ADT/PlantAnalyzer/UI/PlantAnalyzerWindow.xaml.cs
  • Content.Server/ADT/Botany/Components/PlantAnalyzerComponent.cs
  • Content.Server/ADT/Botany/Systems/PlantAnalyzerSystem.cs
  • Content.Shared/ADT/PlantAnalyzer/PlantAnalyzerScannedSeedPlantInformation.cs
  • Resources/Locale/ru-RU/ADT/prototypes/Entities/Devices/plantanalyzer/plantanalyzer.ftl
  • Resources/Prototypes/ADT/Entities/Objects/Devices/plant_analyzer.yml

Comment thread Content.Client/ADT/PlantAnalyzer/UI/PlantAnalyzerBoundUserInterface.cs Outdated
Comment thread Content.Client/ADT/PlantAnalyzer/UI/PlantAnalyzerWindow.xaml.cs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Changes: Localization Изменение локализации Changes: UI Изменение интерфейса size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant