Working flashlight for hard hats (#2599)

* Add verb to toggle flashlight

* Playing with hand-held light for hard hat

* ClothingEquippedPrefix will update players sprite when changed

* Make abstract prototype for hardhat and fixed hardhat orange sprites

* Fixed all other hard hats

* Fixed requested changes

* Restore prototype and sprites changes

* Nullables

* That's actually nullable

Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
This commit is contained in:
Alex Evgrashin
2020-11-23 06:17:38 +03:00
committed by GitHub
parent e97763afd2
commit fb6dd4a490
44 changed files with 202 additions and 31 deletions

View File

@@ -3,8 +3,10 @@ using System.Threading.Tasks;
using Content.Server.GameObjects.Components.Items.Clothing;
using Content.Server.GameObjects.Components.Items.Storage;
using Content.Server.GameObjects.Components.Power;
using Content.Server.GameObjects.Components.Weapon.Ranged.Barrels;
using Content.Shared.GameObjects.Components;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.GameObjects.Verbs;
using Content.Shared.Interfaces;
using Content.Shared.Interfaces.GameObjects.Components;
using Content.Shared.Utility;
@@ -164,7 +166,7 @@ namespace Content.Server.GameObjects.Components.Interactable
if (Owner.TryGetComponent(out ClothingComponent? clothing))
{
clothing.ClothingEquippedPrefix = on ? "On" : "Off";
clothing.ClothingEquippedPrefix = on ? "on" : "off";
}
if (Owner.TryGetComponent(out ItemComponent? item))
@@ -226,5 +228,25 @@ namespace Content.Server.GameObjects.Components.Interactable
{
return new HandheldLightComponentState(GetLevel());
}
[Verb]
public sealed class ToggleLightVerb : Verb<HandheldLightComponent>
{
protected override void GetData(IEntity user, HandheldLightComponent component, VerbData data)
{
if (!ActionBlockerSystem.CanInteract(user))
{
data.Visibility = VerbVisibility.Invisible;
return;
}
data.Text = Loc.GetString("Toggle light");
}
protected override void Activate(IEntity user, HandheldLightComponent component)
{
component.ToggleStatus(user);
}
}
}
}