Revolutionaries (#18477)

Co-authored-by: coolmankid12345 <coolmankid12345@users.noreply.github.com>
Co-authored-by: EmoGarbage404 <retron404@gmail.com>
This commit is contained in:
coolmankid12345
2023-10-04 21:47:33 -04:00
committed by GitHub
parent 2c69dd2df9
commit 9df5ded9ad
51 changed files with 1246 additions and 38 deletions

View File

@@ -0,0 +1,38 @@
using Content.Shared.Revolutionary.Components;
using Content.Shared.IdentityManagement;
using Content.Shared.Mindshield.Components;
using Content.Shared.Popups;
using Content.Shared.Stunnable;
namespace Content.Shared.Revolutionary;
public sealed class SharedRevolutionarySystem : EntitySystem
{
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
[Dependency] private readonly SharedStunSystem _sharedStun = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<MindShieldComponent, ComponentInit>(MindShieldImplanted);
}
/// <summary>
/// When the mindshield is implanted in the rev it will popup saying they were deconverted. In Head Revs it will remove the mindshield component.
/// </summary>
private void MindShieldImplanted(EntityUid uid, MindShieldComponent comp, ComponentInit init)
{
if (HasComp<RevolutionaryComponent>(uid) && !HasComp<HeadRevolutionaryComponent>(uid))
{
var stunTime = TimeSpan.FromSeconds(4);
var name = Identity.Entity(uid, EntityManager);
RemComp<RevolutionaryComponent>(uid);
_sharedStun.TryParalyze(uid, stunTime, true);
_popupSystem.PopupEntity(Loc.GetString("rev-break-control", ("name", name)), uid);
}
else if (HasComp<HeadRevolutionaryComponent>(uid))
{
RemCompDeferred<MindShieldComponent>(uid);
}
}
}