Try fix time offset serialization issues (#17580)

This commit is contained in:
Leon Friedrich
2023-06-26 08:36:35 +12:00
committed by GitHub
parent 082aed2f5a
commit 6f76ae4720
5 changed files with 11 additions and 13 deletions

View File

@@ -75,7 +75,7 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem
{ {
RaiseNetworkEvent(new PlayBoxEffectMessage(uid, component.Mover.Value)); RaiseNetworkEvent(new PlayBoxEffectMessage(uid, component.Mover.Value));
_audio.PlayPvs(component.EffectSound, uid); _audio.PlayPvs(component.EffectSound, uid);
component.EffectCooldown = _timing.CurTime + CardboardBoxComponent.MaxEffectCooldown; component.EffectCooldown = _timing.CurTime + component.CooldownDuration;
} }
} }
} }

View File

@@ -12,7 +12,7 @@ public sealed class AnomalyPulsingComponent : Component
/// The time at which the pulse will be over. /// The time at which the pulse will be over.
/// </summary> /// </summary>
[DataField("endTime", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)] [DataField("endTime", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)]
public TimeSpan EndTime = TimeSpan.MaxValue; public TimeSpan EndTime;
/// <summary> /// <summary>
/// How long the pulse visual lasts /// How long the pulse visual lasts

View File

@@ -14,7 +14,7 @@ public sealed class AnomalySupercriticalComponent : Component
/// The time when the supercritical animation ends and it does whatever effect. /// The time when the supercritical animation ends and it does whatever effect.
/// </summary> /// </summary>
[DataField("endTime", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)] [DataField("endTime", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)]
public TimeSpan EndTime = TimeSpan.MaxValue; public TimeSpan EndTime;
/// <summary> /// <summary>
/// The length of the animation before it goes supercritical. /// The length of the animation before it goes supercritical.

View File

@@ -46,18 +46,16 @@ public sealed class CardboardBoxComponent : Component
public float Distance = 6f; public float Distance = 6f;
/// <summary> /// <summary>
/// Current time + max effect cooldown to check to see if effect can play again /// Time at which the sound effect can next be played.
/// Prevents effect spam
/// </summary> /// </summary>
[DataField("effectCooldown", customTypeSerializer: typeof(TimeOffsetSerializer))] [DataField("effectCooldown", customTypeSerializer: typeof(TimeOffsetSerializer))]
public TimeSpan EffectCooldown = TimeSpan.FromSeconds(1f); public TimeSpan EffectCooldown;
/// <summary> /// <summary>
/// How much time should pass + current time until the effect plays again /// Time between sound effects. Prevents effect spam
/// Prevents effect spam
/// </summary> /// </summary>
[DataField("maxEffectCooldown", customTypeSerializer: typeof(TimeOffsetSerializer))] [DataField("cooldownDuration")]
public static readonly TimeSpan MaxEffectCooldown = TimeSpan.FromSeconds(5f); public readonly TimeSpan CooldownDuration = TimeSpan.FromSeconds(5f);
} }
[Serializable, NetSerializable] [Serializable, NetSerializable]

View File

@@ -18,5 +18,5 @@ public sealed class EmitSoundOnCollideComponent : BaseEmitSoundComponent
/// To avoid sound spam add a cooldown to it. /// To avoid sound spam add a cooldown to it.
/// </summary> /// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField("nextSound", customTypeSerializer: typeof(TimeOffsetSerializer))] [ViewVariables(VVAccess.ReadWrite), DataField("nextSound", customTypeSerializer: typeof(TimeOffsetSerializer))]
public TimeSpan NextSound = TimeSpan.FromSeconds(0.2); public TimeSpan NextSound;
} }