2021-02-12 10:45:22 +01:00
|
|
|
using Content.Server.Holiday.Greet;
|
|
|
|
|
using Content.Server.Holiday.Interfaces;
|
|
|
|
|
using Content.Server.Holiday.ShouldCelebrate;
|
|
|
|
|
using Robust.Shared.Prototypes;
|
|
|
|
|
|
|
|
|
|
namespace Content.Server.Holiday
|
|
|
|
|
{
|
|
|
|
|
[Prototype("holiday")]
|
2023-11-01 19:56:23 -07:00
|
|
|
public sealed partial class HolidayPrototype : IPrototype
|
2021-02-12 10:45:22 +01:00
|
|
|
{
|
2022-11-16 20:22:11 +01:00
|
|
|
[DataField("name")] public string Name { get; private set; } = string.Empty;
|
2021-03-05 01:08:38 +01:00
|
|
|
|
|
|
|
|
[ViewVariables]
|
2023-01-19 03:56:45 +01:00
|
|
|
[IdDataField]
|
2023-08-22 18:14:33 -07:00
|
|
|
public string ID { get; private set; } = default!;
|
2021-03-05 01:08:38 +01:00
|
|
|
|
|
|
|
|
[DataField("beginDay")]
|
|
|
|
|
public byte BeginDay { get; set; } = 1;
|
|
|
|
|
|
|
|
|
|
[DataField("beginMonth")]
|
|
|
|
|
public Month BeginMonth { get; set; } = Month.Invalid;
|
2021-02-12 10:45:22 +01:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Day this holiday will end. Zero means it lasts a single day.
|
|
|
|
|
/// </summary>
|
2021-03-05 01:08:38 +01:00
|
|
|
[DataField("endDay")]
|
|
|
|
|
public byte EndDay { get; set; }
|
2021-02-12 10:45:22 +01:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Month this holiday will end in. Invalid means it lasts a single month.
|
|
|
|
|
/// </summary>
|
2021-03-05 01:08:38 +01:00
|
|
|
[DataField("endMonth")]
|
|
|
|
|
public Month EndMonth { get; set; } = Month.Invalid;
|
2021-02-12 10:45:22 +01:00
|
|
|
|
2022-11-16 20:22:11 +01:00
|
|
|
[DataField("shouldCelebrate")]
|
2023-08-22 18:14:33 -07:00
|
|
|
private IHolidayShouldCelebrate _shouldCelebrate = new DefaultHolidayShouldCelebrate();
|
2021-02-12 10:45:22 +01:00
|
|
|
|
2022-11-16 20:22:11 +01:00
|
|
|
[DataField("greet")]
|
2023-08-22 18:14:33 -07:00
|
|
|
private IHolidayGreet _greet = new DefaultHolidayGreet();
|
2021-02-12 10:45:22 +01:00
|
|
|
|
2022-11-16 20:22:11 +01:00
|
|
|
[DataField("celebrate")]
|
2023-08-22 18:14:33 -07:00
|
|
|
private IHolidayCelebrate? _celebrate = null;
|
2021-02-12 10:45:22 +01:00
|
|
|
|
|
|
|
|
public bool ShouldCelebrate(DateTime date)
|
|
|
|
|
{
|
|
|
|
|
return _shouldCelebrate.ShouldCelebrate(date, this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string Greet()
|
|
|
|
|
{
|
|
|
|
|
return _greet.Greet(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Called before the round starts to set up any festive shenanigans.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void Celebrate()
|
|
|
|
|
{
|
2023-08-06 14:47:45 +12:00
|
|
|
_celebrate?.Celebrate(this);
|
2021-02-12 10:45:22 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|