Remove diseases (#15684)

This commit is contained in:
metalgearsloth
2023-05-07 17:50:37 +10:00
committed by GitHub
parent 29f7a39780
commit 0e81cb4319
111 changed files with 103 additions and 3419 deletions

View File

@@ -1,11 +0,0 @@
using Content.Shared.Atmos.Miasma;
using Robust.Shared.GameStates;
namespace Content.Server.Atmos.Miasma;
[NetworkedComponent, RegisterComponent]
public sealed class FliesComponent : SharedFliesComponent
{
/// Need something to hold the ambient sound, at least until that system becomes more robust
public EntityUid VirtFlies;
}

View File

@@ -26,42 +26,6 @@ public sealed class RottingSystem : EntitySystem
[Dependency] private readonly MobStateSystem _mobState = default!;
[Dependency] private readonly TransformSystem _transform = default!;
/// Miasma Disease Pool
/// Miasma outbreaks are not per-entity,
/// so this ensures that each entity in the same incident
/// receives the same disease.
public readonly IReadOnlyList<string> MiasmaDiseasePool = new[]
{
"VentCough",
"AMIV",
"SpaceCold",
"SpaceFlu",
"BirdFlew",
"VanAusdallsRobovirus",
"BleedersBite",
"Plague",
"TongueTwister",
"MemeticAmirmir"
};
/// <summary>
/// The current pool disease.
/// </summary>
private string _poolDisease = "";
/// <summary>
/// The target time it waits until..
/// After that, it resets current time + _poolRepickTime.
/// Any infection will also reset it to current time + _poolRepickTime.
/// </summary>
private TimeSpan _diseaseTime = TimeSpan.FromMinutes(5);
/// <summary>
/// How long without an infection before we pick a new disease.
/// </summary>
private readonly TimeSpan _poolRepickTime = TimeSpan.FromMinutes(5);
public override void Initialize()
{
base.Initialize();
@@ -76,13 +40,7 @@ public sealed class RottingSystem : EntitySystem
SubscribeLocalEvent<RottingComponent, ExaminedEvent>(OnExamined);
SubscribeLocalEvent<RottingComponent, RejuvenateEvent>(OnRejuvenate);
SubscribeLocalEvent<FliesComponent, ComponentInit>(OnFliesInit);
SubscribeLocalEvent<FliesComponent, ComponentShutdown>(OnFliesShutdown);
SubscribeLocalEvent<TemperatureComponent, IsRottingEvent>(OnTempIsRotting);
// Init disease pool
_poolDisease = _random.Pick(MiasmaDiseasePool);
}
private void OnPerishableUnpaused(EntityUid uid, PerishableComponent component, ref EntityUnpausedEvent args)
@@ -106,7 +64,6 @@ public sealed class RottingSystem : EntitySystem
private void OnShutdown(EntityUid uid, RottingComponent component, ComponentShutdown args)
{
RemComp<FliesComponent>(uid);
if (TryComp<PerishableComponent>(uid, out var perishable))
{
perishable.NextPerishUpdate = TimeSpan.Zero;
@@ -182,22 +139,6 @@ public sealed class RottingSystem : EntitySystem
RemCompDeferred<RottingComponent>(uid);
}
/// Containers
#region Fly stuff
private void OnFliesInit(EntityUid uid, FliesComponent component, ComponentInit args)
{
component.VirtFlies = Spawn("AmbientSoundSourceFlies", Transform(uid).Coordinates);
}
private void OnFliesShutdown(EntityUid uid, FliesComponent component, ComponentShutdown args)
{
if (!Terminating(uid) && !Deleted(uid))
Del(component.VirtFlies);
}
#endregion
private void OnTempIsRotting(EntityUid uid, TemperatureComponent component, ref IsRottingEvent args)
{
if (args.Handled)
@@ -205,23 +146,10 @@ public sealed class RottingSystem : EntitySystem
args.Handled = component.CurrentTemperature > Atmospherics.T0C + 0.85f;
}
public string RequestPoolDisease()
{
// We reset the current time on this outbreak so people don't get unlucky at the transition time
_diseaseTime = _timing.CurTime + _poolRepickTime;
return _poolDisease;
}
public override void Update(float frameTime)
{
base.Update(frameTime);
if (_timing.CurTime >= _diseaseTime)
{
_diseaseTime = _timing.CurTime + _poolRepickTime;
_poolDisease = _random.Pick(MiasmaDiseasePool);
}
var perishQuery = EntityQueryEnumerator<PerishableComponent>();
while (perishQuery.MoveNext(out var uid, out var perishable))
{
@@ -237,9 +165,7 @@ public sealed class RottingSystem : EntitySystem
{
var rot = AddComp<RottingComponent>(uid);
rot.NextRotUpdate = _timing.CurTime + rot.RotUpdateRate;
EnsureComp<FliesComponent>(uid);
}
}
var rotQuery = EntityQueryEnumerator<RottingComponent, PerishableComponent, TransformComponent>();