From 3cf41ef3c842afccba153377d7c5392ccf0f8b94 Mon Sep 17 00:00:00 2001 From: deltanedas <@deltanedas:kde.org> Date: Sun, 22 Dec 2024 15:57:52 +0000 Subject: [PATCH] predict redeeming properly --- .../DeltaV/Salvage/Systems/MiningVoucherSystem.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Content.Shared/DeltaV/Salvage/Systems/MiningVoucherSystem.cs b/Content.Shared/DeltaV/Salvage/Systems/MiningVoucherSystem.cs index b5d5a00472d..30b44eef493 100644 --- a/Content.Shared/DeltaV/Salvage/Systems/MiningVoucherSystem.cs +++ b/Content.Shared/DeltaV/Salvage/Systems/MiningVoucherSystem.cs @@ -4,13 +4,17 @@ using Content.Shared.Power.EntitySystems; using Content.Shared.Whitelist; using Robust.Shared.Audio.Systems; +using Robust.Shared.Network; using Robust.Shared.Prototypes; +using Robust.Shared.Timing; namespace Content.Shared.DeltaV.Salvage.Systems; public sealed class MiningVoucherSystem : EntitySystem { [Dependency] private readonly EntityWhitelistSystem _whitelist = default!; + [Dependency] private readonly IGameTiming _timing = default!; + [Dependency] private readonly INetManager _net = default!; [Dependency] private readonly IPrototypeManager _proto = default!; [Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly SharedPopupSystem _popup = default!; @@ -50,7 +54,10 @@ private void OnAfterInteract(Entity ent, ref AfterIntera return; } - _audio.PlayPvs(ent.Comp.RedeemSound, target); + if (!_timing.IsFirstTimePredicted) + return; + + _audio.PlayPredicted(ent.Comp.RedeemSound, target, user); Redeem(ent, index, user); } @@ -71,6 +78,9 @@ private void OnSelect(Entity ent, ref MiningVoucherSelec public void Redeem(Entity ent, int index, EntityUid user) { + if (_net.IsClient) + return; + var kit = _proto.Index(ent.Comp.Kits[index]); var xform = Transform(ent); foreach (var id in kit.Content)