official security anti-inflatable armament (#18634)

This commit is contained in:
Nemanja
2023-08-03 21:53:06 -04:00
committed by GitHub
parent 4821003972
commit 6db6b423f4
11 changed files with 130 additions and 0 deletions

View File

@@ -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;
/// <summary>
/// This is used for weapons that pop balloons on attack.
/// </summary>
[RegisterComponent]
public sealed class BalloonPopperComponent : Component
{
/// <summary>
/// The tag that marks something as a balloon.
/// </summary>
[DataField("balloonTag", customTypeSerializer: typeof(PrototypeIdSerializer<TagPrototype>))]
public string BalloonTag = "Balloon";
/// <summary>
/// The sound played when a balloon is popped.
/// </summary>
[DataField("popSound")]
public SoundSpecifier PopSound = new SoundPathSpecifier("/Audio/Effects/balloon-pop.ogg");
}

View File

@@ -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;
/// <summary>
/// This handles popping ballons when attacked with <see cref="BalloonPopperComponent"/>
/// </summary>
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!;
/// <inheritdoc/>
public override void Initialize()
{
SubscribeLocalEvent<BalloonPopperComponent, MeleeHitEvent>(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);
}
}
/// <summary>
/// Pops a target balloon, making a popup and playing a sound.
/// </summary>
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);
}
}

View File

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

Binary file not shown.

View File

@@ -1 +1,3 @@
melee-inject-failed-hardsuit = Your {$weapon} cannot inject through hardsuits!
melee-balloon-pop = {CAPITALIZE(THE($balloon))} popped!

View File

@@ -67,6 +67,8 @@
- id: ClothingHeadsetSecurity
- id: ClothingHandsGlovesColorBlack
- id: ClothingShoesBootsJack
- id: WeaponMeleeNeedle
prob: 0.1
- type: entity
id: LockerBrigmedicFilled

View File

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

View File

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

View File

@@ -22,6 +22,9 @@
- type: Tag
id: Baguette
- type: Tag
id: Balloon
- type: Tag
id: BaseballBat

Binary file not shown.

After

Width:  |  Height:  |  Size: 307 B

View File

@@ -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"
}
]
}