Fix errors
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user