-
-
Notifications
You must be signed in to change notification settings - Fork 87
Добавления для спящего агента и обычного. #1123
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
Merged
WardexOfficial
merged 11 commits into
makura-games:master
from
EngineerLND:scp-sleep-spy-new-changes
Aug 25, 2026
Merged
Changes from 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
38c0bdd
Спящий агент - активация!
EngineerLND eb1c35e
фиксы по приказу командира зайчика
EngineerLND ef37fde
фикс от зайчика
EngineerLND 6e0e8d1
фикс от зайчика номер 2
EngineerLND 66274a4
Добавил задание для ШПХ в локализацию
EngineerLND 311a80c
фиксы
EngineerLND 7eb2939
Update Resources/Locale/ru-RU/_prototypes/_scp/objectives/chaos.ftl
EngineerLND b582ddc
Merge branch 'master' into scp-sleep-spy-new-changes
WardexOfficial cf8ad8f
фиксы по приказу генерала
EngineerLND 7328ea1
Merge remote-tracking branch 'origin/scp-sleep-spy-new-changes' into …
EngineerLND 8f5e40f
фиксы
EngineerLND File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
Content.Server/_Scp/Objectives/Components/ScpActivateSleepSpyConditionComponent.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| using Content.Server._Scp.Objectives.Systems; | ||
|
|
||
| namespace Content.Server._Scp.Objectives.Components; | ||
|
|
||
| [RegisterComponent, Access(typeof(ScpActivateSleepSpyConditionSystem))] | ||
| public sealed partial class ScpActivateSleepSpyConditionComponent : Component | ||
| { | ||
| /// <summary>The sleep spy target that an active Chaos Spy must activate.</summary> | ||
| [ViewVariables] | ||
| public EntityUid? Target; | ||
| } |
96 changes: 96 additions & 0 deletions
96
Content.Server/_Scp/Objectives/Systems/ScpActivateSleepSpyConditionSystem.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| using Content.Server._Scp.Objectives.Components; | ||
| using Content.Server.Mind; | ||
| using Content.Server.Objectives.Components; | ||
| using Content.Server.Objectives.Systems; | ||
| using Content.Shared._Scp.Chaos; | ||
| using Content.Shared.Mobs.Systems; | ||
| using Content.Shared.Objectives.Components; | ||
| using Content.Shared.Roles.Jobs; | ||
| using Robust.Shared.Random; | ||
|
|
||
| namespace Content.Server._Scp.Objectives.Systems; | ||
|
|
||
| public sealed class ScpActivateSleepSpyConditionSystem : EntitySystem | ||
| { | ||
| [Dependency] private readonly CodeConditionSystem _condition = default!; | ||
| [Dependency] private readonly MindSystem _mind = default!; | ||
| [Dependency] private readonly MobStateSystem _mobState = default!; | ||
| [Dependency] private readonly SharedJobSystem _job = default!; | ||
| [Dependency] private readonly MetaDataSystem _metaData = default!; | ||
| [Dependency] private readonly IRobustRandom _random = default!; | ||
|
|
||
| public override void Initialize() | ||
| { | ||
| base.Initialize(); | ||
|
|
||
| SubscribeLocalEvent<ScpActivateSleepSpyConditionComponent, ObjectiveAssignedEvent>(OnAssigned); | ||
| SubscribeLocalEvent<ScpActivateSleepSpyConditionComponent, ObjectiveAfterAssignEvent>(OnAfterAssign); | ||
| SubscribeLocalEvent<ScpActivateSleepSpyConditionComponent, ObjectiveGetProgressEvent>(OnGetProgress, after: [typeof(CodeConditionSystem)]); | ||
| } | ||
|
|
||
| private void OnAssigned(Entity<ScpActivateSleepSpyConditionComponent> ent, ref ObjectiveAssignedEvent args) | ||
| { | ||
| var candidates = new HashSet<EntityUid>(); | ||
|
|
||
| var query = EntityQueryEnumerator<ChaosSleepSpyMobComponent>(); | ||
| while (query.MoveNext(out var uid, out var comp)) | ||
| { | ||
| if (comp.IsAssigned) | ||
| continue; | ||
|
|
||
| if (!_mobState.IsAlive(uid)) | ||
| continue; | ||
|
|
||
| candidates.Add(uid); | ||
| } | ||
|
|
||
|
|
||
| if (candidates.Count >= 1) | ||
| { | ||
| ent.Comp.Target = _random.Pick(candidates); | ||
|
EngineerLND marked this conversation as resolved.
|
||
| TryComp<ChaosSleepSpyMobComponent>(ent.Comp.Target.Value, out var sleepSpyComp); | ||
| if(sleepSpyComp != null) | ||
| sleepSpyComp.IsAssigned = true; | ||
| } | ||
| else | ||
| args.Cancelled = true; | ||
|
|
||
| } | ||
|
|
||
| private void OnAfterAssign(Entity<ScpActivateSleepSpyConditionComponent> ent, ref ObjectiveAfterAssignEvent args) | ||
| { | ||
|
|
||
| if (ent.Comp.Target is not { } target || Deleted(target)) | ||
| return; | ||
|
WardexOfficial marked this conversation as resolved.
Outdated
|
||
|
|
||
| if (!_mind.TryGetMind(target, out var mindId, out _)) | ||
| return; | ||
|
|
||
| if (!_job.MindTryGetJob(mindId, out var jobPrototype)) | ||
| return; | ||
|
|
||
| if (!_job.TryGetDepartment(jobPrototype.ID, out var departmentPrototype)) | ||
| return; | ||
|
|
||
| _metaData.SetEntityName(ent, Loc.GetString("objective-condition-chaos-spy-activate-sleep-spy-title"), args.Meta); | ||
| _metaData.SetEntityDescription(ent, Loc.GetString("objective-condition-chaos-spy-activate-sleep-spy-description", ("department", Loc.GetString(departmentPrototype.Name))), args.Meta); | ||
|
EngineerLND marked this conversation as resolved.
|
||
| } | ||
|
|
||
| private void OnGetProgress(Entity<ScpActivateSleepSpyConditionComponent> ent, ref ObjectiveGetProgressEvent args) | ||
| { | ||
| if (TryComp<CodeConditionComponent>(ent, out var code) && code.Completed) | ||
| { | ||
| args.Progress = 1f; | ||
| return; | ||
| } | ||
|
|
||
| if (HasComp<ChaosSpyMobComponent>(ent.Comp.Target)) | ||
| { | ||
| _condition.SetCompleted((ent.Owner, code), true); | ||
| args.Progress = 1f; | ||
| return; | ||
| } | ||
|
|
||
| args.Progress = 0f; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| using Robust.Shared.GameStates; | ||
|
|
||
| namespace Content.Shared._Scp.Chaos; | ||
|
|
||
| [RegisterComponent, NetworkedComponent] | ||
| public sealed partial class ChaosSpyMobComponent : Component; | ||
|
EngineerLND marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,9 @@ | ||
| admin-verb-make-chaos-raider = Make the target into a Chaos Raider | ||
| admin-verb-make-chaos-spy = Make the target into a Chaos Spy | ||
|
|
||
| admin-verb-make-chaos-sleep-spy = Make the target into a Chaos Sleep Spy | ||
| admin-verb-text-make-chaos-raider = Make Chaos Raider | ||
|
|
||
| admin-verb-text-make-chaos-spy = Make Chaos Spy | ||
| admin-verb-text-make-chaos-sleep-spy = Make Chaos Sleep Spy | ||
| admin-verb-text-make-chaos-sleep-spy = Make Chaos Sleep Spy | ||
| admin-verb-result-make-chaos-sleep-spy = Player "{$targetName}" is now a sleeper agent of the Chaos Insurgency. An objective to activate them will be given to a random active spy. | ||
|
EngineerLND marked this conversation as resolved.
|
||
2 changes: 2 additions & 0 deletions
2
Resources/Locale/en-US/_strings/_scp/objectives/conditions/activate-sleep-spy.ftl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| objective-condition-chaos-spy-activate-sleep-spy-title = Activate the sleeper agent. | ||
| objective-condition-chaos-spy-activate-sleep-spy-description = Find and activate the sleeper agent in the "{$department}" department. Do this as discreetly as possible. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
Resources/Locale/ru-RU/_strings/_scp/objectives/conditions/activate-sleep-spy.ftl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| objective-condition-chaos-spy-activate-sleep-spy-title = Активируйте cпящего агента. | ||
|
EngineerLND marked this conversation as resolved.
|
||
| objective-condition-chaos-spy-activate-sleep-spy-description = Найдите и активируйте спящего агента из отдела "{$department}". Сделайте это как можно незаметнее. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.