fixes a bunch of warnings

This commit is contained in:
Paul
2021-12-20 13:58:30 +01:00
parent 21174366b7
commit d4d85b663f
68 changed files with 113 additions and 168 deletions

View File

@@ -14,9 +14,6 @@ namespace Content.Client.Body.UI
[ViewVariables]
private BodyScannerDisplay? _display;
[ViewVariables]
private EntityUid _entity;
public BodyScannerBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey) { }
protected override void Open()
@@ -43,7 +40,7 @@ namespace Content.Client.Body.UI
throw new ArgumentException($"Received an invalid entity with id {scannerState.Uid} for body scanner with id {Owner.Owner} at {entMan.GetComponent<TransformComponent>(Owner.Owner).MapPosition}");
}
_display?.UpdateDisplay(_entity);
_display?.UpdateDisplay(scannerState.Uid);
}
protected override void Dispose(bool disposing)

View File

@@ -104,7 +104,7 @@ namespace Content.Client.Body.UI
public void UpdateDisplay(EntityUid entity)
{
if(entity == null)
if(!entity.Valid)
return;
_currentEntity = entity;
@@ -125,12 +125,7 @@ namespace Content.Client.Body.UI
public void BodyPartOnItemSelected(ItemListSelectedEventArgs args)
{
if (_currentEntity == null)
return;
var body = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<SharedBodyComponent>(_currentEntity);
if (body == null)
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<SharedBodyComponent>(_currentEntity, out var body))
{
return;
}