Remove do-after on null fragmentation (#4102)
* Change stuff * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix * How did that even get here --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
618c768e27
commit
90974a99b2
|
|
@ -1,10 +1,9 @@
|
|||
using Content.Server._DV.Objectives.Events;
|
||||
using Content.Server.Antag;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Server.Radio.Components;
|
||||
using Content.Shared._DV.CosmicCult;
|
||||
using Content.Shared._DV.CosmicCult.Components;
|
||||
using Content.Shared.DoAfter;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using Content.Shared.NPC;
|
||||
|
|
@ -21,9 +20,8 @@ public sealed class CosmicFragmentationSystem : EntitySystem
|
|||
[Dependency] private readonly AntagSelectionSystem _antag = default!;
|
||||
[Dependency] private readonly CosmicCultSystem _cult = default!;
|
||||
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
||||
[Dependency] private readonly PopupSystem _popup = default!;
|
||||
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
||||
[Dependency] private readonly SharedContainerSystem _container = default!;
|
||||
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
|
||||
[Dependency] private readonly SharedMindSystem _mind = default!;
|
||||
|
||||
private ProtoId<RadioChannelPrototype> _cultRadio = "CosmicRadio";
|
||||
|
|
@ -38,7 +36,6 @@ public sealed class CosmicFragmentationSystem : EntitySystem
|
|||
SubscribeLocalEvent<SiliconLawUpdaterComponent, MalignFragmentationEvent>(OnFragmentAi);
|
||||
|
||||
SubscribeLocalEvent<CosmicCultComponent, EventCosmicFragmentation>(OnCosmicFragmentation);
|
||||
SubscribeLocalEvent<CosmicCultComponent, EventCosmicFragmentationDoAfter>(OnCosmicFragmentationDoAfter);
|
||||
}
|
||||
|
||||
private void UnEmpower(Entity<CosmicCultComponent> ent)
|
||||
|
|
@ -61,43 +58,27 @@ public sealed class CosmicFragmentationSystem : EntitySystem
|
|||
_popup.PopupEntity(Loc.GetString("cosmicability-generic-fail"), ent, ent);
|
||||
return;
|
||||
}
|
||||
|
||||
var doargs = new DoAfterArgs(EntityManager, ent, ent.Comp.CosmicSiphonDelay, new EventCosmicFragmentationDoAfter(), ent, args.Target)
|
||||
{
|
||||
DistanceThreshold = 2f,
|
||||
Hidden = false,
|
||||
BreakOnHandChange = true,
|
||||
BreakOnDamage = true,
|
||||
BreakOnMove = true,
|
||||
BreakOnDropItem = true,
|
||||
};
|
||||
var evt = new MalignFragmentationEvent(ent, args.Target);
|
||||
RaiseLocalEvent(args.Target, ref evt);
|
||||
if (evt.Cancelled) return;
|
||||
args.Handled = true;
|
||||
_doAfter.TryStartDoAfter(doargs);
|
||||
_popup.PopupEntity(Loc.GetString("cosmicability-fragmentation-success", ("user", ent), ("target", args.Target)), ent, PopupType.MediumCaution);
|
||||
_cult.MalignEcho(ent);
|
||||
UnEmpower(ent);
|
||||
}
|
||||
|
||||
private void OnCosmicFragmentationDoAfter(Entity<CosmicCultComponent> ent, ref EventCosmicFragmentationDoAfter args)
|
||||
{
|
||||
if (args.Args.Target is not { } target)
|
||||
return;
|
||||
if (args.Cancelled || args.Handled)
|
||||
return;
|
||||
args.Handled = true;
|
||||
|
||||
var evt = new MalignFragmentationEvent(ent, target);
|
||||
RaiseLocalEvent(target, ref evt);
|
||||
}
|
||||
|
||||
private void OnFragmentBorg(Entity<BorgChassisComponent> ent, ref MalignFragmentationEvent args)
|
||||
{
|
||||
if (!_mind.TryGetMind(ent, out var mindId, out var mind))
|
||||
if (!_mind.TryGetMind(args.Target, out var mindId, out var mind))
|
||||
{
|
||||
args.Cancelled = true;
|
||||
return;
|
||||
var wisp = Spawn("CosmicChantryWisp", Transform(ent).Coordinates);
|
||||
var chantry = Spawn("CosmicBorgChantry", Transform(ent).Coordinates);
|
||||
}
|
||||
var wisp = Spawn("CosmicChantryWisp", Transform(args.Target).Coordinates);
|
||||
var chantry = Spawn("CosmicBorgChantry", Transform(args.Target).Coordinates);
|
||||
EnsureComp<CosmicChantryComponent>(chantry, out var chantryComponent);
|
||||
chantryComponent.InternalVictim = wisp;
|
||||
chantryComponent.VictimBody = ent;
|
||||
chantryComponent.VictimBody = args.Target;
|
||||
_mind.TransferTo(mindId, wisp, mind: mind);
|
||||
|
||||
var mins = chantryComponent.EventTime.Minutes;
|
||||
|
|
@ -134,4 +115,4 @@ public sealed class CosmicFragmentationSystem : EntitySystem
|
|||
}
|
||||
|
||||
[ByRefEvent]
|
||||
public record struct MalignFragmentationEvent(Entity<CosmicCultComponent> User, EntityUid Target);
|
||||
public record struct MalignFragmentationEvent(Entity<CosmicCultComponent> User, EntityUid Target, bool Cancelled = false);
|
||||
|
|
|
|||
|
|
@ -20,3 +20,5 @@ cosmicability-monument-spawn-error-grid = Invalid location! The Monument must be
|
|||
cosmicability-monument-spawn-error-station = Invalid location! The Monument must be beckoned upon the station.
|
||||
cosmicability-monument-spawn-error-intersection = Too crowded! The Monument requires an empty 3x1 area to be beckoned.
|
||||
cosmicability-monument-spawn-error-space = Too close to space! The Monument must be be at least {$DISTANCE}m away.
|
||||
|
||||
cosmicability-fragmentation-success = {CAPITALIZE(THE($user))} pours cosmic energies into {CAPITALIZE(THE($target))}!
|
||||
|
|
|
|||
Loading…
Reference in New Issue