Make more uids nullable (#5794)

This commit is contained in:
Leon Friedrich
2021-12-26 15:32:45 +13:00
committed by GitHub
parent 83114de0e4
commit afc3ae6335
42 changed files with 161 additions and 204 deletions

View File

@@ -128,7 +128,7 @@ namespace Content.Server.PowerCell.Components
/// <param name="user">(optional) the user to give the removed cell to.</param>
/// <param name="playSound">Should <see cref="CellRemoveSound"/> be played upon removal?</param>
/// <returns>The cell component of the entity that was removed, or null if removal failed.</returns>
public PowerCellComponent? EjectCell(EntityUid user, bool playSound = true)
public PowerCellComponent? EjectCell(EntityUid? user = null, bool playSound = true)
{
var cell = Cell;
if (cell == null || !CanRemoveCell) return null;
@@ -138,7 +138,7 @@ namespace Content.Server.PowerCell.Components
{
if (!_entities.TryGetComponent(user, out HandsComponent? hands) || !hands.PutInHand(_entities.GetComponent<ItemComponent>(cell.Owner)))
{
_entities.GetComponent<TransformComponent>(cell.Owner).Coordinates = _entities.GetComponent<TransformComponent>(user).Coordinates;
_entities.GetComponent<TransformComponent>(cell.Owner).Coordinates = _entities.GetComponent<TransformComponent>(user.Value).Coordinates;
}
}
else