using Content.Server.Interfaces.Chat;
using Robust.Server.GameObjects;
using Robust.Shared.IoC;
namespace Content.Server.StationEvents
{
public abstract class StationEvent
{
///
/// If the event has started and is currently running
///
public bool Running { get; protected set; }
///
/// Human-readable name for the event
///
public abstract string Name { get; }
public virtual StationEventWeight Weight { get; } = StationEventWeight.Normal;
///
/// What should be said in chat when the event starts (if anything).
///
protected virtual string StartAnnouncement { get; } = null;
///
/// What should be said in chat when the event end (if anything).
///
protected virtual string EndAnnouncement { get; } = null;
///
/// In minutes, when is the first time this event can start
///
///
public virtual int EarliestStart { get; } = 20;
///
/// How many players need to be present on station for the event to run
///
/// To avoid running deadly events with low-pop
public virtual int MinimumPlayers { get; } = 0;
///
/// How many times this event has run this round
///
public int Occurrences { get; set; } = 0;
///
/// How many times this even can occur in a single round
///
public virtual int? MaxOccurrences { get; } = null;
///
/// Called once when the station event starts
///
public virtual void Startup()
{
Running = true;
Occurrences += 1;
if (StartAnnouncement != null)
{
var chatManager = IoCManager.Resolve();
chatManager.DispatchStationAnnouncement(StartAnnouncement);
}
}
///
/// Called every tick when this event is active
///
///
public abstract void Update(float frameTime);
///
/// Called once when the station event ends
///
public virtual void Shutdown()
{
if (EndAnnouncement != null)
{
var chatManager = IoCManager.Resolve();
chatManager.DispatchStationAnnouncement(EndAnnouncement);
}
}
}
public enum StationEventWeight
{
VeryLow = 0,
Low = 5,
Normal = 10,
High = 15,
VeryHigh = 20,
}
}