Natural immunities (#9026)
This commit is contained in:
@@ -44,5 +44,13 @@ namespace Content.Server.Disease.Components
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables, DataField("carrierDiseases", customTypeSerializer: typeof(PrototypeIdHashSetSerializer<DiseasePrototype>))]
|
[ViewVariables, DataField("carrierDiseases", customTypeSerializer: typeof(PrototypeIdHashSetSerializer<DiseasePrototype>))]
|
||||||
public HashSet<string>? CarrierDiseases;
|
public HashSet<string>? CarrierDiseases;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// When this component is initialized,
|
||||||
|
/// these diseases will be added to past diseases,
|
||||||
|
/// rendering them immune.
|
||||||
|
/// </summary>
|
||||||
|
[DataField("naturalImmunities")]
|
||||||
|
public List<string>? NaturalImmunities;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ namespace Content.Server.Disease
|
|||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
SubscribeLocalEvent<DiseaseCarrierComponent, ComponentInit>(OnInit);
|
||||||
SubscribeLocalEvent<DiseaseCarrierComponent, CureDiseaseAttemptEvent>(OnTryCureDisease);
|
SubscribeLocalEvent<DiseaseCarrierComponent, CureDiseaseAttemptEvent>(OnTryCureDisease);
|
||||||
SubscribeLocalEvent<DiseasedComponent, InteractHandEvent>(OnInteractDiseasedHand);
|
SubscribeLocalEvent<DiseasedComponent, InteractHandEvent>(OnInteractDiseasedHand);
|
||||||
SubscribeLocalEvent<DiseasedComponent, InteractUsingEvent>(OnInteractDiseasedUsing);
|
SubscribeLocalEvent<DiseasedComponent, InteractUsingEvent>(OnInteractDiseasedUsing);
|
||||||
@@ -127,6 +128,25 @@ namespace Content.Server.Disease
|
|||||||
/// Event Handlers
|
/// Event Handlers
|
||||||
///
|
///
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Fill in the natural immunities of this entity.
|
||||||
|
/// </summary>
|
||||||
|
private void OnInit(EntityUid uid, DiseaseCarrierComponent component, ComponentInit args)
|
||||||
|
{
|
||||||
|
if (component.NaturalImmunities == null || component.NaturalImmunities.Count == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
foreach (var immunity in component.NaturalImmunities)
|
||||||
|
{
|
||||||
|
if (_prototypeManager.TryIndex<DiseasePrototype>(immunity, out var disease))
|
||||||
|
component.PastDiseases.Add(disease);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Logger.Error("Failed to index disease prototype + " + immunity + " for " + uid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used when something is trying to cure ANY disease on the target,
|
/// Used when something is trying to cure ANY disease on the target,
|
||||||
/// not for special disease interactions. Randomly
|
/// not for special disease interactions. Randomly
|
||||||
|
|||||||
@@ -86,6 +86,7 @@
|
|||||||
Piercing: 1.2
|
Piercing: 1.2
|
||||||
Cold: 1.5
|
Cold: 1.5
|
||||||
Poison: 0.8
|
Poison: 0.8
|
||||||
|
Cellular: 0.2
|
||||||
|
|
||||||
- type: damageModifierSet
|
- type: damageModifierSet
|
||||||
id: Infernal
|
id: Infernal
|
||||||
|
|||||||
@@ -155,6 +155,10 @@
|
|||||||
types:
|
types:
|
||||||
Asphyxiation: -1.0
|
Asphyxiation: -1.0
|
||||||
maxSaturation: 15
|
maxSaturation: 15
|
||||||
|
- type: DiseaseCarrier
|
||||||
|
naturalImmunities:
|
||||||
|
- Ultragigacancer
|
||||||
|
- BleedersBite
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
save: false
|
save: false
|
||||||
|
|||||||
Reference in New Issue
Block a user