diff --git a/Content.Client/HealthAnalyzer/UI/HealthAnalyzerWindow.xaml.cs b/Content.Client/HealthAnalyzer/UI/HealthAnalyzerWindow.xaml.cs index 4a141072ccb..8ed6fc63e40 100644 --- a/Content.Client/HealthAnalyzer/UI/HealthAnalyzerWindow.xaml.cs +++ b/Content.Client/HealthAnalyzer/UI/HealthAnalyzerWindow.xaml.cs @@ -1,6 +1,7 @@ using System.Linq; using System.Numerics; using Content.Client.Message; +using Content.Shared._DV.Traits.Assorted; // DeltaV using Content.Shared.Atmos; using Content.Client.UserInterface.Controls; using Content.Shared._Shitmed.Targeting; // Shitmed @@ -36,6 +37,7 @@ public sealed partial class HealthAnalyzerWindow : FancyWindow private readonly SpriteSystem _spriteSystem; private readonly IPrototypeManager _prototypes; private readonly IResourceCache _cache; + private readonly UnborgableSystem _unborgable; // DeltaV // Shitmed Change Start public event Action? OnBodyPartSelected; @@ -57,6 +59,7 @@ public HealthAnalyzerWindow() _spriteSystem = _entityManager.System(); _prototypes = dependencies.Resolve(); _cache = dependencies.Resolve(); + _unborgable = _entityManager.System(); // DeltaV // Shitmed Change Start _bodyPartControls = new Dictionary { @@ -184,7 +187,8 @@ public void Populate(HealthAnalyzerScannedUserMessage msg) // Alerts - var showAlerts = msg.Unrevivable == true || msg.Bleeding == true; + var unborgable = _unborgable.IsUnborgable(_target.Value); // DeltaV + var showAlerts = msg.Unrevivable == true || msg.Bleeding == true || unborgable; AlertsDivider.Visible = showAlerts; AlertsContainer.Visible = showAlerts; @@ -208,6 +212,14 @@ public void Populate(HealthAnalyzerScannedUserMessage msg) MaxWidth = 300 }); + if (unborgable) // DeltaV + AlertsContainer.AddChild(new RichTextLabel + { + Text = Loc.GetString("health-analyzer-window-entity-unborgable-text"), + Margin = new Thickness(0, 4), + MaxWidth = 300 + }); + // Damage Groups var damageSortedGroups = diff --git a/Content.Shared/_DV/Traits/Assorted/UnborgableComponent.cs b/Content.Shared/_DV/Traits/Assorted/UnborgableComponent.cs new file mode 100644 index 00000000000..752d745870d --- /dev/null +++ b/Content.Shared/_DV/Traits/Assorted/UnborgableComponent.cs @@ -0,0 +1,10 @@ +using Robust.Shared.GameStates; + +namespace Content.Shared._DV.Traits.Assorted; + +/// +/// This is used for the unborgable trait, which blacklists a brain from MMIs. +/// If this is added to a body, it gets moved to its brain if it has one. +/// +[RegisterComponent, NetworkedComponent] +public sealed partial class UnborgableComponent : Component; diff --git a/Content.Shared/_DV/Traits/Assorted/UnborgableSystem.cs b/Content.Shared/_DV/Traits/Assorted/UnborgableSystem.cs new file mode 100644 index 00000000000..5580e171531 --- /dev/null +++ b/Content.Shared/_DV/Traits/Assorted/UnborgableSystem.cs @@ -0,0 +1,54 @@ +using Content.Shared.Body.Components; +using Content.Shared.Body.Organ; +using Content.Shared.Body.Systems; +using Content.Shared.Examine; +using Content.Shared.Movement.Components; // TODO: use BrainComponent instead of InputMover when shitmed is merged +using Robust.Shared.Utility; + +namespace Content.Shared._DV.Traits.Assorted; + +/// +/// Adds a warning examine message to brains with . +/// +public sealed class UnborgableSystem : EntitySystem +{ + [Dependency] private readonly SharedBodySystem _body = default!; + + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(OnMapInit); + SubscribeLocalEvent(OnExamined); + } + + /// + /// Returns true if a mob's brain has . + /// + public bool IsUnborgable(Entity ent) + { + // technically this will apply for any organ not just brain, but assume nobody will be evil and do that + return _body.GetBodyOrganEntityComps(ent).Count > 0; + } + + private void OnMapInit(Entity ent, ref MapInitEvent args) + { + if (!TryComp(ent, out var body)) + return; + + var brains = _body.GetBodyOrganEntityComps((ent.Owner, body)); + foreach (var brain in brains) + { + EnsureComp(brain); + } + } + + private void OnExamined(Entity ent, ref ExaminedEvent args) + { + // need a health analyzer to see if someone can't be borged, can't just look at them and know + if (!args.IsInDetailsRange || HasComp(ent)) + return; + + args.PushMarkup(Loc.GetString("brain-cannot-be-borged-message")); + } +} diff --git a/Resources/Locale/en-US/_DV/borg/borg.ftl b/Resources/Locale/en-US/_DV/borg/borg.ftl index 22c7e3850c6..afb1e15827d 100644 --- a/Resources/Locale/en-US/_DV/borg/borg.ftl +++ b/Resources/Locale/en-US/_DV/borg/borg.ftl @@ -1,3 +1,5 @@ borg-type-security-name = Security borg-type-security-desc = Assist security in the fight for justice by detaining dangerous criminals. borg-type-security-transponder = security cyborg + +brain-cannot-be-borged-message = [color=red]This brain is damaged beyond use.[/color] diff --git a/Resources/Locale/en-US/_DV/medical/components/health-analyzer-component.ftl b/Resources/Locale/en-US/_DV/medical/components/health-analyzer-component.ftl new file mode 100644 index 00000000000..7698576e4e5 --- /dev/null +++ b/Resources/Locale/en-US/_DV/medical/components/health-analyzer-component.ftl @@ -0,0 +1 @@ +health-analyzer-window-entity-unborgable-text = [color=red]Patient's brain signatures are incompatible with MMI technology![/color] diff --git a/Resources/Locale/en-US/_DV/traits/traits.ftl b/Resources/Locale/en-US/_DV/traits/traits.ftl index 5fb2e7052bc..b7f66f0bf8d 100644 --- a/Resources/Locale/en-US/_DV/traits/traits.ftl +++ b/Resources/Locale/en-US/_DV/traits/traits.ftl @@ -32,3 +32,6 @@ trait-inpain-desc = You’re constantly in discomfort. You need painkillers to f trait-addicted-name = Addicted trait-addicted-desc = You crave the substance, and your thoughts keep drifting back to it. Without it, you feel incomplete, anxious, and on edge. + +trait-unborgable-name = Machine Incompatible +trait-unborgable-desc = Your brain cannot be put into a man-machine interface. diff --git a/Resources/Prototypes/Entities/Objects/Specific/Robotics/mmi.yml b/Resources/Prototypes/Entities/Objects/Specific/Robotics/mmi.yml index 33eabbb60b5..4251a2447a5 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/Robotics/mmi.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/Robotics/mmi.yml @@ -41,6 +41,9 @@ whitelist: components: - Brain + blacklist: # DeltaV + components: + - Unborgable - type: ContainerContainer containers: brain_slot: !type:ContainerSlot diff --git a/Resources/Prototypes/_DV/Traits/disabilities.yml b/Resources/Prototypes/_DV/Traits/disabilities.yml index 96ded539387..611933b2e15 100644 --- a/Resources/Prototypes/_DV/Traits/disabilities.yml +++ b/Resources/Prototypes/_DV/Traits/disabilities.yml @@ -22,3 +22,11 @@ category: Disabilities components: - type: Pain + +- type: trait + id: Unborgable + name: trait-unborgable-name + description: trait-unborgable-desc + category: Disabilities + components: + - type: Unborgable # Automatically gets moved to the brain