Files
tbd-station-14/Content.IntegrationTests/Tests/StationEvents/StationEventsSystemTest.cs
metalgearsloth 5962280d36 Station events (#1518)
* Station event system

Adds 2 basic events: (Power) GridCheck and RadiationStorm (based on the goonstation version).
The system itself to choose events is based on tgstation's implementation.
This also adds the event command that can be run to force specific events.

There's still some other TODO items for these to be complete, to my knowledge:
1. There's no worldspace DrawCircle method (though the radstorm could look a lot nicer with a shader).
2. The PlayGlobal power_off / power_on audio seems to cut out halfway-through
3. (I think this is a known issue) lights still emit light until you get closer in a gridcheck so PVS range might need bumping.

* Invariants for event names

* Fix random event shutdown

* Mix stereo announcements to mono

* Address feedback

* Remove redundant client system and use the overlay component instead
* Drop the server prefix

* Fix radiation overlay enum

* use entityquery instead

* zum's feedback

* Use EntityQuery

Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
2020-08-13 22:52:17 +02:00

44 lines
1.4 KiB
C#

using System.Threading.Tasks;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.GameObjects.EntitySystems.StationEvents;
using NUnit.Framework;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.Timing;
using Robust.Shared.IoC;
namespace Content.IntegrationTests.Tests.StationEvents
{
[TestFixture]
public class StationEventsSystemTest : ContentIntegrationTest
{
[Test]
public async Task Test()
{
var server = StartServerDummyTicker();
server.Assert(() =>
{
// Idle each event once
var stationEventsSystem = EntitySystem.Get<StationEventSystem>();
var dummyFrameTime = (float) IoCManager.Resolve<IGameTiming>().TickPeriod.TotalSeconds;
foreach (var stationEvent in stationEventsSystem.StationEvents)
{
stationEvent.Startup();
stationEvent.Update(dummyFrameTime);
stationEvent.Shutdown();
Assert.That(stationEvent.Occurrences == 1);
}
stationEventsSystem.ResettingCleanup();
foreach (var stationEvent in stationEventsSystem.StationEvents)
{
Assert.That(stationEvent.Occurrences == 0);
}
});
await server.WaitIdleAsync();
}
}
}