MCPcopy Create free account
hub / github.com/ddnet/ddnet / TryRespawn

Method TryRespawn

src/game/server/player.cpp:724–740  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

722}
723
724void CPlayer::TryRespawn()
725{
726 vec2 SpawnPos;
727
728 if(!GameServer()->m_pController->CanSpawn(m_Team, &SpawnPos, m_ClientId))
729 return;
730
731 m_WeakHookSpawn = false;
732 m_Spawning = false;
733 m_pCharacter = new(m_ClientId) CCharacter(&GameServer()->m_World, GameServer()->GetLastPlayerInput(m_ClientId));
734 m_ViewPos = SpawnPos;
735 m_pCharacter->Spawn(this, SpawnPos);
736 GameServer()->CreatePlayerSpawn(SpawnPos, GameServer()->m_pController->GetMaskForPlayerWorldEvent(m_ClientId));
737
738 if(g_Config.m_SvTeam == SV_TEAM_FORCED_SOLO)
739 m_pCharacter->SetSolo(true);
740}
741
742void CPlayer::UpdatePlaytime()
743{

Callers

nothing calls this directly

Calls 6

CanSpawnMethod · 0.80
GetLastPlayerInputMethod · 0.80
SpawnMethod · 0.80
CreatePlayerSpawnMethod · 0.80
SetSoloMethod · 0.45

Tested by

no test coverage detected