Ghost on mind shutdown fixes, no more ghost stacking at bar.
Fixes #1701
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
|
using Content.Server.Commands.Observer;
|
||||||
using Content.Server.GameObjects.Components.Medical;
|
using Content.Server.GameObjects.Components.Medical;
|
||||||
using Content.Server.GameObjects.Components.Observer;
|
using Content.Server.GameObjects.Components.Observer;
|
||||||
|
using Content.Server.GameTicking;
|
||||||
using Content.Server.Interfaces.GameTicking;
|
using Content.Server.Interfaces.GameTicking;
|
||||||
using Content.Server.Mobs;
|
using Content.Server.Mobs;
|
||||||
using Content.Server.Utility;
|
using Content.Server.Utility;
|
||||||
@@ -29,7 +31,6 @@ namespace Content.Server.GameObjects.Components.Mobs
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public class MindComponent : Component, IExamine
|
public class MindComponent : Component, IExamine
|
||||||
{
|
{
|
||||||
private bool _showExamineInfo;
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string Name => "Mind";
|
public override string Name => "Mind";
|
||||||
@@ -50,11 +51,13 @@ namespace Content.Server.GameObjects.Components.Mobs
|
|||||||
/// Whether examining should show information about the mind or not.
|
/// Whether examining should show information about the mind or not.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
public bool ShowExamineInfo
|
public bool ShowExamineInfo { get; set; }
|
||||||
{
|
|
||||||
get => _showExamineInfo;
|
/// <summary>
|
||||||
set => _showExamineInfo = value;
|
/// Whether the mind will be put on a ghost after this component is shutdown.
|
||||||
}
|
/// </summary>
|
||||||
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public bool GhostOnShutdown { get; set; }
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
private BoundUserInterface? UserInterface =>
|
private BoundUserInterface? UserInterface =>
|
||||||
@@ -122,6 +125,10 @@ namespace Content.Server.GameObjects.Components.Mobs
|
|||||||
{
|
{
|
||||||
base.Shutdown();
|
base.Shutdown();
|
||||||
|
|
||||||
|
// Let's not create ghosts if not in the middle of the round.
|
||||||
|
if (IoCManager.Resolve<IGameTicker>().RunLevel != GameRunLevel.InRound)
|
||||||
|
return;
|
||||||
|
|
||||||
if (HasMind)
|
if (HasMind)
|
||||||
{
|
{
|
||||||
var visiting = Mind?.VisitingEntity;
|
var visiting = Mind?.VisitingEntity;
|
||||||
@@ -134,7 +141,7 @@ namespace Content.Server.GameObjects.Components.Mobs
|
|||||||
|
|
||||||
Mind!.TransferTo(visiting);
|
Mind!.TransferTo(visiting);
|
||||||
}
|
}
|
||||||
else
|
else if(GhostOnShutdown)
|
||||||
{
|
{
|
||||||
var spawnPosition = Owner.Transform.Coordinates;
|
var spawnPosition = Owner.Transform.Coordinates;
|
||||||
// Use a regular timer here because the entity has probably been deleted.
|
// Use a regular timer here because the entity has probably been deleted.
|
||||||
@@ -166,7 +173,8 @@ namespace Content.Server.GameObjects.Components.Mobs
|
|||||||
public override void ExposeData(ObjectSerializer serializer)
|
public override void ExposeData(ObjectSerializer serializer)
|
||||||
{
|
{
|
||||||
base.ExposeData(serializer);
|
base.ExposeData(serializer);
|
||||||
serializer.DataField(ref _showExamineInfo, "show_examine_info", false);
|
serializer.DataField(this, x => x.ShowExamineInfo, "showExamineInfo", false);
|
||||||
|
serializer.DataField(this, x => x.GhostOnShutdown, "ghostOnShutdown", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Examine(FormattedMessage message, bool inDetailsRange)
|
public void Examine(FormattedMessage message, bool inDetailsRange)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
drawdepth: Mobs
|
drawdepth: Mobs
|
||||||
components:
|
components:
|
||||||
- type: Mind
|
- type: Mind
|
||||||
show_examine_info: true
|
showExamineInfo: true
|
||||||
- type: Input
|
- type: Input
|
||||||
context: "human"
|
context: "human"
|
||||||
- type: Alerts
|
- type: Alerts
|
||||||
|
|||||||
Reference in New Issue
Block a user