From 56f1e37f0846018f76bbd0c03884b60cd6bbff88 Mon Sep 17 00:00:00 2001 From: Zack Backmen Date: Mon, 8 Apr 2024 14:33:43 +0300 Subject: [PATCH] upd --- .../Disease/Cures/DiseaseCureSystem.cs | 4 ++ .../Backmen/Disease/Cures/DiseaseDeathCure.cs | 40 +++++++++++++++++++ .../Backmen/Disease/DiseaseSystem.cs | 9 +++-- .../Backmen/Disease/VaccineSystem.cs | 12 ++++-- Content.Server/Medical/DefibrillatorSystem.cs | 7 ++++ .../Disease/DiseaseCarrierComponent.cs | 4 +- .../Objects/Weapons/Grenades/smoke.yml | 19 ++++++++- 7 files changed, 84 insertions(+), 11 deletions(-) create mode 100644 Content.Server/Backmen/Disease/Cures/DiseaseDeathCure.cs diff --git a/Content.Server/Backmen/Disease/Cures/DiseaseCureSystem.cs b/Content.Server/Backmen/Disease/Cures/DiseaseCureSystem.cs index 75b2b8293bd..b13d7ed5364 100644 --- a/Content.Server/Backmen/Disease/Cures/DiseaseCureSystem.cs +++ b/Content.Server/Backmen/Disease/Cures/DiseaseCureSystem.cs @@ -4,6 +4,7 @@ using Content.Shared.Backmen.Disease; using Content.Shared.Bed.Sleep; using Content.Shared.Buckle.Components; +using Content.Shared.Mobs.Components; namespace Content.Server.Backmen.Disease.Cures; @@ -15,6 +16,7 @@ public sealed partial class DiseaseCureSystem : EntitySystem private EntityQuery _sleepingComponentQuery; private EntityQuery _bloodstreamQuery; private EntityQuery _temperatureQuery; + private EntityQuery _mobStateQuery; public override void Initialize() { @@ -24,11 +26,13 @@ public override void Initialize() SubscribeLocalEvent>(DiseaseBodyTemperatureCure); SubscribeLocalEvent>(DiseaseJustWaitCure); SubscribeLocalEvent>(DiseaseReagentCure); + SubscribeLocalEvent>(DiseaseDeathCure); _buckleQuery = GetEntityQuery(); _healOnBuckleQuery = GetEntityQuery(); _sleepingComponentQuery = GetEntityQuery(); _bloodstreamQuery = GetEntityQuery(); _temperatureQuery = GetEntityQuery(); + _mobStateQuery = GetEntityQuery(); } } diff --git a/Content.Server/Backmen/Disease/Cures/DiseaseDeathCure.cs b/Content.Server/Backmen/Disease/Cures/DiseaseDeathCure.cs new file mode 100644 index 00000000000..aeb22542de3 --- /dev/null +++ b/Content.Server/Backmen/Disease/Cures/DiseaseDeathCure.cs @@ -0,0 +1,40 @@ +using Content.Shared.Backmen.Disease; +using Content.Shared.Mobs; +using Content.Shared.Mobs.Systems; +using Robust.Shared.Prototypes; + +namespace Content.Server.Backmen.Disease.Cures; + +public sealed partial class DiseaseDeathCure : DiseaseCure +{ + public override string CureText() + { + return Loc.GetString("diagnoser-cure-death"); + } + + public override object GenerateEvent(Entity ent, ProtoId disease) + { + return new DiseaseCureArgs(ent, disease, this); + } +} + +public sealed partial class DiseaseCureSystem +{ + [Dependency] private readonly MobStateSystem _mobStateSystem = default!; + + private void DiseaseDeathCure(Entity ent, ref DiseaseCureArgs args) + { + if(args.Handled) + return; + + args.Handled = true; + + if (!_mobStateQuery.TryGetComponent(ent, out var mobStateComponent)) + return; + + if (_mobStateSystem.IsIncapacitated(ent, mobStateComponent)) + { + _disease.CureDisease(args.DiseasedEntity, args.Disease); + } + } +} diff --git a/Content.Server/Backmen/Disease/DiseaseSystem.cs b/Content.Server/Backmen/Disease/DiseaseSystem.cs index b31b723dac6..728ca493f24 100644 --- a/Content.Server/Backmen/Disease/DiseaseSystem.cs +++ b/Content.Server/Backmen/Disease/DiseaseSystem.cs @@ -92,14 +92,17 @@ public override void Update(float frameTime) foreach (var (carrier, disease) in _cureQueue) { - if (carrier.Comp.Diseases.Count > 0) //This is reliable unlike testing Count == 0 right after removal for reasons I don't quite get - RemCompDeferred(carrier); - carrier.Comp.PastDiseases.Add(disease); var d = carrier.Comp.Diseases.FirstOrDefault(x => x.ID == disease); if (d != null) { carrier.Comp.Diseases.Remove(d); + if (d.Infectious) + { + carrier.Comp.PastDiseases.Add(disease); + } } + if (carrier.Comp.Diseases.Count == 0) //This is reliable unlike testing Count == 0 right after removal for reasons I don't quite get + RemCompDeferred(carrier); } _cureQueue.Clear(); diff --git a/Content.Server/Backmen/Disease/VaccineSystem.cs b/Content.Server/Backmen/Disease/VaccineSystem.cs index 5149561f8f6..8d7a2b3892b 100644 --- a/Content.Server/Backmen/Disease/VaccineSystem.cs +++ b/Content.Server/Backmen/Disease/VaccineSystem.cs @@ -43,8 +43,6 @@ public sealed class VaccineSystem : EntitySystem [Dependency] private readonly PopupSystem _popupSystem = default!; [Dependency] private readonly DoAfterSystem _doAfterSystem = default!; [Dependency] private readonly AudioSystem _audioSystem = default!; - [Dependency] private readonly TagSystem _tagSystem = default!; - [Dependency] private readonly SharedAppearanceSystem _appearance = default!; [Dependency] private readonly MetaDataSystem _metaData = default!; public override void Initialize() @@ -258,14 +256,20 @@ private void OnExamined(EntityUid uid, DiseaseVaccineComponent vaxx, ExaminedEve /// past diseases to give them immunity /// IF they don't already have the disease. /// - public void Vaccinate(DiseaseCarrierComponent carrier, DiseasePrototype disease) + public bool Vaccinate(DiseaseCarrierComponent carrier, DiseasePrototype disease) { foreach (var currentDisease in carrier.Diseases) { if (currentDisease.ID == disease.ID) //ID because of the way protoypes work - return; + return false; + } + + if (!disease.Infectious) + { + return false; } carrier.PastDiseases.Add(disease.ID); + return true; } private void OnDoAfter(EntityUid uid, DiseaseVaccineComponent component, VaccineDoAfterEvent args) diff --git a/Content.Server/Medical/DefibrillatorSystem.cs b/Content.Server/Medical/DefibrillatorSystem.cs index 64861fdc515..25ccac3ead5 100644 --- a/Content.Server/Medical/DefibrillatorSystem.cs +++ b/Content.Server/Medical/DefibrillatorSystem.cs @@ -238,6 +238,13 @@ public void Zap(EntityUid uid, EntityUid target, EntityUid user, DefibrillatorCo { _euiManager.OpenEui(new ReturnToBodyEui(mind, _mind), session); } + + // start-backmen: revenant + if (TryComp(target, out var essenceComponent)) + { + essenceComponent.Harvested = false; + } + // end-backmen: revenant } else { diff --git a/Content.Shared/Backmen/Disease/DiseaseCarrierComponent.cs b/Content.Shared/Backmen/Disease/DiseaseCarrierComponent.cs index e032c9df5c8..5301aedae04 100644 --- a/Content.Shared/Backmen/Disease/DiseaseCarrierComponent.cs +++ b/Content.Shared/Backmen/Disease/DiseaseCarrierComponent.cs @@ -32,7 +32,7 @@ public sealed partial class DiseaseCarrierComponent : Component /// Diseases the carrier has had, used for immunity. /// [ViewVariables(VVAccess.ReadWrite)] - public List> PastDiseases = new(); + public HashSet> PastDiseases = new(); /// /// All the diseases the carrier has or has had. @@ -55,5 +55,5 @@ public sealed partial class DiseaseCarrierComponent : Component /// rendering them immune. /// [DataField("naturalImmunities")] - public List>? NaturalImmunities; + public HashSet>? NaturalImmunities; } diff --git a/Resources/Prototypes/Backmen/Entities/Objects/Weapons/Grenades/smoke.yml b/Resources/Prototypes/Backmen/Entities/Objects/Weapons/Grenades/smoke.yml index f34d868773f..f1a4708cdce 100644 --- a/Resources/Prototypes/Backmen/Entities/Objects/Weapons/Grenades/smoke.yml +++ b/Resources/Prototypes/Backmen/Entities/Objects/Weapons/Grenades/smoke.yml @@ -29,7 +29,22 @@ reagents: - ReagentId: LotophagoiOil Quantity: 100 - + +- type: entity + parent: SmokeGrenade + id: XenoGrenade + name: xeno virus grenade + components: + - type: Sprite + sprite: Objects/Weapons/Grenades/tear_gas.rsi + - type: SmokeOnTrigger + duration: 5 + spreadAmount: 20 + solution: + reagents: + - ReagentId: FluorosulfuricAcid + Quantity: 20 + - type: entity parent: SmokeGrenade id: AntiPsiGrenade @@ -44,4 +59,4 @@ solution: reagents: - ReagentId: MindbreakerToxin - Quantity: 75 \ No newline at end of file + Quantity: 75