From a6f32650fa6b4125fec80d26f70650e04f30a3d5 Mon Sep 17 00:00:00 2001 From: LankLTE <135308300+LankLTE@users.noreply.github.com> Date: Sun, 21 Jul 2024 22:38:56 -0700 Subject: [PATCH] Darts can now pop balloons. (#30088) Basic implementation. --- .../Weapons/Melee/Balloon/BalloonPopperSystem.cs | 12 +++++++++++- Resources/Prototypes/Entities/Objects/Fun/darts.yml | 1 + .../Entities/Objects/Weapons/Melee/needle.yml | 7 +++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Content.Server/Weapons/Melee/Balloon/BalloonPopperSystem.cs b/Content.Server/Weapons/Melee/Balloon/BalloonPopperSystem.cs index 45c6a3d9d557..a8460a8c6600 100644 --- a/Content.Server/Weapons/Melee/Balloon/BalloonPopperSystem.cs +++ b/Content.Server/Weapons/Melee/Balloon/BalloonPopperSystem.cs @@ -4,7 +4,7 @@ using Content.Shared.Popups; using Content.Shared.Tag; using Content.Shared.Weapons.Melee.Events; -using Robust.Shared.Audio; +using Content.Shared.Throwing; using Robust.Shared.Audio.Systems; namespace Content.Server.Weapons.Melee.Balloon; @@ -23,6 +23,7 @@ public sealed class BalloonPopperSystem : EntitySystem public override void Initialize() { SubscribeLocalEvent(OnMeleeHit); + SubscribeLocalEvent(OnThrowHit); } private void OnMeleeHit(EntityUid uid, BalloonPopperComponent component, MeleeHitEvent args) @@ -40,6 +41,15 @@ private void OnMeleeHit(EntityUid uid, BalloonPopperComponent component, MeleeHi } } + private void OnThrowHit(EntityUid uid, BalloonPopperComponent component, ThrowDoHitEvent args) + { + foreach (var held in _hands.EnumerateHeld(args.Target)) + { + if (_tag.HasTag(held, component.BalloonTag)) + PopBallooon(uid, held, component); + } + } + /// /// Pops a target balloon, making a popup and playing a sound. /// diff --git a/Resources/Prototypes/Entities/Objects/Fun/darts.yml b/Resources/Prototypes/Entities/Objects/Fun/darts.yml index dd25d503ce23..31fd4fd8e276 100644 --- a/Resources/Prototypes/Entities/Objects/Fun/darts.yml +++ b/Resources/Prototypes/Entities/Objects/Fun/darts.yml @@ -84,6 +84,7 @@ max: 1 - !type:DoActsBehavior acts: [ "Destruction" ] + - type: BalloonPopper - type: entity parent: Dart diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Melee/needle.yml b/Resources/Prototypes/Entities/Objects/Weapons/Melee/needle.yml index 11efeba5f8c0..e472157081a8 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Melee/needle.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Melee/needle.yml @@ -12,6 +12,13 @@ damage: types: Piercing: 1 + - type: DamageOtherOnHit + damage: + types: + Piercing: 1 - type: Item size: Tiny - type: BalloonPopper + - type: ThrowingAngle + angle: -135 + - type: LandAtCursor