From 3bd117bcc4c078c9e6410fd73bff16625ac24d80 Mon Sep 17 00:00:00 2001 From: deltanedas <@deltanedas:kde.org> Date: Mon, 23 Dec 2024 15:21:52 +0000 Subject: [PATCH 1/3] update events to use entity tables --- .../Prototypes/DeltaV/GameRules/events.yml | 40 +++++------ Resources/Prototypes/GameRules/events.yml | 34 ++++----- Resources/Prototypes/GameRules/pests.yml | 71 +++++++++---------- 3 files changed, 66 insertions(+), 79 deletions(-) diff --git a/Resources/Prototypes/DeltaV/GameRules/events.yml b/Resources/Prototypes/DeltaV/GameRules/events.yml index 94217ab589a..bb120890fa5 100644 --- a/Resources/Prototypes/DeltaV/GameRules/events.yml +++ b/Resources/Prototypes/DeltaV/GameRules/events.yml @@ -49,23 +49,24 @@ - type: PrecognitionResult message: psionic-power-precognition-xeno-vents-result-message - type: VentCrittersRule - entries: - - id: MobXeno - prob: 0.08 - - id: MobXenoRouny - prob: 0.01 - - id: MobXenoDrone - prob: 0.01 - - id: MobXenoSpitter - prob: 0.01 - - id: MobXenoRunner - prob: 0.01 - - id: MobXenoPraetorian - prob: 0.01 - - id: MobXenoRavager - prob: 0.01 - - id: MobXenoQueen - prob: 0.007 + table: !type:GroupSelector # DeltaV: EntityTable instead of spawn entries + children: + - id: MobXeno + weight: 0.55 + - id: MobXenoRouny + weight: 0.01 + - id: MobXenoDrone + weight: 0.25 + - id: MobXenoSpitter + weight: 0.05 + - id: MobXenoRunner + weight: 0.08 + - id: MobXenoPraetorian + weight: 0.03 + - id: MobXenoRavager + weight: 0.02 + - id: MobXenoQueen + weight: 0.01 - type: entity id: MothroachSpawn @@ -79,9 +80,8 @@ - type: PrecognitionResult message: psionic-power-precognition-mothroach-spawn-result-message - type: VentCrittersRule - entries: - - id: MobMothroach - prob: 0.05 + table: # DeltaV: EntityTable instead of spawn entries + id: MobMothroach - type: entity id: ListeningPost diff --git a/Resources/Prototypes/GameRules/events.yml b/Resources/Prototypes/GameRules/events.yml index b345120c10f..f2c9c446673 100644 --- a/Resources/Prototypes/GameRules/events.yml +++ b/Resources/Prototypes/GameRules/events.yml @@ -393,13 +393,11 @@ - type: PrecognitionResult # DeltaV - Precogniton message: psionic-power-precognition-slimes-spawn-result-message - type: VentCrittersRule - entries: - - id: MobAdultSlimesBlueAngry - prob: 0.02 - - id: MobAdultSlimesGreenAngry - prob: 0.02 - - id: MobAdultSlimesYellowAngry - prob: 0.02 + table: !type:GroupSelector # DeltaV: EntityTable instead of spawn entries + children: + - id: MobAdultSlimesBlueAngry + - id: MobAdultSlimesGreenAngry + - id: MobAdultSlimesYellowAngry - type: entity id: SnakeSpawn @@ -416,13 +414,11 @@ - type: PrecognitionResult # DeltaV - Precogniton message: psionic-power-precognition-snake-spawn-result-message - type: VentCrittersRule - entries: - - id: MobPurpleSnake - prob: 0.02 - - id: MobSmallPurpleSnake - prob: 0.02 - - id: MobCobraSpace - prob: 0.02 + table: !type:GroupSelector # DeltaV: EntityTable instead of spawn entries + children: + - id: MobPurpleSnake + - id: MobSmallPurpleSnake + - id: MobCobraSpace - type: entity id: SpiderSpawn @@ -439,9 +435,8 @@ - type: PrecognitionResult # DeltaV - Precogniton message: psionic-power-precognition-spider-spawn-result-message - type: VentCrittersRule - entries: - - id: MobGiantSpiderAngry - prob: 0.05 + table: # DeltaV: EntityTable instead of spawn entries + id: MobGiantSpiderAngry - type: entity id: SpiderClownSpawn @@ -459,9 +454,8 @@ message: psionic-power-precognition-spider-clown-spawn-result-message - type: VentCrittersRule playerRatio: 35 # DeltaV: Clown spiders are very robust - entries: - - id: MobClownSpider - prob: 0.03 # DeltaV - was 0.05 + table: # DeltaV: EntityTable instead of spawn entries + id: MobClownSpider - type: entity id: ZombieOutbreak diff --git a/Resources/Prototypes/GameRules/pests.yml b/Resources/Prototypes/GameRules/pests.yml index 8ddde7e1a61..e156211e367 100644 --- a/Resources/Prototypes/GameRules/pests.yml +++ b/Resources/Prototypes/GameRules/pests.yml @@ -31,15 +31,12 @@ - type: PrecognitionResult # DeltaV - Precogniton message: psionic-power-precognition-mouse-migration-result-message - type: VentCrittersRule - entries: - - id: MobMouse - prob: 0.02 - - id: MobMouse1 - prob: 0.02 - - id: MobMouse2 - prob: 0.02 - #- id: MobMouseCancer # DeltaV - no - #prob: 0.001 + table: !type:GroupSelector # DeltaV: EntityTable instead of spawn entries + children: + - id: MobMouse + - id: MobMouse1 + - id: MobMouse2 + #- id: MobMouseCancer # DeltaV - no # Events always spawn a critter regardless of Probability https://github.com/space-wizards/space-station-14/issues/28480 I added the Rat King to their own event with a player cap. - type: entity @@ -57,15 +54,12 @@ - type: PrecognitionResult # DeltaV - Precogniton message: psionic-power-precognition-king-rat-migration-result-message - type: VentCrittersRule - entries: - - id: MobMouse - prob: 0.02 - - id: MobMouse1 - prob: 0.02 - - id: MobMouse2 - prob: 0.02 - #- id: MobMouseCancer # DeltaV - no - #prob: 0.001 + table: !type:GroupSelector # DeltaV: EntityTable instead of spawn entries + children: + - id: MobMouse + - id: MobMouse1 + - id: MobMouse2 + #- id: MobMouseCancer # DeltaV - no specialEntries: - id: SpawnPointGhostRatKing prob: 0.001 @@ -83,11 +77,12 @@ - type: PrecognitionResult # DeltaV - Precogniton message: psionic-power-precognition-cockroach-migration-result-message - type: VentCrittersRule - entries: - - id: MobCockroach - prob: 0.03 - - id: MobMothroach - prob: 0.008 + table: !type:GroupSelector # DeltaV: EntityTable instead of spawn entries + children: + - id: MobCockroach + weight: 0.79 + - id: MobMothroach + weight: 0.21 - type: entity id: SnailMigrationLowPop @@ -102,13 +97,11 @@ - type: PrecognitionResult # DeltaV - Precogniton message: psionic-power-precognition-snail-migration-result-message - type: VentCrittersRule - entries: - - id: MobSnail - prob: 0.02 - - id: MobSnailSpeed - prob: 0.002 - - id: MobSnailMoth - prob: 0.002 + table: !type:GroupSelector # DeltaV: EntityTable instead of spawn entries + children: + - id: MobSnail + - id: MobSnailSpeed + - id: MobSnailMoth - type: entity id: SnailMigration @@ -125,12 +118,12 @@ - type: PrecognitionResult # DeltaV - Precogniton message: psionic-power-precognition-snail-migration-result-message - type: VentCrittersRule - entries: - - id: MobSnail - prob: 0.02 - - id: MobSnailSpeed - prob: 0.002 - - id: MobSnailMoth - prob: 0.002 - #- id: MobSnailInstantDeath # DeltaV - no - #prob: 0.00001 # ~ 1:2000 snails + table: !type:GroupSelector # DeltaV: EntityTable instead of spawn entries + children: + - id: MobSnail + weight: 0.84 + - id: MobSnailSpeed + weight: 0.08 + - id: MobSnailMoth + weight: 0.08 + #- id: MobSnailInstantDeath # DeltaV - no From 76379abc0a7f6809412e2c62e121396d71419b66 Mon Sep 17 00:00:00 2001 From: deltanedas <@deltanedas:kde.org> Date: Mon, 23 Dec 2024 15:24:04 +0000 Subject: [PATCH 2/3] change Entries to Table in the component --- .../Components/VentCrittersRuleComponent.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Content.Server/StationEvents/Components/VentCrittersRuleComponent.cs b/Content.Server/StationEvents/Components/VentCrittersRuleComponent.cs index a575075632e..7ec6e3d54ac 100644 --- a/Content.Server/StationEvents/Components/VentCrittersRuleComponent.cs +++ b/Content.Server/StationEvents/Components/VentCrittersRuleComponent.cs @@ -1,4 +1,5 @@ using Content.Server.StationEvents.Events; +using Content.Shared.EntityTable.EntitySelectors; using Content.Shared.Storage; using Robust.Shared.Map; // DeltaV @@ -7,8 +8,15 @@ namespace Content.Server.StationEvents.Components; [RegisterComponent, Access(typeof(VentCrittersRule))] public sealed partial class VentCrittersRuleComponent : Component { - [DataField("entries")] - public List Entries = new(); + // DeltaV: Replaced by Table + //[DataField("entries")] + //public List Entries = new(); + + /// + /// DeltaV: Table of possible entities to spawn. + /// + [DataField(required: true)] + public EntityTableSelector Table = default!; /// /// At least one special entry is guaranteed to spawn From 919e422e64e3e1bc1c73f0e802696fc1c30b799a Mon Sep 17 00:00:00 2001 From: deltanedas <@deltanedas:kde.org> Date: Mon, 23 Dec 2024 15:31:35 +0000 Subject: [PATCH 3/3] update rule and add log --- .../DeltaV/Abilities/Psionics/PrecognitionPowerSystem.cs | 2 +- Content.Server/StationEvents/Events/VentCrittersRule.cs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Content.Server/DeltaV/Abilities/Psionics/PrecognitionPowerSystem.cs b/Content.Server/DeltaV/Abilities/Psionics/PrecognitionPowerSystem.cs index 60d574192e1..79a56066e31 100644 --- a/Content.Server/DeltaV/Abilities/Psionics/PrecognitionPowerSystem.cs +++ b/Content.Server/DeltaV/Abilities/Psionics/PrecognitionPowerSystem.cs @@ -148,7 +148,7 @@ private void OnDoAfter(EntityUid uid, PrecognitionPowerComponent component, Prec var msg = Loc.GetString(locId); _chat.ChatMessageToOne(ChatChannel.Server, msg, - Loc.GetString("chat-manager-server-wrap-message", ("message", message)), + Loc.GetString("chat-manager-server-wrap-message", ("message", msg)), uid, false, mindComponent.Session.Channel, diff --git a/Content.Server/StationEvents/Events/VentCrittersRule.cs b/Content.Server/StationEvents/Events/VentCrittersRule.cs index 20143a77591..90c0cc262dc 100644 --- a/Content.Server/StationEvents/Events/VentCrittersRule.cs +++ b/Content.Server/StationEvents/Events/VentCrittersRule.cs @@ -2,6 +2,7 @@ using Content.Server.GameTicking.Rules.Components; using Content.Server.Pinpointer; using Content.Server.StationEvents.Components; +using Content.Shared.EntityTable; using Content.Shared.GameTicking.Components; using Content.Shared.Station.Components; using Content.Shared.Storage; @@ -26,6 +27,7 @@ public sealed class VentCrittersRule : StationEventSystem