diff --git a/Content.Server/Cuffs/Components/CuffableComponent.cs b/Content.Server/Cuffs/Components/CuffableComponent.cs
index 3c15fdbb6c..024c68c8ef 100644
--- a/Content.Server/Cuffs/Components/CuffableComponent.cs
+++ b/Content.Server/Cuffs/Components/CuffableComponent.cs
@@ -177,7 +177,7 @@ namespace Content.Server.Cuffs.Components
///
/// The cuffed entity
/// Optional param for the handcuff entity to remove from the cuffed entity. If null, uses the most recently added handcuff entity.
- public async void TryUncuff(EntityUid user, EntityUid cuffsToRemove = default)
+ public async void TryUncuff(EntityUid user, EntityUid? cuffsToRemove = null)
{
if (_uncuffing) return;
@@ -194,7 +194,7 @@ namespace Content.Server.Cuffs.Components
}
else
{
- if (!Container.ContainedEntities.Contains(cuffsToRemove))
+ if (!Container.ContainedEntities.Contains(cuffsToRemove.Value))
{
Logger.Warning("A user is trying to remove handcuffs that aren't in the owner's container. This should never happen!");
}
@@ -220,13 +220,6 @@ namespace Content.Server.Cuffs.Components
return;
}
- // TODO: Why are we even doing this check?
- if (!cuffsToRemove.InRangeUnobstructed(Owner))
- {
- Logger.Warning("Handcuffs being removed from player are obstructed or too far away! This should not happen!");
- return;
- }
-
user.PopupMessage(Loc.GetString("cuffable-component-start-removing-cuffs-message"));
if (isOwner)
@@ -258,16 +251,18 @@ namespace Content.Server.Cuffs.Components
{
SoundSystem.Play(Filter.Pvs(Owner), cuff.EndUncuffSound.GetSound(), Owner);
- Container.ForceRemove(cuffsToRemove);
- _entMan.GetComponent(cuffsToRemove).AttachToGridOrMap();
- _entMan.GetComponent(cuffsToRemove).WorldPosition = _entMan.GetComponent(Owner).WorldPosition;
+ Container.ForceRemove(cuffsToRemove.Value);
+ var transform = _entMan.GetComponent(cuffsToRemove.Value);
+ transform.AttachToGridOrMap();
+ transform.WorldPosition = _entMan.GetComponent(Owner).WorldPosition;
if (cuff.BreakOnRemove)
{
cuff.Broken = true;
- _entMan.GetComponent(cuffsToRemove).EntityName = cuff.BrokenName;
- _entMan.GetComponent(cuffsToRemove).EntityDescription = cuff.BrokenDesc;
+ var meta = _entMan.GetComponent(cuffsToRemove.Value);
+ meta.EntityName = cuff.BrokenName;
+ meta.EntityDescription = cuff.BrokenDesc;
if (_entMan.TryGetComponent(cuffsToRemove, out var sprite) && cuff.BrokenState != null)
{
diff --git a/Content.Server/Morgue/Components/MorgueEntityStorageComponent.cs b/Content.Server/Morgue/Components/MorgueEntityStorageComponent.cs
index 1900b36a47..e4faa794ba 100644
--- a/Content.Server/Morgue/Components/MorgueEntityStorageComponent.cs
+++ b/Content.Server/Morgue/Components/MorgueEntityStorageComponent.cs
@@ -42,7 +42,7 @@ namespace Content.Server.Morgue.Components
private string? _trayPrototypeId;
[ViewVariables]
- private EntityUid _tray;
+ private EntityUid? _tray;
[ViewVariables]
public ContainerSlot? TrayContainer { get; private set; }
@@ -67,7 +67,7 @@ namespace Content.Server.Morgue.Components
public override Vector2 ContentsDumpPosition()
{
if (_tray != null)
- return _entMan.GetComponent(_tray).WorldPosition;
+ return _entMan.GetComponent(_tray.Value).WorldPosition;
return base.ContentsDumpPosition();
}
@@ -103,15 +103,15 @@ namespace Content.Server.Morgue.Components
if (_tray == null)
{
_tray = _entMan.SpawnEntity(_trayPrototypeId, _entMan.GetComponent(Owner).Coordinates);
- var trayComp = _tray.EnsureComponent();
+ var trayComp = _tray.Value.EnsureComponent();
trayComp.Morgue = Owner;
}
else
{
- TrayContainer?.Remove(_tray);
+ TrayContainer?.Remove(_tray.Value);
}
- _entMan.GetComponent(_tray).Coordinates = new EntityCoordinates(Owner, 0, -1);
+ _entMan.GetComponent(_tray.Value).Coordinates = new EntityCoordinates(Owner, 0, -1);
base.OpenStorage();
}
@@ -143,7 +143,7 @@ namespace Content.Server.Morgue.Components
if (_tray != null)
{
- TrayContainer?.Insert(_tray);
+ TrayContainer?.Insert(_tray.Value);
}
}
@@ -155,7 +155,7 @@ namespace Content.Server.Morgue.Components
}
var entityLookup = IoCManager.Resolve();
- foreach (var entity in entityLookup.GetEntitiesIntersecting(_tray, flags: LookupFlags.None))
+ foreach (var entity in entityLookup.GetEntitiesIntersecting(_tray.Value, flags: LookupFlags.None))
{
yield return entity;
}