Files
crystall-punk-14/Content.Server/StationEvents/Events/BluespaceArtifactRule.cs
Nemanja 161fd6c83c Mega Antag Refactor (#25786)
* Mega Antag Refactor

* last minute delta save

* more workshopping

* more shit

* ok tested this for once

* okkkkk sure

* generic delays for starting rules

* well darn

* nukies partially

* ouagh

* ballin' faded and smonkin wed

* obliterated the diff

* Spread my arms and soak up congratulations

* I've got plenty of love, but nothing to show for it

* but there’s too much sunlight
Shining on my laptop monitor, so I
Can’t see anything with any amount of clarity

* ok this junk

* OOK!

* fubar

* most of sloth's review

* oh boy

* eek

* hell yea!

* ASDFJASDJFvsakcvjkzjnhhhyh
2024-04-25 11:31:45 +10:00

36 lines
1.4 KiB
C#

using Content.Server.GameTicking.Components;
using Content.Server.GameTicking.Rules.Components;
using Content.Server.StationEvents.Components;
using Robust.Shared.Random;
namespace Content.Server.StationEvents.Events;
public sealed class BluespaceArtifactRule : StationEventSystem<BluespaceArtifactRuleComponent>
{
protected override void Added(EntityUid uid, BluespaceArtifactRuleComponent component, GameRuleComponent gameRule, GameRuleAddedEvent args)
{
base.Added(uid, component, gameRule, args);
var str = Loc.GetString("bluespace-artifact-event-announcement",
("sighting", Loc.GetString(RobustRandom.Pick(component.PossibleSighting))));
ChatSystem.DispatchGlobalAnnouncement(str, colorOverride: Color.FromHex("#18abf5"));
}
protected override void Started(EntityUid uid, BluespaceArtifactRuleComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args)
{
base.Started(uid, component, gameRule, args);
var amountToSpawn = 1;
for (var i = 0; i < amountToSpawn; i++)
{
if (!TryFindRandomTile(out _, out _, out _, out var coords))
return;
Spawn(component.ArtifactSpawnerPrototype, coords);
Spawn(component.ArtifactFlashPrototype, coords);
Sawmill.Info($"Spawning random artifact at {coords}");
}
}
}