Disease stages (#8405)

* Added the stages , time to implelement them

* adjusted the zombie code to fit within the new staged system

* because I forgot it starts at 0

* mmmm Mistaken

* Removed unused comp

* removed DiseaseBuildup comp from IgnoredComponents.cs

* Resolved review

* Delete IgnoredComponents.cs

* Resolved review

* resolved review

Co-authored-by: wrexbe <81056464+wrexbe@users.noreply.github.com>
Co-authored-by: wrexbe <wrexbe@protonmail.com>
This commit is contained in:
Ripmorld
2022-06-23 04:41:17 +08:00
committed by GitHub
parent dab63cbc1e
commit 13b208a5f1
4 changed files with 69 additions and 1 deletions

View File

@@ -115,7 +115,9 @@ namespace Content.Server.Disease
{
foreach (var effect in disease.Effects)
{
if (_random.Prob(effect.Probability))
if (disease.DiseaseSeverity <= effect.MaxSeverity
&& disease.DiseaseSeverity >= effect.MinSeverity
&& _random.Prob(effect.Probability))
effect.Effect(args);
}
}

View File

@@ -0,0 +1,22 @@
using Content.Shared.Disease;
using JetBrains.Annotations;
namespace Content.Server.Disease.Effects;
[UsedImplicitly]
public sealed class DiseaseAddComp : DiseaseEffect
{
[DataField("comp")]
public string? Comp = null;
public override void Effect(DiseaseEffectArgs args)
{
if (Comp == null) return;
EntityUid uid = args.DiseasedEntity;
Component newComponent = (Component) IoCManager.Resolve<IComponentFactory>().GetComponent(Comp);
newComponent.Owner = uid;
if (!args.EntityManager.HasComponent(uid, newComponent.GetType()))
args.EntityManager.AddComponent(uid, newComponent);
}
}