Darts can now pop balloons. (#30088)

Basic implementation.
This commit is contained in:
LankLTE 2024-07-21 22:38:56 -07:00 committed by deltanedas
parent 432a103ead
commit 2a643d2606
3 changed files with 19 additions and 1 deletions

View File

@ -4,7 +4,7 @@ using Content.Shared.IdentityManagement;
using Content.Shared.Popups; using Content.Shared.Popups;
using Content.Shared.Tag; using Content.Shared.Tag;
using Content.Shared.Weapons.Melee.Events; using Content.Shared.Weapons.Melee.Events;
using Robust.Shared.Audio; using Content.Shared.Throwing;
using Robust.Shared.Audio.Systems; using Robust.Shared.Audio.Systems;
namespace Content.Server.Weapons.Melee.Balloon; namespace Content.Server.Weapons.Melee.Balloon;
@ -23,6 +23,7 @@ public sealed class BalloonPopperSystem : EntitySystem
public override void Initialize() public override void Initialize()
{ {
SubscribeLocalEvent<BalloonPopperComponent, MeleeHitEvent>(OnMeleeHit); SubscribeLocalEvent<BalloonPopperComponent, MeleeHitEvent>(OnMeleeHit);
SubscribeLocalEvent<BalloonPopperComponent, ThrowDoHitEvent>(OnThrowHit);
} }
private void OnMeleeHit(EntityUid uid, BalloonPopperComponent component, MeleeHitEvent args) private void OnMeleeHit(EntityUid uid, BalloonPopperComponent component, MeleeHitEvent args)
@ -40,6 +41,15 @@ public sealed class BalloonPopperSystem : EntitySystem
} }
} }
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);
}
}
/// <summary> /// <summary>
/// Pops a target balloon, making a popup and playing a sound. /// Pops a target balloon, making a popup and playing a sound.
/// </summary> /// </summary>

View File

@ -84,6 +84,7 @@
max: 1 max: 1
- !type:DoActsBehavior - !type:DoActsBehavior
acts: [ "Destruction" ] acts: [ "Destruction" ]
- type: BalloonPopper
- type: entity - type: entity
parent: Dart parent: Dart

View File

@ -12,6 +12,13 @@
damage: damage:
types: types:
Piercing: 1 Piercing: 1
- type: DamageOtherOnHit
damage:
types:
Piercing: 1
- type: Item - type: Item
size: Tiny size: Tiny
- type: BalloonPopper - type: BalloonPopper
- type: ThrowingAngle
angle: -135
- type: LandAtCursor