Enable nullability in Content.Server (#3685)
This commit is contained in:
@@ -20,7 +20,7 @@ namespace Content.Server.GlobalVerbs
|
||||
return;
|
||||
}
|
||||
|
||||
if (!user.TryGetComponent(out IActorComponent actor))
|
||||
if (!user.TryGetComponent(out IActorComponent? actor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -38,7 +38,7 @@ namespace Content.Server.GlobalVerbs
|
||||
|
||||
public override void Activate(IEntity user, IEntity target)
|
||||
{
|
||||
if (!user.TryGetComponent(out IActorComponent actor))
|
||||
if (!user.TryGetComponent(out IActorComponent? actor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Content.Server.GlobalVerbs
|
||||
return;
|
||||
}
|
||||
|
||||
if (!user.TryGetComponent(out IActorComponent actor))
|
||||
if (!user.TryGetComponent(out IActorComponent? actor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -37,7 +37,7 @@ namespace Content.Server.GlobalVerbs
|
||||
|
||||
public override void Activate(IEntity user, IEntity target)
|
||||
{
|
||||
if (!user.TryGetComponent(out IActorComponent actor))
|
||||
if (!user.TryGetComponent(out IActorComponent? actor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Content.Server.GlobalVerbs
|
||||
return;
|
||||
}
|
||||
|
||||
if (!user.TryGetComponent(out IActorComponent actor))
|
||||
if (!user.TryGetComponent(out IActorComponent? actor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -37,7 +37,7 @@ namespace Content.Server.GlobalVerbs
|
||||
|
||||
public override void Activate(IEntity user, IEntity target)
|
||||
{
|
||||
if (!user.TryGetComponent(out IActorComponent actor))
|
||||
if (!user.TryGetComponent(out IActorComponent? actor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -52,15 +52,15 @@ namespace Content.Server.GlobalVerbs
|
||||
return;
|
||||
}
|
||||
|
||||
var userMind = player.ContentData().Mind;
|
||||
var userMind = player.ContentData()?.Mind;
|
||||
|
||||
var targetMind = target.GetComponent<MindComponent>();
|
||||
var oldEntity = userMind.CurrentEntity;
|
||||
var oldEntity = userMind?.CurrentEntity;
|
||||
|
||||
targetMind.Mind?.TransferTo(null);
|
||||
userMind.TransferTo(target);
|
||||
userMind?.TransferTo(target);
|
||||
|
||||
if (oldEntity.HasComponent<GhostComponent>())
|
||||
if (oldEntity != null && oldEntity.HasComponent<GhostComponent>())
|
||||
oldEntity.Delete();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Content.Server.GlobalVerbs
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
|
||||
if (!user.TryGetComponent(out IActorComponent actor))
|
||||
if (!user.TryGetComponent(out IActorComponent? actor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -36,7 +36,7 @@ namespace Content.Server.GlobalVerbs
|
||||
|
||||
public override void Activate(IEntity user, IEntity target)
|
||||
{
|
||||
if (!user.TryGetComponent(out IActorComponent actor))
|
||||
if (!user.TryGetComponent(out IActorComponent? actor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace Content.Server.GlobalVerbs
|
||||
|
||||
public override void Activate(IEntity user, IEntity target)
|
||||
{
|
||||
if (!user.TryGetComponent(out IActorComponent actor))
|
||||
if (!user.TryGetComponent(out IActorComponent? actor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -57,37 +57,37 @@ namespace Content.Server.GlobalVerbs
|
||||
|
||||
public static void PerformRejuvenate(IEntity target)
|
||||
{
|
||||
if (target.TryGetComponent(out IDamageableComponent damage))
|
||||
if (target.TryGetComponent(out IDamageableComponent? damage))
|
||||
{
|
||||
damage.Heal();
|
||||
}
|
||||
|
||||
if (target.TryGetComponent(out IMobStateComponent mobState))
|
||||
if (target.TryGetComponent(out IMobStateComponent? mobState))
|
||||
{
|
||||
mobState.UpdateState(0);
|
||||
}
|
||||
|
||||
if (target.TryGetComponent(out HungerComponent hunger))
|
||||
if (target.TryGetComponent(out HungerComponent? hunger))
|
||||
{
|
||||
hunger.ResetFood();
|
||||
}
|
||||
|
||||
if (target.TryGetComponent(out ThirstComponent thirst))
|
||||
if (target.TryGetComponent(out ThirstComponent? thirst))
|
||||
{
|
||||
thirst.ResetThirst();
|
||||
}
|
||||
|
||||
if (target.TryGetComponent(out StunnableComponent stun))
|
||||
if (target.TryGetComponent(out StunnableComponent? stun))
|
||||
{
|
||||
stun.ResetStuns();
|
||||
}
|
||||
|
||||
if (target.TryGetComponent(out FlammableComponent flammable))
|
||||
if (target.TryGetComponent(out FlammableComponent? flammable))
|
||||
{
|
||||
flammable.Extinguish();
|
||||
}
|
||||
|
||||
if (target.TryGetComponent(out CreamPiedComponent creamPied))
|
||||
if (target.TryGetComponent(out CreamPiedComponent? creamPied))
|
||||
{
|
||||
creamPied.Wash();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user