Hacking protections for airlocks (#18894)

* Adds the ability to better protect to the internal wiring of airlocks
- Achieved by opening the maintenance panel, adding either steel or plasteel to the airlock, then welding the plate in place
- To access the wiring, the plating must be cut with a welder and then pried out with a crowbar

* Code revisions
- Cleaned up the code
- Cutting the security grille can now shock you
- Atmospherics and Security dept airlocks start with a medium level of protection (a welded steel plate)
- Command dept airlocks start with a high level of protection (a welded plasteel plate and electrified security grille)

* Code revision
- Accounted for a potentially null string

* Update Content.Server/Construction/Completions/AttemptElectrocute.cs

Co-authored-by: Slava0135 <40753025+Slava0135@users.noreply.github.com>

* Update ChangeWiresPanelSecurityLevel.cs

Adjusted scope

* Update Content.Shared/Wires/SharedWiresSystem.cs

Co-authored-by: Slava0135 <40753025+Slava0135@users.noreply.github.com>

* Update Content.Shared/Wires/SharedWiresSystem.cs

Co-authored-by: Slava0135 <40753025+Slava0135@users.noreply.github.com>

* Update ChangeWiresPanelSecurityLevel.cs

Removed get / setter and added [ValidatePrototypeId] attribute

* Update ChangeWiresPanelSecurityLevel.cs

Set security level to "Level0" as the default

* Update airlock.yml

Removed 'super max' level of security

* Update WiresPanelSecurityLevelPrototype.cs

* Update WiresSystem.cs

Added check for WiresAccessible to OnInteractUsing

* Update AttemptElectrocute.cs

File scoped namespace

* Update ChangeWiresPanelSecurityLevel.cs

File scoped namespace

* Update AirlockSystem.cs

File scoped namespace

* Update SharedWiresSystem.cs

Removed boiler plate 'OnGetState' and 'OnHandleState'

* Update WiresPanelComponent.cs

Implemented AutoGenerateComponentState

* Removed unnecessary usage references

* use TryCloseAll when wires not accessible

* minor changes to AttemmptElectrocute

* lets try all 7 levels

* fix indent in airlock graph

* fix indent 2

---------

Co-authored-by: Slava0135 <40753025+Slava0135@users.noreply.github.com>
Co-authored-by: Slava0135 <super.novalskiy_0135@inbox.ru>
This commit is contained in:
chromiumboy
2023-08-10 03:33:03 -05:00
committed by GitHub
parent 13991d3948
commit 636819f4e3
13 changed files with 557 additions and 231 deletions

View File

@@ -31,6 +31,7 @@ public sealed class WiresSystem : SharedWiresSystem
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly WiresSystem _wiresSystem = default!;
// This is where all the wire layouts are stored.
[ViewVariables] private readonly Dictionary<string, WireLayout> _layouts = new();
@@ -455,7 +456,7 @@ public sealed class WiresSystem : SharedWiresSystem
if (!TryComp<ToolComponent>(args.Used, out var tool) || !TryComp<WiresPanelComponent>(uid, out var panel))
return;
if (panel.Open &&
if (panel.Open && panel.WiresAccessible &&
(_toolSystem.HasQuality(args.Used, "Cutting", tool) ||
_toolSystem.HasQuality(args.Used, "Pulsing", tool)))
{
@@ -631,6 +632,23 @@ public sealed class WiresSystem : SharedWiresSystem
Dirty(component);
}
public void SetWiresPanelSecurityData(EntityUid uid, WiresPanelComponent component, string wiresPanelSecurityLevelID)
{
var wiresPanelSecurityLevelPrototype = _protoMan.Index<WiresPanelSecurityLevelPrototype>(wiresPanelSecurityLevelID);
if (wiresPanelSecurityLevelPrototype == null)
return;
component.WiresAccessible = wiresPanelSecurityLevelPrototype.WiresAccessible;
component.WiresPanelSecurityExamination = wiresPanelSecurityLevelPrototype.Examine;
Dirty(component);
if (wiresPanelSecurityLevelPrototype?.WiresAccessible == false)
{
_uiSystem.TryCloseAll(uid, WiresUiKey.Key);
}
}
private void UpdateAppearance(EntityUid uid, WiresPanelComponent panel)
{
if (TryComp<AppearanceComponent>(uid, out var appearance))