diff --git a/Content.Server/Weapons/Melee/Balloon/BalloonPopperComponent.cs b/Content.Server/Weapons/Melee/Balloon/BalloonPopperComponent.cs new file mode 100644 index 0000000000..1f7ac592fc --- /dev/null +++ b/Content.Server/Weapons/Melee/Balloon/BalloonPopperComponent.cs @@ -0,0 +1,24 @@ +using Content.Shared.Tag; +using Robust.Shared.Audio; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; + +namespace Content.Server.Weapons.Melee.Balloon; + +/// +/// This is used for weapons that pop balloons on attack. +/// +[RegisterComponent] +public sealed class BalloonPopperComponent : Component +{ + /// + /// The tag that marks something as a balloon. + /// + [DataField("balloonTag", customTypeSerializer: typeof(PrototypeIdSerializer))] + public string BalloonTag = "Balloon"; + + /// + /// The sound played when a balloon is popped. + /// + [DataField("popSound")] + public SoundSpecifier PopSound = new SoundPathSpecifier("/Audio/Effects/balloon-pop.ogg"); +} diff --git a/Content.Server/Weapons/Melee/Balloon/BalloonPopperSystem.cs b/Content.Server/Weapons/Melee/Balloon/BalloonPopperSystem.cs new file mode 100644 index 0000000000..d7864ba16c --- /dev/null +++ b/Content.Server/Weapons/Melee/Balloon/BalloonPopperSystem.cs @@ -0,0 +1,54 @@ +using Content.Server.Hands.Systems; +using Content.Server.Popups; +using Content.Shared.IdentityManagement; +using Content.Shared.Popups; +using Content.Shared.Tag; +using Content.Shared.Weapons.Melee.Events; + +namespace Content.Server.Weapons.Melee.Balloon; + +/// +/// This handles popping ballons when attacked with +/// +public sealed class BalloonPopperSystem : EntitySystem +{ + [Dependency] private readonly SharedAudioSystem _audio = default!; + [Dependency] private readonly HandsSystem _hands = default!; + [Dependency] private readonly PopupSystem _popup = default!; + [Dependency] private readonly TagSystem _tag = default!; + + /// + public override void Initialize() + { + SubscribeLocalEvent(OnMeleeHit); + } + + private void OnMeleeHit(EntityUid uid, BalloonPopperComponent component, MeleeHitEvent args) + { + foreach (var entity in args.HitEntities) + { + foreach (var held in _hands.EnumerateHeld(entity)) + { + if (_tag.HasTag(held, component.BalloonTag)) + PopBallooon(uid, held, component); + } + + if (_tag.HasTag(entity, component.BalloonTag)) + PopBallooon(uid, entity, component); + } + } + + /// + /// Pops a target balloon, making a popup and playing a sound. + /// + public void PopBallooon(EntityUid popper, EntityUid balloon, BalloonPopperComponent? component = null) + { + if (!Resolve(popper, ref component)) + return; + + _audio.PlayPvs(component.PopSound, balloon); + _popup.PopupCoordinates(Loc.GetString("melee-balloon-pop", + ("balloon", Identity.Entity(balloon, EntityManager))), Transform(balloon).Coordinates, PopupType.Large); + QueueDel(balloon); + } +} diff --git a/Resources/Audio/Effects/attributions.yml b/Resources/Audio/Effects/attributions.yml index 6624f15ba6..0d5702171a 100644 --- a/Resources/Audio/Effects/attributions.yml +++ b/Resources/Audio/Effects/attributions.yml @@ -1,3 +1,8 @@ +- files: ["balloon-pop"] + license: "CC-BY-4.0" + copyright: "Taken from Aesterial-Arts on freesound.org and converted to mono by EmoGarbage404 (github)" + source: "https://freesound.org/people/Aesterial-Arts/sounds/633835/" + - files: ["pill_insert.ogg", "pill_remove.ogg"] license: "CC-BY-NC-SA-3.0" copyright: "Amateur foley and audio editing by Bright0." diff --git a/Resources/Audio/Effects/balloon-pop.ogg b/Resources/Audio/Effects/balloon-pop.ogg new file mode 100644 index 0000000000..c3bb51f4e8 Binary files /dev/null and b/Resources/Audio/Effects/balloon-pop.ogg differ diff --git a/Resources/Locale/en-US/weapons/melee/melee.ftl b/Resources/Locale/en-US/weapons/melee/melee.ftl index ad18c43121..6dddfcc824 100644 --- a/Resources/Locale/en-US/weapons/melee/melee.ftl +++ b/Resources/Locale/en-US/weapons/melee/melee.ftl @@ -1 +1,3 @@ melee-inject-failed-hardsuit = Your {$weapon} cannot inject through hardsuits! + +melee-balloon-pop = {CAPITALIZE(THE($balloon))} popped! diff --git a/Resources/Prototypes/Catalog/Fills/Lockers/security.yml b/Resources/Prototypes/Catalog/Fills/Lockers/security.yml index 0795d59f05..d7997b1d4d 100644 --- a/Resources/Prototypes/Catalog/Fills/Lockers/security.yml +++ b/Resources/Prototypes/Catalog/Fills/Lockers/security.yml @@ -67,6 +67,8 @@ - id: ClothingHeadsetSecurity - id: ClothingHandsGlovesColorBlack - id: ClothingShoesBootsJack + - id: WeaponMeleeNeedle + prob: 0.1 - type: entity id: LockerBrigmedicFilled diff --git a/Resources/Prototypes/Entities/Objects/Fun/toys.yml b/Resources/Prototypes/Entities/Objects/Fun/toys.yml index 0769a04a9b..12e97de4d9 100644 --- a/Resources/Prototypes/Entities/Objects/Fun/toys.yml +++ b/Resources/Prototypes/Entities/Objects/Fun/toys.yml @@ -721,6 +721,11 @@ size: 24 sprite: Objects/Fun/toys.rsi heldPrefix: synb + - type: Damageable + damageContainer: Inorganic + - type: Tag + tags: + - Balloon - type: entity parent: BaseItem @@ -735,6 +740,11 @@ size: 24 sprite: Objects/Fun/toys.rsi heldPrefix: corgib + - type: Damageable + damageContainer: Inorganic + - type: Tag + tags: + - Balloon - type: entity parent: BaseItem diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Melee/needle.yml b/Resources/Prototypes/Entities/Objects/Weapons/Melee/needle.yml new file mode 100644 index 0000000000..cfe6c7b273 --- /dev/null +++ b/Resources/Prototypes/Entities/Objects/Weapons/Melee/needle.yml @@ -0,0 +1,16 @@ +- type: entity + parent: BaseItem + id: WeaponMeleeNeedle + name: official security anti-inflatable armament + description: A specialty weapon used in the destruction of unique syndicate morale-boosting equipment. + components: + - type: Sprite + sprite: Objects/Weapons/Melee/needle.rsi + state: icon + - type: MeleeWeapon + damage: + types: + Piercing: 1 + - type: Item + size: 1 + - type: BalloonPopper diff --git a/Resources/Prototypes/tags.yml b/Resources/Prototypes/tags.yml index a0a6433c61..5d22537db1 100644 --- a/Resources/Prototypes/tags.yml +++ b/Resources/Prototypes/tags.yml @@ -22,6 +22,9 @@ - type: Tag id: Baguette +- type: Tag + id: Balloon + - type: Tag id: BaseballBat diff --git a/Resources/Textures/Objects/Weapons/Melee/needle.rsi/icon.png b/Resources/Textures/Objects/Weapons/Melee/needle.rsi/icon.png new file mode 100644 index 0000000000..14ef636b6f Binary files /dev/null and b/Resources/Textures/Objects/Weapons/Melee/needle.rsi/icon.png differ diff --git a/Resources/Textures/Objects/Weapons/Melee/needle.rsi/meta.json b/Resources/Textures/Objects/Weapons/Melee/needle.rsi/meta.json new file mode 100644 index 0000000000..d8c80a1fd6 --- /dev/null +++ b/Resources/Textures/Objects/Weapons/Melee/needle.rsi/meta.json @@ -0,0 +1,14 @@ +{ + "version": 1, + "license": "CC0-1.0", + "copyright": "Created by EmoGarbage404 (github) for Space Station 14.", + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "icon" + } + ] +}