Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Machine Incompatible Trait #2395

Merged
merged 14 commits into from
Jan 10, 2025
17 changes: 17 additions & 0 deletions Content.Server/Body/Systems/BrainSystem.cs
deltanedas marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
using Content.Shared.Mind;
using Content.Shared.Mind.Components;
using Content.Shared.Pointing;
// DeltaV Start
using Content.Shared.Examine;
using Content.Server.Traits.Assorted;
using Robust.Shared.Utility;
// DeltaV End

namespace Content.Server.Body.Systems
{
Expand All @@ -19,6 +24,7 @@ public override void Initialize()
SubscribeLocalEvent<BrainComponent, OrganAddedToBodyEvent>((uid, _, args) => HandleMind(args.Body, uid));
SubscribeLocalEvent<BrainComponent, OrganRemovedFromBodyEvent>((uid, _, args) => HandleMind(uid, args.OldBody));
SubscribeLocalEvent<BrainComponent, PointAttemptEvent>(OnPointAttempt);
SubscribeLocalEvent<UnborgableComponent, ExaminedEvent>(OnExamined); // DeltaV
}

private void HandleMind(EntityUid newEntity, EntityUid oldEntity)
Expand All @@ -33,12 +39,23 @@ private void HandleMind(EntityUid newEntity, EntityUid oldEntity)
if (HasComp<BodyComponent>(newEntity))
ghostOnMove.MustBeDead = true;

if (HasComp<UnborgableComponent>(oldEntity)) // DeltaV
EnsureComp<UnborgableComponent>(newEntity);

if (!_mindSystem.TryGetMind(oldEntity, out var mindId, out var mind))
return;

_mindSystem.TransferTo(mindId, newEntity, mind: mind);
}

private void OnExamined(Entity<UnborgableComponent> ent, ref ExaminedEvent args) //DeltaV
deltanedas marked this conversation as resolved.
Show resolved Hide resolved
{
var msg = new FormattedMessage();
msg.AddMarkupPermissive("[color=red]This brain is damaged beyond use.[/color]");
Emily9031 marked this conversation as resolved.
Show resolved Hide resolved

args.PushMessage(msg, 1);
}

private void OnPointAttempt(Entity<BrainComponent> ent, ref PointAttemptEvent args)
{
args.Cancel();
Expand Down
10 changes: 10 additions & 0 deletions Content.Server/Traits/Assorted/UnborgableComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Content.Server.Traits.Assorted;

/// <summary>
/// This is used for the unborgable trait.
/// </summary>
[RegisterComponent]
deltanedas marked this conversation as resolved.
Show resolved Hide resolved
public sealed partial class UnborgableComponent : Component
{

}
Emily9031 marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 3 additions & 0 deletions Resources/Locale/en-US/deltav/traits/traits.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -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.
8 changes: 8 additions & 0 deletions Resources/Prototypes/DeltaV/Traits/disabilities.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
whitelist:
components:
- Brain
blacklist:
components:
- Unborgable # DeltaV
Emily9031 marked this conversation as resolved.
Show resolved Hide resolved
- type: ContainerContainer
containers:
brain_slot: !type:ContainerSlot
Expand Down
Loading