Rejunevate now satiates hunger and thirst plus code quality (#456)

* Change Rejunevate to satiate hunger and thirst whenever applicable

* More progress

* One more before rebase

* Shit

* Bop obsolete using

* Verb will not show on non-applicable objects
This commit is contained in:
dylanstrategie
2019-11-23 21:57:02 +01:00
committed by Pieter-Jan Briers
parent 421847e9d3
commit 17b31c417b
5 changed files with 76 additions and 52 deletions

View File

@@ -4,11 +4,7 @@ using System.Linq;
using Content.Server.Interfaces;
using Content.Server.Interfaces.GameObjects;
using Content.Shared.GameObjects;
using Robust.Server.Console;
using Robust.Server.Interfaces.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
@@ -186,38 +182,6 @@ namespace Content.Server.GameObjects
Thresholds.Add(damageType, new List<DamageThreshold>());
}
}
/// <summary>
/// Completely removes all damage from the DamageableComponent (heals the mob).
/// </summary>
[Verb]
private sealed class RejuvenateVerb : Verb<DamageableComponent>
{
protected override string GetText(IEntity user, DamageableComponent component) => "Rejuvenate";
protected override VerbVisibility GetVisibility(IEntity user, DamageableComponent component)
{
var groupController = IoCManager.Resolve<IConGroupController>();
if (user.TryGetComponent<IActorComponent>(out var player))
{
if (groupController.CanCommand(player.playerSession, "rejuvenate"))
return VerbVisibility.Visible;
}
return VerbVisibility.Invisible;
}
protected override void Activate(IEntity user, DamageableComponent component)
{
var groupController = IoCManager.Resolve<IConGroupController>();
if (user.TryGetComponent<IActorComponent>(out var player))
{
if (groupController.CanCommand(player.playerSession, "rejuvenate"))
component.HealAllDamage();
}
}
}
}
}