using System.Linq; using Content.Shared.Disease; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set; namespace Content.Server.Disease.Components { /// /// Allows the entity to be infected with diseases. /// Please use only on mobs. /// [RegisterComponent] public sealed class DiseaseCarrierComponent : Component { /// /// Shows the CURRENT diseases on the carrier /// [ViewVariables(VVAccess.ReadWrite)] public List Diseases = new(); /// /// The carrier's resistance to disease /// [DataField("diseaseResist")] [ViewVariables(VVAccess.ReadWrite)] public float DiseaseResist = 0f; /// /// Diseases the carrier has had, used for immunity. /// [ViewVariables(VVAccess.ReadWrite)] public List PastDiseases = new(); /// /// All the diseases the carrier has or has had. /// Checked against when trying to add a disease /// [ViewVariables(VVAccess.ReadWrite)] public List AllDiseases => PastDiseases.Concat(Diseases).ToList(); /// /// A list of diseases which the entity does not /// exhibit direct symptoms from. They still transmit /// these diseases, just without symptoms. /// [DataField("carrierDiseases", customTypeSerializer: typeof(PrototypeIdHashSetSerializer))] public HashSet? CarrierDiseases; /// /// When this component is initialized, /// these diseases will be added to past diseases, /// rendering them immune. /// [DataField("naturalImmunities")] public List? NaturalImmunities; } }