Player post-spawn hook and player ghosting controlled by preset (#2734)

* GamePreset: Add a hook to catch all player spawns for modification.

Unless someone makes the entire job system unpluggable, this is what you get...

* GamePreset: Is now in control of voluntary ghosting

* Clean up ghost code to only rely on a player's Mind
This commit is contained in:
20kdc
2020-12-11 01:10:55 +00:00
committed by GitHub
parent adc972f9d3
commit 31b39823ad
5 changed files with 107 additions and 56 deletions

View File

@@ -31,6 +31,7 @@ using Robust.Server.Interfaces.Maps;
using Robust.Server.Interfaces.Player;
using Robust.Server.Player;
using Robust.Server.ServerStatus;
using Robust.Server.Interfaces.Console;
using Robust.Shared.Enums;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.Configuration;
@@ -440,6 +441,11 @@ namespace Content.Server.GameTicking
UpdateJobsAvailable();
}
public bool OnGhostAttempt(Mind mind, bool canReturnGlobal)
{
return Preset.OnGhostAttempt(mind, canReturnGlobal);
}
public T AddGameRule<T>() where T : GameRule, new()
{
var instance = _dynamicTypeFactory.CreateInstance<T>();
@@ -887,6 +893,8 @@ namespace Content.Server.GameTicking
AddSpawnedPosition(jobId);
EquipIdCard(mob, character.Name, jobPrototype);
jobPrototype.Special?.AfterEquip(mob);
Preset.OnSpawnPlayerCompleted(session, mob, lateJoin);
}
private void EquipIdCard(IEntity mob, string characterName, JobPrototype jobPrototype)