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.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<BalloonPopperComponent, MeleeHitEvent>(OnMeleeHit);
SubscribeLocalEvent<BalloonPopperComponent, ThrowDoHitEvent>(OnThrowHit);
}
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>
/// Pops a target balloon, making a popup and playing a sound.
/// </summary>

View File

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

View File

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