Skip to content

Добавления для спящего агента и обычного. - #1123

Open
EngineerLND wants to merge 5 commits into
space-sunrise:masterfrom
EngineerLND:scp-sleep-spy-new-changes
Open

Добавления для спящего агента и обычного.#1123
EngineerLND wants to merge 5 commits into
space-sunrise:masterfrom
EngineerLND:scp-sleep-spy-new-changes

Conversation

@EngineerLND

@EngineerLND EngineerLND commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Краткое описание

Теперь при появлении спящего агента Повстанцев Хаоса, один из шпионов (с наименьшим количеством задач) будет получать цель на активацию спящего агента. Из информации у него будет только отдел, в котором находится спящая ячейка.

Ссылка на багрепорт/Предложение

Медиа (Видео/Скриншоты)

Changelog

🆑 EngineerLND

  • add: Добавлена цель для ШПХ: Активация спящего агента.
  • add: Изменение для администрации. Теперь создание спящего агента вручную выводит сообщение в чат.

Summary by CodeRabbit

  • Новые возможности

    • Добавлена механика спящих агентов Повстанцев Хаоса.
    • Активным шпионам автоматически назначается цель для пробуждения подходящего спящего агента.
    • Администраторы получают сообщение с назначенной целью и ответственным шпионом.
    • Добавлены локализованные названия и описания цели на русском и английском языках.
  • Изменения игрового процесса

    • Спящие агенты отмечаются как назначенные после выбора целью.
    • Шпионы Хаоса получают соответствующее обозначение и новые задачи.
    • Скорректированы вероятности выбора некоторых групп целей шпионов.

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@EngineerLND, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 19 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: e926e395-9cdb-47a0-9c1d-1230686d0512

📥 Commits

Reviewing files that changed from the base of the PR and between eb1c35e and 66274a4.

📒 Files selected for processing (4)
  • Content.Server/_Scp/Objectives/Components/ScpActivateSleepSpyConditionComponent.cs
  • Content.Server/_Scp/Objectives/Systems/ScpActivateSleepSpyConditionSystem.cs
  • Resources/Locale/en-US/_prototypes/_scp/objectives/chaos.ftl
  • Resources/Locale/ru-RU/_prototypes/_scp/objectives/chaos.ftl
📝 Walkthrough

Walkthrough

Добавлена цель активации спящего агента для Chaos Spy. Система выбирает неназначенного агента, выдаёт цель активному шпиону и отслеживает прогресс. Администратор получает сообщение о назначении.

Changes

Активация спящего агента

Layer / File(s) Summary
Контракты и прототипы цели
Content.Shared/_Scp/Chaos/*, Content.Server/_Scp/Objectives/Components/*, Resources/Prototypes/_Scp/Objectives/*, Resources/Prototypes/_Scp/GameRules/roundstart.yml
Добавлены ChaosSpyMobComponent, флаг назначения спящего агента и компонент условия цели. Добавлен прототип ChaosSpyActivateSleepSpyObjective. Роли Chaos Spy получили новый компонент. Изменены веса групп целей.
Условие активации
Content.Server/_Scp/Objectives/Systems/ScpActivateSleepSpyConditionSystem.cs, Resources/Locale/*/_strings/_scp/objectives/conditions/*
Система выбирает живого неназначенного спящего агента, задаёт локализованные название и описание цели и возвращает прогресс по активации.
Назначение роли и уведомление
Content.Server/_Scp/GameTicking/Rules/ChaosSleepSpyRuleSystem.cs, Content.Server/Administration/Systems/AdminVerbSystem.Antags.cs, Content.Server/_Scp/GameTicking/Rules/ChaosSpyRuleSystem.cs, Resources/Locale/*/_strings/_scp/administration/antag.ftl
После назначения система добавляет цель Chaos Spy с минимальным числом целей. При пробуждении сохраняется ChaosSpyMobComponent. Администратор получает сообщение с именем цели. Форматирование GenerateBriefing исправлено без изменения поведения.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

  • space-sunrise/project-fire#1048: вводит базовые системы и компоненты Chaos Spy и sleep-spy, расширенные в этом PR.
  • space-sunrise/project-fire#1121: изменяет системы администрирования и правил Chaos Sleep Spy, дополненные в этом PR.
  • space-sunrise/project-fire#1083: изменяет ChaosSpyRuleSystem.GenerateBriefing, затронутый также в этом PR.

Suggested labels: 🛠️ Есть C# 🛠️, 📦 YAML | Прототип 📦, 📚 Изменения: Локализация 📚

Suggested reviewers: wardexofficial


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (2 errors, 1 inconclusive)

Check name Status Explanation Resolution
Ss14 Yaml/Ftl Rules ❌ Error В добавленном chaosSpy.yml:151 уникальный для _Scp ID ChaosSpyActivateSleepSpyObjective не имеет обязательного префикса Scp. Переименуйте ID в ScpChaosSpyActivateSleepSpyObjective и обновите ссылку на него в ChaosSleepSpyRuleSystem.cs.
Ss14 Prototype ↔ Ftl Parity ❌ Error Добавлен игрокоориентированный прототип ChaosSpyActivateSleepSpyObjective с name и description, но в en-US и ru-RU отсутствуют ключи ent-ChaosSpyActivateSleepSpyObjective. Добавьте ent-ChaosSpyActivateSleepSpyObjective и .desc в файлы локализации прототипов en-US и ru-RU; ключи условия цели этого не заменяют.
Title check ❓ Inconclusive Заголовок связан с механикой спящего агента, но слово «обычного» не уточняет вторую часть изменений. Укажите основное изменение точнее, например: «Добавлена активация спящего агента шпионом Хаоса».
✅ Passed checks (8 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Ss14 Bridge Sync ✅ Passed Полный diff PR относительно origin/master не содержит изменений в .agents/rules, .agents/skills или соответствующих bridge-каталогах.
Ss14 Fork/Project Folder Selection ✅ Passed Активная ветка — Fire: remote содержит project-fire, код использует _Scp. Новые файлы размещены в _Scp/_scp, а хук в vanilla-файле отмечен Fire edit.
Ss14 C# Rules ✅ Passed Все изменённые C#-файлы используют корректные суффиксы Component/System, зависимости с _, код размещён в _Scp; vanilla-hook помечен Fire edit, новые обработчики используют ref-события.
Ss14 Prediction Safety ✅ Passed Изменения в Content.Shared содержат только сетевые компоненты и поля; клиентских или общих систем с логикой предсказания нет. IRobustRandom используется только в Content.Server.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 8

🤖 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.Server/_Scp/GameTicking/Rules/ChaosSleepSpyRuleSystem.cs`:
- Around line 71-75: Добавьте зависимость MobStateSystem в
ChaosSleepSpyRuleSystem и в цикле перебора ChaosSpyMobComponent проверяйте
_mobState.IsAlive(uid) до сравнения количества целей; пропускайте кандидата,
если он мёртв, сохраняя остальную логику выбора цели без изменений.

In
`@Content.Server/_Scp/Objectives/Systems/ScpActivateSleepSpyConditionSystem.cs`:
- Line 48: After selecting the target in the objective activation system, also
set the chosen agent’s ChaosSleepSpyMobComponent.IsAssigned flag to true so it
cannot be selected again. When the objective target is cancelled or otherwise
becomes available, reset IsAssigned to false.
- Around line 69-70: In the EntitySystem containing the shown metadata updates,
add an injected [Dependency] readonly ILocalizationManager field named _loc,
then replace both Loc.GetString calls in the entity name and description setup
with _loc.GetString. Keep the localization keys and arguments unchanged.

In `@Content.Shared/_Scp/Chaos/ChaosSleepSpyMobComponent.cs`:
- Around line 21-22: Добавьте краткую XML-документацию на английском языке перед
публичным полем IsAssigned в
Content.Shared/_Scp/Chaos/ChaosSleepSpyMobComponent.cs (строки 21-22) и перед
публичным полем Target в
Content.Server/_Scp/Objectives/Components/ScpActivateSleepSpyConditionComponent.cs
(строки 8-9), не изменяя их поведение.
- Around line 21-22: Добавьте перед атрибутом ViewVariables краткую
XML-документацию для публичного поля IsAssigned, описывающую его назначение, не
изменяя существующую логику.

In `@Resources/Locale/en-US/_strings/_scp/administration/antag.ftl`:
- Line 9: Update the antag result text at
Resources/Locale/en-US/_strings/_scp/administration/antag.ftl:9-9 and
Resources/Locale/ru-RU/_strings/_scp/administration/antag.ftl:9-9 to state that
the activation objective is assigned to the active spy with the fewest targets,
replacing the random-selection wording while preserving the rest of each
translation.

In
`@Resources/Locale/ru-RU/_strings/_scp/objectives/conditions/activate-sleep-spy.ftl`:
- Line 1: В строке objective-condition-chaos-spy-activate-sleep-spy-title
замените латинскую букву «c» в слове «cпящего» на кириллическую «с», сохранив
остальной текст без изменений.

In `@Resources/Prototypes/_Scp/Objectives/chaosSpy.yml`:
- Line 153: Update only the fallback description value in the objective
prototype so it begins with an uppercase letter, preserving the existing name
and all other fields unchanged.
🪄 Autofix

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 Plus

Run ID: c725fb7a-4ad8-4746-b6a1-748f751d880e

📥 Commits

Reviewing files that changed from the base of the PR and between ae326eb and 38c0bdd.

📒 Files selected for processing (14)
  • Content.Server/Administration/Systems/AdminVerbSystem.Antags.cs
  • Content.Server/_Scp/GameTicking/Rules/ChaosSleepSpyRuleSystem.cs
  • Content.Server/_Scp/GameTicking/Rules/ChaosSpyRuleSystem.cs
  • Content.Server/_Scp/Objectives/Components/ScpActivateSleepSpyConditionComponent.cs
  • Content.Server/_Scp/Objectives/Systems/ScpActivateSleepSpyConditionSystem.cs
  • Content.Shared/_Scp/Chaos/ChaosSleepSpyMobComponent.cs
  • Content.Shared/_Scp/Chaos/ChaosSpyMobComponent.cs
  • Resources/Locale/en-US/_strings/_scp/administration/antag.ftl
  • Resources/Locale/en-US/_strings/_scp/objectives/conditions/activate-sleep-spy.ftl
  • Resources/Locale/ru-RU/_strings/_scp/administration/antag.ftl
  • Resources/Locale/ru-RU/_strings/_scp/objectives/conditions/activate-sleep-spy.ftl
  • Resources/Prototypes/_Scp/GameRules/roundstart.yml
  • Resources/Prototypes/_Scp/Objectives/chaosSpy.yml
  • Resources/Prototypes/_Scp/Objectives/objectiveGroups.yml

Comment thread Content.Server/_Scp/GameTicking/Rules/ChaosSleepSpyRuleSystem.cs
Comment thread Content.Server/_Scp/Objectives/Systems/ScpActivateSleepSpyConditionSystem.cs Outdated
Comment thread Content.Shared/_Scp/Chaos/ChaosSleepSpyMobComponent.cs
Comment thread Resources/Locale/en-US/_strings/_scp/administration/antag.ftl
Comment thread Resources/Prototypes/_Scp/Objectives/chaosSpy.yml Outdated
@EngineerLND

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

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.

@EngineerLND

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Review rate limited.


Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 54 minutes.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 (2)
Content.Server/_Scp/Objectives/Systems/ScpActivateSleepSpyConditionSystem.cs (2)

80-88: 🩺 Stability & Availability | 🔵 Trivial | 💤 Low value

Используйте Comp<CodeConditionComponent> для обязательного компонента.

ChaosSpyActivateSleepSpyObjective наследует BaseCodeObjective, где объявлен компонент CodeCondition, поэтому TryComp здесь не должен давать null и потом использоваться в _condition.SetCompleted.

Предлагаемое исправление
-        if (TryComp<CodeConditionComponent>(ent, out var code) && code.Completed)
+        var code = Comp<CodeConditionComponent>(ent);
+        if (code.Completed)
🤖 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/_Scp/Objectives/Systems/ScpActivateSleepSpyConditionSystem.cs`
around lines 80 - 88, В системе проверки условия замените
TryComp<CodeConditionComponent> на обязательное получение через
Comp<CodeConditionComponent> перед использованием _condition.SetCompleted.
Сохраните проверку code.Completed и ранний выход с Progress = 1f, используя
гарантированно существующий компонент CodeConditionComponent.

Source: Learnings


27-29: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Зафиксируйте порядок обработки прогресса цели.

OnGetProgress проверяет CodeConditionComponent и может установить Completed = true через CodeConditionSystem. Событие CodeConditionSystem тоже пишет в args.Progress, поэтому без фиксированного порядка итоговое значение прогресса зависит от порядка подписок.

Предлагаемое исправление
-        SubscribeLocalEvent<ScpActivateSleepSpyConditionComponent, ObjectiveGetProgressEvent>(OnGetProgress);
+        SubscribeLocalEvent<ScpActivateSleepSpyConditionComponent, ObjectiveGetProgressEvent>(
+            OnGetProgress, after: [typeof(CodeConditionSystem)]);
🤖 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/_Scp/Objectives/Systems/ScpActivateSleepSpyConditionSystem.cs`
around lines 27 - 29, Зафиксируйте порядок обработки ObjectiveGetProgressEvent
для OnGetProgress относительно обработчика CodeConditionSystem: настройте
подписку так, чтобы проверка ScpActivateSleepSpyConditionComponent выполнялась
после записи прогресса CodeConditionSystem. Сохраните текущую логику
OnGetProgress, чтобы итоговые Completed и Progress не зависели от порядка
регистрации подписчиков.

Source: Coding guidelines

♻️ Duplicate comments (1)
Content.Server/_Scp/Objectives/Systems/ScpActivateSleepSpyConditionSystem.cs (1)

48-53: ⚠️ Potential issue | 🟠 Major

Сбрасывайте IsAssigned при отмене или удалении цели.

OnAssigned устанавливает IsAssigned = true, но обратного пути в этом коде нет. Если цель отменена или удалена до TryUnsleepSpy, спящий шпион останется недоступным для следующих назначений.

Добавьте очистку в lifecycle цели для текущего Target. После успешного пробуждения сбрасывать флаг отдельно не требуется, потому что ChaosSleepSpyMobComponent удаляется.

#!/usr/bin/env bash
set -euo pipefail

rg -n -C 8 'IsAssigned|ScpActivateSleepSpyCondition|Objective.*(Cancel|Delete|Remove)' \
  Content.Server Content.Shared
🤖 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/_Scp/Objectives/Systems/ScpActivateSleepSpyConditionSystem.cs`
around lines 48 - 53, Добавьте обработку отмены или удаления текущей цели в
lifecycle системы ScpActivateSleepSpyConditionSystem: перед очисткой Target
проверьте его наличие и сбросьте ChaosSleepSpyMobComponent.IsAssigned в false.
Сохраните существующий сброс компонента после успешного пробуждения и не
добавляйте отдельную очистку для уже удалённого ChaosSleepSpyMobComponent.
🤖 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.Server/_Scp/Objectives/Components/ScpActivateSleepSpyConditionComponent.cs`:
- Around line 8-10: Update the XML summary for the Target field in
ScpActivateSleepSpyConditionComponent to use grammatically correct wording and
clearly state that it identifies the entity the active spy will activate.

In `@Resources/Prototypes/_Scp/Objectives/chaosSpy.yml`:
- Around line 152-153: Remove the unnecessary quotation marks around sleeper in
the prototype’s name and description fallback text, and update any corresponding
FTL strings using the same wording to match the unquoted text.

---

Outside diff comments:
In
`@Content.Server/_Scp/Objectives/Systems/ScpActivateSleepSpyConditionSystem.cs`:
- Around line 80-88: В системе проверки условия замените
TryComp<CodeConditionComponent> на обязательное получение через
Comp<CodeConditionComponent> перед использованием _condition.SetCompleted.
Сохраните проверку code.Completed и ранний выход с Progress = 1f, используя
гарантированно существующий компонент CodeConditionComponent.
- Around line 27-29: Зафиксируйте порядок обработки ObjectiveGetProgressEvent
для OnGetProgress относительно обработчика CodeConditionSystem: настройте
подписку так, чтобы проверка ScpActivateSleepSpyConditionComponent выполнялась
после записи прогресса CodeConditionSystem. Сохраните текущую логику
OnGetProgress, чтобы итоговые Completed и Progress не зависели от порядка
регистрации подписчиков.

---

Duplicate comments:
In
`@Content.Server/_Scp/Objectives/Systems/ScpActivateSleepSpyConditionSystem.cs`:
- Around line 48-53: Добавьте обработку отмены или удаления текущей цели в
lifecycle системы ScpActivateSleepSpyConditionSystem: перед очисткой Target
проверьте его наличие и сбросьте ChaosSleepSpyMobComponent.IsAssigned в false.
Сохраните существующий сброс компонента после успешного пробуждения и не
добавляйте отдельную очистку для уже удалённого ChaosSleepSpyMobComponent.
🪄 Autofix

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 Plus

Run ID: 05346f5f-00b6-4ab0-a2e6-95042085188f

📥 Commits

Reviewing files that changed from the base of the PR and between 38c0bdd and eb1c35e.

📒 Files selected for processing (5)
  • Content.Server/_Scp/GameTicking/Rules/ChaosSleepSpyRuleSystem.cs
  • Content.Server/_Scp/Objectives/Components/ScpActivateSleepSpyConditionComponent.cs
  • Content.Server/_Scp/Objectives/Systems/ScpActivateSleepSpyConditionSystem.cs
  • Content.Shared/_Scp/Chaos/ChaosSleepSpyMobComponent.cs
  • Resources/Prototypes/_Scp/Objectives/chaosSpy.yml

Comment thread Resources/Prototypes/_Scp/Objectives/chaosSpy.yml
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.

1 participant