This commit is contained in:
ShadowCommander
2023-06-18 11:33:19 -07:00
committed by GitHub
parent 8a943fb374
commit dd7032a860
85 changed files with 1432 additions and 711 deletions

View File

@@ -3,6 +3,7 @@ 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;
@@ -19,6 +20,7 @@ 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; }
@@ -188,10 +190,10 @@ namespace Content.Server.GameTicking
if (mind.VisitingEntity != default)
{
mind.UnVisit();
_mindSystem.UnVisit(mind);
}
var position = playerEntity is {Valid: true}
var position = Exists(playerEntity)
? Transform(playerEntity.Value).Coordinates
: GetObserverSpawnPoint();
@@ -206,7 +208,7 @@ 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 && mind.CharacterDeadPhysically;
var canReturn = canReturnGlobal && _mindSystem.IsCharacterDeadPhysically(mind);
if (canReturnGlobal && TryComp(playerEntity, out MobStateComponent? mobState))
{
@@ -248,9 +250,9 @@ namespace Content.Server.GameTicking
_ghosts.SetCanReturnToBody(ghostComponent, canReturn);
if (canReturn)
mind.Visit(ghost);
_mindSystem.Visit(mind, ghost);
else
mind.TransferTo(ghost);
_mindSystem.TransferTo(mind, ghost);
return true;
}