Fix more errors

This commit is contained in:
DrSmugleaf
2021-12-06 00:52:58 +01:00
parent 2b1fecbe02
commit 215cae5655
55 changed files with 262 additions and 297 deletions

View File

@@ -1,11 +1,10 @@
using System;
using Content.Server.RCD.Components;
using Content.Shared.Examine;
using Content.Shared.Hands.Components;
using Content.Shared.Interaction;
using Content.Shared.Popups;
using Robust.Shared.GameObjects;
using Robust.Shared.Localization;
using System;
namespace Content.Server.RCD.Systems
{
@@ -29,7 +28,8 @@ namespace Content.Server.RCD.Systems
if (args.Handled || !args.CanReach)
return;
if (args.Target == null || !EntityManager.TryGetComponent(args.Target, out RCDComponent? rcdComponent))
if (args.Target is not {Valid: true} target ||
!EntityManager.TryGetComponent(target, out RCDComponent? rcdComponent))
return;
if (rcdComponent.MaxAmmo - rcdComponent.CurrentAmmo < component.RefillAmmo)

View File

@@ -8,6 +8,7 @@ using Content.Shared.Interaction;
using Content.Shared.Interaction.Helpers;
using Content.Shared.Maps;
using Content.Shared.Popups;
using Content.Shared.Tag;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
@@ -117,10 +118,9 @@ namespace Content.Server.RCD.Systems
}
else //Delete what the user targeted
{
EntityUid tempQualifier = args.Target;
if (tempQualifier != null)
if (args.Target is {Valid: true} target)
{
IoCManager.Resolve<IEntityManager>().DeleteEntity(tempQualifier);
EntityManager.DeleteEntity(target);
}
}
break;
@@ -189,7 +189,7 @@ namespace Content.Server.RCD.Systems
return false;
}
//They tried to decon a non-turf but it's not in the whitelist
if (eventArgs.Target != null && !eventArgs.Target.HasTag("RCDDeconstructWhitelist"))
if (eventArgs.Target != null && !eventArgs.Target.Value.HasTag("RCDDeconstructWhitelist"))
{
rcd.Owner.PopupMessage(eventArgs.User, Loc.GetString("rcd-component-deconstruct-target-not-on-whitelist-message"));
return false;