[ЗАКАЗ] Тела для ИИ/Возможность вселиться в боргов#4535
Conversation
📝 WalkthroughWalkthroughДобавлена полноценная система управления телами для Station AI: новые общие компоненты ( ChangesStation AI Body Control System
Sequence Diagram(s)sequenceDiagram
participant Player as Игрок (Station AI)
participant BUI as StationAiBodyBoundUserInterface
participant InterfaceServer as StationAiBodySystem.Interface (Server)
participant StateServer as StationAiBodySystem.State (Server)
participant Features as StationAiBodySystem.Features (Server)
participant Mind as MindSystem
Player->>BUI: нажать "Enter" у тела
BUI->>InterfaceServer: StationAiBodyEnterMessage(body)
InterfaceServer->>StateServer: TryEnterBody(stationAi, body)
StateServer->>StateServer: CanEnterBody → валидация board/связей/mind
StateServer->>StateServer: ReleaseCurrentBody (если было)
StateServer->>Mind: TransferTo(body)
StateServer->>Features: GrantStationAiRadioChannels(body)
StateServer->>InterfaceServer: GrantControlledBodyActions(body)
StateServer->>InterfaceServer: UpdateBodyUiData(controller)
InterfaceServer->>BUI: UpdateState (via AfterAutoHandleStateEvent)
Player->>BUI: нажать "Leave AI body"
BUI->>InterfaceServer: StationAiBodyExitMessage
InterfaceServer->>StateServer: TryExitBody(stationAi)
StateServer->>Mind: TransferTo(brain)
StateServer->>Features: RevokeStationAiRadioChannels(body)
StateServer->>InterfaceServer: RevokeControlledBodyActions(body)
StateServer->>InterfaceServer: UpdateBodyUiData(controller)
InterfaceServer->>BUI: UpdateState
Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes Suggested labels
Suggested reviewers
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
|
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 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/_Sunrise/Silicons/StationAi/StationAiBodyWindow.xaml.cs`:
- Around line 16-21: The StationAiBodyWindow constructor is missing the required
dependency injection call. After the RobustXamlLoader.Load(this) call in the
StationAiBodyWindow constructor, add a call to
IoCManager.InjectDependencies(this) to comply with XAML.cs UI class coding
guidelines that mandate dependency injection immediately after XAML loading.
In `@Content.Server/_Sunrise/Silicons/StationAi/StationAiBodySystem.State.cs`:
- Around line 86-106: The OnStationAiBrainGotRemovedFromCore event handler is
performing direct state mutations (RemComp of RelayInputMoverComponent and
modifying mover.CanMove) before delegating, violating the required OnEvent ->
TryDo -> CanDo -> Do pattern. Extract all side-effects from this event handler
into a separate Do method that performs the component removal and mover state
changes, keeping only validation checks in OnStationAiBrainGotRemovedFromCore
itself. Create a TryExitBody-style method (or expand its responsibilities) to
encapsulate the Do logic that applies the mutations after validation passes,
ensuring the CanDo validation phase remains side-effect free.
In `@Content.Server/Silicons/StationAi/StationAiSystem.cs`:
- Around line 167-171: All Russian inline comments in the Station AI system
files must be translated to English per repository guidelines. In
Content.Server/Silicons/StationAi/StationAiSystem.cs lines 167-171, translate
the comment about clearing alerts for the active AI actor body. In
Content.Shared/Silicons/StationAi/SharedStationAiSystem.Airlock.cs lines 27-32,
translate the comment about AI core access checking and any other comments in
the airlock event handlers. In
Content.Shared/Silicons/StationAi/SharedStationAiSystem.Held.cs lines 135-166,
translate comments about AI-only BUI interaction and whitelist/power checks,
including those in the verbs block. In
Content.Shared/Silicons/StationAi/SharedStationAiSystem.cs line 176, translate
the inline comment for the TryGetCoreForAiActor method and the notification
comment around line 307. In
Content.Shared/Silicons/StationAi/SharedStationAiSystem.Customization.cs lines
48-51, translate the comment about separate body customization. Replace all
Russian text with clear, equivalent English translations while preserving the
original meaning and context.
In
`@Content.Shared/_Sunrise/Silicons/StationAi/StationAiBodyControllerComponent.cs`:
- Around line 21-23: The `Bodies` field is marked as `[AutoNetworkedField]` but
contains a reference type `StationAiBodyEntry` defined as a `class` without
implementing `IRobustCloneable`, which violates the requirement that reference
types in networked components must support safe state serialization and rollback
during prediction. Either convert `StationAiBodyEntry` from a `class` to a
`record struct` to make it a value-type, or implement the `IRobustCloneable`
interface on the `StationAiBodyEntry` class with proper cloning logic to ensure
safe copying of component state.
In `@Content.Shared/Silicons/Borgs/SharedBorgSwitchableTypeSystem.cs`:
- Line 15: The inline comment on the SharedBorgSwitchableTypeSystem class
declaration is written in Russian but must be in English per coding guidelines
for .cs files. Translate the comment "Sunrise-Edit - partial для расширения из
_Sunrise." to English while preserving the meaning about the partial class being
used for extension from _Sunrise.
🪄 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: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 10692f0a-df2e-46ce-be6b-7573f4964629
⛔ Files ignored due to path filters (4)
Resources/Textures/_Sunrise/Mobs/Silicon/station_ai_body.rsi/borg.pngis excluded by!**/*.pngResources/Textures/_Sunrise/Mobs/Silicon/station_ai_body.rsi/female.pngis excluded by!**/*.pngResources/Textures/_Sunrise/Mobs/Silicon/station_ai_body.rsi/male.pngis excluded by!**/*.pngResources/Textures/_Sunrise/Objects/Specific/Robotics/station_ai_communication_board.rsi/board.pngis excluded by!**/*.png
📒 Files selected for processing (43)
Content.Client/_Sunrise/Silicons/StationAi/StationAiBodyBoundUserInterface.csContent.Client/_Sunrise/Silicons/StationAi/StationAiBodySystem.csContent.Client/_Sunrise/Silicons/StationAi/StationAiBodyVisualizerSystem.csContent.Client/_Sunrise/Silicons/StationAi/StationAiBodyWindow.xamlContent.Client/_Sunrise/Silicons/StationAi/StationAiBodyWindow.xaml.csContent.Server/Holopad/HolopadSystem.csContent.Server/Silicons/StationAi/StationAiSystem.csContent.Server/_Sunrise/Silicons/StationAi/StationAiBodySystem.Features.csContent.Server/_Sunrise/Silicons/StationAi/StationAiBodySystem.Interface.csContent.Server/_Sunrise/Silicons/StationAi/StationAiBodySystem.State.csContent.Server/_Sunrise/Silicons/StationAi/StationAiBodySystem.csContent.Shared/Silicons/Borgs/Components/BorgChassisComponent.csContent.Shared/Silicons/Borgs/SharedBorgSwitchableTypeSystem.csContent.Shared/Silicons/StationAi/SharedStationAiSystem.Airlock.csContent.Shared/Silicons/StationAi/SharedStationAiSystem.Customization.csContent.Shared/Silicons/StationAi/SharedStationAiSystem.Held.csContent.Shared/Silicons/StationAi/SharedStationAiSystem.csContent.Shared/Silicons/StationAi/StationAiCustomizationComponent.csContent.Shared/_Sunrise/Silicons/Borgs/SharedBorgSwitchableTypeSystem.Sunrise.csContent.Shared/_Sunrise/Silicons/StationAi/SharedStationAiSystem.Body.csContent.Shared/_Sunrise/Silicons/StationAi/StationAiBodyComponent.csContent.Shared/_Sunrise/Silicons/StationAi/StationAiBodyControllerComponent.csContent.Shared/_Sunrise/Silicons/StationAi/StationAiBodyEvents.csContent.Shared/_Sunrise/Silicons/StationAi/StationAiBodyUi.csResources/Locale/en-US/_prototypes/_sunrise/actions/borg_actions.ftlResources/Locale/en-US/_prototypes/_sunrise/actions/station_ai.ftlResources/Locale/en-US/_prototypes/_sunrise/entities/objects/specific/robotics/borg_brains.ftlResources/Locale/en-US/_strings/_sunrise/borg-gender.ftlResources/Locale/en-US/_strings/_sunrise/silicons/station-ai.ftlResources/Locale/ru-RU/_prototypes/_sunrise/actions/borg_actions.ftlResources/Locale/ru-RU/_prototypes/_sunrise/actions/station_ai.ftlResources/Locale/ru-RU/_prototypes/_sunrise/entities/objects/specific/robotics/borg_brains.ftlResources/Locale/ru-RU/_strings/_sunrise/borg-gender.ftlResources/Locale/ru-RU/_strings/_sunrise/silicons/station-ai.ftlResources/Prototypes/Entities/Mobs/Player/silicon.ymlResources/Prototypes/_Sunrise/Actions/station_ai.ymlResources/Prototypes/_Sunrise/AppearanceCustomization/station_ai_body.ymlResources/Prototypes/_Sunrise/Entities/Objects/Specific/Robotics/station_ai_boards.ymlResources/Prototypes/_Sunrise/Recipes/Lathes/Packs/robotics.ymlResources/Prototypes/_Sunrise/Recipes/Lathes/robotic.ymlResources/Prototypes/_Sunrise/tags.ymlResources/Textures/_Sunrise/Mobs/Silicon/station_ai_body.rsi/meta.jsonResources/Textures/_Sunrise/Objects/Specific/Robotics/station_ai_communication_board.rsi/meta.json

Краткое описание | Short description
Заказ с ласта на возможность ИИ вселиться в борга и управлять им, если в борге есть специальная плата.
Подробности в ветке заказов.
Всякие проблемы вроде синхронизации законов тела, радио каналов между телом и ядром продуманы.
События, когда ИИ переносят на карту, ломают ядро и он в теле нормально обрабатываются, ИИ уходит из тела. Ломание тела аналогично.
Когда множество ИИ пытаются тыкать 1 тело тоже работает штатно.
Ссылка на багрепорт/Предложение | Related Issue/Bug Report
https://discord.com/channels/1499823476360613898/1505533814166917120
Медиа (Видео/Скриншоты) | Media (Video/Screenshots)
https://cdn.discordapp.com/attachments/1505533814166917120/1515713549765316628/2026-06-14_16-42-29.mp4?ex=6a3001be&is=6a2eb03e&hm=82eafadb8bf2c8fe3c44fd43dd4f2fa3ab8baef10438a32c4c55f5deae7a1f4e&
TODO
Пока пусть остальной код пройдет ревью
Changelog
🆑 ThereDrD
Summary by CodeRabbit
Новые возможности
New Features
Documentation