From 22b36cee3647346d95ff57bfe2843625d4bdeb50 Mon Sep 17 00:00:00 2001 From: mirrorcult Date: Fri, 18 Feb 2022 23:03:15 -0700 Subject: [PATCH] Blood stuff in health examine (#6788) * Blood stuff in health examine * oop --- .../Body/Systems/BloodstreamSystem.cs | 19 ++++++++++++--- .../HealthExaminableComponent.cs | 2 +- .../HealthExaminableSystem.cs | 23 +++++++++++++++++-- .../Locale/en-US/bloodstream/bloodstream.ftl | 2 ++ 4 files changed, 40 insertions(+), 6 deletions(-) diff --git a/Content.Server/Body/Systems/BloodstreamSystem.cs b/Content.Server/Body/Systems/BloodstreamSystem.cs index 540fd3156d..7bcc7fd5da 100644 --- a/Content.Server/Body/Systems/BloodstreamSystem.cs +++ b/Content.Server/Body/Systems/BloodstreamSystem.cs @@ -2,6 +2,7 @@ using Content.Server.Body.Components; using Content.Server.Chemistry.EntitySystems; using Content.Server.Fluids.EntitySystems; +using Content.Server.HealthExaminable; using Content.Shared.Chemistry.Components; using Content.Shared.Damage; using Content.Shared.Damage.Prototypes; @@ -33,7 +34,7 @@ public sealed class BloodstreamSystem : EntitySystem SubscribeLocalEvent(OnComponentInit); SubscribeLocalEvent(OnDamageChanged); - SubscribeLocalEvent(OnExamined); + SubscribeLocalEvent(OnHealthBeingExamined); SubscribeLocalEvent(OnBeingGibbed); } @@ -125,11 +126,23 @@ public sealed class BloodstreamSystem : EntitySystem } } - private void OnExamined(EntityUid uid, BloodstreamComponent component, ExaminedEvent args) + private void OnHealthBeingExamined(EntityUid uid, BloodstreamComponent component, HealthBeingExaminedEvent args) { + if (component.BleedAmount > 10) + { + args.Message.PushNewline(); + args.Message.AddMarkup(Loc.GetString("bloodstream-component-profusely-bleeding", ("target", uid))); + } + else if (component.BleedAmount > 0) + { + args.Message.PushNewline(); + args.Message.AddMarkup(Loc.GetString("bloodstream-component-bleeding", ("target", uid))); + } + if (GetBloodLevelPercentage(uid, component) < component.BloodlossThreshold) { - args.PushMarkup(Loc.GetString("bloodstream-component-looks-pale", ("target", uid))); + args.Message.PushNewline(); + args.Message.AddMarkup(Loc.GetString("bloodstream-component-looks-pale", ("target", uid))); } } diff --git a/Content.Server/HealthExaminable/HealthExaminableComponent.cs b/Content.Server/HealthExaminable/HealthExaminableComponent.cs index 97b8bf8ee5..c1eb417ed2 100644 --- a/Content.Server/HealthExaminable/HealthExaminableComponent.cs +++ b/Content.Server/HealthExaminable/HealthExaminableComponent.cs @@ -4,7 +4,7 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototy namespace Content.Server.HealthExaminable; -[RegisterComponent] +[RegisterComponent, Friend(typeof(HealthExaminableSystem))] public sealed class HealthExaminableComponent : Component { public List Thresholds = new() diff --git a/Content.Server/HealthExaminable/HealthExaminableSystem.cs b/Content.Server/HealthExaminable/HealthExaminableSystem.cs index 1826858b9e..dd5aa04691 100644 --- a/Content.Server/HealthExaminable/HealthExaminableSystem.cs +++ b/Content.Server/HealthExaminable/HealthExaminableSystem.cs @@ -68,10 +68,11 @@ public sealed class HealthExaminableSystem : EntitySystem if (tempLocStr == str) continue; - chosenLocStr = tempLocStr; - if (dmg > threshold && threshold > closest) + { + chosenLocStr = tempLocStr; closest = threshold; + } } if (closest == FixedPoint2.Zero) @@ -93,6 +94,24 @@ public sealed class HealthExaminableSystem : EntitySystem msg.AddMarkup(Loc.GetString($"health-examinable-{component.LocPrefix}-none")); } + // Anything else want to add on to this? + RaiseLocalEvent(uid, new HealthBeingExaminedEvent(msg)); + return msg; } } + +/// +/// A class raised on an entity whose health is being examined +/// in order to add special text that is not handled by the +/// damage thresholds. +/// +public sealed class HealthBeingExaminedEvent +{ + public FormattedMessage Message; + + public HealthBeingExaminedEvent(FormattedMessage message) + { + Message = message; + } +} diff --git a/Resources/Locale/en-US/bloodstream/bloodstream.ftl b/Resources/Locale/en-US/bloodstream/bloodstream.ftl index 96996b6b91..d2f0501a99 100644 --- a/Resources/Locale/en-US/bloodstream/bloodstream.ftl +++ b/Resources/Locale/en-US/bloodstream/bloodstream.ftl @@ -1 +1,3 @@ bloodstream-component-looks-pale = [color=bisque]{CAPITALIZE(SUBJECT($target))} looks pale.[/color] +bloodstream-component-bleeding = [color=red]{CAPITALIZE(SUBJECT($target))} {CONJUGATE-BE($target)} bleeding.[/color] +bloodstream-component-profusely-bleeding = [color=crimson]{CAPITALIZE(SUBJECT($target))} {CONJUGATE-BE($target)} profusely bleeding![/color]