Try fix time offset serialization issues (#17580)
This commit is contained in:
@@ -75,7 +75,7 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem
|
||||
{
|
||||
RaiseNetworkEvent(new PlayBoxEffectMessage(uid, component.Mover.Value));
|
||||
_audio.PlayPvs(component.EffectSound, uid);
|
||||
component.EffectCooldown = _timing.CurTime + CardboardBoxComponent.MaxEffectCooldown;
|
||||
component.EffectCooldown = _timing.CurTime + component.CooldownDuration;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ public sealed class AnomalyPulsingComponent : Component
|
||||
/// The time at which the pulse will be over.
|
||||
/// </summary>
|
||||
[DataField("endTime", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)]
|
||||
public TimeSpan EndTime = TimeSpan.MaxValue;
|
||||
public TimeSpan EndTime;
|
||||
|
||||
/// <summary>
|
||||
/// How long the pulse visual lasts
|
||||
|
||||
@@ -14,7 +14,7 @@ public sealed class AnomalySupercriticalComponent : Component
|
||||
/// The time when the supercritical animation ends and it does whatever effect.
|
||||
/// </summary>
|
||||
[DataField("endTime", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)]
|
||||
public TimeSpan EndTime = TimeSpan.MaxValue;
|
||||
public TimeSpan EndTime;
|
||||
|
||||
/// <summary>
|
||||
/// The length of the animation before it goes supercritical.
|
||||
|
||||
@@ -46,18 +46,16 @@ public sealed class CardboardBoxComponent : Component
|
||||
public float Distance = 6f;
|
||||
|
||||
/// <summary>
|
||||
/// Current time + max effect cooldown to check to see if effect can play again
|
||||
/// Prevents effect spam
|
||||
/// Time at which the sound effect can next be played.
|
||||
/// </summary>
|
||||
[DataField("effectCooldown", customTypeSerializer: typeof(TimeOffsetSerializer))]
|
||||
public TimeSpan EffectCooldown = TimeSpan.FromSeconds(1f);
|
||||
public TimeSpan EffectCooldown;
|
||||
|
||||
/// <summary>
|
||||
/// How much time should pass + current time until the effect plays again
|
||||
/// Prevents effect spam
|
||||
/// Time between sound effects. Prevents effect spam
|
||||
/// </summary>
|
||||
[DataField("maxEffectCooldown", customTypeSerializer: typeof(TimeOffsetSerializer))]
|
||||
public static readonly TimeSpan MaxEffectCooldown = TimeSpan.FromSeconds(5f);
|
||||
[DataField("cooldownDuration")]
|
||||
public readonly TimeSpan CooldownDuration = TimeSpan.FromSeconds(5f);
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
|
||||
@@ -18,5 +18,5 @@ public sealed class EmitSoundOnCollideComponent : BaseEmitSoundComponent
|
||||
/// To avoid sound spam add a cooldown to it.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("nextSound", customTypeSerializer: typeof(TimeOffsetSerializer))]
|
||||
public TimeSpan NextSound = TimeSpan.FromSeconds(0.2);
|
||||
public TimeSpan NextSound;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user