Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions Content.Server/Body/Components/BrainComponent.cs

This file was deleted.

11 changes: 0 additions & 11 deletions Content.Server/Ghost/Components/GhostOnMoveComponent.cs

This file was deleted.

6 changes: 6 additions & 0 deletions Content.Shared/Body/Components/BrainComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
using Content.Shared.Body.Systems;

namespace Content.Shared.Body.Components;

[RegisterComponent, Access(typeof(BrainSystem))]
public sealed partial class BrainComponent : Component;
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
using Content.Server.Body.Components;
using Content.Server.Ghost.Components;
using Content.Shared.Body.Components;
using Content.Shared.Body.Events;
using Content.Shared.Ghost;
using Content.Shared.Mind;
using Content.Shared.Mind.Components;
using Content.Shared.Mobs.Components;
using Content.Shared.Pointing;

namespace Content.Server.Body.Systems;
namespace Content.Shared.Body.Systems;

public sealed class BrainSystem : EntitySystem
{
[Dependency] private readonly SharedMindSystem _mindSystem = default!;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<BrainComponent, OrganAddedToBodyEvent>((uid, _, args) => HandleMind(args.Body, uid));
SubscribeLocalEvent<BrainComponent, OrganRemovedFromBodyEvent>((uid, _, args) => HandleMind(uid, args.OldBody));
SubscribeLocalEvent<BrainComponent, PointAttemptEvent>(OnPointAttempt);
Expand All @@ -31,16 +29,16 @@ private void HandleMind(EntityUid newEntity, EntityUid oldEntity)

var ghostOnMove = EnsureComp<GhostOnMoveComponent>(newEntity);
ghostOnMove.MustBeDead = HasComp<MobStateComponent>(newEntity); // Don't ghost living players out of their bodies.
Dirty(newEntity, ghostOnMove);

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

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

private void OnPointAttempt(Entity<BrainComponent> ent, ref PointAttemptEvent args)
private static void OnPointAttempt(Entity<BrainComponent> ent, ref PointAttemptEvent args)
{
args.Cancel();
}
}

13 changes: 13 additions & 0 deletions Content.Shared/Ghost/GhostOnMoveComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using Robust.Shared.GameStates;

namespace Content.Shared.Ghost;

[RegisterComponent, NetworkedComponent]
public sealed partial class GhostOnMoveComponent : Component
{
[DataField]
public bool CanReturn { get; set; } = true;

[DataField]
public bool MustBeDead;
}
Loading