Fix errors

This commit is contained in:
DrSmugleaf
2021-12-05 21:02:04 +01:00
parent 2a3b7d809d
commit ab9d0cc6d8
94 changed files with 568 additions and 591 deletions

View File

@@ -12,6 +12,8 @@ namespace Content.Server.Nutrition
[AdminCommand(AdminFlags.Debug)]
public class Hungry : IConsoleCommand
{
[Dependency] private readonly IEntityManager _entities = default!;
public string Command => "hungry";
public string Description => "Makes you hungry.";
public string Help => $"{Command}";
@@ -25,13 +27,13 @@ namespace Content.Server.Nutrition
return;
}
if (player.AttachedEntity == null)
if (player.AttachedEntity is not {Valid: true} playerEntity)
{
shell.WriteLine("You cannot use this command without an entity.");
return;
}
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(player.AttachedEntity, out HungerComponent? hunger))
if (!_entities.TryGetComponent(playerEntity, out HungerComponent? hunger))
{
shell.WriteLine($"Your entity does not have a {nameof(HungerComponent)} component.");
return;