2022-03-07 21:45:52 -06:00
|
|
|
using Content.Server.DoAfter;
|
|
|
|
|
using Content.Server.Medical.Components;
|
Diseases (#7057)
* Disease system first pass
* Renamed HealthChange
* First working version of diseases (wtf???)
* Fix the cursed yaml initialization
* Pop-Up effect
* Generic status effect
* Create copy of prototype
* CureDiseaseEffect
* Disease resistance
* Spaceacillin
* Nerf spaceacillin now that we know it works
* Sneezing, Coughing, Snoughing
* Fix queuing, prevent future issues
* Disease protection
* Disease outbreak event
* Disease Reagent Cure
* Chem cause disease effect
* Disease artifacts
* Try infect when interacting with diseased
* Diseases don't have to be infectious
* Talking without a mask does a snough
* Temperature cure
* Bedrest
* DiseaseAdjustReagent
* Tweak how disease statuses work to be a bit less shit
* A few more diseases
* Natural immunity (can't get the same disease twice)
* Polished up some diseases, touched up spaceacillin production
* Rebalanced transmission
* Edit a few diseases, make disease cures support a minimum value
* Nitrile gloves, more disease protection sources
* Health scanner shows diseased status
* Clean up disease system
* Traitor item
* Mouth swabs
* Disease diagnoser machine
* Support for clean samples
* Vaccines + fixes
* Pass on disease resistant clothes
* More work on non-infectious diseases & vaccines
* Handle dead bodies
* Added the relatively CBT visualizer
* Pass over diseases and their populators
* Comment stuff
* Readability cleanup
* Add printing sound to diagnoser, fix printing bug
* vaccinator sound, seal up some classes
* Make disease protection equip detection not shit (thanks whoever wrote addaccentcomponent)
* Mirror review
* More review stuff
* More mirror review stuff
* Refactor snoughing
* Redid report creator
* Fix snough messages, new vaccinator sound
* Mirror review naming
* Woops, forgot the artifact
* Add recipes and fills
* Rebalance space cold and robovirus
* Give lizarb disease interaction stuff
* Tweak some stuff and move things around
* Add diseases to mice (since animal vectors are interesting and can be used to make vaccines)
* Remove unused reagent
2022-03-13 21:02:55 -04:00
|
|
|
using Content.Server.Disease;
|
|
|
|
|
using Content.Server.Popups;
|
2022-03-07 21:45:52 -06:00
|
|
|
using Content.Shared.Damage;
|
2023-02-24 19:01:25 -05:00
|
|
|
using Content.Shared.DoAfter;
|
2022-07-10 18:36:53 -07:00
|
|
|
using Content.Shared.IdentityManagement;
|
2022-03-07 21:45:52 -06:00
|
|
|
using Content.Shared.Interaction;
|
2023-01-13 16:57:10 -08:00
|
|
|
using Content.Shared.Mobs.Components;
|
2022-03-07 21:45:52 -06:00
|
|
|
using Robust.Server.GameObjects;
|
|
|
|
|
using static Content.Shared.MedicalScanner.SharedHealthAnalyzerComponent;
|
|
|
|
|
|
|
|
|
|
namespace Content.Server.Medical
|
|
|
|
|
{
|
|
|
|
|
public sealed class HealthAnalyzerSystem : EntitySystem
|
|
|
|
|
{
|
2023-01-12 01:38:39 -05:00
|
|
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
2022-03-15 07:51:42 +11:00
|
|
|
[Dependency] private readonly DiseaseSystem _disease = default!;
|
2022-03-07 21:45:52 -06:00
|
|
|
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
|
Diseases (#7057)
* Disease system first pass
* Renamed HealthChange
* First working version of diseases (wtf???)
* Fix the cursed yaml initialization
* Pop-Up effect
* Generic status effect
* Create copy of prototype
* CureDiseaseEffect
* Disease resistance
* Spaceacillin
* Nerf spaceacillin now that we know it works
* Sneezing, Coughing, Snoughing
* Fix queuing, prevent future issues
* Disease protection
* Disease outbreak event
* Disease Reagent Cure
* Chem cause disease effect
* Disease artifacts
* Try infect when interacting with diseased
* Diseases don't have to be infectious
* Talking without a mask does a snough
* Temperature cure
* Bedrest
* DiseaseAdjustReagent
* Tweak how disease statuses work to be a bit less shit
* A few more diseases
* Natural immunity (can't get the same disease twice)
* Polished up some diseases, touched up spaceacillin production
* Rebalanced transmission
* Edit a few diseases, make disease cures support a minimum value
* Nitrile gloves, more disease protection sources
* Health scanner shows diseased status
* Clean up disease system
* Traitor item
* Mouth swabs
* Disease diagnoser machine
* Support for clean samples
* Vaccines + fixes
* Pass on disease resistant clothes
* More work on non-infectious diseases & vaccines
* Handle dead bodies
* Added the relatively CBT visualizer
* Pass over diseases and their populators
* Comment stuff
* Readability cleanup
* Add printing sound to diagnoser, fix printing bug
* vaccinator sound, seal up some classes
* Make disease protection equip detection not shit (thanks whoever wrote addaccentcomponent)
* Mirror review
* More review stuff
* More mirror review stuff
* Refactor snoughing
* Redid report creator
* Fix snough messages, new vaccinator sound
* Mirror review naming
* Woops, forgot the artifact
* Add recipes and fills
* Rebalance space cold and robovirus
* Give lizarb disease interaction stuff
* Tweak some stuff and move things around
* Add diseases to mice (since animal vectors are interesting and can be used to make vaccines)
* Remove unused reagent
2022-03-13 21:02:55 -04:00
|
|
|
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
2023-02-24 19:01:25 -05:00
|
|
|
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
|
2022-03-07 21:45:52 -06:00
|
|
|
|
|
|
|
|
public override void Initialize()
|
|
|
|
|
{
|
|
|
|
|
base.Initialize();
|
|
|
|
|
SubscribeLocalEvent<HealthAnalyzerComponent, ActivateInWorldEvent>(HandleActivateInWorld);
|
|
|
|
|
SubscribeLocalEvent<HealthAnalyzerComponent, AfterInteractEvent>(OnAfterInteract);
|
2023-02-24 19:01:25 -05:00
|
|
|
SubscribeLocalEvent<HealthAnalyzerComponent, DoAfterEvent>(OnDoAfter);
|
2022-03-07 21:45:52 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void HandleActivateInWorld(EntityUid uid, HealthAnalyzerComponent healthAnalyzer, ActivateInWorldEvent args)
|
|
|
|
|
{
|
|
|
|
|
OpenUserInterface(args.User, healthAnalyzer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnAfterInteract(EntityUid uid, HealthAnalyzerComponent healthAnalyzer, AfterInteractEvent args)
|
|
|
|
|
{
|
2023-02-24 19:01:25 -05:00
|
|
|
if (args.Target == null || !args.CanReach || !HasComp<MobStateComponent>(args.Target))
|
2022-03-07 21:45:52 -06:00
|
|
|
return;
|
2023-01-12 01:38:39 -05:00
|
|
|
|
|
|
|
|
_audio.PlayPvs(healthAnalyzer.ScanningBeginSound, uid);
|
|
|
|
|
|
2023-02-24 19:01:25 -05:00
|
|
|
_doAfterSystem.DoAfter(new DoAfterEventArgs(args.User, healthAnalyzer.ScanDelay, target: args.Target, used:uid)
|
2022-03-07 21:45:52 -06:00
|
|
|
{
|
|
|
|
|
BreakOnTargetMove = true,
|
|
|
|
|
BreakOnUserMove = true,
|
|
|
|
|
BreakOnStun = true,
|
|
|
|
|
NeedHand = true
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-24 19:01:25 -05:00
|
|
|
private void OnDoAfter(EntityUid uid, HealthAnalyzerComponent component, DoAfterEvent args)
|
2022-03-07 21:45:52 -06:00
|
|
|
{
|
2023-02-24 19:01:25 -05:00
|
|
|
if (args.Handled || args.Cancelled || args.Args.Target == null)
|
|
|
|
|
return;
|
2023-01-12 01:38:39 -05:00
|
|
|
|
2023-02-24 19:01:25 -05:00
|
|
|
_audio.PlayPvs(component.ScanningEndSound, args.Args.User);
|
2023-01-12 01:38:39 -05:00
|
|
|
|
2023-02-24 19:01:25 -05:00
|
|
|
UpdateScannedUser(uid, args.Args.User, args.Args.Target.Value, component);
|
2022-03-15 07:51:42 +11:00
|
|
|
// Below is for the traitor item
|
|
|
|
|
// Piggybacking off another component's doafter is complete CBT so I gave up
|
|
|
|
|
// and put it on the same component
|
2023-02-24 19:01:25 -05:00
|
|
|
if (string.IsNullOrEmpty(component.Disease))
|
|
|
|
|
{
|
|
|
|
|
args.Handled = true;
|
Diseases (#7057)
* Disease system first pass
* Renamed HealthChange
* First working version of diseases (wtf???)
* Fix the cursed yaml initialization
* Pop-Up effect
* Generic status effect
* Create copy of prototype
* CureDiseaseEffect
* Disease resistance
* Spaceacillin
* Nerf spaceacillin now that we know it works
* Sneezing, Coughing, Snoughing
* Fix queuing, prevent future issues
* Disease protection
* Disease outbreak event
* Disease Reagent Cure
* Chem cause disease effect
* Disease artifacts
* Try infect when interacting with diseased
* Diseases don't have to be infectious
* Talking without a mask does a snough
* Temperature cure
* Bedrest
* DiseaseAdjustReagent
* Tweak how disease statuses work to be a bit less shit
* A few more diseases
* Natural immunity (can't get the same disease twice)
* Polished up some diseases, touched up spaceacillin production
* Rebalanced transmission
* Edit a few diseases, make disease cures support a minimum value
* Nitrile gloves, more disease protection sources
* Health scanner shows diseased status
* Clean up disease system
* Traitor item
* Mouth swabs
* Disease diagnoser machine
* Support for clean samples
* Vaccines + fixes
* Pass on disease resistant clothes
* More work on non-infectious diseases & vaccines
* Handle dead bodies
* Added the relatively CBT visualizer
* Pass over diseases and their populators
* Comment stuff
* Readability cleanup
* Add printing sound to diagnoser, fix printing bug
* vaccinator sound, seal up some classes
* Make disease protection equip detection not shit (thanks whoever wrote addaccentcomponent)
* Mirror review
* More review stuff
* More mirror review stuff
* Refactor snoughing
* Redid report creator
* Fix snough messages, new vaccinator sound
* Mirror review naming
* Woops, forgot the artifact
* Add recipes and fills
* Rebalance space cold and robovirus
* Give lizarb disease interaction stuff
* Tweak some stuff and move things around
* Add diseases to mice (since animal vectors are interesting and can be used to make vaccines)
* Remove unused reagent
2022-03-13 21:02:55 -04:00
|
|
|
return;
|
2023-02-24 19:01:25 -05:00
|
|
|
}
|
Diseases (#7057)
* Disease system first pass
* Renamed HealthChange
* First working version of diseases (wtf???)
* Fix the cursed yaml initialization
* Pop-Up effect
* Generic status effect
* Create copy of prototype
* CureDiseaseEffect
* Disease resistance
* Spaceacillin
* Nerf spaceacillin now that we know it works
* Sneezing, Coughing, Snoughing
* Fix queuing, prevent future issues
* Disease protection
* Disease outbreak event
* Disease Reagent Cure
* Chem cause disease effect
* Disease artifacts
* Try infect when interacting with diseased
* Diseases don't have to be infectious
* Talking without a mask does a snough
* Temperature cure
* Bedrest
* DiseaseAdjustReagent
* Tweak how disease statuses work to be a bit less shit
* A few more diseases
* Natural immunity (can't get the same disease twice)
* Polished up some diseases, touched up spaceacillin production
* Rebalanced transmission
* Edit a few diseases, make disease cures support a minimum value
* Nitrile gloves, more disease protection sources
* Health scanner shows diseased status
* Clean up disease system
* Traitor item
* Mouth swabs
* Disease diagnoser machine
* Support for clean samples
* Vaccines + fixes
* Pass on disease resistant clothes
* More work on non-infectious diseases & vaccines
* Handle dead bodies
* Added the relatively CBT visualizer
* Pass over diseases and their populators
* Comment stuff
* Readability cleanup
* Add printing sound to diagnoser, fix printing bug
* vaccinator sound, seal up some classes
* Make disease protection equip detection not shit (thanks whoever wrote addaccentcomponent)
* Mirror review
* More review stuff
* More mirror review stuff
* Refactor snoughing
* Redid report creator
* Fix snough messages, new vaccinator sound
* Mirror review naming
* Woops, forgot the artifact
* Add recipes and fills
* Rebalance space cold and robovirus
* Give lizarb disease interaction stuff
* Tweak some stuff and move things around
* Add diseases to mice (since animal vectors are interesting and can be used to make vaccines)
* Remove unused reagent
2022-03-13 21:02:55 -04:00
|
|
|
|
2023-02-24 19:01:25 -05:00
|
|
|
_disease.TryAddDisease(args.Args.Target.Value, component.Disease);
|
Diseases (#7057)
* Disease system first pass
* Renamed HealthChange
* First working version of diseases (wtf???)
* Fix the cursed yaml initialization
* Pop-Up effect
* Generic status effect
* Create copy of prototype
* CureDiseaseEffect
* Disease resistance
* Spaceacillin
* Nerf spaceacillin now that we know it works
* Sneezing, Coughing, Snoughing
* Fix queuing, prevent future issues
* Disease protection
* Disease outbreak event
* Disease Reagent Cure
* Chem cause disease effect
* Disease artifacts
* Try infect when interacting with diseased
* Diseases don't have to be infectious
* Talking without a mask does a snough
* Temperature cure
* Bedrest
* DiseaseAdjustReagent
* Tweak how disease statuses work to be a bit less shit
* A few more diseases
* Natural immunity (can't get the same disease twice)
* Polished up some diseases, touched up spaceacillin production
* Rebalanced transmission
* Edit a few diseases, make disease cures support a minimum value
* Nitrile gloves, more disease protection sources
* Health scanner shows diseased status
* Clean up disease system
* Traitor item
* Mouth swabs
* Disease diagnoser machine
* Support for clean samples
* Vaccines + fixes
* Pass on disease resistant clothes
* More work on non-infectious diseases & vaccines
* Handle dead bodies
* Added the relatively CBT visualizer
* Pass over diseases and their populators
* Comment stuff
* Readability cleanup
* Add printing sound to diagnoser, fix printing bug
* vaccinator sound, seal up some classes
* Make disease protection equip detection not shit (thanks whoever wrote addaccentcomponent)
* Mirror review
* More review stuff
* More mirror review stuff
* Refactor snoughing
* Redid report creator
* Fix snough messages, new vaccinator sound
* Mirror review naming
* Woops, forgot the artifact
* Add recipes and fills
* Rebalance space cold and robovirus
* Give lizarb disease interaction stuff
* Tweak some stuff and move things around
* Add diseases to mice (since animal vectors are interesting and can be used to make vaccines)
* Remove unused reagent
2022-03-13 21:02:55 -04:00
|
|
|
|
2023-02-24 19:01:25 -05:00
|
|
|
if (args.Args.User == args.Args.Target)
|
Diseases (#7057)
* Disease system first pass
* Renamed HealthChange
* First working version of diseases (wtf???)
* Fix the cursed yaml initialization
* Pop-Up effect
* Generic status effect
* Create copy of prototype
* CureDiseaseEffect
* Disease resistance
* Spaceacillin
* Nerf spaceacillin now that we know it works
* Sneezing, Coughing, Snoughing
* Fix queuing, prevent future issues
* Disease protection
* Disease outbreak event
* Disease Reagent Cure
* Chem cause disease effect
* Disease artifacts
* Try infect when interacting with diseased
* Diseases don't have to be infectious
* Talking without a mask does a snough
* Temperature cure
* Bedrest
* DiseaseAdjustReagent
* Tweak how disease statuses work to be a bit less shit
* A few more diseases
* Natural immunity (can't get the same disease twice)
* Polished up some diseases, touched up spaceacillin production
* Rebalanced transmission
* Edit a few diseases, make disease cures support a minimum value
* Nitrile gloves, more disease protection sources
* Health scanner shows diseased status
* Clean up disease system
* Traitor item
* Mouth swabs
* Disease diagnoser machine
* Support for clean samples
* Vaccines + fixes
* Pass on disease resistant clothes
* More work on non-infectious diseases & vaccines
* Handle dead bodies
* Added the relatively CBT visualizer
* Pass over diseases and their populators
* Comment stuff
* Readability cleanup
* Add printing sound to diagnoser, fix printing bug
* vaccinator sound, seal up some classes
* Make disease protection equip detection not shit (thanks whoever wrote addaccentcomponent)
* Mirror review
* More review stuff
* More mirror review stuff
* Refactor snoughing
* Redid report creator
* Fix snough messages, new vaccinator sound
* Mirror review naming
* Woops, forgot the artifact
* Add recipes and fills
* Rebalance space cold and robovirus
* Give lizarb disease interaction stuff
* Tweak some stuff and move things around
* Add diseases to mice (since animal vectors are interesting and can be used to make vaccines)
* Remove unused reagent
2022-03-13 21:02:55 -04:00
|
|
|
{
|
2023-02-24 19:01:25 -05:00
|
|
|
_popupSystem.PopupEntity(Loc.GetString("disease-scanner-gave-self", ("disease", component.Disease)),
|
|
|
|
|
args.Args.User, args.Args.User);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_popupSystem.PopupEntity(Loc.GetString("disease-scanner-gave-other", ("target", Identity.Entity(args.Args.Target.Value, EntityManager)),
|
|
|
|
|
("disease", component.Disease)), args.Args.User, args.Args.User);
|
Diseases (#7057)
* Disease system first pass
* Renamed HealthChange
* First working version of diseases (wtf???)
* Fix the cursed yaml initialization
* Pop-Up effect
* Generic status effect
* Create copy of prototype
* CureDiseaseEffect
* Disease resistance
* Spaceacillin
* Nerf spaceacillin now that we know it works
* Sneezing, Coughing, Snoughing
* Fix queuing, prevent future issues
* Disease protection
* Disease outbreak event
* Disease Reagent Cure
* Chem cause disease effect
* Disease artifacts
* Try infect when interacting with diseased
* Diseases don't have to be infectious
* Talking without a mask does a snough
* Temperature cure
* Bedrest
* DiseaseAdjustReagent
* Tweak how disease statuses work to be a bit less shit
* A few more diseases
* Natural immunity (can't get the same disease twice)
* Polished up some diseases, touched up spaceacillin production
* Rebalanced transmission
* Edit a few diseases, make disease cures support a minimum value
* Nitrile gloves, more disease protection sources
* Health scanner shows diseased status
* Clean up disease system
* Traitor item
* Mouth swabs
* Disease diagnoser machine
* Support for clean samples
* Vaccines + fixes
* Pass on disease resistant clothes
* More work on non-infectious diseases & vaccines
* Handle dead bodies
* Added the relatively CBT visualizer
* Pass over diseases and their populators
* Comment stuff
* Readability cleanup
* Add printing sound to diagnoser, fix printing bug
* vaccinator sound, seal up some classes
* Make disease protection equip detection not shit (thanks whoever wrote addaccentcomponent)
* Mirror review
* More review stuff
* More mirror review stuff
* Refactor snoughing
* Redid report creator
* Fix snough messages, new vaccinator sound
* Mirror review naming
* Woops, forgot the artifact
* Add recipes and fills
* Rebalance space cold and robovirus
* Give lizarb disease interaction stuff
* Tweak some stuff and move things around
* Add diseases to mice (since animal vectors are interesting and can be used to make vaccines)
* Remove unused reagent
2022-03-13 21:02:55 -04:00
|
|
|
}
|
2023-02-24 19:01:25 -05:00
|
|
|
|
|
|
|
|
args.Handled = true;
|
2022-03-07 21:45:52 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OpenUserInterface(EntityUid user, HealthAnalyzerComponent healthAnalyzer)
|
|
|
|
|
{
|
2023-02-24 19:01:25 -05:00
|
|
|
if (!TryComp<ActorComponent>(user, out var actor) || healthAnalyzer.UserInterface == null)
|
2022-03-07 21:45:52 -06:00
|
|
|
return;
|
|
|
|
|
|
2023-02-24 19:01:25 -05:00
|
|
|
_uiSystem.OpenUi(healthAnalyzer.UserInterface ,actor.PlayerSession);
|
2022-03-07 21:45:52 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void UpdateScannedUser(EntityUid uid, EntityUid user, EntityUid? target, HealthAnalyzerComponent? healthAnalyzer)
|
|
|
|
|
{
|
|
|
|
|
if (!Resolve(uid, ref healthAnalyzer))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (target == null || healthAnalyzer.UserInterface == null)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (!HasComp<DamageableComponent>(target))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
OpenUserInterface(user, healthAnalyzer);
|
2023-02-24 19:01:25 -05:00
|
|
|
_uiSystem.SendUiMessage(healthAnalyzer.UserInterface, new HealthAnalyzerScannedUserMessage(target));
|
2022-03-07 21:45:52 -06:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|