-
-
Notifications
You must be signed in to change notification settings - Fork 86
Добавления для спящего агента и обычного. #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
Open
EngineerLND
wants to merge
8
commits into
makura-games:master
Choose a base branch
from
EngineerLND:scp-sleep-spy-new-changes
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
8 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 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
Some comments aren't visible on the classic Files Changed page.
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>Target that active spy going to activate.</summary> | ||
| [ViewVariables] | ||
| public EntityUid? Target; | ||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
| } | ||
95 changes: 95 additions & 0 deletions
95
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,95 @@ | ||
| 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 ILocalizationManager _loc = default!; | ||
|
EngineerLND marked this conversation as resolved.
Outdated
|
||
| [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); | ||
| } | ||
|
|
||
| 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.
|
||
| Comp<ChaosSleepSpyMobComponent>(ent.Comp.Target.Value).IsAssigned = true; | ||
|
EngineerLND marked this conversation as resolved.
Outdated
|
||
| } | ||
| else | ||
| args.Cancelled = true; | ||
|
|
||
| } | ||
|
|
||
| private void OnAfterAssign(Entity<ScpActivateSleepSpyConditionComponent> ent, ref ObjectiveAfterAssignEvent args) | ||
| { | ||
|
|
||
| if (ent.Comp.Target is not { } target || Deleted(target)) | ||
| return; | ||
|
|
||
| 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); | ||
| } | ||
|
|
||
| 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; |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
У тебя уже проходит эта проверка на строке 74
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Подумай