Refactor Plant Analyzer UI#2789
Conversation
Large refactor of the Plant Analyzer
|
Warning Rate limit exceeded
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 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 configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughЭто полная переработка системы Plant Analyzer с переходом от режима «продвинутого сканирования» к модели периодического обновления UI. Ключевые изменения: DTO-модель заменяет GasFlags на массивы Gas[], сервер-компонент переходит с Settings-структуры на отдельные поля состояния (ScanDelay, UpdateInterval, NextUpdate, ScannedEntity), система добавляет Update-цикл для периодического обновления и упрощает взаимодействие, а клиент переделывает XAML-макет с группировкой по секциям и переписывает логику отображения данных через прототипы для локализации. Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (8)
Content.Client/ADT/PlantAnalyzer/UI/PlantAnalyzerBoundUserInterface.csContent.Client/ADT/PlantAnalyzer/UI/PlantAnalyzerWindow.xamlContent.Client/ADT/PlantAnalyzer/UI/PlantAnalyzerWindow.xaml.csContent.Server/ADT/Botany/Components/PlantAnalyzerComponent.csContent.Server/ADT/Botany/Systems/PlantAnalyzerSystem.csContent.Shared/ADT/PlantAnalyzer/PlantAnalyzerScannedSeedPlantInformation.csResources/Locale/ru-RU/ADT/prototypes/Entities/Devices/plantanalyzer/plantanalyzer.ftlResources/Prototypes/ADT/Entities/Objects/Devices/plant_analyzer.yml
Описание PR
Рефактор серверной системы анализатора растений, рефактор UI
Почему / Баланс
Анализатор растений был неудобным в использовании. Quality of Life :D
Уменьшение времени сканирования делает процесс менее раздражающим
Техническая информация
Предикт - миф, ботаника серверная💔💔💔💔💔💔💔💔💔💔💔💔💔💔💔💔💔💔💔💔💔
Медиа
Чейнджлог
🆑 Inconnu