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,36 +0,0 @@
using Content.Shared.Chemistry.Reagent;
using Content.Server.Disease;
using Content.Shared.Disease;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using JetBrains.Annotations;
namespace Content.Server.Chemistry.ReagentEffects
{
/// <summary>
/// Default metabolism for medicine reagents.
/// </summary>
[UsedImplicitly]
public sealed class ChemCauseDisease : ReagentEffect
{
/// <summary>
/// Chance it has each tick to cause disease, between 0 and 1
/// </summary>
[DataField("causeChance")]
public float CauseChance = 0.15f;
/// <summary>
/// The disease to add.
/// </summary>
[DataField("disease", customTypeSerializer: typeof(PrototypeIdSerializer<DiseasePrototype>), required: true)]
[ViewVariables(VVAccess.ReadWrite)]
public string Disease = default!;
public override void Effect(ReagentEffectArgs args)
{
if (args.Scale != 1f)
return;
EntitySystem.Get<DiseaseSystem>().TryAddDisease(args.SolutionEntity, Disease);
}
}
}

View File

@@ -1,35 +0,0 @@
using Content.Shared.Chemistry.Reagent;
using Content.Server.Disease;
using Content.Shared.Disease.Components;
using Robust.Shared.Random;
using JetBrains.Annotations;
namespace Content.Server.Chemistry.ReagentEffects
{
/// <summary>
/// Causes a random disease from a list, if the user is not already diseased.
/// </summary>
[UsedImplicitly]
public sealed class ChemCauseRandomDisease : ReagentEffect
{
/// <summary>
/// A disease to choose from.
/// </summary>
[DataField("diseases", required: true)]
[ViewVariables(VVAccess.ReadWrite)]
public List<string> Diseases = default!;
public override void Effect(ReagentEffectArgs args)
{
if (args.EntityManager.TryGetComponent<DiseasedComponent>(args.SolutionEntity, out var diseased))
return;
if (args.Scale != 1f)
return;
var random = IoCManager.Resolve<IRobustRandom>();
EntitySystem.Get<DiseaseSystem>().TryAddDisease(args.SolutionEntity, random.Pick(Diseases));
}
}
}

View File

@@ -1,29 +0,0 @@
using Content.Shared.Chemistry.Reagent;
using Content.Server.Disease;
using JetBrains.Annotations;
namespace Content.Server.Chemistry.ReagentEffects
{
/// <summary>
/// Default metabolism for medicine reagents.
/// </summary>
[UsedImplicitly]
public sealed class ChemCureDisease : ReagentEffect
{
/// <summary>
/// Chance it has each tick to cure a disease, between 0 and 1
/// </summary>
[DataField("cureChance")]
public float CureChance = 0.15f;
public override void Effect(ReagentEffectArgs args)
{
var cureChance = CureChance;
cureChance *= args.Scale;
var ev = new CureDiseaseAttemptEvent(cureChance);
args.EntityManager.EventBus.RaiseLocalEvent(args.SolutionEntity, ev, false);
}
}
}

View File

@@ -1,26 +0,0 @@
using Content.Shared.Chemistry.Reagent;
using JetBrains.Annotations;
using Content.Server.Atmos.Miasma;
using Content.Server.Disease;
namespace Content.Server.Chemistry.ReagentEffects
{
/// <summary>
/// The miasma system rotates between 1 disease at a time.
/// This gives all entities the disease the miasme system is currently on.
/// For things ingested by one person, you probably want ChemCauseRandomDisease instead.
/// </summary>
[UsedImplicitly]
public sealed class ChemMiasmaPoolSource : ReagentEffect
{
public override void Effect(ReagentEffectArgs args)
{
if (args.Scale != 1f)
return;
string disease = EntitySystem.Get<RottingSystem>().RequestPoolDisease();
EntitySystem.Get<DiseaseSystem>().TryAddDisease(args.SolutionEntity, disease);
}
}
}