2022-06-24 04:20:52 -04:00
|
|
|
using Content.Server.Atmos.Miasma;
|
2022-02-20 17:18:24 -07:00
|
|
|
using Content.Server.Body.Components;
|
|
|
|
|
using Content.Server.Body.Systems;
|
2022-04-11 06:46:35 -04:00
|
|
|
using Content.Server.Disease.Components;
|
|
|
|
|
using Content.Server.Disease;
|
2021-10-05 14:29:03 +11:00
|
|
|
using Content.Server.Nutrition.Components;
|
|
|
|
|
using Content.Server.Nutrition.EntitySystems;
|
2020-10-30 16:06:48 +01:00
|
|
|
using Content.Shared.Administration;
|
2021-10-05 14:29:03 +11:00
|
|
|
using Content.Shared.Damage;
|
2021-10-09 17:30:04 +02:00
|
|
|
using Content.Shared.Jittering;
|
2021-10-05 14:29:03 +11:00
|
|
|
using Content.Shared.Nutrition.Components;
|
2022-09-14 19:30:56 +02:00
|
|
|
using Content.Shared.Rejuvenate;
|
2021-10-15 14:45:04 -07:00
|
|
|
using Content.Shared.StatusEffect;
|
2021-02-11 01:13:03 -08:00
|
|
|
using Robust.Server.Player;
|
2021-02-01 16:49:43 -08:00
|
|
|
using Robust.Shared.Console;
|
2022-04-11 06:46:35 -04:00
|
|
|
|
2020-10-30 16:06:48 +01:00
|
|
|
namespace Content.Server.Administration.Commands
|
2019-10-13 09:30:44 -04:00
|
|
|
{
|
2020-10-30 16:06:48 +01:00
|
|
|
[AdminCommand(AdminFlags.Admin)]
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class RejuvenateCommand : IConsoleCommand
|
2019-10-13 09:30:44 -04:00
|
|
|
{
|
|
|
|
|
public string Command => "rejuvenate";
|
2021-06-21 02:13:54 +02:00
|
|
|
|
|
|
|
|
public string Description => Loc.GetString("rejuvenate-command-description");
|
|
|
|
|
|
|
|
|
|
public string Help => Loc.GetString("rejuvenate-command-help-text");
|
2019-10-13 09:30:44 -04:00
|
|
|
|
2021-02-01 16:49:43 -08:00
|
|
|
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
2019-10-13 09:30:44 -04:00
|
|
|
{
|
2021-12-05 18:09:01 +01:00
|
|
|
if (args.Length < 1 && shell.Player is IPlayerSession player) //Try to heal the users mob if applicable
|
2019-10-13 09:30:44 -04:00
|
|
|
{
|
2021-06-21 02:13:54 +02:00
|
|
|
shell.WriteLine(Loc.GetString("rejuvenate-command-self-heal-message"));
|
2021-12-06 15:34:46 +01:00
|
|
|
if (player.AttachedEntity == null)
|
2019-10-13 09:30:44 -04:00
|
|
|
{
|
2021-06-21 02:13:54 +02:00
|
|
|
shell.WriteLine(Loc.GetString("rejuvenate-command-no-entity-attached-message"));
|
2019-10-13 09:30:44 -04:00
|
|
|
return;
|
|
|
|
|
}
|
2021-12-06 15:34:46 +01:00
|
|
|
PerformRejuvenate(player.AttachedEntity.Value);
|
2019-10-13 09:30:44 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
|
|
|
|
foreach (var arg in args)
|
|
|
|
|
{
|
2021-12-05 18:09:01 +01:00
|
|
|
if (!EntityUid.TryParse(arg, out var entity) || !entityManager.EntityExists(entity))
|
2019-10-13 09:30:44 -04:00
|
|
|
{
|
2021-06-21 02:13:54 +02:00
|
|
|
shell.WriteLine(Loc.GetString("shell-could-not-find-entity",("entity", arg)));
|
2019-10-13 09:30:44 -04:00
|
|
|
continue;
|
|
|
|
|
}
|
2021-10-05 14:29:03 +11:00
|
|
|
PerformRejuvenate(entity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-05 18:09:01 +01:00
|
|
|
public static void PerformRejuvenate(EntityUid target)
|
2021-10-05 14:29:03 +11:00
|
|
|
{
|
2022-09-14 19:30:56 +02:00
|
|
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
|
|
|
|
entityManager.EventBus.RaiseLocalEvent(target, new RejuvenateEvent());
|
2019-10-13 09:30:44 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|