parent
317ab5a006
commit
b0b28467f5
|
|
@ -254,36 +254,11 @@ namespace Content.Server.GameTicking
|
|||
return;
|
||||
}
|
||||
|
||||
PlayerJoinGame(player, silent);
|
||||
|
||||
var data = player.ContentData();
|
||||
|
||||
DebugTools.AssertNotNull(data);
|
||||
|
||||
var newMind = _mind.CreateMind(data!.UserId, character.Name);
|
||||
_mind.SetUserId(newMind, data.UserId);
|
||||
|
||||
var jobPrototype = _prototypeManager.Index<JobPrototype>(jobId);
|
||||
|
||||
_playTimeTrackings.PlayerRolesChanged(player);
|
||||
|
||||
// Delta-V: Add AlwaysUseSpawner.
|
||||
var spawnPointType = SpawnPointType.Unset;
|
||||
if (jobPrototype.AlwaysUseSpawner)
|
||||
{
|
||||
// Begin DeltaV Additions - Override latejoin
|
||||
DoSpawn(player, character, station, jobId, silent, out var mob, out var jobPrototype, out var jobName, out var clearLatejoin);
|
||||
if (clearLatejoin)
|
||||
lateJoin = false;
|
||||
spawnPointType = SpawnPointType.Job;
|
||||
}
|
||||
|
||||
var mobMaybe = _stationSpawning.SpawnPlayerCharacterOnStation(station, jobId, character, spawnPointType: spawnPointType); // DeltaV: pass in spawn point type
|
||||
DebugTools.AssertNotNull(mobMaybe);
|
||||
var mob = mobMaybe!.Value;
|
||||
|
||||
_mind.TransferTo(newMind, mob);
|
||||
|
||||
_roles.MindAddJobRole(newMind, silent: silent, jobPrototype: jobId);
|
||||
var jobName = _jobs.MindTryGetJobName(newMind);
|
||||
_admin.UpdatePlayerList(player);
|
||||
// End DeltaV Additions - Override latejoin
|
||||
|
||||
if (lateJoin && !silent)
|
||||
{
|
||||
|
|
@ -356,6 +331,54 @@ namespace Content.Server.GameTicking
|
|||
RaiseLocalEvent(mob, aev, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a mob on the specified station, creates the new mind, equips job-specific starting gear and loadout
|
||||
/// </summary>
|
||||
public void DoSpawn(
|
||||
ICommonSession player,
|
||||
HumanoidCharacterProfile character,
|
||||
EntityUid station,
|
||||
string jobId,
|
||||
bool silent,
|
||||
out EntityUid mob,
|
||||
out JobPrototype jobPrototype,
|
||||
out string jobName,
|
||||
out bool clearLatejoin)
|
||||
{
|
||||
PlayerJoinGame(player, silent);
|
||||
|
||||
var data = player.ContentData();
|
||||
|
||||
DebugTools.AssertNotNull(data);
|
||||
|
||||
var newMind = _mind.CreateMind(data!.UserId, character.Name);
|
||||
_mind.SetUserId(newMind, data.UserId);
|
||||
|
||||
jobPrototype = _prototypeManager.Index<JobPrototype>(jobId);
|
||||
|
||||
_playTimeTrackings.PlayerRolesChanged(player);
|
||||
|
||||
// Delta-V: Add AlwaysUseSpawner.
|
||||
var spawnPointType = SpawnPointType.Unset;
|
||||
if (jobPrototype.AlwaysUseSpawner)
|
||||
{
|
||||
clearLatejoin = true;
|
||||
spawnPointType = SpawnPointType.Job;
|
||||
}
|
||||
else
|
||||
clearLatejoin = false;
|
||||
|
||||
var mobMaybe = _stationSpawning.SpawnPlayerCharacterOnStation(station, jobId, character, spawnPointType: spawnPointType); // DeltaV: pass in spawn point type
|
||||
DebugTools.AssertNotNull(mobMaybe);
|
||||
mob = mobMaybe!.Value;
|
||||
|
||||
_mind.TransferTo(newMind, mob);
|
||||
|
||||
_roles.MindAddJobRole(newMind, silent: silent, jobPrototype: jobId);
|
||||
jobName = _jobs.MindTryGetJobName(newMind);
|
||||
_admin.UpdatePlayerList(player);
|
||||
}
|
||||
|
||||
public void Respawn(ICommonSession player)
|
||||
{
|
||||
_mind.WipeMind(player);
|
||||
|
|
|
|||
Loading…
Reference in New Issue