Revert "Disease stages" (#9034)
This commit is contained in:
@@ -115,9 +115,7 @@ namespace Content.Server.Disease
|
|||||||
{
|
{
|
||||||
foreach (var effect in disease.Effects)
|
foreach (var effect in disease.Effects)
|
||||||
{
|
{
|
||||||
if (disease.DiseaseSeverity <= effect.MaxSeverity
|
if (_random.Prob(effect.Probability))
|
||||||
&& disease.DiseaseSeverity >= effect.MinSeverity
|
|
||||||
&& _random.Prob(effect.Probability))
|
|
||||||
effect.Effect(args);
|
effect.Effect(args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.Utility;
|
|
||||||
|
|
||||||
namespace Content.Shared.Disease
|
namespace Content.Shared.Disease
|
||||||
{
|
{
|
||||||
@@ -16,38 +15,6 @@ namespace Content.Shared.Disease
|
|||||||
/// What effect the disease will have.
|
/// What effect the disease will have.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract void Effect(DiseaseEffectArgs args);
|
public abstract void Effect(DiseaseEffectArgs args);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// What is the minimal severity needed for this effect to occur?
|
|
||||||
/// </summary>
|
|
||||||
[DataField("minSeverity")]
|
|
||||||
public float MinSeverity
|
|
||||||
{
|
|
||||||
get => _minSeverity;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
DebugTools.Assert(value > 1f || value < 0f ,"MinSeverity have been attempted to be set out of range");
|
|
||||||
_minSeverity = Math.Clamp(value, 0.0f, 1.0f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private float _minSeverity = 0.0f;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// What is the maximum severity that this effect can occur?
|
|
||||||
/// </summary>
|
|
||||||
[DataField("maxSeverity")]
|
|
||||||
public float MaxSeverity
|
|
||||||
{
|
|
||||||
get => _maxSeverity;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
DebugTools.Assert(value > 1f || value < 0f ,"MaxSeverity have been attempted to be set out of range");
|
|
||||||
_maxSeverity = Math.Clamp(value, 0.0f, 1.0f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private float _maxSeverity = 1.0f;
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// What you have to work with in any disease effect/cure.
|
/// What you have to work with in any disease effect/cure.
|
||||||
|
|||||||
@@ -36,17 +36,6 @@ namespace Content.Shared.Disease
|
|||||||
/// it needs something to control its tickrate
|
/// it needs something to control its tickrate
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float Accumulator = 0f;
|
public float Accumulator = 0f;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// This controls the progression of the disease, used to stage disease effects
|
|
||||||
/// </summary>
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
|
||||||
public float DiseaseSeverity
|
|
||||||
{
|
|
||||||
get => _diseaseServerity;
|
|
||||||
set => _diseaseServerity = Math.Clamp(value, 0f, 1f);
|
|
||||||
}
|
|
||||||
private float _diseaseServerity = 0f;
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// List of effects the disease has that will
|
/// List of effects the disease has that will
|
||||||
/// run every second (by default anyway)
|
/// run every second (by default anyway)
|
||||||
|
|||||||
Reference in New Issue
Block a user