Files
tbd-station-14/Content.Server/StationEvents/Events/BluespaceLockerRule.cs
Nemanja 161fd6c83c Mega Antag Refactor (#25786)
* Mega Antag Refactor

* last minute delta save

* more workshopping

* more shit

* ok tested this for once

* okkkkk sure

* generic delays for starting rules

* well darn

* nukies partially

* ouagh

* ballin' faded and smonkin wed

* obliterated the diff

* Spread my arms and soak up congratulations

* I've got plenty of love, but nothing to show for it

* but there’s too much sunlight
Shining on my laptop monitor, so I
Can’t see anything with any amount of clarity

* ok this junk

* OOK!

* fubar

* most of sloth's review

* oh boy

* eek

* hell yea!

* ASDFJASDJFvsakcvjkzjnhhhyh
2024-04-25 11:31:45 +10:00

55 lines
2.1 KiB
C#

using Content.Server.GameTicking.Components;
using Content.Server.GameTicking.Rules.Components;
using Content.Server.Resist;
using Content.Server.Station.Components;
using Content.Server.StationEvents.Components;
using Content.Server.Storage.Components;
using Content.Server.Storage.EntitySystems;
using Content.Shared.Access.Components;
using Content.Shared.Coordinates;
namespace Content.Server.StationEvents.Events;
public sealed class BluespaceLockerRule : StationEventSystem<BluespaceLockerRuleComponent>
{
[Dependency] private readonly BluespaceLockerSystem _bluespaceLocker = default!;
protected override void Started(EntityUid uid, BluespaceLockerRuleComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args)
{
base.Started(uid, component, gameRule, args);
var targets = new List<EntityUid>();
var query = EntityQueryEnumerator<EntityStorageComponent, ResistLockerComponent>();
while (query.MoveNext(out var storageUid, out _, out _))
{
targets.Add(storageUid);
}
RobustRandom.Shuffle(targets);
foreach (var potentialLink in targets)
{
if (HasComp<AccessReaderComponent>(potentialLink) ||
HasComp<BluespaceLockerComponent>(potentialLink) ||
!HasComp<StationMemberComponent>(potentialLink.ToCoordinates().GetGridUid(EntityManager)))
continue;
var comp = AddComp<BluespaceLockerComponent>(potentialLink);
comp.PickLinksFromSameMap = true;
comp.MinBluespaceLinks = 1;
comp.BehaviorProperties.BluespaceEffectOnTeleportSource = true;
comp.AutoLinksBidirectional = true;
comp.AutoLinksUseProperties = true;
comp.AutoLinkProperties.BluespaceEffectOnInit = true;
comp.AutoLinkProperties.BluespaceEffectOnTeleportSource = true;
_bluespaceLocker.GetTarget(potentialLink, comp, true);
_bluespaceLocker.BluespaceEffect(potentialLink, comp, comp, true);
Sawmill.Info($"Converted {ToPrettyString(potentialLink)} to bluespace locker");
return;
}
}
}