Refactor serialization copying to use source generators (#19412)
This commit is contained in:
@@ -6,6 +6,6 @@ namespace Content.Shared.DoAfter;
|
||||
/// Added to entities that are currently performing any doafters.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed class ActiveDoAfterComponent : Component
|
||||
public sealed partial class ActiveDoAfterComponent : Component
|
||||
{
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Content.Shared.DoAfter;
|
||||
[Serializable, NetSerializable]
|
||||
[DataDefinition]
|
||||
[Access(typeof(SharedDoAfterSystem))]
|
||||
public sealed class DoAfter
|
||||
public sealed partial class DoAfter
|
||||
{
|
||||
[DataField("index", required:true)]
|
||||
public ushort Index;
|
||||
@@ -16,7 +16,7 @@ public sealed class DoAfter
|
||||
public DoAfterId Id => new(Args.User, Index);
|
||||
|
||||
[IncludeDataField]
|
||||
public readonly DoAfterArgs Args = default!;
|
||||
public DoAfterArgs Args = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Time at which this do after was started.
|
||||
|
||||
@@ -5,38 +5,38 @@ namespace Content.Shared.DoAfter;
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
[DataDefinition]
|
||||
public sealed class DoAfterArgs
|
||||
public sealed partial class DoAfterArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// The entity invoking do_after
|
||||
/// </summary>
|
||||
[DataField("user", required: true)]
|
||||
public readonly EntityUid User;
|
||||
public EntityUid User;
|
||||
|
||||
/// <summary>
|
||||
/// How long does the do_after require to complete
|
||||
/// </summary>
|
||||
[DataField("delay", required: true)]
|
||||
public readonly TimeSpan Delay;
|
||||
public TimeSpan Delay;
|
||||
|
||||
/// <summary>
|
||||
/// Applicable target (if relevant)
|
||||
/// </summary>
|
||||
[DataField("target")]
|
||||
public readonly EntityUid? Target;
|
||||
public EntityUid? Target;
|
||||
|
||||
/// <summary>
|
||||
/// Entity used by the User on the Target.
|
||||
/// </summary>
|
||||
[DataField("using")]
|
||||
public readonly EntityUid? Used;
|
||||
public EntityUid? Used;
|
||||
|
||||
#region Event options
|
||||
/// <summary>
|
||||
/// The event that will get raised when the DoAfter has finished. If null, this will simply raise a <see cref="SimpleDoAfterEvent"/>
|
||||
/// </summary>
|
||||
[DataField("event", required: true)]
|
||||
public readonly DoAfterEvent Event = default!;
|
||||
public DoAfterEvent Event = default!;
|
||||
|
||||
/// <summary>
|
||||
/// This option determines how frequently the DoAfterAttempt event will get raised. Defaults to never raising the
|
||||
@@ -49,7 +49,7 @@ public sealed class DoAfterArgs
|
||||
/// Entity which will receive the directed event. If null, no directed event will be raised.
|
||||
/// </summary>
|
||||
[DataField("eventTarget")]
|
||||
public readonly EntityUid? EventTarget;
|
||||
public EntityUid? EventTarget;
|
||||
|
||||
/// <summary>
|
||||
/// Should the DoAfter event broadcast? If this is false, then <see cref="EventTarget"/> should be a valid entity.
|
||||
|
||||
@@ -6,13 +6,13 @@ namespace Content.Shared.DoAfter;
|
||||
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
[Access(typeof(SharedDoAfterSystem))]
|
||||
public sealed class DoAfterComponent : Component
|
||||
public sealed partial class DoAfterComponent : Component
|
||||
{
|
||||
[DataField("nextId")]
|
||||
public ushort NextId;
|
||||
|
||||
[DataField("doAfters")]
|
||||
public readonly Dictionary<ushort, DoAfter> DoAfters = new();
|
||||
public Dictionary<ushort, DoAfter> DoAfters = new();
|
||||
|
||||
// Used by obsolete async do afters
|
||||
public readonly Dictionary<ushort, TaskCompletionSource<DoAfterStatus>> AwaitedDoAfters = new();
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Content.Shared.DoAfter;
|
||||
/// </summary>
|
||||
[Serializable, NetSerializable]
|
||||
[ImplicitDataDefinitionForInheritors]
|
||||
public abstract class DoAfterEvent : HandledEntityEventArgs
|
||||
public abstract partial class DoAfterEvent : HandledEntityEventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// The do after that triggered this event. This will be set by the do after system before the event is raised.
|
||||
@@ -44,7 +44,7 @@ public abstract class DoAfterEvent : HandledEntityEventArgs
|
||||
/// If an event actually contains data, it should actually override Clone().
|
||||
/// </remarks>
|
||||
[Serializable, NetSerializable]
|
||||
public abstract class SimpleDoAfterEvent : DoAfterEvent
|
||||
public abstract partial class SimpleDoAfterEvent : DoAfterEvent
|
||||
{
|
||||
// TODO: Find some way to enforce that inheritors don't store data?
|
||||
// Alternatively, I just need to allow generics to be networked.
|
||||
@@ -57,7 +57,7 @@ public abstract class SimpleDoAfterEvent : DoAfterEvent
|
||||
// Placeholder for obsolete async do afters
|
||||
[Serializable, NetSerializable]
|
||||
[Obsolete("Dont use async DoAfters")]
|
||||
public sealed class AwaitedDoAfterEvent : SimpleDoAfterEvent
|
||||
public sealed partial class AwaitedDoAfterEvent : SimpleDoAfterEvent
|
||||
{
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public sealed class AwaitedDoAfterEvent : SimpleDoAfterEvent
|
||||
/// This event will optionally get raised every tick while a do-after is in progress to check whether the do-after
|
||||
/// should be canceled.
|
||||
/// </summary>
|
||||
public sealed class DoAfterAttemptEvent<TEvent> : CancellableEntityEventArgs where TEvent : DoAfterEvent
|
||||
public sealed partial class DoAfterAttemptEvent<TEvent> : CancellableEntityEventArgs where TEvent : DoAfterEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// The do after that triggered this event.
|
||||
|
||||
Reference in New Issue
Block a user