From 699f4f912fcd3692bf766fea0ae88c4d01e7c6f5 Mon Sep 17 00:00:00 2001 From: Peter Wedder Date: Sun, 18 Oct 2020 15:52:42 +0300 Subject: [PATCH] Add a toggle flashlight verb to the PDA (#2287) * Add a toggle flashlight verb to the PDA * capitalization * Remove redundancy --- .../Components/PDA/PDAComponent.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Content.Server/GameObjects/Components/PDA/PDAComponent.cs b/Content.Server/GameObjects/Components/PDA/PDAComponent.cs index b25fc1b2f1..faf5cd1e64 100644 --- a/Content.Server/GameObjects/Components/PDA/PDAComponent.cs +++ b/Content.Server/GameObjects/Components/PDA/PDAComponent.cs @@ -293,6 +293,25 @@ namespace Content.Server.GameObjects.Components.PDA } } + public sealed class ToggleFlashlightVerb : Verb + { + protected override void GetData(IEntity user, PDAComponent component, VerbData data) + { + if (!ActionBlockerSystem.CanInteract(user)) + { + data.Visibility = VerbVisibility.Invisible; + return; + } + + data.Text = Loc.GetString("Toggle flashlight"); + } + + protected override void Activate(IEntity user, PDAComponent component) + { + component.ToggleLight(); + } + } + private ISet? GetContainedAccess() { return ContainedID?.Owner?.GetComponent()?.Tags;