Skip to content

Commit

Permalink
ReinforcementV2
Browse files Browse the repository at this point in the history
  • Loading branch information
Rxup committed Feb 28, 2024
1 parent 5377414 commit 5b44432
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Content.Shared.Backmen.Reinforcement.Components;

namespace Content.Server.Backmen.Reinforcement.Components;

[RegisterComponent]
public sealed partial class ReinforcementMindComponent : Component
{
[ViewVariables(VVAccess.ReadOnly)]
public Entity<ReinforcementConsoleComponent> Linked;
}
14 changes: 14 additions & 0 deletions Content.Server/Backmen/Reinforcement/ReinforcementSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Content.Server.Mind;
using Content.Server.Players.PlayTimeTracking;
using Content.Server.Popups;
using Content.Server.Roles;
using Content.Server.Station.Systems;
using Content.Shared.Access.Systems;
using Content.Shared.Backmen.Cryostorage;
Expand Down Expand Up @@ -77,6 +78,7 @@ public override void Initialize()
SubscribeLocalEvent<ReinforcementSpawnPlayer>(OnSpawnPlayer);
SubscribeLocalEvent<ReinforcementConsoleComponent,ActivatableUIOpenAttemptEvent>(OnTryOpenUi);
SubscribeLocalEvent<ReinforcementMemberComponent, MovedToStorageEvent>(OnMoveToSSD);
SubscribeLocalEvent<ReinforcementMindComponent, GetBriefingEvent>(OnGetBrief);

Subs.BuiEvents<ReinforcementConsoleComponent>(ReinforcementConsoleKey.Key, subs =>
{
Expand All @@ -87,6 +89,17 @@ public override void Initialize()
});
}

private void OnGetBrief(Entity<ReinforcementMindComponent> ent, ref GetBriefingEvent args)
{
args.Append("Вы вызваны как подкрепление, брифинг: ");
if (TerminatingOrDeleted(ent.Comp.Linked))
{
args.Append("- нет связи с сервером -");
return;
}
args.Append(ent.Comp.Linked.Comp.Brief);
}

private void OnMoveToSSD(Entity<ReinforcementMemberComponent> ent, ref MovedToStorageEvent args)
{
if (TerminatingOrDeleted(ent.Comp.Linked))
Expand Down Expand Up @@ -145,6 +158,7 @@ private void OnSpawnPlayer(ReinforcementSpawnPlayer args)
var jobPrototype = _prototype.Index<JobPrototype>(args.Proto.Job);
var job = new JobComponent { Prototype = args.Proto.Job };
_roles.MindAddRole(newMind, job, silent: false);
EnsureComp<ReinforcementMindComponent>(newMind).Linked = ent.Comp.Linked;
var jobName = _jobs.MindTryGetJobName(newMind);

_playTimeTrackings.PlayerRolesChanged(args.Player);
Expand Down

0 comments on commit 5b44432

Please sign in to comment.