From e9f973a4260d44775f1ded9c24bf0fe61a5a858b Mon Sep 17 00:00:00 2001 From: Rxup Date: Fri, 22 Mar 2024 21:59:06 +0300 Subject: [PATCH 1/4] Disease (#528) * Disease * upd * upd * commit_name * fix tests --------- Co-authored-by: Kirillcas --- .../Backmen/Disease/DiseaseMachineSystem.cs | 26 + .../Disease/DiseaseMachineVisualsComponent.cs | 15 + .../UI/VaccineMachineBoundUserInterface.cs | 67 +++ .../Disease/UI/VaccineMachineMenu.xaml | 50 ++ .../Disease/UI/VaccineMachineMenu.xaml.cs | 136 +++++ .../Tests/Backmen/Disease/TryAddDisease.cs | 74 +++ .../ReagentEffects/ChemCauseDisease.cs | 40 ++ .../ReagentEffects/ChemMiasmaPoolSource.cs | 29 + .../Backmen/Disease/BkRottingSystem.cs | 75 +++ .../Components/DiseaseDiagnoserComponent.cs | 7 + .../Components/DiseaseMachineComponent.cs | 36 ++ .../Components/DiseaseProtectionComponent.cs | 23 + .../Components/DiseaseSwabComponent.cs | 26 + .../Components/DiseaseVaccineComponent.cs | 27 + .../DiseaseVaccineCreatorComponent.cs | 38 ++ .../Disease/Cures/DiseaseBedrestCure.cs | 46 ++ .../Cures/DiseaseBodyTemperatureCure.cs | 37 ++ .../Disease/Cures/DiseaseCureSystem.cs | 40 ++ .../Disease/Cures/DiseaseJustWaitCure.cs | 36 ++ .../Disease/Cures/DiseaseReagentCure.cs | 50 ++ .../Backmen/Disease/DiseaseDiagnosisSystem.cs | 351 ++++++++++++ .../Backmen/Disease/DiseaseSystem.cs | 513 ++++++++++++++++++ .../Disease/Effects/DiseaseAddComponent.cs | 42 ++ .../Disease/Effects/DiseaseAdjustReagent.cs | 51 ++ .../Effects/DiseaseGenericStatusEffect.cs | 73 +++ .../Disease/Effects/DiseaseHealthChange.cs | 26 + .../Disease/Effects/DiseasePolymorph.cs | 48 ++ .../Backmen/Disease/Effects/DiseasePopUp.cs | 40 ++ .../Backmen/Disease/Effects/DiseaseSnough.cs | 34 ++ .../Backmen/Disease/Effects/DiseaseVomit.cs | 27 + .../Backmen/Disease/Effects/EffectSystem.cs | 58 ++ .../Disease/Server/DiseaseServerComponent.cs | 13 + .../StationEvents/DiseaseOutbreakRule.cs | 66 +++ .../DiseaseOutbreakRuleComponent.cs | 26 + .../Backmen/Disease/VaccineSystem.cs | 296 ++++++++++ .../EntitySystems/RevenantSystem.Abilities.cs | 10 + .../Disease/DiseaseCarrierComponent.cs | 59 ++ Content.Shared/Backmen/Disease/DiseaseCure.cs | 34 ++ .../Backmen/Disease/DiseaseEffect.cs | 41 ++ .../Disease/DiseaseMachineRunningComponent.cs | 13 + .../Backmen/Disease/DiseaseMachineVisuals.cs | 15 + .../Backmen/Disease/DiseasePrototype.cs | 82 +++ .../Disease/DiseaseVaccineCreatorMessages.cs | 75 +++ .../Backmen/Disease/DiseasedComponent.cs | 13 + .../Disease/Effects/SharedEffectSystem.cs | 6 + .../Disease/Events/AttemptSneezeCoughEvent.cs | 6 + .../Disease/Events/VaccineDoAfterEvent.cs | 9 + .../Backmen/Disease/Swab/SwabEvents.cs | 14 + .../Revenant/Components/RevenantComponent.cs | 6 + .../Audio/Voice/Human/female_cough_1.ogg | Bin 16792 -> 11172 bytes .../Audio/Voice/Human/female_cough_2.ogg | Bin 17231 -> 12643 bytes .../en-US/backmen/disease/diagnoser.ftl | 20 + .../en-US/backmen/disease/disease-proto.ftl | 21 + .../Locale/en-US/backmen/disease/disease.ftl | 9 + .../Locale/en-US/backmen/disease/miasma.ftl | 4 + .../Locale/en-US/backmen/disease/scanner.ftl | 4 + .../Locale/en-US/backmen/disease/swab.ftl | 8 + .../Locale/en-US/backmen/disease/vaccine.ftl | 17 + .../ru-RU/backmen/disease/diagnoser.ftl | 20 + .../ru-RU/backmen/disease/disease-proto.ftl | 21 + .../Locale/ru-RU/backmen/disease/disease.ftl | 9 + .../Locale/ru-RU/backmen/disease/miasma.ftl | 4 + .../Locale/ru-RU/backmen/disease/scanner.ftl | 4 + .../Locale/ru-RU/backmen/disease/swab.ftl | 8 + .../Locale/ru-RU/backmen/disease/vaccine.ftl | 17 + Resources/Prototypes/Actions/revenant.yml | 20 +- .../Backmen/Diseases/infectious.yml | 312 +++++++++++ .../Backmen/Diseases/noninfectious.yml | 205 +++++++ .../Prototypes/Backmen/GameRules/disease.yml | 10 + .../Prototypes/Backmen/Polymorphs/xeno.yml | 20 + .../Prototypes/Catalog/revenant_catalog.yml | 24 +- .../Prototypes/Entities/Mobs/Species/base.yml | 1 + .../Objects/Specific/Medical/disease.yml | 2 + .../Machines/Medical/disease_diagnoser.yml | 6 + .../Machines/Medical/vaccinator.yml | 17 + .../Entities/Structures/Machines/research.yml | 1 + Resources/Prototypes/Reagents/botany.yml | 8 + Resources/Prototypes/Reagents/toxins.yml | 16 + 78 files changed, 3711 insertions(+), 22 deletions(-) create mode 100644 Content.Client/Backmen/Disease/DiseaseMachineSystem.cs create mode 100644 Content.Client/Backmen/Disease/DiseaseMachineVisualsComponent.cs create mode 100644 Content.Client/Backmen/Disease/UI/VaccineMachineBoundUserInterface.cs create mode 100644 Content.Client/Backmen/Disease/UI/VaccineMachineMenu.xaml create mode 100644 Content.Client/Backmen/Disease/UI/VaccineMachineMenu.xaml.cs create mode 100644 Content.IntegrationTests/Tests/Backmen/Disease/TryAddDisease.cs create mode 100644 Content.Server/Backmen/Chemistry/ReagentEffects/ChemCauseDisease.cs create mode 100644 Content.Server/Backmen/Chemistry/ReagentEffects/ChemMiasmaPoolSource.cs create mode 100644 Content.Server/Backmen/Disease/BkRottingSystem.cs create mode 100644 Content.Server/Backmen/Disease/Components/DiseaseDiagnoserComponent.cs create mode 100644 Content.Server/Backmen/Disease/Components/DiseaseMachineComponent.cs create mode 100644 Content.Server/Backmen/Disease/Components/DiseaseProtectionComponent.cs create mode 100644 Content.Server/Backmen/Disease/Components/DiseaseSwabComponent.cs create mode 100644 Content.Server/Backmen/Disease/Components/DiseaseVaccineComponent.cs create mode 100644 Content.Server/Backmen/Disease/Components/DiseaseVaccineCreatorComponent.cs create mode 100644 Content.Server/Backmen/Disease/Cures/DiseaseBedrestCure.cs create mode 100644 Content.Server/Backmen/Disease/Cures/DiseaseBodyTemperatureCure.cs create mode 100644 Content.Server/Backmen/Disease/Cures/DiseaseCureSystem.cs create mode 100644 Content.Server/Backmen/Disease/Cures/DiseaseJustWaitCure.cs create mode 100644 Content.Server/Backmen/Disease/Cures/DiseaseReagentCure.cs create mode 100644 Content.Server/Backmen/Disease/DiseaseDiagnosisSystem.cs create mode 100644 Content.Server/Backmen/Disease/DiseaseSystem.cs create mode 100644 Content.Server/Backmen/Disease/Effects/DiseaseAddComponent.cs create mode 100644 Content.Server/Backmen/Disease/Effects/DiseaseAdjustReagent.cs create mode 100644 Content.Server/Backmen/Disease/Effects/DiseaseGenericStatusEffect.cs create mode 100644 Content.Server/Backmen/Disease/Effects/DiseaseHealthChange.cs create mode 100644 Content.Server/Backmen/Disease/Effects/DiseasePolymorph.cs create mode 100644 Content.Server/Backmen/Disease/Effects/DiseasePopUp.cs create mode 100644 Content.Server/Backmen/Disease/Effects/DiseaseSnough.cs create mode 100644 Content.Server/Backmen/Disease/Effects/DiseaseVomit.cs create mode 100644 Content.Server/Backmen/Disease/Effects/EffectSystem.cs create mode 100644 Content.Server/Backmen/Disease/Server/DiseaseServerComponent.cs create mode 100644 Content.Server/Backmen/Disease/StationEvents/DiseaseOutbreakRule.cs create mode 100644 Content.Server/Backmen/Disease/StationEvents/DiseaseOutbreakRuleComponent.cs create mode 100644 Content.Server/Backmen/Disease/VaccineSystem.cs create mode 100644 Content.Shared/Backmen/Disease/DiseaseCarrierComponent.cs create mode 100644 Content.Shared/Backmen/Disease/DiseaseCure.cs create mode 100644 Content.Shared/Backmen/Disease/DiseaseEffect.cs create mode 100644 Content.Shared/Backmen/Disease/DiseaseMachineRunningComponent.cs create mode 100644 Content.Shared/Backmen/Disease/DiseaseMachineVisuals.cs create mode 100644 Content.Shared/Backmen/Disease/DiseasePrototype.cs create mode 100644 Content.Shared/Backmen/Disease/DiseaseVaccineCreatorMessages.cs create mode 100644 Content.Shared/Backmen/Disease/DiseasedComponent.cs create mode 100644 Content.Shared/Backmen/Disease/Effects/SharedEffectSystem.cs create mode 100644 Content.Shared/Backmen/Disease/Events/AttemptSneezeCoughEvent.cs create mode 100644 Content.Shared/Backmen/Disease/Events/VaccineDoAfterEvent.cs create mode 100644 Content.Shared/Backmen/Disease/Swab/SwabEvents.cs create mode 100644 Resources/Locale/en-US/backmen/disease/diagnoser.ftl create mode 100644 Resources/Locale/en-US/backmen/disease/disease-proto.ftl create mode 100644 Resources/Locale/en-US/backmen/disease/disease.ftl create mode 100644 Resources/Locale/en-US/backmen/disease/miasma.ftl create mode 100644 Resources/Locale/en-US/backmen/disease/scanner.ftl create mode 100644 Resources/Locale/en-US/backmen/disease/swab.ftl create mode 100644 Resources/Locale/en-US/backmen/disease/vaccine.ftl create mode 100644 Resources/Locale/ru-RU/backmen/disease/diagnoser.ftl create mode 100644 Resources/Locale/ru-RU/backmen/disease/disease-proto.ftl create mode 100644 Resources/Locale/ru-RU/backmen/disease/disease.ftl create mode 100644 Resources/Locale/ru-RU/backmen/disease/miasma.ftl create mode 100644 Resources/Locale/ru-RU/backmen/disease/scanner.ftl create mode 100644 Resources/Locale/ru-RU/backmen/disease/swab.ftl create mode 100644 Resources/Locale/ru-RU/backmen/disease/vaccine.ftl create mode 100644 Resources/Prototypes/Backmen/Diseases/infectious.yml create mode 100644 Resources/Prototypes/Backmen/Diseases/noninfectious.yml create mode 100644 Resources/Prototypes/Backmen/GameRules/disease.yml create mode 100644 Resources/Prototypes/Backmen/Polymorphs/xeno.yml diff --git a/Content.Client/Backmen/Disease/DiseaseMachineSystem.cs b/Content.Client/Backmen/Disease/DiseaseMachineSystem.cs new file mode 100644 index 00000000000..f42c587dd50 --- /dev/null +++ b/Content.Client/Backmen/Disease/DiseaseMachineSystem.cs @@ -0,0 +1,26 @@ +using Content.Client.Medical; +using Content.Shared.Backmen.Disease; +using Robust.Client.GameObjects; + +namespace Content.Client.Backmen.Disease; + +/// +/// Controls client-side visuals for the +/// disease machines. +/// +public sealed class DiseaseMachineSystem : VisualizerSystem +{ + protected override void OnAppearanceChange(EntityUid uid, DiseaseMachineVisualsComponent component, ref AppearanceChangeEvent args) + { + if (args.Sprite == null) + return; + + if (AppearanceSystem.TryGetData(uid, DiseaseMachineVisuals.IsOn, out var isOn, args.Component) + && AppearanceSystem.TryGetData(uid, DiseaseMachineVisuals.IsRunning, out var isRunning, args.Component)) + { + var state = isRunning ? component.RunningState : component.IdleState; + args.Sprite.LayerSetVisible(DiseaseMachineVisualLayers.IsOn, isOn); + args.Sprite.LayerSetState(DiseaseMachineVisualLayers.IsRunning, state); + } + } +} diff --git a/Content.Client/Backmen/Disease/DiseaseMachineVisualsComponent.cs b/Content.Client/Backmen/Disease/DiseaseMachineVisualsComponent.cs new file mode 100644 index 00000000000..a7624d202e0 --- /dev/null +++ b/Content.Client/Backmen/Disease/DiseaseMachineVisualsComponent.cs @@ -0,0 +1,15 @@ +namespace Content.Client.Backmen.Disease; + +/// +/// Holds the idle and running state for machines to control +/// playing animtions on the client. +/// +[RegisterComponent] +public sealed partial class DiseaseMachineVisualsComponent : Component +{ + [DataField("idleState", required: true)] + public string IdleState = default!; + + [DataField("runningState", required: true)] + public string RunningState = default!; +} diff --git a/Content.Client/Backmen/Disease/UI/VaccineMachineBoundUserInterface.cs b/Content.Client/Backmen/Disease/UI/VaccineMachineBoundUserInterface.cs new file mode 100644 index 00000000000..9cc96a24a3f --- /dev/null +++ b/Content.Client/Backmen/Disease/UI/VaccineMachineBoundUserInterface.cs @@ -0,0 +1,67 @@ +using Content.Shared.Backmen.Disease; +using JetBrains.Annotations; + +namespace Content.Client.Backmen.Disease.UI; + +[UsedImplicitly] +public sealed class VaccineMachineBoundUserInterface : BoundUserInterface +{ + private VaccineMachineMenu? _machineMenu; + + public VaccineMachineBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) + { + } + + protected override void Open() + { + base.Open(); + + _machineMenu = new VaccineMachineMenu(this); + + _machineMenu.OnClose += Close; + + _machineMenu.OnServerSelectionButtonPressed += _ => + { + SendMessage(new VaccinatorServerSelectionMessage()); + }; + + _machineMenu.OpenCentered(); + _machineMenu?.PopulateBiomass(Owner); + } + + public void CreateVaccineMessage(string disease, int amount) + { + SendMessage(new CreateVaccineMessage(disease, amount)); + } + + public void RequestSync() + { + SendMessage(new VaccinatorSyncRequestMessage()); + } + + protected override void UpdateState(BoundUserInterfaceState state) + { + base.UpdateState(state); + + switch (state) + { + case VaccineMachineUpdateState msg: + _machineMenu?.UpdateLocked(msg.Locked); + _machineMenu?.PopulateDiseases(msg.Diseases); + _machineMenu?.PopulateBiomass(Owner); + _machineMenu?.UpdateCost(msg.BiomassCost); + _machineMenu?.UpdateServerConnection(msg.HasServer); + break; + } + } + + protected override void Dispose(bool disposing) + { + base.Dispose(disposing); + + if (!disposing) + return; + + _machineMenu?.Dispose(); + } +} diff --git a/Content.Client/Backmen/Disease/UI/VaccineMachineMenu.xaml b/Content.Client/Backmen/Disease/UI/VaccineMachineMenu.xaml new file mode 100644 index 00000000000..6d0653912a0 --- /dev/null +++ b/Content.Client/Backmen/Disease/UI/VaccineMachineMenu.xaml @@ -0,0 +1,50 @@ + + + + + + +