Missing nullables (#8634)
This commit is contained in:
@@ -15,14 +15,14 @@ public abstract class AlertsSystem : EntitySystem
|
||||
|
||||
public IReadOnlyDictionary<AlertKey, AlertState>? GetActiveAlerts(EntityUid euid)
|
||||
{
|
||||
return EntityManager.TryGetComponent(euid, out AlertsComponent comp)
|
||||
return EntityManager.TryGetComponent(euid, out AlertsComponent? comp)
|
||||
? comp.Alerts
|
||||
: null;
|
||||
}
|
||||
|
||||
public bool IsShowingAlert(EntityUid euid, AlertType alertType)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent(euid, out AlertsComponent alertsComponent))
|
||||
if (!EntityManager.TryGetComponent(euid, out AlertsComponent? alertsComponent))
|
||||
return false;
|
||||
|
||||
if (TryGet(alertType, out var alert))
|
||||
@@ -37,13 +37,13 @@ public abstract class AlertsSystem : EntitySystem
|
||||
/// <returns>true iff an alert of the indicated alert category is currently showing</returns>
|
||||
public bool IsShowingAlertCategory(EntityUid euid, AlertCategory alertCategory)
|
||||
{
|
||||
return EntityManager.TryGetComponent(euid, out AlertsComponent alertsComponent)
|
||||
return EntityManager.TryGetComponent(euid, out AlertsComponent? alertsComponent)
|
||||
&& alertsComponent.Alerts.ContainsKey(AlertKey.ForCategory(alertCategory));
|
||||
}
|
||||
|
||||
public bool TryGetAlertState(EntityUid euid, AlertKey key, out AlertState alertState)
|
||||
{
|
||||
if (EntityManager.TryGetComponent(euid, out AlertsComponent alertsComponent))
|
||||
if (EntityManager.TryGetComponent(euid, out AlertsComponent? alertsComponent))
|
||||
return alertsComponent.Alerts.TryGetValue(key, out alertState);
|
||||
|
||||
alertState = default;
|
||||
@@ -62,7 +62,7 @@ public abstract class AlertsSystem : EntitySystem
|
||||
/// be erased if there is currently a cooldown for the alert)</param>
|
||||
public void ShowAlert(EntityUid euid, AlertType alertType, short? severity = null, (TimeSpan, TimeSpan)? cooldown = null)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent(euid, out AlertsComponent alertsComponent))
|
||||
if (!EntityManager.TryGetComponent(euid, out AlertsComponent? alertsComponent))
|
||||
return;
|
||||
|
||||
if (TryGet(alertType, out var alert))
|
||||
@@ -100,7 +100,7 @@ public abstract class AlertsSystem : EntitySystem
|
||||
/// </summary>
|
||||
public void ClearAlertCategory(EntityUid euid, AlertCategory category)
|
||||
{
|
||||
if(!EntityManager.TryGetComponent(euid, out AlertsComponent alertsComponent))
|
||||
if(!EntityManager.TryGetComponent(euid, out AlertsComponent? alertsComponent))
|
||||
return;
|
||||
|
||||
var key = AlertKey.ForCategory(category);
|
||||
@@ -119,7 +119,7 @@ public abstract class AlertsSystem : EntitySystem
|
||||
/// </summary>
|
||||
public void ClearAlert(EntityUid euid, AlertType alertType)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent(euid, out AlertsComponent alertsComponent))
|
||||
if (!EntityManager.TryGetComponent(euid, out AlertsComponent? alertsComponent))
|
||||
return;
|
||||
|
||||
if (TryGet(alertType, out var alert))
|
||||
|
||||
@@ -88,7 +88,7 @@ public sealed class CameraRecoilSystem : EntitySystem
|
||||
|
||||
private void HandleCameraKick(CameraKickEvent args)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent(args.Euid, out CameraRecoilComponent recoil))
|
||||
if (!EntityManager.TryGetComponent(args.Euid, out CameraRecoilComponent? recoil))
|
||||
{
|
||||
_log.Warning($"Received a kick for euid {args.Euid}, but it is missing required components.");
|
||||
return;
|
||||
|
||||
@@ -165,7 +165,7 @@ namespace Content.Shared.Containers.ItemSlots
|
||||
if (args.Handled)
|
||||
return;
|
||||
|
||||
if (!EntityManager.TryGetComponent(args.User, out SharedHandsComponent hands))
|
||||
if (!EntityManager.TryGetComponent(args.User, out SharedHandsComponent? hands))
|
||||
return;
|
||||
|
||||
foreach (var slot in itemSlots.Slots.Values)
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Content.Shared.Examine
|
||||
public bool IsInDetailsRange(EntityUid examiner, EntityUid entity)
|
||||
{
|
||||
// check if the mob is in ciritcal or dead
|
||||
if (EntityManager.TryGetComponent(examiner, out MobStateComponent mobState) && mobState.IsIncapacitated())
|
||||
if (EntityManager.TryGetComponent(examiner, out MobStateComponent? mobState) && mobState.IsIncapacitated())
|
||||
return false;
|
||||
|
||||
if (!_interactionSystem.InRangeUnobstructed(examiner, entity, ExamineDetailsRange))
|
||||
|
||||
@@ -90,13 +90,13 @@ namespace Content.Shared.Item
|
||||
|
||||
public void RemovedFromSlot()
|
||||
{
|
||||
if (_entMan.TryGetComponent(Owner, out SharedSpriteComponent component))
|
||||
if (_entMan.TryGetComponent(Owner, out SharedSpriteComponent? component))
|
||||
component.Visible = true;
|
||||
}
|
||||
|
||||
public virtual void EquippedToSlot()
|
||||
{
|
||||
if (_entMan.TryGetComponent(Owner, out SharedSpriteComponent component))
|
||||
if (_entMan.TryGetComponent(Owner, out SharedSpriteComponent? component))
|
||||
component.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user