Content fixes for timeoffsets (#15934)
This commit is contained in:
@@ -17,6 +17,6 @@ public sealed class EmitSoundOnCollideComponent : BaseEmitSoundComponent
|
||||
/// <summary>
|
||||
/// To avoid sound spam add a cooldown to it.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("nextSound", customTypeSerializer:typeof(TimeOffsetSerializer))]
|
||||
public TimeSpan NextSound;
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("nextSound", customTypeSerializer: typeof(TimeOffsetSerializer))]
|
||||
public TimeSpan NextSound = TimeSpan.FromSeconds(0.2);
|
||||
}
|
||||
|
||||
@@ -39,6 +39,8 @@ public abstract class SharedEmitSoundSystem : EntitySystem
|
||||
SubscribeLocalEvent<EmitSoundOnActivateComponent, ActivateInWorldEvent>(OnEmitSoundOnActivateInWorld);
|
||||
SubscribeLocalEvent<EmitSoundOnPickupComponent, GotEquippedHandEvent>(OnEmitSoundOnPickup);
|
||||
SubscribeLocalEvent<EmitSoundOnDropComponent, DroppedEvent>(OnEmitSoundOnDrop);
|
||||
|
||||
SubscribeLocalEvent<EmitSoundOnCollideComponent, EntityUnpausedEvent>(OnEmitSoundUnpaused);
|
||||
SubscribeLocalEvent<EmitSoundOnCollideComponent, StartCollideEvent>(OnEmitSoundOnCollide);
|
||||
}
|
||||
|
||||
@@ -112,6 +114,11 @@ public abstract class SharedEmitSoundSystem : EntitySystem
|
||||
}
|
||||
}
|
||||
|
||||
private void OnEmitSoundUnpaused(EntityUid uid, EmitSoundOnCollideComponent component, ref EntityUnpausedEvent args)
|
||||
{
|
||||
component.NextSound += args.PausedTime;
|
||||
}
|
||||
|
||||
private void OnEmitSoundOnCollide(EntityUid uid, EmitSoundOnCollideComponent component, ref StartCollideEvent args)
|
||||
{
|
||||
if (!args.OurFixture.Hard ||
|
||||
|
||||
Reference in New Issue
Block a user