xenoarch inhands + a few effects (#12655)

This commit is contained in:
Nemanja
2022-11-17 18:10:45 -05:00
committed by GitHub
parent 786a4d461c
commit 257a9db5c1
33 changed files with 229 additions and 2 deletions

View File

@@ -0,0 +1,25 @@
using Content.Server.Instruments;
using Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Components;
using Content.Shared.Instruments;
using Robust.Shared.Random;
namespace Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Systems;
public sealed class RandomInstrumentArtifactSystem : EntitySystem
{
[Dependency] private readonly InstrumentSystem _instrument = default!;
[Dependency] private readonly IRobustRandom _random = default!;
/// <inheritdoc/>
public override void Initialize()
{
SubscribeLocalEvent<RandomInstrumentArtifactComponent, ComponentStartup>(OnStartup);
}
private void OnStartup(EntityUid uid, RandomInstrumentArtifactComponent component, ComponentStartup args)
{
if (!TryComp<SharedInstrumentComponent>(uid, out var instrument))
return;
_instrument.SetInstrumentProgram(instrument, (byte) _random.Next(0, 127), 0);
}
}