Skip to content

Commit

Permalink
Darts can now pop balloons. (#30088)
Browse files Browse the repository at this point in the history
Basic implementation.
  • Loading branch information
LankLTE authored Jul 22, 2024
1 parent 1fa91e2 commit 395b296
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Content.Server/Weapons/Melee/Balloon/BalloonPopperSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -23,6 +23,7 @@ public sealed class BalloonPopperSystem : EntitySystem
public override void Initialize()
{
SubscribeLocalEvent<BalloonPopperComponent, MeleeHitEvent>(OnMeleeHit);
SubscribeLocalEvent<BalloonPopperComponent, ThrowDoHitEvent>(OnThrowHit);
}

private void OnMeleeHit(EntityUid uid, BalloonPopperComponent component, MeleeHitEvent args)
Expand All @@ -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);
}
}

/// <summary>
/// Pops a target balloon, making a popup and playing a sound.
/// </summary>
Expand Down
1 change: 1 addition & 0 deletions Resources/Prototypes/Entities/Objects/Fun/darts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
max: 1
- !type:DoActsBehavior
acts: [ "Destruction" ]
- type: BalloonPopper

- type: entity
parent: Dart
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 395b296

Please sign in to comment.