]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
add exploding pen from goldeneye (#14421)
authordeltanedas <39013340+deltanedas@users.noreply.github.com>
Mon, 20 Mar 2023 19:32:28 +0000 (19:32 +0000)
committerGitHub <noreply@github.com>
Mon, 20 Mar 2023 19:32:28 +0000 (15:32 -0400)
Content.Server/Explosion/Components/OnUseTimerTriggerComponent.cs
Content.Server/Explosion/EntitySystems/TriggerSystem.OnUse.cs
Content.Server/Paper/ActivateOnPaperOpenedComponent.cs [new file with mode: 0644]
Content.Server/Paper/PaperSystem.cs
Resources/Locale/en-US/store/uplink-catalog.ftl
Resources/Prototypes/Catalog/uplink_catalog.yml
Resources/Prototypes/Entities/Objects/Weapons/Bombs/pen.yml [new file with mode: 0644]

index be66d23f9d4ca89975fa300de2ddfd8962dc7098..54969c7752796541b871e56d7ef08842aff7a72f 100644 (file)
@@ -15,7 +15,7 @@ namespace Content.Server.Explosion.Components
         public List<float>? DelayOptions = null;
 
         /// <summary>
-        ///     If not null, this timer will periodically play this sound wile active.
+        ///     If not null, this timer will periodically play this sound while active.
         /// </summary>
         [DataField("beepSound")]
         public SoundSpecifier? BeepSound;
@@ -44,5 +44,11 @@ namespace Content.Server.Explosion.Components
         /// </summary>
         [DataField("canToggleStartOnStick")]
         public bool AllowToggleStartOnStick;
+
+        /// <summary>
+        ///     Whether you can examine the item to see its timer or not.
+        /// </summary>
+        [DataField("examinable")]
+        public bool Examinable = true;
     }
 }
index 4e4ea2cd11d60ba759bae3bd307bb780cc88cd1b..826ed29e12c3936bec7b00c2fce39262ced1829d 100644 (file)
@@ -37,7 +37,7 @@ public sealed partial class TriggerSystem
 
     private void OnExamined(EntityUid uid, OnUseTimerTriggerComponent component, ExaminedEvent args)
     {
-        if (args.IsInDetailsRange)
+        if (args.IsInDetailsRange && component.Examinable)
             args.PushText(Loc.GetString("examine-trigger-timer", ("time", component.Delay)));
     }
 
diff --git a/Content.Server/Paper/ActivateOnPaperOpenedComponent.cs b/Content.Server/Paper/ActivateOnPaperOpenedComponent.cs
new file mode 100644 (file)
index 0000000..c702ec5
--- /dev/null
@@ -0,0 +1,10 @@
+namespace Content.Server.Paper;
+
+/// <summary>
+/// Activates the item when used to write on paper, as if Z was pressed.
+/// </summary>
+[RegisterComponent]
+[Access(typeof(PaperSystem))]
+public sealed class ActivateOnPaperOpenedComponent : Component
+{
+}
index a5d819477b93bcd0deadb6a58f6b975724bf240c..a9f4235aa1f20cb621b9499daf03e8c7ee9a189d 100644 (file)
@@ -16,11 +16,12 @@ namespace Content.Server.Paper
 {
     public sealed class PaperSystem : EntitySystem
     {
-        [Dependency] private readonly TagSystem _tagSystem = default!;
-        [Dependency] private readonly PopupSystem _popupSystem = default!;
-        [Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
         [Dependency] private readonly IAdminLogManager _adminLogger = default!;
         [Dependency] private readonly SharedAppearanceSystem _appearance = default!;
+        [Dependency] private readonly SharedInteractionSystem _interaction = default!;
+        [Dependency] private readonly PopupSystem _popupSystem = default!;
+        [Dependency] private readonly TagSystem _tagSystem = default!;
+        [Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
 
         public override void Initialize()
         {
@@ -31,6 +32,8 @@ namespace Content.Server.Paper
             SubscribeLocalEvent<PaperComponent, ExaminedEvent>(OnExamined);
             SubscribeLocalEvent<PaperComponent, InteractUsingEvent>(OnInteractUsing);
             SubscribeLocalEvent<PaperComponent, PaperInputTextMessage>(OnInputTextMessage);
+
+            SubscribeLocalEvent<ActivateOnPaperOpenedComponent, PaperWriteEvent>(OnPaperWrite);
         }
 
         private void OnInit(EntityUid uid, PaperComponent paperComp, ComponentInit args)
@@ -81,6 +84,8 @@ namespace Content.Server.Paper
         {
             if (_tagSystem.HasTag(args.Used, "Write"))
             {
+                var writeEvent = new PaperWriteEvent(uid, args.User);
+                RaiseLocalEvent(args.Used, ref writeEvent);
                 if (!TryComp<ActorComponent>(args.User, out var actor))
                     return;
 
@@ -124,6 +129,11 @@ namespace Content.Server.Paper
             UpdateUserInterface(uid, paperComp);
         }
 
+        private void OnPaperWrite(EntityUid uid, ActivateOnPaperOpenedComponent comp, ref PaperWriteEvent args)
+        {
+            _interaction.UseInHandInteraction(args.User, uid);
+        }
+
         /// <summary>
         ///     Accepts the name and state to be stamped onto the paper, returns true if successful.
         /// </summary>
@@ -170,4 +180,10 @@ namespace Content.Server.Paper
             _uiSystem.GetUiOrNull(uid, PaperUiKey.Key)?.SetState(new PaperBoundUserInterfaceState(paperComp.Content, paperComp.StampedBy, paperComp.Mode));
         }
     }
+
+    /// <summary>
+    /// Event fired when using a pen on paper, opening the UI.
+    /// </summary>
+    [ByRefEvent]
+    public record struct PaperWriteEvent(EntityUid User, EntityUid Paper);
 }
index 6c92ddd29bc4841bc63716f7c02682043ef324b6..55cb414003e2869f2e10445ec0e08980b6ae6683 100644 (file)
@@ -42,6 +42,9 @@ uplink-c4-bundle-desc = Because sometimes quantity is quality. Contains 8 C-4 pl
 uplink-emp-grenade-name = Emp Grenade
 uplink-emp-grenade-desc = Releases electromagnetic pulses that disrupt or damage many electronic devices or drain power cells.
 
+uplink-exploding-pen-name = Exploding pen
+uplink-exploding-pen-desc = A class IV explosive device contained within a standard pen. Comes with a 4 second fuse.
+
 # Ammo
 uplink-pistol-magazine-name = Pistol Magazine (.35 auto)
 uplink-pistol-magazine-desc = Pistol magazine with 10 catridges. Compatible with Viper.
index a6928fbc60f585a6ac03e271a62f6cb0902d095c..fb638897b771c6c476cf2ee47a2938aed8ee0059 100644 (file)
   categories:
   - UplinkExplosives
 
+- type: listing
+  id: UplinkExplodingPen
+  name: uplink-exploding-pen-name
+  description: uplink-exploding-pen-desc
+  productEntity: PenExploding
+  cost:
+    Telecrystal: 5
+  categories:
+  - UplinkExplosives
+
 # Ammo
 
 - type: listing
     blacklist:
       components:
       - SurplusBundle
-  
+
 - type: listing
   id: uplinkRevolverCapGunFake
   name: uplink-revolver-cap-gun-fake-name
     Telecrystal: 8
   categories:
   - UplinkMisc
-  
+
 - type: listing
   id: UplinkStimkit
   name: uplink-stimkit-name
     Telecrystal: 12
   categories:
   - UplinkMisc
-  
+
 - type: listing
   id: UplinkStimpackExperimental
   name: uplink-experimental-stimpack-name
diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Bombs/pen.yml b/Resources/Prototypes/Entities/Objects/Weapons/Bombs/pen.yml
new file mode 100644 (file)
index 0000000..f7e746e
--- /dev/null
@@ -0,0 +1,18 @@
+- type: entity
+  name: pen
+  suffix: Exploding
+  parent: Pen
+  description: A dark ink pen.
+  id: PenExploding
+  components:
+  - type: OnUseTimerTrigger
+    delay: 4
+    examinable: false
+  - type: Explosive
+    explosionType: Default
+    maxIntensity: 8
+    intensitySlope: 5
+    totalIntensity: 20
+    canCreateVacuum: false
+  - type: ActivateOnPaperOpened
+  - type: ExplodeOnTrigger