Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mirror: Immovable Rod visual variations #371

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -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();
}
13 changes: 9 additions & 4 deletions Content.Server/StationEvents/Events/ImmovableRodRule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -19,20 +21,23 @@ protected override void Started(EntityUid uid, ImmovableRodRuleComponent compone
{
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 speed = RobustRandom.NextFloat(rod.MinSpeed, rod.MaxSpeed);
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}");
}
}
}
83 changes: 83 additions & 0 deletions Resources/Prototypes/Entities/Objects/Fun/immovable_rod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
53 changes: 39 additions & 14 deletions Resources/Prototypes/GameRules/events.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading