Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions Content.Server/_HL/Sound/EmitSoundOnCritDeathSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using Content.Shared._HL.Sound;
using Content.Shared.Mobs;
using Robust.Shared.Audio.Systems;

namespace Content.Server._HL.Sound;

/// <summary>
/// Handles playing sounds when an entity enters critical or dead state.
/// </summary>
public sealed class EmitSoundOnCritDeathSystem : EntitySystem
{
[Dependency] private readonly SharedAudioSystem _audio = default!;

public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<EmitSoundOnCritDeathComponent, MobStateChangedEvent>(OnMobStateChanged);
}

private void OnMobStateChanged(EntityUid uid, EmitSoundOnCritDeathComponent component, MobStateChangedEvent args)
{
// Don't replay sounds if we're already in the same state
if (args.OldMobState == args.NewMobState)
return;

switch (args.NewMobState)
{
case MobState.Critical when component.CritSound != null:
_audio.PlayPvs(component.CritSound, uid);
break;
case MobState.Dead when component.DeathSound != null:
_audio.PlayPvs(component.DeathSound, uid);
break;
}
}
}
23 changes: 23 additions & 0 deletions Content.Shared/_HL/Sound/EmitSoundOnCritDeathComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using Robust.Shared.Audio;
using Robust.Shared.GameStates;

namespace Content.Shared._HL.Sound;

/// <summary>
/// Plays sounds when the entity enters critical or dead state.
/// </summary>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class EmitSoundOnCritDeathComponent : Component
{
/// <summary>
/// Sound to play when the entity enters critical state.
/// </summary>
[DataField, AutoNetworkedField]
public SoundSpecifier? CritSound;

/// <summary>
/// Sound to play when the entity dies.
/// </summary>
[DataField, AutoNetworkedField]
public SoundSpecifier? DeathSound;
}
3 changes: 3 additions & 0 deletions Resources/Locale/en-US/_HL/traits/traits.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ hl-trait-egglayer-desc = You produce and lay eggs (10 cum per egg)

hl-trait-egglayer-infertile-name = Egg Layer (very infertile)
hl-trait-egglayer-infertile-desc = You produce eggs very slowly and seldomly (50 cum per egg)

pooltoy-name = Pool Toy!
pooltoy-text = You're a living inflatable, whether by some weird mutation or by being a synthetic being. You are quite resillient to blunt and naturally insulated, but are extra susceptible to pierce and slash, and you are easily knocked about by sudden forces!
35 changes: 34 additions & 1 deletion Resources/Prototypes/_HL/Traits/Physical.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
description: lead-footed-text
category: Physical
cost: 3
mutuallyExclusiveTraits:
- Leadfooted
components:
- type: FTLKnockdownImmune

Expand Down Expand Up @@ -35,6 +37,7 @@
- Radproof
- SnakeEater
- Cryoresistant
- PoolToy
components:
- type: Insulated

Expand All @@ -51,6 +54,7 @@
- Radproof
- SnakeEater
- Cryoresistant
- PoolToy
components:
- type: FireproofBodyParts
- type: DamageProtectionBuff
Expand All @@ -75,6 +79,7 @@
- Heatresistant
- SnakeEater
- Cryoresistant
- PoolToy
components:
- type: DamageProtectionBuff
modifiers:
Expand All @@ -96,6 +101,7 @@
- Heatresistant
- Radproof
- Cryoresistant
- PoolToy
components:
- type: DamageProtectionBuff
modifiers:
Expand All @@ -117,6 +123,7 @@
- Insulated
- SnakeEater
- Radproof
- PoolToy
components:
- type: DamageProtectionBuff
modifiers:
Expand Down Expand Up @@ -180,4 +187,30 @@
Burn: -0.4
Airloss: -1


- type: trait
id: PoolToy
name: pooltoy-name
description: pooltoy-text
category: Physical
cost: 8
mutuallyExclusiveTraits:
- Heatresistant
- Insulated
- SnakeEater
- Radproof
- DermalArmor
components:
- type: Insulated
- type: DamageProtectionBuff
modifiers:
dermal:
id: PoolToyTrait
coefficients:
Blunt: 0.10
Slash: 2
Piercing: 3
- type: EmitSoundOnCritDeath
critSound:
path: /Audio/Items/smoke_grenade_smoke.ogg
deathSound:
path: /Audio/Effects/balloon-pop.ogg
2 changes: 2 additions & 0 deletions Resources/Prototypes/_Mono/Traits/physical.yml
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,8 @@
description: trait-dermal-armor-desc
category: Physical
cost: 6
mutuallyExclusiveTraits:
- PoolToy
components:
- type: DamageProtectionBuff
modifiers:
Expand Down
Loading