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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
22
Content.Server/Disease/Effects/DiseaseAddComp.cs
Normal file
22
Content.Server/Disease/Effects/DiseaseAddComp.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user