Blood stuff in health examine (#6788)
* Blood stuff in health examine * oop
This commit is contained in:
@@ -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<BloodstreamComponent, ComponentInit>(OnComponentInit);
|
||||
SubscribeLocalEvent<BloodstreamComponent, DamageChangedEvent>(OnDamageChanged);
|
||||
SubscribeLocalEvent<BloodstreamComponent, ExaminedEvent>(OnExamined);
|
||||
SubscribeLocalEvent<BloodstreamComponent, HealthBeingExaminedEvent>(OnHealthBeingExamined);
|
||||
SubscribeLocalEvent<BloodstreamComponent, BeingGibbedEvent>(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)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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<FixedPoint2> Thresholds = new()
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
public sealed class HealthBeingExaminedEvent
|
||||
{
|
||||
public FormattedMessage Message;
|
||||
|
||||
public HealthBeingExaminedEvent(FormattedMessage message)
|
||||
{
|
||||
Message = message;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user