add exploding pen from goldeneye (#14421)

This commit is contained in:
deltanedas
2023-03-20 19:32:28 +00:00
committed by GitHub
parent 1ca6ced0cc
commit 93425f0dd5
7 changed files with 71 additions and 8 deletions

View 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;
}
}

View 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)));
}

View File

@@ -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
{
}

View 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);
}

View 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.

View File

@@ -152,6 +152,16 @@
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

View File

@@ -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