]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Immovable Rod visual variations (#25932)
authorSlamBamActionman <83650252+SlamBamActionman@users.noreply.github.com>
Sun, 24 Mar 2024 22:45:52 +0000 (23:45 +0100)
committerGitHub <noreply@github.com>
Sun, 24 Mar 2024 22:45:52 +0000 (23:45 +0100)
* Adds variations to immovable rod

* slash oopsie

* Changed prototypes from being hardcoded to being defined in the rules component

* Changed from 10% chance to 5%

* Changes based on feedback

* Fix nullable error

* Moved randomized logic to .yaml. Probabilities of alternate rods add up to 5%.

Content.Server/StationEvents/Components/ImmovableRodRuleComponent.cs
Content.Server/StationEvents/Events/ImmovableRodRule.cs
Resources/Prototypes/Entities/Objects/Fun/immovable_rod.yml
Resources/Prototypes/GameRules/events.yml

index 95c326520728edac440f3302190380c127bad831..7b35dd9a1476b116f643deb58242bdbb60c820dd 100644 (file)
@@ -1,4 +1,5 @@
 using Content.Server.StationEvents.Events;
+using Content.Shared.Storage;
 using Robust.Shared.Prototypes;
 using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
 
@@ -7,6 +8,8 @@ namespace Content.Server.StationEvents.Components;
 [RegisterComponent, Access(typeof(ImmovableRodRule))]
 public sealed partial class ImmovableRodRuleComponent : Component
 {
-    [DataField("rodPrototype", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
-    public string RodPrototype = "ImmovableRodKeepTilesStill";
+    ///     List of possible rods and spawn probabilities.
+    /// </summary>
+    [DataField]
+    public List<EntitySpawnEntry> RodPrototypes = new();
 }
index a61c6b69e1a592ce27402910097e9cf2e1334260..1b8fb6be1f85d5ebaa466cb347ca5166a1a58c2a 100644 (file)
@@ -3,9 +3,11 @@ using Content.Server.GameTicking.Rules.Components;
 using Content.Server.ImmovableRod;
 using Content.Server.StationEvents.Components;
 using Content.Server.Weapons.Ranged.Systems;
-using Robust.Shared.Spawners;
+using Content.Shared.Storage;
 using Robust.Shared.Prototypes;
+using Robust.Shared.Random;
 using TimedDespawnComponent = Robust.Shared.Spawners.TimedDespawnComponent;
+using System.Linq;
 
 namespace Content.Server.StationEvents.Events;
 
@@ -19,7 +21,10 @@ public sealed class ImmovableRodRule : StationEventSystem<ImmovableRodRuleCompon
     {
         base.Started(uid, component, gameRule, args);
 
-        var proto = _prototypeManager.Index<EntityPrototype>(component.RodPrototype);
+        var protoName = EntitySpawnCollection.GetSpawns(component.RodPrototypes).First();
+
+        var proto = _prototypeManager.Index<EntityPrototype>(protoName);
+
         if (proto.TryGetComponent<ImmovableRodComponent>(out var rod) && proto.TryGetComponent<TimedDespawnComponent>(out var despawn))
         {
             TryFindRandomTile(out _, out _, out _, out var targetCoords);
@@ -27,12 +32,12 @@ public sealed class ImmovableRodRule : StationEventSystem<ImmovableRodRuleCompon
             var angle = RobustRandom.NextAngle();
             var direction = angle.ToVec();
             var spawnCoords = targetCoords.ToMap(EntityManager, _transform).Offset(-direction * speed * despawn.Lifetime / 2);
-            var ent = Spawn(component.RodPrototype, spawnCoords);
+            var ent = Spawn(protoName, spawnCoords);
             _gun.ShootProjectile(ent, direction, Vector2.Zero, uid, speed: speed);
         }
         else
         {
-            Sawmill.Error($"Invalid immovable rod prototype: {component.RodPrototype}");
+            Sawmill.Error($"Invalid immovable rod prototype: {protoName}");
         }
     }
 }
index 466e433e8b59c960915b66359ed3c0d11435a6c8..f46abe8a5af67a809ef79e2c191b1bfd3f4fcf52 100644 (file)
   components:
   - type: ImmovableRod
     randomizeVelocity: false
+
+- type: entity
+  parent: ImmovableRodKeepTilesStill
+  id: ImmovableRodMop
+  name: immovable mop
+  description: Hurled like a javelin, with the power of a thousand furious janitors.
+  components:
+  - type: Sprite
+    sprite: Objects/Specific/Janitorial/mop.rsi
+    state: mop
+    rotation: 225
+    noRot: false
+
+- type: entity
+  parent: ImmovableRodKeepTilesStill
+  id: ImmovableRodShark
+  name: immovable shark
+  description: SHARK TORNADO!
+  components:
+  - type: Sprite
+    sprite: Objects/Fun/sharkplush.rsi
+    state: blue
+    rotation: 90
+    noRot: false
+
+- type: entity
+  parent: ImmovableRodKeepTilesStill
+  id: ImmovableRodClown
+  name: immovable clown
+  description: Ejected from the neighbouring station one solar system over. HONK!
+  components:
+  - type: Sprite
+    sprite: Markers/jobs.rsi
+    state: clown
+    rotation: 180
+    noRot: false
+
+- type: entity
+  parent: ImmovableRodKeepTilesStill
+  id: ImmovableRodBanana
+  name: immovable banana
+  description: At least you won't slip on it.
+  components:
+  - type: Sprite
+    sprite: Objects/Specific/Hydroponics/banana.rsi
+    state: produce
+    noRot: false
+
+- type: entity
+  parent: ImmovableRodKeepTilesStill
+  id: ImmovableRodHammer
+  name: immovable hammer
+  description: Bwoink.
+  components:
+  - type: Sprite
+    sprite: Objects/Weapons/Melee/sledgehammer.rsi
+    state: icon
+    rotation: 225
+    noRot: false
+
+- type: entity
+  parent: ImmovableRodKeepTilesStill
+  id: ImmovableRodThrongler
+  name: immovable throngler
+  description: If you catch it, you can keep it.
+  components:
+  - type: Sprite
+    sprite: Objects/Weapons/Melee/Throngler2.rsi
+    state: icon
+    rotation: 225
+    noRot: false
+
+- type: entity
+  parent: ImmovableRodKeepTilesStill
+  id: ImmovableRodGibstick
+  name: immovable gibstick
+  description: What did you expect?
+  components:
+  - type: Sprite
+    sprite: Objects/Weapons/Melee/debug.rsi
+    state: icon
+    rotation: 225
+    noRot: false
index 878250267f53810385fec8d2ca469bf5a4ec1194..d3084e43b665405ecd41f4390bb9b827646a5805 100644 (file)
     earliestStart: 45
     minimumPlayers: 20
   - type: ImmovableRodRule
+    rodPrototypes:
+    - id: ImmovableRodKeepTilesStill
+      prob: 0.95
+      orGroup: rodProto
+    - id: ImmovableRodMop
+      prob: 0.0072
+      orGroup: rodProto
+    - id: ImmovableRodShark
+      prob: 0.0072
+      orGroup: rodProto
+    - id: ImmovableRodClown
+      prob: 0.0072
+      orGroup: rodProto
+    - id: ImmovableRodBanana
+      prob: 0.0072
+      orGroup: rodProto
+    - id: ImmovableRodHammer
+      prob: 0.0072
+      orGroup: rodProto
+    - id: ImmovableRodThrongler
+      prob: 0.0072
+      orGroup: rodProto
+    - id: ImmovableRodGibstick
+      prob: 0.0072
+      orGroup: rodProto
 
 - type: entity
   noSpawn: true