Files
tbd-station-14/Content.Server/StationEvents/Events/VentClog.cs
Rane bb9ad4259c Diseases (#7057)
* Disease system first pass

* Renamed HealthChange

* First working version of diseases (wtf???)

* Fix the cursed yaml initialization

* Pop-Up effect

* Generic status effect

* Create copy of prototype

* CureDiseaseEffect

* Disease resistance

* Spaceacillin

* Nerf spaceacillin now that we know it works

* Sneezing, Coughing, Snoughing

* Fix queuing, prevent future issues

* Disease protection

* Disease outbreak event

* Disease Reagent Cure

* Chem cause disease effect

* Disease artifacts

* Try infect when interacting with diseased

* Diseases don't have to be infectious

* Talking without a mask does a snough

* Temperature cure

* Bedrest

* DiseaseAdjustReagent

* Tweak how disease statuses work to be a bit less shit

* A few more diseases

* Natural immunity (can't get the same disease twice)

* Polished up some diseases, touched up spaceacillin production

* Rebalanced transmission

* Edit a few diseases, make disease cures support a minimum value

* Nitrile gloves, more disease protection sources

* Health scanner shows diseased status

* Clean up disease system

* Traitor item

* Mouth swabs

* Disease diagnoser machine

* Support for clean samples

* Vaccines + fixes

* Pass on disease resistant clothes

* More work on non-infectious diseases & vaccines

* Handle dead bodies

* Added the relatively CBT visualizer

* Pass over diseases and their populators

* Comment stuff

* Readability cleanup

* Add printing sound to diagnoser, fix printing bug

* vaccinator sound, seal up some classes

* Make disease protection equip detection not shit (thanks whoever wrote addaccentcomponent)

* Mirror review

* More review stuff

* More mirror review stuff

* Refactor snoughing

* Redid report creator

* Fix snough messages, new vaccinator sound

* Mirror review naming

* Woops, forgot the artifact

* Add recipes and fills

* Rebalance space cold and robovirus

* Give lizarb disease interaction stuff

* Tweak some stuff and move things around

* Add diseases to mice (since animal vectors are interesting and can be used to make vaccines)

* Remove unused reagent
2022-03-13 20:02:55 -05:00

79 lines
2.7 KiB
C#

using System.Linq;
using Content.Server.Atmos.Piping.Unary.Components;
using Content.Server.Chemistry.ReactionEffects;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.Sound;
using JetBrains.Annotations;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Utility;
namespace Content.Server.StationEvents.Events;
[UsedImplicitly]
public sealed class VentClog : StationEvent
{
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
public override string Name => "VentClog";
public override string? StartAnnouncement =>
Loc.GetString("station-event-vent-clog-start-announcement");
public override string? StartAudio => "/Audio/Announcements/bloblarm.ogg";
public override int EarliestStart => 15;
public override int MinimumPlayers => 15;
public override float Weight => WeightLow;
public override int? MaxOccurrences => 2;
// Give players time to reach cover.
protected override float StartAfter => 50f;
protected override float EndAfter => 51.0f; // This can, surprisingly, cause the event to end before it starts.
public readonly IReadOnlyList<string> SafeishVentChemicals = new[]
{
"Water", "Iron", "Oxygen", "Tritium", "Plasma", "SulfuricAcid", "Blood", "SpaceDrugs", "SpaceCleaner", "Flour",
"Nutriment", "Sugar", "SpaceLube", "Ethanol", "Mercury", "Ephedrine", "WeldingFuel", "VentCrud"
};
public override void Startup()
{
base.Startup();
// TODO: "safe random" for chems. Right now this includes admin chemicals.
var allReagents = _prototypeManager.EnumeratePrototypes<ReagentPrototype>()
.Where(x => !x.Abstract)
.Select(x => x.ID).ToList();
// This is gross, but not much can be done until event refactor, which needs Dynamic.
var sound = new SoundPathSpecifier("/Audio/Effects/extinguish.ogg");
foreach (var (_, transform) in _entityManager.EntityQuery<GasVentPumpComponent, TransformComponent>())
{
var solution = new Solution();
if (_random.Prob(0.05f))
{
solution.AddReagent(_random.Pick(allReagents), 100);
}
else
{
solution.AddReagent(_random.Pick(SafeishVentChemicals), 100);
}
FoamAreaReactionEffect.SpawnFoam("Foam", transform.Coordinates, solution, _random.Next(2, 6), 20, 1,
1, sound, _entityManager);
}
}
}