* 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>
102 lines
3.7 KiB
C#
102 lines
3.7 KiB
C#
#nullable enable
|
|
using Content.Server.GameObjects.EntitySystems;
|
|
using Content.Server.GameObjects.EntitySystems.StationEvents;
|
|
using JetBrains.Annotations;
|
|
using Robust.Server.Interfaces.Console;
|
|
using Robust.Server.Interfaces.Player;
|
|
using Robust.Shared.GameObjects.Systems;
|
|
using Robust.Shared.Localization;
|
|
|
|
namespace Content.Client.Commands
|
|
{
|
|
[UsedImplicitly]
|
|
public sealed class StationEventCommand : IClientCommand
|
|
{
|
|
public string Command => "events";
|
|
public string Description => "Provides admin control to station events";
|
|
public string Help => "events <list/pause/resume/random/stop/run <eventname>>\n" +
|
|
"list: return all event names that can be run\n " +
|
|
"pause: stop all random events from running\n" +
|
|
"resume: allow random events to run again\n" +
|
|
"random: choose a random event that is valid and run it\n" +
|
|
"run: start a particular event now; <eventname> is case-insensitive and not localized";
|
|
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
|
{
|
|
if (args.Length == 0)
|
|
{
|
|
shell.SendText(player, "Need more args");
|
|
return;
|
|
}
|
|
|
|
if (args[0] == "list")
|
|
{
|
|
var resultText = "Random\n" + EntitySystem.Get<StationEventSystem>().GetEventNames();
|
|
shell.SendText(player, resultText);
|
|
return;
|
|
}
|
|
|
|
// Didn't use a "toggle" so it's explicit
|
|
if (args[0] == "pause")
|
|
{
|
|
var stationEventSystem = EntitySystem.Get<StationEventSystem>();
|
|
|
|
if (!stationEventSystem.Enabled)
|
|
{
|
|
shell.SendText(player, Loc.GetString("Station events are already paused"));
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
stationEventSystem.Enabled = false;
|
|
shell.SendText(player, Loc.GetString("Station events paused"));
|
|
return;
|
|
}
|
|
}
|
|
|
|
if (args[0] == "resume")
|
|
{
|
|
var stationEventSystem = EntitySystem.Get<StationEventSystem>();
|
|
|
|
if (stationEventSystem.Enabled)
|
|
{
|
|
shell.SendText(player, Loc.GetString("Station events are already running"));
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
stationEventSystem.Enabled = true;
|
|
shell.SendText(player, Loc.GetString("Station events resumed"));
|
|
return;
|
|
}
|
|
}
|
|
|
|
if (args[0] == "stop")
|
|
{
|
|
var resultText = EntitySystem.Get<StationEventSystem>().StopEvent();
|
|
shell.SendText(player, resultText);
|
|
return;
|
|
}
|
|
|
|
if (args[0] == "run" && args.Length == 2)
|
|
{
|
|
var eventName = args[1];
|
|
string resultText;
|
|
|
|
if (eventName == "random")
|
|
{
|
|
resultText = EntitySystem.Get<StationEventSystem>().RunRandomEvent();
|
|
}
|
|
else
|
|
{
|
|
resultText = EntitySystem.Get<StationEventSystem>().RunEvent(eventName);
|
|
}
|
|
|
|
shell.SendText(player, resultText);
|
|
return;
|
|
}
|
|
|
|
shell.SendText(player, Loc.GetString("Invalid events command"));
|
|
return;
|
|
}
|
|
}
|
|
} |