Fix sloth's disease shit (#7123)

This commit is contained in:
metalgearsloth
2022-03-15 07:51:42 +11:00
committed by GitHub
parent 4970a0ff71
commit 84225dde3d
7 changed files with 53 additions and 39 deletions

View File

@@ -27,17 +27,10 @@ namespace Content.Server.Medical.Components
public BoundUserInterface? UserInterface => Owner.GetUIOrNull(HealthAnalyzerUiKey.Key);
/// <summary>
/// Is this actually going to give people the disease below
/// </summary>
[DataField("fake")]
[ViewVariables(VVAccess.ReadWrite)]
public bool Fake = false;
/// <summary>
/// The disease this will give people if Fake == true
/// The disease this will give people.
/// </summary>
[DataField("disease", customTypeSerializer: typeof(PrototypeIdSerializer<DiseasePrototype>))]
[ViewVariables(VVAccess.ReadWrite)]
public string Disease = string.Empty;
public string? Disease;
}
}

View File

@@ -14,6 +14,7 @@ namespace Content.Server.Medical
{
public sealed class HealthAnalyzerSystem : EntitySystem
{
[Dependency] private readonly DiseaseSystem _disease = default!;
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!;
@@ -68,13 +69,13 @@ namespace Content.Server.Medical
{
args.Component.CancelToken = null;
UpdateScannedUser(args.Component.Owner, args.User, args.Target, args.Component);
/// 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
if (!args.Component.Fake || args.Component.Disease == string.Empty || args.Target == null)
// 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
if (string.IsNullOrEmpty(args.Component.Disease) || args.Target == null)
return;
EntitySystem.Get<DiseaseSystem>().TryAddDisease(null, null, args.Component.Disease, args.Target.Value);
_disease.TryAddDisease(args.Target.Value, args.Component.Disease);
if (args.User == args.Target)
{