DoAfter & misc interaction fixes (#15144)
This commit is contained in:
@@ -92,8 +92,20 @@ public sealed class EncryptionKeySystem : EntitySystem
|
||||
if ( args.Handled || !TryComp<ContainerManagerComponent>(uid, out var storage))
|
||||
return;
|
||||
|
||||
args.Handled = true;
|
||||
if (HasComp<EncryptionKeyComponent>(args.Used))
|
||||
{
|
||||
args.Handled = true;
|
||||
TryInsertKey(uid, component, args);
|
||||
}
|
||||
else if (TryComp<ToolComponent>(args.Used, out var tool) && tool.Qualities.Contains(component.KeysExtractionMethod))
|
||||
{
|
||||
args.Handled = true;
|
||||
TryRemoveKey(uid, component, args, tool);
|
||||
}
|
||||
}
|
||||
|
||||
private void TryInsertKey(EntityUid uid, EncryptionKeyHolderComponent component, InteractUsingEvent args)
|
||||
{
|
||||
if (!component.KeysUnlocked)
|
||||
{
|
||||
if (_net.IsClient && _timing.IsFirstTimePredicted)
|
||||
@@ -101,18 +113,6 @@ public sealed class EncryptionKeySystem : EntitySystem
|
||||
return;
|
||||
}
|
||||
|
||||
if (TryComp<EncryptionKeyComponent>(args.Used, out var key))
|
||||
{
|
||||
TryInsertKey(uid, component, args);
|
||||
}
|
||||
else
|
||||
{
|
||||
TryRemoveKey(uid, component, args);
|
||||
}
|
||||
}
|
||||
|
||||
private void TryInsertKey(EntityUid uid, EncryptionKeyHolderComponent component, InteractUsingEvent args)
|
||||
{
|
||||
if (TryComp<WiresPanelComponent>(uid, out var panel) && !panel.Open)
|
||||
{
|
||||
if (_net.IsClient && _timing.IsFirstTimePredicted)
|
||||
@@ -137,10 +137,15 @@ public sealed class EncryptionKeySystem : EntitySystem
|
||||
}
|
||||
}
|
||||
|
||||
private void TryRemoveKey(EntityUid uid, EncryptionKeyHolderComponent component, InteractUsingEvent args)
|
||||
private void TryRemoveKey(EntityUid uid, EncryptionKeyHolderComponent component, InteractUsingEvent args,
|
||||
ToolComponent? tool)
|
||||
{
|
||||
if (!TryComp<ToolComponent>(args.Used, out var tool) || !tool.Qualities.Contains(component.KeysExtractionMethod))
|
||||
if (!component.KeysUnlocked)
|
||||
{
|
||||
if (_net.IsClient && _timing.IsFirstTimePredicted)
|
||||
_popup.PopupEntity(Loc.GetString("encryption-keys-are-locked"), uid, args.User);
|
||||
return;
|
||||
}
|
||||
|
||||
if (TryComp<WiresPanelComponent>(uid, out var panel) && !panel.Open)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user