Fix misc bugs (#15314)

This commit is contained in:
Leon Friedrich
2023-04-12 12:18:30 +12:00
committed by GitHub
parent d068c4f36b
commit 21378f6e41
9 changed files with 31 additions and 19 deletions

View File

@@ -56,9 +56,13 @@ public sealed class EncryptionKeySystem : EntitySystem
_hands.PickupOrDrop(args.User, ent);
}
// if tool use ever gets predicted this needs changing.
_popup.PopupEntity(Loc.GetString("encryption-keys-all-extracted"), uid, args.User);
_audio.PlayPvs(component.KeyExtractionSound, uid);
if (!_timing.IsFirstTimePredicted)
return;
// TODO add predicted pop-up overrides.
if (_net.IsServer)
_popup.PopupEntity(Loc.GetString("encryption-keys-all-extracted"), uid, args.User);
_audio.PlayPredicted(component.KeyExtractionSound, uid, args.User);
}
public void UpdateChannels(EntityUid uid, EncryptionKeyHolderComponent component)
@@ -89,7 +93,7 @@ public sealed class EncryptionKeySystem : EntitySystem
private void OnInteractUsing(EntityUid uid, EncryptionKeyHolderComponent component, InteractUsingEvent args)
{
if ( args.Handled || !TryComp<ContainerManagerComponent>(uid, out var storage))
if (args.Handled)
return;
if (HasComp<EncryptionKeyComponent>(args.Used))
@@ -97,7 +101,9 @@ public sealed class EncryptionKeySystem : EntitySystem
args.Handled = true;
TryInsertKey(uid, component, args);
}
else if (TryComp<ToolComponent>(args.Used, out var tool) && tool.Qualities.Contains(component.KeysExtractionMethod))
else if (TryComp<ToolComponent>(args.Used, out var tool)
&& tool.Qualities.Contains(component.KeysExtractionMethod)
&& component.KeyContainer.ContainedEntities.Count > 0) // dont block deconstruction
{
args.Handled = true;
TryRemoveKey(uid, component, args, tool);