* 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
41 lines
1.7 KiB
C#
41 lines
1.7 KiB
C#
using Content.Server.GameTicking.Components;
|
|
using Content.Server.GameTicking.Rules.Components;
|
|
using Content.Server.StationEvents.Components;
|
|
using Content.Server.Traits.Assorted;
|
|
using Content.Shared.Mind.Components;
|
|
using Content.Shared.Traits.Assorted;
|
|
|
|
namespace Content.Server.StationEvents.Events;
|
|
|
|
public sealed class MassHallucinationsRule : StationEventSystem<MassHallucinationsRuleComponent>
|
|
{
|
|
[Dependency] private readonly ParacusiaSystem _paracusia = default!;
|
|
|
|
protected override void Started(EntityUid uid, MassHallucinationsRuleComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args)
|
|
{
|
|
base.Started(uid, component, gameRule, args);
|
|
var query = EntityQueryEnumerator<MindContainerComponent>();
|
|
while (query.MoveNext(out var ent, out _))
|
|
{
|
|
if (!HasComp<ParacusiaComponent>(ent))
|
|
{
|
|
EnsureComp<MassHallucinationsComponent>(ent);
|
|
var paracusia = EnsureComp<ParacusiaComponent>(ent);
|
|
_paracusia.SetSounds(ent, component.Sounds, paracusia);
|
|
_paracusia.SetTime(ent, component.MinTimeBetweenIncidents, component.MaxTimeBetweenIncidents, paracusia);
|
|
_paracusia.SetDistance(ent, component.MaxSoundDistance);
|
|
}
|
|
}
|
|
}
|
|
|
|
protected override void Ended(EntityUid uid, MassHallucinationsRuleComponent component, GameRuleComponent gameRule, GameRuleEndedEvent args)
|
|
{
|
|
base.Ended(uid, component, gameRule, args);
|
|
var query = EntityQueryEnumerator<MassHallucinationsComponent>();
|
|
while (query.MoveNext(out var ent, out _))
|
|
{
|
|
RemComp<ParacusiaComponent>(ent);
|
|
}
|
|
}
|
|
}
|