Make MMIs work again (#20844)
This commit is contained in:
@@ -2,17 +2,13 @@ using Content.Server.Body.Components;
|
|||||||
using Content.Server.Ghost.Components;
|
using Content.Server.Ghost.Components;
|
||||||
using Content.Shared.Body.Components;
|
using Content.Shared.Body.Components;
|
||||||
using Content.Shared.Body.Events;
|
using Content.Shared.Body.Events;
|
||||||
using Content.Shared.Body.Organ;
|
|
||||||
using Content.Shared.Mind;
|
using Content.Shared.Mind;
|
||||||
using Content.Shared.Mind.Components;
|
using Content.Shared.Mind.Components;
|
||||||
using Content.Shared.Movement.Components;
|
|
||||||
using Content.Shared.Movement.Systems;
|
|
||||||
|
|
||||||
namespace Content.Server.Body.Systems
|
namespace Content.Server.Body.Systems
|
||||||
{
|
{
|
||||||
public sealed class BrainSystem : EntitySystem
|
public sealed class BrainSystem : EntitySystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly MovementSpeedModifierSystem _movementSpeed = default!;
|
|
||||||
[Dependency] private readonly SharedMindSystem _mindSystem = default!;
|
[Dependency] private readonly SharedMindSystem _mindSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
@@ -20,11 +16,14 @@ namespace Content.Server.Body.Systems
|
|||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
SubscribeLocalEvent<BrainComponent, AddedToPartInBodyEvent>((uid, _, args) => HandleMind(args.Body, uid));
|
SubscribeLocalEvent<BrainComponent, AddedToPartInBodyEvent>((uid, _, args) => HandleMind(args.Body, uid));
|
||||||
SubscribeLocalEvent<BrainComponent, RemovedFromPartInBodyEvent>((uid, _, args) => HandleMind(args.OldBody, uid));
|
SubscribeLocalEvent<BrainComponent, RemovedFromPartInBodyEvent>((uid, _, args) => HandleMind(uid, args.OldBody));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleMind(EntityUid newEntity, EntityUid oldEntity)
|
private void HandleMind(EntityUid newEntity, EntityUid oldEntity)
|
||||||
{
|
{
|
||||||
|
if (TerminatingOrDeleted(newEntity) || TerminatingOrDeleted(oldEntity))
|
||||||
|
return;
|
||||||
|
|
||||||
EnsureComp<MindContainerComponent>(newEntity);
|
EnsureComp<MindContainerComponent>(newEntity);
|
||||||
EnsureComp<MindContainerComponent>(oldEntity);
|
EnsureComp<MindContainerComponent>(oldEntity);
|
||||||
|
|
||||||
@@ -32,16 +31,6 @@ namespace Content.Server.Body.Systems
|
|||||||
if (HasComp<BodyComponent>(newEntity))
|
if (HasComp<BodyComponent>(newEntity))
|
||||||
ghostOnMove.MustBeDead = true;
|
ghostOnMove.MustBeDead = true;
|
||||||
|
|
||||||
// TODO: This is an awful solution.
|
|
||||||
// Our greatest minds still can't figure out how to allow brains/heads to ghost without giving them the
|
|
||||||
// ability to move first. I hate this with a passion.
|
|
||||||
if (!HasComp<InputMoverComponent>(newEntity))
|
|
||||||
{
|
|
||||||
AddComp<InputMoverComponent>(newEntity);
|
|
||||||
var move = EnsureComp<MovementSpeedModifierComponent>(newEntity);
|
|
||||||
_movementSpeed.ChangeBaseSpeed(newEntity, 0, 0 , 0, move);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!_mindSystem.TryGetMind(oldEntity, out var mindId, out var mind))
|
if (!_mindSystem.TryGetMind(oldEntity, out var mindId, out var mind))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public partial class SharedBodySystem
|
|||||||
private void OnBodyRemoved(EntityUid uid, BodyComponent component, EntRemovedFromContainerMessage args)
|
private void OnBodyRemoved(EntityUid uid, BodyComponent component, EntRemovedFromContainerMessage args)
|
||||||
{
|
{
|
||||||
// TODO: lifestage shenanigans
|
// TODO: lifestage shenanigans
|
||||||
if (LifeStage(uid) >= EntityLifeStage.Terminating)
|
if (TerminatingOrDeleted(uid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Root body part?
|
// Root body part?
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public partial class SharedBodySystem
|
|||||||
private void OnBodyPartRemoved(EntityUid uid, BodyPartComponent component, EntRemovedFromContainerMessage args)
|
private void OnBodyPartRemoved(EntityUid uid, BodyPartComponent component, EntRemovedFromContainerMessage args)
|
||||||
{
|
{
|
||||||
// TODO: lifestage shenanigans
|
// TODO: lifestage shenanigans
|
||||||
if (LifeStage(uid) >= EntityLifeStage.Terminating)
|
if (TerminatingOrDeleted(uid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Body part removed from another body part.
|
// Body part removed from another body part.
|
||||||
|
|||||||
@@ -49,6 +49,8 @@
|
|||||||
- ReagentId: Nutriment
|
- ReagentId: Nutriment
|
||||||
Quantity: 5
|
Quantity: 5
|
||||||
- type: Brain
|
- type: Brain
|
||||||
|
- type: InputMover
|
||||||
|
- type: Examiner
|
||||||
- type: Lung #lungs in they head. why they there tho?
|
- type: Lung #lungs in they head. why they there tho?
|
||||||
- type: Metabolizer
|
- type: Metabolizer
|
||||||
removeEmpty: true
|
removeEmpty: true
|
||||||
|
|||||||
@@ -36,6 +36,8 @@
|
|||||||
- type: Input
|
- type: Input
|
||||||
context: "ghost"
|
context: "ghost"
|
||||||
- type: Brain
|
- type: Brain
|
||||||
|
- type: InputMover
|
||||||
|
- type: Examiner
|
||||||
- type: BlockMovement
|
- type: BlockMovement
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
|
|||||||
Reference in New Issue
Block a user