diff --git a/Content.Server/DeltaV/StationEvents/Components/GlimmerMobRuleComponent.cs b/Content.Server/DeltaV/StationEvents/Components/GlimmerMobRuleComponent.cs index 31f1b358271..959c4fe7716 100644 --- a/Content.Server/DeltaV/StationEvents/Components/GlimmerMobRuleComponent.cs +++ b/Content.Server/DeltaV/StationEvents/Components/GlimmerMobRuleComponent.cs @@ -17,6 +17,12 @@ public sealed partial class GlimmerMobRuleComponent : Component [DataField(required: true)] public EntProtoId MobPrototype = string.Empty; + /// + /// Hard cap on spawns, regardless of glimmer or psionics. + /// + [DataField] + public int? MaxSpawns; + /// /// Every this number of psionics spawns 1 mob. /// diff --git a/Content.Server/DeltaV/StationEvents/Events/GlimmerMobSpawnRule.cs b/Content.Server/DeltaV/StationEvents/Events/GlimmerMobSpawnRule.cs index 802a6379b21..f1ec9372897 100644 --- a/Content.Server/DeltaV/StationEvents/Events/GlimmerMobSpawnRule.cs +++ b/Content.Server/DeltaV/StationEvents/Events/GlimmerMobSpawnRule.cs @@ -29,6 +29,8 @@ protected override void Started(EntityUid uid, GlimmerMobRuleComponent comp, Gam int multiplier = Math.Max(1, (int) _glimmer.GetGlimmerTier() - (int) comp.GlimmerTier); var total = baseCount * multiplier; + if (comp.MaxSpawns is {} maxSpawns) + total = Math.Min(total, maxSpawns); Log.Info($"Spawning {total} of {comp.MobPrototype} from {ToPrettyString(uid):rule}"); for (var i = 0; i < total; i++) diff --git a/Content.Server/Nyanotrasen/StationEvents/Components/GlimmerRandomSentienceRuleComponent.cs b/Content.Server/Nyanotrasen/StationEvents/Components/GlimmerRandomSentienceRuleComponent.cs deleted file mode 100644 index 764cb807bac..00000000000 --- a/Content.Server/Nyanotrasen/StationEvents/Components/GlimmerRandomSentienceRuleComponent.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Content.Server.Nyanotrasen.StationEvents.Events; -using Content.Server.StationEvents.Events; - -namespace Content.Server.StationEvents.Components; - -[RegisterComponent, Access(typeof(GlimmerRandomSentienceRule))] -public sealed partial class GlimmerRandomSentienceRuleComponent : Component -{ - [DataField("maxMakeSentient")] - public int MaxMakeSentient = 4; -} diff --git a/Content.Server/Nyanotrasen/StationEvents/Components/GlimmerRevenantSpawnRuleComponent.cs b/Content.Server/Nyanotrasen/StationEvents/Components/GlimmerRevenantSpawnRuleComponent.cs deleted file mode 100644 index 808daa5767d..00000000000 --- a/Content.Server/Nyanotrasen/StationEvents/Components/GlimmerRevenantSpawnRuleComponent.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Content.Server.Nyanotrasen.StationEvents.Events; -using Content.Server.StationEvents.Events; - -namespace Content.Server.StationEvents.Components; - -[RegisterComponent, Access(typeof(GlimmerRevenantRule))] -public sealed partial class GlimmerRevenantRuleComponent : Component -{ - [DataField("prototype")] - public string RevenantPrototype = "MobRevenant"; -} diff --git a/Content.Server/Nyanotrasen/StationEvents/Events/GlimmerRandomSentienceRule.cs b/Content.Server/Nyanotrasen/StationEvents/Events/GlimmerRandomSentienceRule.cs deleted file mode 100644 index 26c9e0b4456..00000000000 --- a/Content.Server/Nyanotrasen/StationEvents/Events/GlimmerRandomSentienceRule.cs +++ /dev/null @@ -1,57 +0,0 @@ -using Content.Server.Ghost.Roles.Components; -using Content.Server.Psionics; -using Content.Server.Speech.Components; -using Content.Server.StationEvents.Components; -using Content.Server.StationEvents.Events; -using Content.Shared.GameTicking.Components; -using Content.Shared.Mobs.Systems; - -namespace Content.Server.Nyanotrasen.StationEvents.Events; - -/// -/// Glimmer version of the (removed) random sentience event -/// -internal sealed class GlimmerRandomSentienceRule : StationEventSystem -{ - [Dependency] private readonly MobStateSystem _mobStateSystem = default!; - [Dependency] private readonly MetaDataSystem _metaDataSystem = default!; - - protected override void Started(EntityUid uid, GlimmerRandomSentienceRuleComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args) - { - base.Started(uid, component, gameRule, args); - - List targetList = new(); - - var query = EntityQueryEnumerator(); - while (query.MoveNext(out var target, out _)) - { - if (HasComp(target)) - continue; - - if (!_mobStateSystem.IsAlive(target)) - continue; - - targetList.Add(target); - } - - RobustRandom.Shuffle(targetList); - - var toMakeSentient = RobustRandom.Next(1, component.MaxMakeSentient); - - foreach (var target in targetList) - { - if (toMakeSentient-- == 0) - break; - - EntityManager.RemoveComponent(target); - _metaDataSystem.SetEntityName(target, Loc.GetString("glimmer-event-awakened-prefix", ("entity", target))); - var comp = EntityManager.EnsureComponent(target); - comp.RoleName = EntityManager.GetComponent(target).EntityName; - comp.RoleDescription = Loc.GetString("station-event-random-sentience-role-description", ("name", comp.RoleName)); - RemComp(target); - RemComp(target); - EnsureComp(target); - EnsureComp(target); - } - } -} diff --git a/Content.Server/Nyanotrasen/StationEvents/Events/GlimmerRevenantSpawnRule.cs b/Content.Server/Nyanotrasen/StationEvents/Events/GlimmerRevenantSpawnRule.cs deleted file mode 100644 index 69a2ba18da0..00000000000 --- a/Content.Server/Nyanotrasen/StationEvents/Events/GlimmerRevenantSpawnRule.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Content.Server.Psionics.Glimmer; -using Content.Server.StationEvents.Components; -using Content.Server.StationEvents.Events; -using Content.Shared.GameTicking.Components; -using Robust.Shared.Random; - -namespace Content.Server.Nyanotrasen.StationEvents.Events; - -internal sealed class GlimmerRevenantRule : StationEventSystem -{ - [Dependency] private readonly IRobustRandom _random = default!; - - protected override void Started(EntityUid uid, GlimmerRevenantRuleComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args) - { - base.Started(uid, component, gameRule, args); - - List glimmerSources = new(); - - var query = EntityQueryEnumerator(); - while (query.MoveNext(out var source, out _)) - { - glimmerSources.Add(source); - } - - if (glimmerSources.Count == 0) - return; - - var coords = Transform(_random.Pick(glimmerSources)).Coordinates; - - Sawmill.Info($"Spawning revenant at {coords}"); - EntityManager.SpawnEntity(component.RevenantPrototype, coords); - } -} diff --git a/Resources/Prototypes/DeltaV/GameRules/glimmer_events.yml b/Resources/Prototypes/DeltaV/GameRules/glimmer_events.yml new file mode 100644 index 00000000000..dc940422f8c --- /dev/null +++ b/Resources/Prototypes/DeltaV/GameRules/glimmer_events.yml @@ -0,0 +1,43 @@ +- type: entityTable + id: GlimmerEventsTable + table: !type:AllSelector # we need to pass a list of rules, since rules have further restrictions to consider via StationEventComp and GlimmerEventComp + children: + - id: MundaneDischarge + - id: NoosphericZap + - id: NoosphericFry + - id: PsionicCatGotYourTongue + - id: MassMindSwap + - id: GlimmerWispSpawn + - id: FreeProber + - id: GlimmerRevenantSpawn + - id: GlimmerMiteSpawn + - id: GlimmerRandomSentience + +- type: entity + parent: BaseGameRule + id: GlimmerEventScheduler + components: + - type: BasicStationEventScheduler + minMaxEventTiming: + min: 300 + max: 1500 + scheduledGameRules: !type:NestedSelector + tableId: GlimmerEventsTable + +# Like upstream's event but can reoccur and tied to glimmer. +- type: entity + parent: [RandomSentience, BaseGlimmerEvent] + id: GlimmerRandomSentience + components: + - type: StationEvent + weight: 6 + duration: 1 + reoccurrenceDelay: 20 + startAudio: + path: /Audio/Announcements/attention.ogg + - type: GlimmerEvent + minimumGlimmer: 300 + maximumGlimmer: 600 + glimmerBurnLower: 20 + glimmerBurnUpper: 60 + - type: RandomSentienceRule diff --git a/Resources/Prototypes/GameRules/events.yml b/Resources/Prototypes/GameRules/events.yml index df5c45cd4e1..497b9a1add4 100644 --- a/Resources/Prototypes/GameRules/events.yml +++ b/Resources/Prototypes/GameRules/events.yml @@ -18,7 +18,7 @@ #- id: MimicVendorRule # DeltaV - disabled, see below - id: MouseMigration - id: PowerGridCheck - - id: RandomSentience + #- id: RandomSentience # DeltaV - replaced with RandomSentienceGlimmer - id: SlimesSpawn - id: SolarFlare - id: SpiderClownSpawn diff --git a/Resources/Prototypes/Nyanotrasen/GameRules/events.yml b/Resources/Prototypes/Nyanotrasen/GameRules/events.yml index a604d80b147..9ad4c9a6ecf 100644 --- a/Resources/Prototypes/Nyanotrasen/GameRules/events.yml +++ b/Resources/Prototypes/Nyanotrasen/GameRules/events.yml @@ -92,15 +92,7 @@ components: - type: FreeProberRule -## converted upstream events -- type: entity - parent: BaseGlimmerSignaturesEvent - id: GlimmerRandomSentience - components: - - type: GlimmerEvent - maximumGlimmer: 600 - - type: GlimmerRandomSentienceRule - +# Converted from upstream event - type: entity parent: BaseGlimmerSignaturesEvent id: GlimmerRevenantSpawn @@ -108,7 +100,9 @@ - type: GlimmerEvent minimumGlimmer: 500 maximumGlimmer: 900 - - type: GlimmerRevenantRule + - type: GlimmerMobRule + mobPrototype: MobRevenant + maxSpawns: 1 - type: entity parent: BaseGlimmerSignaturesEvent diff --git a/Resources/Prototypes/game_presets.yml b/Resources/Prototypes/game_presets.yml index 73e1326034a..dc5663c0882 100644 --- a/Resources/Prototypes/game_presets.yml +++ b/Resources/Prototypes/game_presets.yml @@ -11,6 +11,7 @@ - SpaceTrafficControlEventScheduler - SpaceTrafficControlFriendlyEventScheduler - BasicRoundstartVariation + - GlimmerEventScheduler # DeltaV - type: gamePreset id: KesslerSyndrome @@ -26,6 +27,7 @@ - RampingStationEventScheduler - SpaceTrafficControlEventScheduler - BasicRoundstartVariation + - GlimmerEventScheduler # DeltaV - type: gamePreset id: AllAtOnce @@ -43,6 +45,7 @@ - RampingStationEventScheduler - SpaceTrafficControlEventScheduler - BasicRoundstartVariation + - GlimmerEventScheduler # DeltaV - type: gamePreset id: AllerAtOnce @@ -67,6 +70,7 @@ - SpaceTrafficControlEventScheduler - SpaceTrafficControlFriendlyEventScheduler - BasicRoundstartVariation + - GlimmerEventScheduler # DeltaV - type: gamePreset id: Extended @@ -81,6 +85,7 @@ - MeteorSwarmScheduler - SpaceTrafficControlEventScheduler - BasicRoundstartVariation + - GlimmerEventScheduler # DeltaV - type: gamePreset id: Greenshift @@ -93,6 +98,7 @@ rules: - SpaceTrafficControlFriendlyEventScheduler - BasicRoundstartVariation + - GlimmerEventScheduler # DeltaV - type: gamePreset id: Secret @@ -117,6 +123,7 @@ - MeteorSwarmScheduler - SpaceTrafficControlEventScheduler - BasicRoundstartVariation + - GlimmerEventScheduler # DeltaV - type: gamePreset id: SecretGreenshift #For Admin Use: Runs Greenshift but shows "Secret" in lobby. @@ -128,6 +135,7 @@ rules: - SpaceTrafficControlFriendlyEventScheduler - BasicRoundstartVariation + - GlimmerEventScheduler # DeltaV - type: gamePreset id: Sandbox @@ -155,6 +163,7 @@ - MeteorSwarmScheduler - SpaceTrafficControlEventScheduler - BasicRoundstartVariation + - GlimmerEventScheduler # DeltaV - type: gamePreset id: Deathmatch @@ -183,6 +192,7 @@ - MeteorSwarmScheduler - SpaceTrafficControlEventScheduler - BasicRoundstartVariation + - GlimmerEventScheduler # DeltaV - type: gamePreset id: Revolutionary @@ -200,6 +210,7 @@ - MeteorSwarmScheduler - SpaceTrafficControlEventScheduler - BasicRoundstartVariation + - GlimmerEventScheduler # DeltaV - type: gamePreset id: Zombie @@ -218,6 +229,7 @@ - MeteorSwarmScheduler - SpaceTrafficControlEventScheduler - BasicRoundstartVariation + - GlimmerEventScheduler # DeltaV - type: gamePreset id: Zombieteors @@ -234,3 +246,4 @@ - KesslerSyndromeScheduler - SpaceTrafficControlEventScheduler - BasicRoundstartVariation + - GlimmerEventScheduler # DeltaV