diff --git a/Content.Server/StationEvents/Components/SolarFlareRuleComponent.cs b/Content.Server/StationEvents/Components/SolarFlareRuleComponent.cs index 92a3b43375..0ea1127817 100644 --- a/Content.Server/StationEvents/Components/SolarFlareRuleComponent.cs +++ b/Content.Server/StationEvents/Components/SolarFlareRuleComponent.cs @@ -1,5 +1,6 @@ using Content.Server.StationEvents.Events; using Content.Shared.Radio; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set; namespace Content.Server.StationEvents.Components; @@ -22,6 +23,24 @@ public sealed class SolarFlareRuleComponent : Component [DataField("affectedChannels", customTypeSerializer: typeof(PrototypeIdHashSetSerializer))] public readonly HashSet AffectedChannels = new(); + /// + /// List of extra channels that can be random disabled on top of the starting channels. + /// + /// + /// Channels are not removed from this, so its possible to roll the same channel multiple times. + /// + [DataField("extraChannels", customTypeSerializer: typeof(PrototypeIdListSerializer))] + public readonly List ExtraChannels = new(); + + /// + /// Number of times to roll a channel from ExtraChannels. + /// + /// + /// Channels are not removed from it, so its possible to roll the same channel multiple times. + /// + [DataField("extraCount")] + public uint ExtraCount; + /// /// Chance light bulb breaks per second during event /// diff --git a/Content.Server/StationEvents/Events/SolarFlareRule.cs b/Content.Server/StationEvents/Events/SolarFlareRule.cs index 206a8ca685..a4ec74b43b 100644 --- a/Content.Server/StationEvents/Events/SolarFlareRule.cs +++ b/Content.Server/StationEvents/Events/SolarFlareRule.cs @@ -20,7 +20,18 @@ public sealed class SolarFlareRule : StationEventSystem public override void Initialize() { base.Initialize(); - SubscribeLocalEvent(OnRadioSendAttempt); + SubscribeLocalEvent(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 } } - private void OnRadioSendAttempt(ref RadioReceiveAttemptEvent args) + private void OnRadioReceiveAttempt(ref RadioReceiveAttemptEvent args) { var query = EntityQueryEnumerator(); while (query.MoveNext(out var uid, out var flare, out var gameRule)) diff --git a/Resources/Prototypes/GameRules/events.yml b/Resources/Prototypes/GameRules/events.yml index df66266fc6..0fecc1e72f 100644 --- a/Resources/Prototypes/GameRules/events.yml +++ b/Resources/Prototypes/GameRules/events.yml @@ -194,8 +194,8 @@ - type: RandomSentienceRule - type: entity - id: SolarFlare parent: BaseGameRule + id: SolarFlare noSpawn: true components: - type: StationEvent @@ -210,7 +210,15 @@ onlyJamHeadsets: true affectedChannels: - Common + extraChannels: + - Command + - Engineering + - Medical + - Science + - Security - Service + - Supply + extraCount: 2 lightBreakChancePerSecond: 0.0003 doorToggleChancePerSecond: 0.001