Enable nullability in Content.Server (#3685)

This commit is contained in:
DrSmugleaf
2021-03-16 15:50:20 +01:00
committed by GitHub
parent 90fec0ed24
commit a5ade526b7
306 changed files with 1616 additions and 1441 deletions

View File

@@ -29,7 +29,7 @@ namespace Content.Server.GameObjects.Components.Interactable
[ViewVariables]
private float _stateExpiryTime = default;
private AppearanceComponent _appearance = default;
private AppearanceComponent? _appearance = default;
bool IUse.UseEntity(UseEntityEventArgs eventArgs)
{
@@ -64,7 +64,7 @@ namespace Content.Server.GameObjects.Components.Interactable
CurrentState = ExpendableLightState.Lit;
_stateExpiryTime = GlowDuration;
UpdateSpriteAndSounds(Activated);
UpdateVisualizer();
@@ -79,25 +79,22 @@ namespace Content.Server.GameObjects.Components.Interactable
switch (CurrentState)
{
case ExpendableLightState.Lit:
_appearance.SetData(ExpendableLightVisuals.State, TurnOnBehaviourID);
_appearance?.SetData(ExpendableLightVisuals.State, TurnOnBehaviourID);
break;
case ExpendableLightState.Fading:
_appearance.SetData(ExpendableLightVisuals.State, FadeOutBehaviourID);
_appearance?.SetData(ExpendableLightVisuals.State, FadeOutBehaviourID);
break;
case ExpendableLightState.Dead:
_appearance.SetData(ExpendableLightVisuals.State, string.Empty);
break;
default:
_appearance?.SetData(ExpendableLightVisuals.State, string.Empty);
break;
}
}
private void UpdateSpriteAndSounds(bool on)
{
if (Owner.TryGetComponent(out SpriteComponent sprite))
if (Owner.TryGetComponent(out SpriteComponent? sprite))
{
switch (CurrentState)
{
@@ -145,7 +142,7 @@ namespace Content.Server.GameObjects.Components.Interactable
}
}
if (Owner.TryGetComponent(out ClothingComponent clothing))
if (Owner.TryGetComponent(out ClothingComponent? clothing))
{
clothing.ClothingEquippedPrefix = on ? "Activated" : string.Empty;
}