using Content.Server.StationEvents.Events;
+using Content.Shared.Storage;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
[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();
}
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;
{
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);
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}");
}
}
}
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
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