Immovable Rod visual variations (#25932)
* 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%.
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using Content.Server.StationEvents.Events;
|
using Content.Server.StationEvents.Events;
|
||||||
|
using Content.Shared.Storage;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||||
|
|
||||||
@@ -7,6 +8,8 @@ namespace Content.Server.StationEvents.Components;
|
|||||||
[RegisterComponent, Access(typeof(ImmovableRodRule))]
|
[RegisterComponent, Access(typeof(ImmovableRodRule))]
|
||||||
public sealed partial class ImmovableRodRuleComponent : Component
|
public sealed partial class ImmovableRodRuleComponent : Component
|
||||||
{
|
{
|
||||||
[DataField("rodPrototype", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
|
/// List of possible rods and spawn probabilities.
|
||||||
public string RodPrototype = "ImmovableRodKeepTilesStill";
|
/// </summary>
|
||||||
|
[DataField]
|
||||||
|
public List<EntitySpawnEntry> RodPrototypes = new();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,11 @@ using Content.Server.GameTicking.Rules.Components;
|
|||||||
using Content.Server.ImmovableRod;
|
using Content.Server.ImmovableRod;
|
||||||
using Content.Server.StationEvents.Components;
|
using Content.Server.StationEvents.Components;
|
||||||
using Content.Server.Weapons.Ranged.Systems;
|
using Content.Server.Weapons.Ranged.Systems;
|
||||||
using Robust.Shared.Spawners;
|
using Content.Shared.Storage;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
|
using Robust.Shared.Random;
|
||||||
using TimedDespawnComponent = Robust.Shared.Spawners.TimedDespawnComponent;
|
using TimedDespawnComponent = Robust.Shared.Spawners.TimedDespawnComponent;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace Content.Server.StationEvents.Events;
|
namespace Content.Server.StationEvents.Events;
|
||||||
|
|
||||||
@@ -19,7 +21,10 @@ public sealed class ImmovableRodRule : StationEventSystem<ImmovableRodRuleCompon
|
|||||||
{
|
{
|
||||||
base.Started(uid, component, gameRule, args);
|
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))
|
if (proto.TryGetComponent<ImmovableRodComponent>(out var rod) && proto.TryGetComponent<TimedDespawnComponent>(out var despawn))
|
||||||
{
|
{
|
||||||
TryFindRandomTile(out _, out _, out _, out var targetCoords);
|
TryFindRandomTile(out _, out _, out _, out var targetCoords);
|
||||||
@@ -27,12 +32,12 @@ public sealed class ImmovableRodRule : StationEventSystem<ImmovableRodRuleCompon
|
|||||||
var angle = RobustRandom.NextAngle();
|
var angle = RobustRandom.NextAngle();
|
||||||
var direction = angle.ToVec();
|
var direction = angle.ToVec();
|
||||||
var spawnCoords = targetCoords.ToMap(EntityManager, _transform).Offset(-direction * speed * despawn.Lifetime / 2);
|
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);
|
_gun.ShootProjectile(ent, direction, Vector2.Zero, uid, speed: speed);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Sawmill.Error($"Invalid immovable rod prototype: {component.RodPrototype}");
|
Sawmill.Error($"Invalid immovable rod prototype: {protoName}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,3 +60,86 @@
|
|||||||
components:
|
components:
|
||||||
- type: ImmovableRod
|
- type: ImmovableRod
|
||||||
randomizeVelocity: false
|
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
|
||||||
|
|||||||
@@ -454,6 +454,31 @@
|
|||||||
earliestStart: 45
|
earliestStart: 45
|
||||||
minimumPlayers: 20
|
minimumPlayers: 20
|
||||||
- type: ImmovableRodRule
|
- 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
|
- type: entity
|
||||||
noSpawn: true
|
noSpawn: true
|
||||||
|
|||||||
Reference in New Issue
Block a user