Fix ghost respawn bug (#17511)
This commit is contained in:
@@ -3,13 +3,11 @@ using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.GameTicking.Presets;
|
||||
using Content.Server.Ghost.Components;
|
||||
using Content.Server.Mind;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Damage.Prototypes;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.Player;
|
||||
|
||||
@@ -19,9 +17,6 @@ namespace Content.Server.GameTicking
|
||||
{
|
||||
public const float PresetFailedCooldownIncrease = 30f;
|
||||
|
||||
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
||||
[Dependency] private readonly MindSystem _mindSystem = default!;
|
||||
|
||||
public GamePresetPrototype? Preset { get; private set; }
|
||||
|
||||
private bool StartPreset(IPlayerSession[] origReadyPlayers, bool force)
|
||||
@@ -190,7 +185,7 @@ namespace Content.Server.GameTicking
|
||||
|
||||
if (mind.VisitingEntity != default)
|
||||
{
|
||||
_mindSystem.UnVisit(mind);
|
||||
_mind.UnVisit(mind);
|
||||
}
|
||||
|
||||
var position = Exists(playerEntity)
|
||||
@@ -208,11 +203,11 @@ namespace Content.Server.GameTicking
|
||||
// + If we're in a mob that is critical, and we're supposed to be able to return if possible,
|
||||
// we're succumbing - the mob is killed. Therefore, character is dead. Ghosting OK.
|
||||
// (If the mob survives, that's a bug. Ghosting is kept regardless.)
|
||||
var canReturn = canReturnGlobal && _mindSystem.IsCharacterDeadPhysically(mind);
|
||||
var canReturn = canReturnGlobal && _mind.IsCharacterDeadPhysically(mind);
|
||||
|
||||
if (canReturnGlobal && TryComp(playerEntity, out MobStateComponent? mobState))
|
||||
{
|
||||
if (_mobStateSystem.IsCritical(playerEntity.Value, mobState))
|
||||
if (_mobState.IsCritical(playerEntity.Value, mobState))
|
||||
{
|
||||
canReturn = true;
|
||||
|
||||
@@ -250,9 +245,9 @@ namespace Content.Server.GameTicking
|
||||
_ghosts.SetCanReturnToBody(ghostComponent, canReturn);
|
||||
|
||||
if (canReturn)
|
||||
_mindSystem.Visit(mind, ghost);
|
||||
_mind.Visit(mind, ghost);
|
||||
else
|
||||
_mindSystem.TransferTo(mind, ghost);
|
||||
_mind.TransferTo(mind, ghost);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user