Enable nullability in Content.Server (#3685)
This commit is contained in:
@@ -1,14 +1,12 @@
|
||||
using Content.Server.GameObjects.Components.Body.Circulatory;
|
||||
using System;
|
||||
using Content.Server.GameObjects.Components.Body.Circulatory;
|
||||
using Content.Server.GameObjects.Components.Chemistry;
|
||||
using Content.Shared.Chemistry;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using System;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Collision;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Projectiles
|
||||
{
|
||||
@@ -18,7 +16,7 @@ namespace Content.Server.GameObjects.Components.Projectiles
|
||||
public override string Name => "ChemicalInjectionProjectile";
|
||||
|
||||
[ViewVariables]
|
||||
private SolutionContainerComponent _solutionContainer;
|
||||
private SolutionContainerComponent _solutionContainer = default!;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("transferAmount")]
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Content.Server.GameObjects.Components.Projectiles
|
||||
|
||||
void IStartCollide.CollideWith(IPhysBody ourBody, IPhysBody otherBody, in Manifold manifold)
|
||||
{
|
||||
if (Owner.TryGetComponent(out ExplosiveComponent explosive))
|
||||
if (Owner.TryGetComponent(out ExplosiveComponent? explosive))
|
||||
{
|
||||
explosive.Explosion();
|
||||
}
|
||||
|
||||
@@ -6,11 +6,8 @@ using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Dynamics;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Projectiles
|
||||
{
|
||||
@@ -47,13 +44,13 @@ namespace Content.Server.GameObjects.Components.Projectiles
|
||||
[DataField("spriteName")]
|
||||
private string _spriteName = "Objects/Weapons/Guns/Projectiles/laser.png";
|
||||
[DataField("muzzleFlash")]
|
||||
private string _muzzleFlash;
|
||||
private string? _muzzleFlash;
|
||||
[DataField("impactFlash")]
|
||||
private string _impactFlash;
|
||||
private string? _impactFlash;
|
||||
[DataField("soundHitWall")]
|
||||
private string _soundHitWall = "/Audio/Weapons/Guns/Hits/laser_sear_wall.ogg";
|
||||
|
||||
public void FireEffects(IEntity user, float distance, Angle angle, IEntity hitEntity = null)
|
||||
public void FireEffects(IEntity user, float distance, Angle angle, IEntity? hitEntity = null)
|
||||
{
|
||||
var effectSystem = EntitySystem.Get<EffectSystem>();
|
||||
_startTime = _gameTiming.CurTime;
|
||||
@@ -97,7 +94,7 @@ namespace Content.Server.GameObjects.Components.Projectiles
|
||||
});
|
||||
}
|
||||
|
||||
private EffectSystemMessage MuzzleFlash(EntityCoordinates grid, Angle angle)
|
||||
private EffectSystemMessage? MuzzleFlash(EntityCoordinates grid, Angle angle)
|
||||
{
|
||||
if (_muzzleFlash == null)
|
||||
{
|
||||
@@ -143,7 +140,7 @@ namespace Content.Server.GameObjects.Components.Projectiles
|
||||
return message;
|
||||
}
|
||||
|
||||
private EffectSystemMessage ImpactFlash(float distance, Angle angle)
|
||||
private EffectSystemMessage? ImpactFlash(float distance, Angle angle)
|
||||
{
|
||||
if (_impactFlash == null)
|
||||
{
|
||||
|
||||
@@ -8,7 +8,6 @@ using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Collision;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
@@ -30,15 +29,14 @@ namespace Content.Server.GameObjects.Components.Projectiles
|
||||
set => _damages = value;
|
||||
}
|
||||
|
||||
public bool DeleteOnCollide => _deleteOnCollide;
|
||||
[DataField("delete_on_collide")]
|
||||
private bool _deleteOnCollide = true;
|
||||
[field: DataField("delete_on_collide")]
|
||||
public bool DeleteOnCollide { get; } = true;
|
||||
|
||||
// Get that juicy FPS hit sound
|
||||
[DataField("soundHit")]
|
||||
private string _soundHit = default;
|
||||
private string? _soundHit = default;
|
||||
[DataField("soundHitSpecies")]
|
||||
private string _soundHitSpecies = default;
|
||||
private string? _soundHitSpecies = default;
|
||||
|
||||
private bool _damagedEntity;
|
||||
|
||||
@@ -65,7 +63,7 @@ namespace Content.Server.GameObjects.Components.Projectiles
|
||||
return;
|
||||
}
|
||||
|
||||
if (otherBody.Entity.TryGetComponent(out IDamageableComponent damage) && _soundHitSpecies != null)
|
||||
if (otherBody.Entity.TryGetComponent(out IDamageableComponent? damage) && _soundHitSpecies != null)
|
||||
{
|
||||
EntitySystem.Get<AudioSystem>().PlayAtCoords(_soundHitSpecies, otherBody.Entity.Transform.Coordinates);
|
||||
}
|
||||
@@ -87,7 +85,7 @@ namespace Content.Server.GameObjects.Components.Projectiles
|
||||
}
|
||||
|
||||
// Damaging it can delete it
|
||||
if (!otherBody.Entity.Deleted && otherBody.Entity.TryGetComponent(out CameraRecoilComponent recoilComponent))
|
||||
if (!otherBody.Entity.Deleted && otherBody.Entity.TryGetComponent(out CameraRecoilComponent? recoilComponent))
|
||||
{
|
||||
var direction = ourBody.LinearVelocity.Normalized;
|
||||
recoilComponent.Kick(direction);
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
using Content.Server.GameObjects.Components.Mobs;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Collision;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Projectiles
|
||||
{
|
||||
@@ -32,7 +31,7 @@ namespace Content.Server.GameObjects.Components.Projectiles
|
||||
|
||||
void IStartCollide.CollideWith(IPhysBody ourBody, IPhysBody otherBody, in Manifold manifold)
|
||||
{
|
||||
if (otherBody.Entity.TryGetComponent(out StunnableComponent stunnableComponent))
|
||||
if (otherBody.Entity.TryGetComponent(out StunnableComponent? stunnableComponent))
|
||||
{
|
||||
stunnableComponent.Stun(_stunAmount);
|
||||
stunnableComponent.Knockdown(_knockdownAmount);
|
||||
|
||||
Reference in New Issue
Block a user