Refactor serialization copying to use source generators (#19412)
This commit is contained in:
@@ -8,7 +8,7 @@ namespace Content.Server.Holiday.Christmas;
|
||||
/// This is used for granting items to lucky souls, exactly once.
|
||||
/// </summary>
|
||||
[RegisterComponent, Access(typeof(LimitedItemGiverSystem))]
|
||||
public sealed class LimitedItemGiverComponent : Component
|
||||
public sealed partial class LimitedItemGiverComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// Santa knows who you are behind the screen, only one gift per player per round!
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Content.Server.Holiday.Christmas;
|
||||
/// This is used for gifts with COMPLETELY random things.
|
||||
/// </summary>
|
||||
[RegisterComponent, Access(typeof(RandomGiftSystem))]
|
||||
public sealed class RandomGiftComponent : Component
|
||||
public sealed partial class RandomGiftComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// The wrapper entity to spawn when unwrapping the gift.
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
/// This is used as a marker component, allows them to see gift contents.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed class SantaComponent : Component
|
||||
public sealed partial class SantaComponent : Component
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Content.Server.Holiday.Greet
|
||||
{
|
||||
[UsedImplicitly]
|
||||
[DataDefinition]
|
||||
public sealed class Custom : IHolidayGreet
|
||||
public sealed partial class Custom : IHolidayGreet
|
||||
{
|
||||
[DataField("text")] private string _greet = string.Empty;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ using Content.Server.Holiday.Interfaces;
|
||||
namespace Content.Server.Holiday.Greet
|
||||
{
|
||||
[DataDefinition]
|
||||
public sealed class DefaultHolidayGreet : IHolidayGreet
|
||||
public sealed partial class DefaultHolidayGreet : IHolidayGreet
|
||||
{
|
||||
public string Greet(HolidayPrototype holiday)
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Content.Server.Holiday
|
||||
|
||||
[ViewVariables]
|
||||
[IdDataField]
|
||||
public string ID { get; } = default!;
|
||||
public string ID { get; private set; } = default!;
|
||||
|
||||
[DataField("beginDay")]
|
||||
public byte BeginDay { get; set; } = 1;
|
||||
@@ -33,13 +33,13 @@ namespace Content.Server.Holiday
|
||||
public Month EndMonth { get; set; } = Month.Invalid;
|
||||
|
||||
[DataField("shouldCelebrate")]
|
||||
private readonly IHolidayShouldCelebrate _shouldCelebrate = new DefaultHolidayShouldCelebrate();
|
||||
private IHolidayShouldCelebrate _shouldCelebrate = new DefaultHolidayShouldCelebrate();
|
||||
|
||||
[DataField("greet")]
|
||||
private readonly IHolidayGreet _greet = new DefaultHolidayGreet();
|
||||
private IHolidayGreet _greet = new DefaultHolidayGreet();
|
||||
|
||||
[DataField("celebrate")]
|
||||
private readonly IHolidayCelebrate? _celebrate = null;
|
||||
private IHolidayCelebrate? _celebrate = null;
|
||||
|
||||
public bool ShouldCelebrate(DateTime date)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace Content.Server.Holiday.Interfaces
|
||||
{
|
||||
[ImplicitDataDefinitionForInheritors]
|
||||
public interface IHolidayShouldCelebrate
|
||||
public partial interface IHolidayShouldCelebrate
|
||||
{
|
||||
bool ShouldCelebrate(DateTime date, HolidayPrototype holiday);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ using Content.Server.Holiday.Interfaces;
|
||||
|
||||
namespace Content.Server.Holiday.ShouldCelebrate
|
||||
{
|
||||
public sealed class ChineseNewYear : IHolidayShouldCelebrate
|
||||
public sealed partial class ChineseNewYear : IHolidayShouldCelebrate
|
||||
{
|
||||
public bool ShouldCelebrate(DateTime date, HolidayPrototype holiday)
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Content.Server.Holiday.ShouldCelebrate
|
||||
/// </summary>
|
||||
[UsedImplicitly]
|
||||
[DataDefinition]
|
||||
public sealed class Computus : DefaultHolidayShouldCelebrate
|
||||
public sealed partial class Computus : DefaultHolidayShouldCelebrate
|
||||
{
|
||||
[DataField("daysEarly")]
|
||||
private byte _daysEarly = 1;
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Content.Server.Holiday.ShouldCelebrate
|
||||
/// </summary>
|
||||
[UsedImplicitly]
|
||||
[DataDefinition]
|
||||
public sealed class DayOfYear : IHolidayShouldCelebrate
|
||||
public sealed partial class DayOfYear : IHolidayShouldCelebrate
|
||||
{
|
||||
[DataField("dayOfYear")]
|
||||
private uint _dayOfYear = 1;
|
||||
|
||||
@@ -3,7 +3,7 @@ using Content.Server.Holiday.Interfaces;
|
||||
namespace Content.Server.Holiday.ShouldCelebrate
|
||||
{
|
||||
[Virtual, DataDefinition]
|
||||
public class DefaultHolidayShouldCelebrate : IHolidayShouldCelebrate
|
||||
public partial class DefaultHolidayShouldCelebrate : IHolidayShouldCelebrate
|
||||
{
|
||||
public virtual bool ShouldCelebrate(DateTime date, HolidayPrototype holiday)
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Content.Server.Holiday.ShouldCelebrate
|
||||
/// For Friday the 13th. Spooky!
|
||||
/// </summary>
|
||||
[UsedImplicitly]
|
||||
public sealed class FridayThirteenth : IHolidayShouldCelebrate
|
||||
public sealed partial class FridayThirteenth : IHolidayShouldCelebrate
|
||||
{
|
||||
public bool ShouldCelebrate(DateTime date, HolidayPrototype holiday)
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Content.Server.Holiday.ShouldCelebrate
|
||||
/// For a holiday that happens the first instance of a weekday on a month.
|
||||
/// </summary>
|
||||
[UsedImplicitly]
|
||||
public sealed class WeekdayInMonth : DefaultHolidayShouldCelebrate
|
||||
public sealed partial class WeekdayInMonth : DefaultHolidayShouldCelebrate
|
||||
{
|
||||
[DataField("weekday")] private DayOfWeek _weekday = DayOfWeek.Monday;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user