/// </summary>
public sealed class DiseaseSystem : EntitySystem
{
- [Dependency] private readonly AudioSystem _audioSystem = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly ISerializationManager _serializationManager = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
[Dependency] private readonly InventorySystem _inventorySystem = default!;
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
+ [Dependency] private readonly ChatSystem _chatSystem = default!;
public override void Initialize()
{
base.Initialize();
{
if (TryComp<DiseaseCarrierComponent>(uid, out var carrier))
{
- SneezeCough(uid, _random.Pick(carrier.Diseases), string.Empty, null);
+ SneezeCough(uid, _random.Pick(carrier.Diseases), string.Empty);
}
}
/// and then tries to infect anyone in range
/// if the snougher is not wearing a mask.
/// </summary>
- public bool SneezeCough(EntityUid uid, DiseasePrototype? disease, string snoughMessage, SoundSpecifier? snoughSound, bool airTransmit = true, TransformComponent? xform = null)
+ public bool SneezeCough(EntityUid uid, DiseasePrototype? disease, string emoteId, bool airTransmit = true, TransformComponent? xform = null)
{
if (!Resolve(uid, ref xform)) return false;
if (_mobStateSystem.IsDead(uid)) return false;
- var attemptSneezeCoughEvent = new AttemptSneezeCoughEvent(uid, snoughMessage, snoughSound);
+ var attemptSneezeCoughEvent = new AttemptSneezeCoughEvent(uid, emoteId);
RaiseLocalEvent(uid, ref attemptSneezeCoughEvent);
if (attemptSneezeCoughEvent.Cancelled) return false;
- if (!string.IsNullOrEmpty(snoughMessage))
- _popupSystem.PopupEntity(Loc.GetString(snoughMessage, ("person", Identity.Entity(uid, EntityManager))), uid);
-
- if (snoughSound != null)
- _audioSystem.PlayPvs(snoughSound, uid);
+ _chatSystem.TryEmoteWithChat(uid, emoteId);
if (disease is not { Infectious: true } || !airTransmit)
return true;
+using Content.Shared.Chat.Prototypes;
using Content.Shared.Disease;
using JetBrains.Annotations;
-using Robust.Shared.Audio;
+using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.Disease
{
public sealed class DiseaseSnough : DiseaseEffect
{
/// <summary>
- /// Message to play when snoughing
+ /// Emote to play when snoughing
/// </summary>
- [DataField("snoughMessage")]
- public string SnoughMessage = "disease-sneeze";
-
- /// <summary>
- /// Sound to play when snoughing
- /// </summary>
- [DataField("snoughSound")]
- public SoundSpecifier? SnoughSound;
+ [DataField("emote", required: true, customTypeSerializer: typeof(PrototypeIdSerializer<EmotePrototype>))]
+ public string EmoteId = String.Empty;
/// <summary>
/// Whether to spread the disease through the air
public override void Effect(DiseaseEffectArgs args)
{
- EntitySystem.Get<DiseaseSystem>().SneezeCough(args.DiseasedEntity, args.Disease, SnoughMessage, SnoughSound, AirTransmit);
+ EntitySystem.Get<DiseaseSystem>().SneezeCough(args.DiseasedEntity, args.Disease, EmoteId, AirTransmit);
}
}
}
-using Robust.Shared.Audio;
+using Content.Shared.Chat.Prototypes;
+using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.Traits.Assorted;
public sealed class UncontrollableSnoughComponent : Component
{
/// <summary>
- /// Message to play when snoughing.
+ /// Emote to play when snoughing
/// </summary>
- [DataField("snoughMessage")] public string SnoughMessage = "disease-sneeze";
-
- /// <summary>
- /// Sound to play when snoughing.
- /// </summary>
- [DataField("snoughSound")] public SoundSpecifier? SnoughSound;
+ [DataField("emote", required: true, customTypeSerializer: typeof(PrototypeIdSerializer<EmotePrototype>))]
+ public string EmoteId = String.Empty;
/// <summary>
/// The random time between incidents, (min, max).
{
base.Update(frameTime);
- foreach (var snough in EntityQuery<UncontrollableSnoughComponent>())
+ var query = EntityQueryEnumerator<UncontrollableSnoughComponent>();
+ while (query.MoveNext(out var ent, out var snough))
{
snough.NextIncidentTime -= frameTime;
snough.NextIncidentTime +=
_random.NextFloat(snough.TimeBetweenIncidents.X, snough.TimeBetweenIncidents.Y);
- _diseaseSystem.SneezeCough(snough.Owner, null, snough.SnoughMessage, snough.SnoughSound, false);
+ _diseaseSystem.SneezeCough(ent, null, snough.EmoteId, false);
}
}
}
-using Robust.Shared.Audio;
-
namespace Content.Shared.Disease.Events;
/// <summary>
/// Set Cancelled to true on event handling to suppress the sneeze
/// </summary>
[ByRefEvent]
-public record struct AttemptSneezeCoughEvent(EntityUid uid, string SnoughMessage, SoundSpecifier? SnoughSound, bool Cancelled = false);
+public record struct AttemptSneezeCoughEvent(EntityUid Uid, string? EmoteId, bool Cancelled = false);
-cough1.ogg taken from freesound (deleted user)
-cough2.ogg taken from https://freesound.org/people/Harris85/sounds/208761/
-sneeze.ogg taken from https://freesound.org/people/sherby168/sounds/540771/
beepboop.ogg taken from https://freesound.org/people/Fidjo20/sounds/503526/
monkey1.ogg taken from https://freesound.org/people/TRAVELcandies/sounds/423396/
monkey2.ogg taken from https://freesound.org/people/Archeos/sounds/325549/
-sneeze2.ogg taken from https://freesound.org/people/InspectorJ/sounds/352177/
-vomiting.ogg taken from https://freesound.org/people/vikuserro/sounds/246308/
-yawn1.ogg taken from https://freesound.org/people/ckvoiceover/sounds/401338/ user ckvoiceover CC-3.0
-yawn2.ogg taken from https://freesound.org/people/Reitanna/sounds/252239/ user reitanna CC-0
-snore1, snore2, snore3.ogg taken from https://freesound.org/people/mattyharm/sounds/432995/ user mattyharm CC-0
manlaugh_2
wilhelm_scream
womanlaugh
+female_cough_1.ogg taken from https://freesound.org/people/OwlStorm/sounds/151213/
+female_cough_2.ogg taken from https://freesound.org/people/thatkellytrna/sounds/425777/ and cropped
+male_cough_1.ogg taken from freesound (deleted user)
+male_cough_2.ogg taken from https://freesound.org/people/Harris85/sounds/208761/
+female_sneeze_1.ogg taken from https://freesound.org/people/sherby168/sounds/540771/
+male_sneeze_1.ogg taken from https://freesound.org/people/InspectorJ/sounds/352177/
+male_yawn_1.ogg taken from https://freesound.org/people/ckvoiceover/sounds/401338/ user ckvoiceover CC-3.0
+female_yawn_1.ogg taken from https://freesound.org/people/Reitanna/sounds/252239/ user reitanna CC-0
+snore1, snore2, snore3.ogg taken from https://freesound.org/people/mattyharm/sounds/432995/ user mattyharm CC-0
disease-cured = You feel a bit better.
disease-sick-generic = You feel sick.
-disease-sneeze = {CAPITALIZE($person)} sneezes.
-disease-cough = {CAPITALIZE($person)} coughs.
-disease-screech = {CAPITALIZE($person)} screeches.
-disease-yawn = {CAPITALIZE($person)} yawns.
-disease-meow = {CAPITALIZE($person)} meows.
-disease-hiss = {CAPITALIZE($person)} hisses.
-disease-beep= {CAPITALIZE($person)} beeps.
disease-eaten-inside = You feel like you're being eaten from the inside.
disease-banana-compulsion = You really want to eat some bananas.
disease-beat-chest-compulsion = {CAPITALIZE(THE($person))} beats {POSS-ADJ($person)} chest.
probability: 0.025
- !type:DiseaseSnough
probability: 0.025
- snoughSound:
- collection: Sneezes
+ emote: Sneeze
cures:
- !type:DiseaseBedrestCure
maxLength: 20
visualType: Medium
- !type:DiseaseSnough
probability: 0.025
- snoughMessage: disease-cough
- snoughSound:
- collection: Coughs
+ emote: Cough
- !type:DiseaseHealthChange
probability: 0.015
damage:
probability: 0.025
- !type:DiseaseSnough
probability: 0.025
- snoughSound:
- collection: Sneezes
+ emote: Sneeze
- !type:DiseaseHealthChange
probability: 0.015
damage:
probability: 0.025
- !type:DiseaseSnough
probability: 0.025
- snoughMessage: disease-cough
- snoughSound:
- collection: Coughs
+ emote: Cough
- !type:DiseaseHealthChange
probability: 0.05
damage:
amount: 0.5
- !type:DiseaseSnough
probability: 0.02
- snoughMessage: disease-beep
- snoughSound:
- collection: RobotBeeps
+ emote: RobotBeep
cures:
- !type:DiseaseJustWaitCure
maxLength: 900
# Screeches - spreads disease
- !type:DiseaseSnough
probability: 0.01
- snoughMessage: disease-screech
- snoughSound:
- collection: MonkeyScreeches
+ emote: MonkeyScreeches
stages:
- 0
- !type:DiseaseSnough
probability: 0.02
- snoughMessage: disease-screech
- snoughSound:
- collection: MonkeyScreeches
+ emote: MonkeyScreeches
stages:
- 1
- !type:DiseaseSnough
probability: 0.04
- snoughMessage: disease-screech
- snoughSound:
- collection: MonkeyScreeches
+ emote: MonkeyScreeches
stages:
- 2
# monkey accent chance when speaking
type: Add
- !type:DiseaseSnough
probability: 0.025
- snoughMessage: disease-yawn
- snoughSound:
- collection: Yawns
+ emote: Yawn
- type: disease
id: BleedersBite
probability: 0.025
- !type:DiseaseSnough
probability: 0.025
- snoughMessage: disease-cough
- snoughSound:
- collection: Coughs
+ emote: Cough
- !type:DiseaseHealthChange
probability: 0.05
damage:
amount: 1
- !type:DiseaseSnough
probability: 0.01
- snoughMessage: disease-meow
- snoughSound:
- collection: CatMeows
+ emote: CatMeow
- !type:DiseaseSnough
probability: 0.01
- snoughMessage: disease-hiss
- snoughSound:
- collection: CatHisses
+ emote: CatHisses
cures:
- !type:DiseaseBodyTemperatureCure
min: 420 ## Reachable with a flamer
component: ScrambledAccent
- !type:DiseaseSnough
probability: 0.01
- snoughSound:
- collection: Sneezes
+ emote: Sneeze
- !type:DiseasePopUp
probability: 0.02
message: disease-think
type: Add
- !type:DiseaseSnough
probability: 0.025
- snoughMessage: disease-yawn
- snoughSound:
- collection: Yawns
+ emote: Yawn
- !type:DiseaseHealthChange
probability: 0.02
damage:
probability: 0.01
- !type:DiseaseSnough
probability: 0.10
- snoughMessage: disease-cough
- snoughSound:
- collection: Coughs
+ emote: Cough
- !type:DiseasePopUp
probability: 0.03
amount: 1
- !type:DiseaseSnough
probability: 0.01
- snoughMessage: disease-cough
- snoughSound:
- collection: Coughs
+ emote: Cough
- !type:DiseaseAddComponent
comp: ZombifyOnDeath
cures:
cureResist: 1 #no cure. Death is your cure.
effects:
- !type:DiseaseAddComponent
- comp: ZombifyOnDeath
\ No newline at end of file
+ comp: ZombifyOnDeath
- type: soundCollection
- id: Sneezes
+ id: MaleSneezes
files:
- - /Audio/Effects/Diseases/sneeze1.ogg
- - /Audio/Effects/Diseases/sneeze2.ogg
+ - /Audio/Voice/Human/male_sneeze_1.ogg
- type: soundCollection
- id: Coughs
+ id: FemaleSneezes
files:
- - /Audio/Effects/Diseases/cough1.ogg
- - /Audio/Effects/Diseases/cough2.ogg
+ - /Audio/Voice/Human/female_sneeze_1.ogg
+
+- type: soundCollection
+ id: MaleCoughs
+ files:
+ - /Audio/Voice/Human/male_cough_1.ogg
+ - /Audio/Voice/Human/male_cough_2.ogg
+
+- type: soundCollection
+ id: FemaleCoughs
+ files:
+ - /Audio/Voice/Human/female_cough_1.ogg
+ - /Audio/Voice/Human/female_cough_2.ogg
- type: soundCollection
id: CatMeows
- /Audio/Effects/Diseases/beepboop.ogg
- type: soundCollection
- id: Yawns
+ id: MaleYawn
+ files:
+ - /Audio/Voice/Human/male_yawn_1.ogg
+
+- type: soundCollection
+ id: FemaleYawn
files:
- - /Audio/Effects/Diseases/yawn1.ogg
- - /Audio/Effects/Diseases/yawn2.ogg
+ - /Audio/Voice/Human/female_yawn_1.ogg
- type: soundCollection
id: Snores
files:
- - /Audio/Effects/Diseases/snore1.ogg
- - /Audio/Effects/Diseases/snore2.ogg
- - /Audio/Effects/Diseases/snore3.ogg
+ - /Audio/Voice/Human/snore1.ogg
+ - /Audio/Voice/Human/snore2.ogg
+ - /Audio/Voice/Human/snore3.ogg
- DiseaseCarrier
components:
- type: UncontrollableSnough
- snoughSound:
- collection: Sneezes
- params:
- variation: 0.2
+ emote: Sneeze
timeBetweenIncidents: 0.3, 300
- type: trait
--- /dev/null
+- type: emote
+ id: Sneeze
+ category: Vocal
+ chatMessages: [sneezes]
+
+- type: emote
+ id: Cough
+ category: Vocal
+ chatMessages: [coughs]
+ chatTriggers:
+ - cough
+ - coughs
+
+- type: emote
+ id: CatMeow
+ category: Vocal
+ chatMessages: [meows]
+
+- type: emote
+ id: CatHisses
+ category: Vocal
+ chatMessages: [hisses]
+
+- type: emote
+ id: MonkeyScreeches
+ category: Vocal
+ chatMessages: [screeches]
+
+- type: emote
+ id: RobotBeep
+ category: Vocal
+ chatMessages: [beeps]
+
+- type: emote
+ id: Yawn
+ category: Vocal
+ chatMessages: [yawns]
+ chatTriggers:
+ - yawn
+ - yawns
+
+- type: emote
+ id: Snore
+ category: Vocal
+ chatMessages: [snores]
collection: MaleScreams
Laugh:
collection: MaleLaugh
+ Sneeze:
+ collection: MaleSneezes
+ Cough:
+ collection: MaleCoughs
+ CatMeow:
+ collection: CatMeows
+ CatHisses:
+ collection: CatHisses
+ MonkeyScreeches:
+ collection: MonkeyScreeches
+ RobotBeep:
+ collection: RobotBeeps
+ Yawn:
+ collection: MaleYawn
+ Snore:
+ collection: Snores
- type: emoteSounds
id: FemaleHuman
collection: FemaleScreams
Laugh:
collection: FemaleLaugh
+ Sneeze:
+ collection: FemaleSneezes
+ Cough:
+ collection: FemaleCoughs
+ CatMeow:
+ collection: CatMeows
+ CatHisses:
+ collection: CatHisses
+ MonkeyScreeches:
+ collection: MonkeyScreeches
+ RobotBeep:
+ collection: RobotBeeps
+ Yawn:
+ collection: FemaleYawn
+ Snore:
+ collection: Snores
- type: emoteSounds
id: UnisexReptilian