2020-08-13 14:40:27 +02:00
|
|
|
|
using Content.Server.GameObjects.Components.Damage;
|
2020-06-23 21:05:25 +02:00
|
|
|
|
using Content.Server.GameObjects.Components.Mobs;
|
2019-11-23 21:57:02 +01:00
|
|
|
|
using Content.Server.GameObjects.Components.Nutrition;
|
2020-08-13 14:40:27 +02:00
|
|
|
|
using Content.Shared.GameObjects.Verbs;
|
2019-11-23 21:57:02 +01:00
|
|
|
|
using Robust.Server.Console;
|
|
|
|
|
|
using Robust.Server.Interfaces.GameObjects;
|
|
|
|
|
|
using Robust.Shared.Interfaces.GameObjects;
|
|
|
|
|
|
using Robust.Shared.IoC;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Content.Server.GlobalVerbs
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Completely removes all damage from the DamageableComponent (heals the mob).
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[GlobalVerb]
|
|
|
|
|
|
class RejuvenateVerb : GlobalVerb
|
|
|
|
|
|
{
|
|
|
|
|
|
public override bool RequireInteractionRange => false;
|
2020-08-15 20:42:39 +02:00
|
|
|
|
public override bool BlockedByContainers => false;
|
2019-11-23 21:57:02 +01:00
|
|
|
|
|
2020-05-23 03:09:44 +02:00
|
|
|
|
public override void GetData(IEntity user, IEntity target, VerbData data)
|
2019-11-23 21:57:02 +01:00
|
|
|
|
{
|
2020-05-23 03:09:44 +02:00
|
|
|
|
data.Text = "Rejuvenate";
|
|
|
|
|
|
data.CategoryData = VerbCategories.Debug;
|
|
|
|
|
|
data.Visibility = VerbVisibility.Invisible;
|
|
|
|
|
|
|
2019-11-23 21:57:02 +01:00
|
|
|
|
var groupController = IoCManager.Resolve<IConGroupController>();
|
|
|
|
|
|
|
|
|
|
|
|
if (user.TryGetComponent<IActorComponent>(out var player))
|
|
|
|
|
|
{
|
2020-05-23 03:09:44 +02:00
|
|
|
|
if (!target.HasComponent<DamageableComponent>() && !target.HasComponent<HungerComponent>() &&
|
|
|
|
|
|
!target.HasComponent<ThirstComponent>())
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2019-11-23 21:57:02 +01:00
|
|
|
|
|
|
|
|
|
|
if (groupController.CanCommand(player.playerSession, "rejuvenate"))
|
2020-05-23 03:09:44 +02:00
|
|
|
|
{
|
|
|
|
|
|
data.Visibility = VerbVisibility.Visible;
|
|
|
|
|
|
}
|
2019-11-23 21:57:02 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override void Activate(IEntity user, IEntity target)
|
|
|
|
|
|
{
|
|
|
|
|
|
var groupController = IoCManager.Resolve<IConGroupController>();
|
|
|
|
|
|
if (user.TryGetComponent<IActorComponent>(out var player))
|
|
|
|
|
|
{
|
|
|
|
|
|
if (groupController.CanCommand(player.playerSession, "rejuvenate"))
|
|
|
|
|
|
PerformRejuvenate(target);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
public static void PerformRejuvenate(IEntity target)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (target.TryGetComponent(out DamageableComponent damage))
|
|
|
|
|
|
{
|
|
|
|
|
|
damage.HealAllDamage();
|
|
|
|
|
|
}
|
|
|
|
|
|
if (target.TryGetComponent(out HungerComponent hunger))
|
|
|
|
|
|
{
|
|
|
|
|
|
hunger.ResetFood();
|
|
|
|
|
|
}
|
|
|
|
|
|
if (target.TryGetComponent(out ThirstComponent thirst))
|
|
|
|
|
|
{
|
|
|
|
|
|
thirst.ResetThirst();
|
|
|
|
|
|
}
|
2020-06-23 21:05:25 +02:00
|
|
|
|
if (target.TryGetComponent(out StunnableComponent stun))
|
|
|
|
|
|
{
|
|
|
|
|
|
stun.ResetStuns();
|
|
|
|
|
|
}
|
2019-11-23 21:57:02 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|