using Content.Server.Bible.Components; using Content.Server.Polymorph.Systems; using Content.Server.Popups; using Content.Shared._DV.CosmicCult; using Content.Shared._DV.CosmicCult.Components; using Content.Shared._DV.CosmicCult.Components.Examine; using Content.Shared.Humanoid; using Content.Shared.IdentityManagement; using Content.Shared.Polymorph; using Robust.Shared.Prototypes; namespace Content.Server._DV.CosmicCult.Abilities; public sealed class CosmicLapseSystem : EntitySystem { [Dependency] private readonly CosmicCultSystem _cult = default!; [Dependency] private readonly IPrototypeManager _prototype = default!; [Dependency] private readonly PolymorphSystem _polymorph = default!; [Dependency] private readonly PopupSystem _popup = default!; private static readonly ProtoId HumanLapse = "CosmicLapseMobHuman"; public override void Initialize() { base.Initialize(); SubscribeLocalEvent(OnCosmicLapse); } private void OnCosmicLapse(Entity uid, ref EventCosmicLapse action) { if (action.Handled || HasComp(action.Target) || HasComp(action.Target) || HasComp(action.Target)) { _popup.PopupEntity(Loc.GetString("cosmicability-generic-fail"), uid, uid); return; } action.Handled = true; var tgtpos = Transform(action.Target).Coordinates; Spawn(uid.Comp.LapseVFX, tgtpos); _popup.PopupEntity(Loc.GetString("cosmicability-lapse-success", ("target", Identity.Entity(action.Target, EntityManager))), uid, uid); var species = Comp(action.Target).Species; var polymorphId = "CosmicLapseMob" + species; if (_prototype.HasIndex(polymorphId)) _polymorph.PolymorphEntity(action.Target, polymorphId); else _polymorph.PolymorphEntity(action.Target, HumanLapse); _cult.MalignEcho(uid); } }