]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Content changes for entity categories PR (#27232)
authorLeon Friedrich <60421075+ElectroJr@users.noreply.github.com>
Sun, 2 Jun 2024 04:08:15 +0000 (16:08 +1200)
committerGitHub <noreply@github.com>
Sun, 2 Jun 2024 04:08:15 +0000 (14:08 +1000)
* Content changes for entity categories PR

* Poke tests

* Why are tests suddenly working?

16 files changed:
Content.IntegrationTests/Tests/EntityTest.cs
Content.Server/GameTicking/Rules/Components/NukeOperativeSpawnerComponent.cs
Content.Server/Ghost/Roles/Components/GhostRoleMobSpawnerComponent.cs
Content.Server/Humanoid/Components/RandomHumanoidSpawnerComponent.cs
Content.Server/Spawners/Components/ConditionalSpawnerComponent.cs
Content.Server/Spawners/Components/RandomSpawnerComponent.cs
Content.Server/Spawners/Components/TimedSpawnerComponent.cs
Content.Shared/Actions/BaseActionComponent.cs
Content.Shared/Body/Prototypes/BodyPrototypeSerializer.cs
Content.Shared/Dragon/SharedDragonRiftComponent.cs
Resources/Locale/en-US/entity-categories.ftl [new file with mode: 0644]
Resources/Prototypes/Alerts/alerts.yml
Resources/Prototypes/Alerts/revenant.yml
Resources/Prototypes/Entities/Objects/Devices/flatpack.yml
Resources/Prototypes/Entities/Structures/Machines/flatpacker.yml
Resources/Prototypes/Entities/categories.yml [new file with mode: 0644]

index 54af64122be036908b818ca75e2ee169f604b1ed..926374cf0500d568ea6f3be8bcb2e0efc0b2db01 100644 (file)
@@ -19,6 +19,8 @@ namespace Content.IntegrationTests.Tests
     [TestOf(typeof(EntityUid))]
     public sealed class EntityTest
     {
+        private static readonly ProtoId<EntityCategoryPrototype> SpawnerCategory = "Spawner";
+
         [Test]
         public async Task SpawnAndDeleteAllEntitiesOnDifferentMaps()
         {
@@ -234,14 +236,6 @@ namespace Content.IntegrationTests.Tests
                 "StationEvent",
                 "TimedDespawn",
 
-                // Spawner entities
-                "DragonRift",
-                "RandomHumanoidSpawner",
-                "RandomSpawner",
-                "ConditionalSpawner",
-                "GhostRoleMobSpawner",
-                "NukeOperativeSpawner",
-                "TimedSpawner",
                 // makes an announcement on mapInit.
                 "AnnounceOnSpawn",
             };
@@ -253,6 +247,7 @@ namespace Content.IntegrationTests.Tests
                 .Where(p => !p.Abstract)
                 .Where(p => !pair.IsTestPrototype(p))
                 .Where(p => !excluded.Any(p.Components.ContainsKey))
+                .Where(p => p.Categories.All(x => x.ID != SpawnerCategory))
                 .Select(p => p.ID)
                 .ToList();
 
index bb1b7c87460689db4aa8f1ca7609d2a065597dfb..54eaa6e32e4cf39e6a21a5c9f5de9e1deeb59eca 100644 (file)
@@ -1,3 +1,5 @@
+using Robust.Shared.Prototypes;
+
 namespace Content.Server.GameTicking.Rules.Components;
 
 /// <summary>
@@ -5,6 +7,5 @@ namespace Content.Server.GameTicking.Rules.Components;
 /// and providing loadout + name for the operative on spawn.
 /// TODO: Remove once systems can request spawns from the ghost role system directly.
 /// </summary>
-[RegisterComponent]
+[RegisterComponent, EntityCategory("Spawner")]
 public sealed partial class NukeOperativeSpawnerComponent : Component;
-
index 6c2a6986fc96e95e3fe55278c0d05b93b58053fb..6116173f904bfab4c1915f06c452c93f01d236af 100644 (file)
@@ -5,7 +5,7 @@ namespace Content.Server.Ghost.Roles.Components
     /// <summary>
     ///     Allows a ghost to take this role, spawning a new entity.
     /// </summary>
-    [RegisterComponent]
+    [RegisterComponent, EntityCategory("Spawner")]
     [Access(typeof(GhostRoleSystem))]
     public sealed partial class GhostRoleMobSpawnerComponent : Component
     {
index b56664fe19e398933170e3790d2936290b410335..bb38e94e04ab8ba813385b54a3b56107b44b213a 100644 (file)
@@ -8,7 +8,7 @@ namespace Content.Server.Humanoid.Components;
 ///     This is added to a marker entity in order to spawn a randomized
 ///     humanoid ingame.
 /// </summary>
-[RegisterComponent]
+[RegisterComponent, EntityCategory("Spawner")]
 public sealed partial class RandomHumanoidSpawnerComponent : Component
 {
     [DataField("settings", customTypeSerializer: typeof(PrototypeIdSerializer<RandomHumanoidSettingsPrototype>))]
index 5b98989bb3ee0e494455777878dfa506301911ae..1b06367b0d86248f8703dadccf642caf04225586 100644 (file)
@@ -2,7 +2,7 @@ using Robust.Shared.Prototypes;
 
 namespace Content.Server.Spawners.Components
 {
-    [RegisterComponent]
+    [RegisterComponent, EntityCategory("Spawner")]
     [Virtual]
     public partial class ConditionalSpawnerComponent : Component
     {
index 9bf4d6d2531706d3f0f3d84004b63217a2172ba2..e6a597f365861d527a55f41f59ba2e1c7639b631 100644 (file)
@@ -2,7 +2,7 @@ using Robust.Shared.Prototypes;
 
 namespace Content.Server.Spawners.Components
 {
-    [RegisterComponent]
+    [RegisterComponent, EntityCategory("Spawner")]
     public sealed partial class RandomSpawnerComponent : ConditionalSpawnerComponent
     {
         [ViewVariables(VVAccess.ReadWrite)]
index b60afbc88ba3d78d65bb1f628781cf7643b05af5..828e5417177e69b26eb76d2887ac40bf8fb89602 100644 (file)
@@ -9,7 +9,7 @@ namespace Content.Server.Spawners.Components;
 /// Can configure the set of entities, spawn timing, spawn chance,
 /// and min/max number of entities to spawn.
 /// </summary>
-[RegisterComponent]
+[RegisterComponent, EntityCategory("Spawner")]
 public sealed partial class TimedSpawnerComponent : Component, ISerializationHooks
 {
     /// <summary>
index 57c145a0ecf3c6300d5243c37238017dd4e740a6..9156f747f5c90a0fee240bfad76ac22b51f58957 100644 (file)
@@ -1,14 +1,16 @@
 using Robust.Shared.Audio;
+using Robust.Shared.Prototypes;
 using Robust.Shared.Serialization;
 using Robust.Shared.Utility;
 
 namespace Content.Shared.Actions;
 
-// TODO ACTIONS make this a seprate component and remove the inheritance stuff.
+// TODO ACTIONS make this a separate component and remove the inheritance stuff.
 // TODO ACTIONS convert to auto comp state?
 
 // TODO add access attribute. Need to figure out what to do with decal & mapping actions.
 // [Access(typeof(SharedActionsSystem))]
+[EntityCategory("Actions")]
 public abstract partial class BaseActionComponent : Component
 {
     public abstract BaseActionEvent? BaseEvent { get; }
index e2b54bf951e0008401fc8483b32c9b44b1b7f016..ae099767049b6c3e5c25c013acd04d621165439d 100644 (file)
@@ -182,7 +182,7 @@ public sealed class BodyPrototypeSerializer : ITypeReader<BodyPrototype, Mapping
 
         foreach (var (slotId, (part, connections, organs)) in allConnections)
         {
-            var slot = new BodyPrototypeSlot(part != null ? new EntProtoId(part) : null!, connections ?? new HashSet<string>(), organs ?? new Dictionary<string, string>());
+            var slot = new BodyPrototypeSlot(part, connections ?? new HashSet<string>(), organs ?? new Dictionary<string, string>());
             slots.Add(slotId, slot);
         }
 
index 0d2bf440180396ffde91e9951f68ce9cce3dfae9..8377dbfee7a6dc2f9223832b5ebb3037f5002552 100644 (file)
@@ -1,9 +1,10 @@
 using Robust.Shared.GameStates;
+using Robust.Shared.Prototypes;
 using Robust.Shared.Serialization;
 
 namespace Content.Shared.Dragon;
 
-[NetworkedComponent]
+[NetworkedComponent, EntityCategory("Spawner")]
 public abstract partial class SharedDragonRiftComponent : Component
 {
     [DataField("state")]
diff --git a/Resources/Locale/en-US/entity-categories.ftl b/Resources/Locale/en-US/entity-categories.ftl
new file mode 100644 (file)
index 0000000..190fe57
--- /dev/null
@@ -0,0 +1 @@
+entity-category-name-actions = Actions
index 7881cddd4aab9e7c5b6e4b3c452d54a6ddff4428..72412fde7cc3477fa31a1175e1d7506489da905b 100644 (file)
@@ -28,7 +28,7 @@
 
 - type: entity
   id: AlertSpriteView
-  categories: [ hideSpawnMenu ]
+  categories: [ HideSpawnMenu  ]
   components:
   - type: Sprite
     layers:
index 7f3f98949e00405cb876b710da0a9f2da0964473..38933df4fe0cedef563fa4eb1db7cdfd25df4bb8 100644 (file)
@@ -16,7 +16,7 @@
 
 - type: entity
   id: AlertEssenceSpriteView
-  categories: [ hideSpawnMenu ]
+  categories: [ HideSpawnMenu ]
   components:
   - type: Sprite
     sprite: /Textures/Interface/Alerts/essence_counter.rsi
index e3e77d5c88ef47e4426a4fc64f8242ddeb0bca43..b9c2b752dba4d77d50c8a2004bf83448975669d1 100644 (file)
@@ -4,7 +4,7 @@
   name: base flatpack
   description: A flatpack used for constructing something.
   categories:
-  - hideSpawnMenu
+  - HideSpawnMenu
   components:
   - type: Item
     size: Large
index b4f05cf68a7b4f08b63f8d11b4b4f5458e7023f8..78f150400306ac45951eb9631691325275f4da5b 100644 (file)
@@ -84,7 +84,7 @@
 - type: entity
   id: FlatpackerNoBoardEffect
   categories:
-  - hideSpawnMenu
+  - HideSpawnMenu
   components:
   - type: Sprite
     sprite: Structures/Machines/autolathe.rsi
diff --git a/Resources/Prototypes/Entities/categories.yml b/Resources/Prototypes/Entities/categories.yml
new file mode 100644 (file)
index 0000000..2fb5681
--- /dev/null
@@ -0,0 +1,4 @@
+- type: entityCategory
+  id: Actions
+  name: entity-category-name-actions
+  hideSpawnMenu: true