Wires patches (#8385)

This commit is contained in:
Flipp Syder
2022-05-23 16:00:51 -07:00
committed by GitHub
parent 8cb336b07a
commit 80a68b3867
5 changed files with 74 additions and 52 deletions

View File

@@ -240,6 +240,7 @@ public sealed class WiresSystem : EntitySystem
SetOrCreateWireLayout(uid, component);
UpdateUserInterface(uid);
UpdateAppearance(uid);
}
#endregion
@@ -536,7 +537,7 @@ public sealed class WiresSystem : EntitySystem
private void UpdateAppearance(EntityUid uid, AppearanceComponent? appearance = null, WiresComponent? wires = null)
{
if (!Resolve(uid, ref appearance, ref wires))
if (!Resolve(uid, ref appearance, ref wires, false))
return;
appearance.SetData(WiresVisuals.MaintenancePanelState, wires.IsPanelOpen && wires.IsPanelVisible);
@@ -676,14 +677,22 @@ public sealed class WiresSystem : EntitySystem
private void UpdateWires(EntityUid used, EntityUid user, EntityUid toolEntity, int id, WiresAction action, WiresComponent? wires = null, ToolComponent? tool = null)
{
if (!Resolve(used, ref wires)
|| !Resolve(toolEntity, ref tool))
if (!Resolve(used, ref wires))
return;
if (!Resolve(toolEntity, ref tool))
{
wires.WiresQueue.Remove(id);
return;
}
var wire = TryGetWire(used, id, wires);
if (wire == null)
{
wires.WiresQueue.Remove(id);
return;
}
switch (action)
{
@@ -691,7 +700,7 @@ public sealed class WiresSystem : EntitySystem
if (!_toolSystem.HasQuality(toolEntity, "Cutting", tool))
{
_popupSystem.PopupCursor(Loc.GetString("wires-component-ui-on-receive-message-need-wirecutters"), Filter.Entities(user));
return;
break;
}
_toolSystem.PlayToolSound(toolEntity, tool);
@@ -706,7 +715,7 @@ public sealed class WiresSystem : EntitySystem
if (!_toolSystem.HasQuality(toolEntity, "Cutting", tool))
{
_popupSystem.PopupCursor(Loc.GetString("wires-component-ui-on-receive-message-need-wirecutters"), Filter.Entities(user));
return;
break;
}
_toolSystem.PlayToolSound(toolEntity, tool);
@@ -721,13 +730,13 @@ public sealed class WiresSystem : EntitySystem
if (!_toolSystem.HasQuality(toolEntity, "Pulsing", tool))
{
_popupSystem.PopupCursor(Loc.GetString("wires-component-ui-on-receive-message-need-multitool"), Filter.Entities(user));
return;
break;
}
if (wire.IsCut)
{
_popupSystem.PopupCursor(Loc.GetString("wires-component-ui-on-receive-message-cannot-pulse-cut-wire"), Filter.Entities(user));
return;
break;
}
wire.Action.Pulse(user, wire);