better solar flare (#19189)

Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
deltanedas
2023-08-20 00:39:35 +01:00
committed by GitHub
parent 4c4397544f
commit e65212ab90
3 changed files with 41 additions and 3 deletions

View File

@@ -20,7 +20,18 @@ public sealed class SolarFlareRule : StationEventSystem<SolarFlareRuleComponent>
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<RadioReceiveAttemptEvent>(OnRadioSendAttempt);
SubscribeLocalEvent<RadioReceiveAttemptEvent>(OnRadioReceiveAttempt);
}
protected override void Started(EntityUid uid, SolarFlareRuleComponent comp, GameRuleComponent gameRule, GameRuleStartedEvent args)
{
base.Started(uid, comp, gameRule, args);
for (var i = 0; i < comp.ExtraCount; i++)
{
var channel = RobustRandom.Pick(comp.ExtraChannels);
comp.AffectedChannels.Add(channel);
}
}
protected override void ActiveTick(EntityUid uid, SolarFlareRuleComponent component, GameRuleComponent gameRule, float frameTime)
@@ -46,7 +57,7 @@ public sealed class SolarFlareRule : StationEventSystem<SolarFlareRuleComponent>
}
}
private void OnRadioSendAttempt(ref RadioReceiveAttemptEvent args)
private void OnRadioReceiveAttempt(ref RadioReceiveAttemptEvent args)
{
var query = EntityQueryEnumerator<SolarFlareRuleComponent, GameRuleComponent>();
while (query.MoveNext(out var uid, out var flare, out var gameRule))