Airlock hacking (#329)
* Airlock hacking * Added status text * Whoops don't need this * Update Content.Server/GameObjects/Components/Doors/AirlockComponent.cs Co-Authored-By: Pieter-Jan Briers <pieterjan.briers@gmail.com> * ComponentReference ServerDoorComponent * Suggested name
This commit is contained in:
committed by
Pieter-Jan Briers
parent
34f4731c9b
commit
36078382e4
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Server.GameObjects.Components.Doors;
|
||||
using Content.Server.GameObjects.Components.Interactable.Tools;
|
||||
using Content.Server.GameObjects.Components.VendingMachines;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
@@ -50,6 +52,11 @@ namespace Content.Server.GameObjects.Components
|
||||
/// </summary>
|
||||
public readonly List<Wire> WiresList = new List<Wire>();
|
||||
|
||||
/// <summary>
|
||||
/// Status messages are displayed at the bottom of the UI.
|
||||
/// </summary>
|
||||
private readonly Dictionary<object, string> _statuses = new Dictionary<object, string>();
|
||||
|
||||
/// <summary>
|
||||
/// As seen on /vg/station.
|
||||
/// <see cref="AssignColor"/> and <see cref="WiresBuilder.CreateWire"/>.
|
||||
@@ -90,6 +97,17 @@ namespace Content.Server.GameObjects.Components
|
||||
UpdateUserInterface();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns whether the wire associated with <see cref="identifier"/> is cut.
|
||||
/// </summary>
|
||||
/// <exception cref="ArgumentException"></exception>
|
||||
public bool IsWireCut(object identifier)
|
||||
{
|
||||
var wire = WiresList.Find(x => x.Identifier.Equals(identifier));
|
||||
if(wire == null) throw new ArgumentException();
|
||||
return wire.IsCut;
|
||||
}
|
||||
|
||||
public class Wire
|
||||
{
|
||||
/// <summary>
|
||||
@@ -233,7 +251,7 @@ namespace Content.Server.GameObjects.Components
|
||||
{
|
||||
clientList.Add(new ClientWire(entry.Guid, entry.Color, entry.IsCut));
|
||||
}
|
||||
_userInterface.SetState(new WiresBoundUserInterfaceState(clientList));
|
||||
_userInterface.SetState(new WiresBoundUserInterfaceState(clientList, _statuses.Values.ToList()));
|
||||
}
|
||||
|
||||
bool IAttackBy.AttackBy(AttackByEventArgs eventArgs)
|
||||
@@ -247,5 +265,18 @@ namespace Content.Server.GameObjects.Components
|
||||
{
|
||||
message.AddText($"The maintenance panel is {(IsOpen ? "open" : "closed")}.");
|
||||
}
|
||||
|
||||
public void SetStatus(object statusIdentifier, string newMessage)
|
||||
{
|
||||
if (_statuses.TryGetValue(statusIdentifier, out var storedMessage))
|
||||
{
|
||||
if (storedMessage == newMessage)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
_statuses[statusIdentifier] = newMessage;
|
||||
UpdateUserInterface();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user