diff --git a/Content.Server/StationEvents/Components/ImmovableRodRuleComponent.cs b/Content.Server/StationEvents/Components/ImmovableRodRuleComponent.cs index 95c32652072..7b35dd9a147 100644 --- a/Content.Server/StationEvents/Components/ImmovableRodRuleComponent.cs +++ b/Content.Server/StationEvents/Components/ImmovableRodRuleComponent.cs @@ -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))] - public string RodPrototype = "ImmovableRodKeepTilesStill"; + /// List of possible rods and spawn probabilities. + /// + [DataField] + public List RodPrototypes = new(); } diff --git a/Content.Server/StationEvents/Events/ImmovableRodRule.cs b/Content.Server/StationEvents/Events/ImmovableRodRule.cs index a61c6b69e1a..1b8fb6be1f8 100644 --- a/Content.Server/StationEvents/Events/ImmovableRodRule.cs +++ b/Content.Server/StationEvents/Events/ImmovableRodRule.cs @@ -3,9 +3,11 @@ 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 @@ protected override void Started(EntityUid uid, ImmovableRodRuleComponent compone { base.Started(uid, component, gameRule, args); - var proto = _prototypeManager.Index(component.RodPrototype); + var protoName = EntitySpawnCollection.GetSpawns(component.RodPrototypes).First(); + + var proto = _prototypeManager.Index(protoName); + if (proto.TryGetComponent(out var rod) && proto.TryGetComponent(out var despawn)) { TryFindRandomTile(out _, out _, out _, out var targetCoords); @@ -27,12 +32,12 @@ protected override void Started(EntityUid uid, ImmovableRodRuleComponent compone 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}"); } } } diff --git a/Resources/Prototypes/Entities/Objects/Fun/immovable_rod.yml b/Resources/Prototypes/Entities/Objects/Fun/immovable_rod.yml index 466e433e8b5..f46abe8a5af 100644 --- a/Resources/Prototypes/Entities/Objects/Fun/immovable_rod.yml +++ b/Resources/Prototypes/Entities/Objects/Fun/immovable_rod.yml @@ -60,3 +60,86 @@ 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 diff --git a/Resources/Prototypes/GameRules/events.yml b/Resources/Prototypes/GameRules/events.yml index db99266cbaa..b19d6fd8d7f 100644 --- a/Resources/Prototypes/GameRules/events.yml +++ b/Resources/Prototypes/GameRules/events.yml @@ -441,20 +441,45 @@ sounds: collection: Paracusia -#- type: entity # DeltaV - Why does this exist?? -# id: ImmovableRodSpawn -# parent: BaseGameRule -# noSpawn: true -# components: -# - type: StationEvent -# startAnnouncement: station-event-immovable-rod-start-announcement -# startAudio: -# path: /Audio/Announcements/attention.ogg -# weight: 5 -# duration: 1 -# earliestStart: 45 -# minimumPlayers: 20 -# - type: ImmovableRodRule +- type: entity + id: ImmovableRodSpawn + parent: BaseGameRule + noSpawn: true + components: + - type: StationEvent + startAnnouncement: station-event-immovable-rod-start-announcement + startAudio: + path: /Audio/Announcements/attention.ogg + weight: 5 + duration: 1 + 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