2021-12-23 12:38:14 -06:00
|
|
|
using System.Linq;
|
|
|
|
|
using Content.Server.Holiday;
|
|
|
|
|
using Robust.Shared.GameObjects;
|
|
|
|
|
using Robust.Shared.IoC;
|
|
|
|
|
using Robust.Shared.Log;
|
|
|
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
|
|
|
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
|
|
|
|
|
|
|
|
|
|
namespace Content.Server.Maps.Conditions;
|
|
|
|
|
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class HolidayMapCondition : GameMapCondition
|
2021-12-23 12:38:14 -06:00
|
|
|
{
|
|
|
|
|
[DataField("holidays")]
|
|
|
|
|
public string[] Holidays { get; } = default!;
|
|
|
|
|
|
|
|
|
|
public override bool Check(GameMapPrototype map)
|
|
|
|
|
{
|
|
|
|
|
var holidaySystem = EntitySystem.Get<HolidaySystem>();
|
|
|
|
|
|
|
|
|
|
return Holidays.Any(holiday => holidaySystem.IsCurrentlyHoliday(holiday)) ^ Inverted;
|
|
|
|
|
}
|
|
|
|
|
}
|