]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Clean up YAML issues in animals.yml (#26696)
authorTayrtahn <tayrtahn@gmail.com>
Thu, 4 Apr 2024 06:26:21 +0000 (02:26 -0400)
committerGitHub <noreply@github.com>
Thu, 4 Apr 2024 06:26:21 +0000 (17:26 +1100)
* Cleaned up YAML issues in animals.yml

* Cleaned up TimedSpawnerComponent

Content.Server/Spawners/Components/TimedSpawnerComponent.cs
Resources/Prototypes/Entities/Mobs/NPCs/animals.yml

index abbfd37c6a2d5f2cae308c2d938265b109f05f00..b60afbc88ba3d78d65bb1f628781cf7643b05af5 100644 (file)
@@ -1,40 +1,54 @@
 using System.Threading;
 using Robust.Shared.Prototypes;
-using Robust.Shared.Random;
 using Robust.Shared.Serialization;
-using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
 
-namespace Content.Server.Spawners.Components
+namespace Content.Server.Spawners.Components;
+
+/// <summary>
+/// Spawns entities at a set interval.
+/// Can configure the set of entities, spawn timing, spawn chance,
+/// and min/max number of entities to spawn.
+/// </summary>
+[RegisterComponent]
+public sealed partial class TimedSpawnerComponent : Component, ISerializationHooks
 {
-    [RegisterComponent]
-    public sealed partial class TimedSpawnerComponent : Component, ISerializationHooks
-    {
-        [ViewVariables(VVAccess.ReadWrite)]
-        [DataField("prototypes", customTypeSerializer:typeof(PrototypeIdListSerializer<EntityPrototype>))]
-        public List<string> Prototypes { get; set; } = new();
+    /// <summary>
+    /// List of entities that can be spawned by this component. One will be randomly
+    /// chosen for each entity spawned. When multiple entities are spawned at once,
+    /// each will be randomly chosen separately.
+    /// </summary>
+    [DataField]
+    public List<EntProtoId> Prototypes = [];
 
-        [ViewVariables(VVAccess.ReadWrite)]
-        [DataField("chance")]
-        public float Chance { get; set; } = 1.0f;
+    /// <summary>
+    /// Chance of an entity being spawned at the end of each interval.
+    /// </summary>
+    [DataField]
+    public float Chance = 1.0f;
 
-        [ViewVariables(VVAccess.ReadWrite)]
-        [DataField("intervalSeconds")]
-        public int IntervalSeconds { get; set; } = 60;
+    /// <summary>
+    /// Length of the interval between spawn attempts.
+    /// </summary>
+    [DataField]
+    public int IntervalSeconds = 60;
 
-        [ViewVariables(VVAccess.ReadWrite)]
-        [DataField("MinimumEntitiesSpawned")]
-        public int MinimumEntitiesSpawned { get; set; } = 1;
+    /// <summary>
+    /// The minimum number of entities that can be spawned when an interval elapses.
+    /// </summary>
+    [DataField]
+    public int MinimumEntitiesSpawned = 1;
 
-        [ViewVariables(VVAccess.ReadWrite)]
-        [DataField("MaximumEntitiesSpawned")]
-        public int MaximumEntitiesSpawned { get; set; } = 1;
+    /// <summary>
+    /// The maximum number of entities that can be spawned when an interval elapses.
+    /// </summary>
+    [DataField]
+    public int MaximumEntitiesSpawned = 1;
 
-        public CancellationTokenSource? TokenSource;
+    public CancellationTokenSource? TokenSource;
 
-        void ISerializationHooks.AfterDeserialization()
-        {
-            if (MinimumEntitiesSpawned > MaximumEntitiesSpawned)
-                throw new ArgumentException("MaximumEntitiesSpawned can't be lower than MinimumEntitiesSpawned!");
-        }
+    void ISerializationHooks.AfterDeserialization()
+    {
+        if (MinimumEntitiesSpawned > MaximumEntitiesSpawned)
+            throw new ArgumentException("MaximumEntitiesSpawned can't be lower than MinimumEntitiesSpawned!");
     }
 }
index de9a3db19e2144e5c8a68b13a63ba08e85047de0..6dcf553da1a941ae200e8afc32fb0efb5a959417 100644 (file)
     makeSentient: true
     allowSpeech: true
     allowMovement: true
-    whitelistRequired: false
     name: ghost-role-information-mothroach-name
     description: ghost-role-information-mothroach-description
   - type: Fixtures
           Quantity: 30
   - type: Udder
     reagentId: Milk
-    targetSolution: udder
-    quantity: 25
-    updateRate: 30
+    quantityPerUpdate: 25
+    growthDelay: 30
   - type: Butcherable
     spawned:
     - id: FoodMeat
   - type: Bloodstream
     bloodMaxVolume: 60
   - type: CanEscapeInventory
-    BaseResistTime: 3
+    baseResistTime: 3
   - type: MobPrice
     price: 60
   - type: NonSpreaderZombie