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

Method Reset

src/game/server/player.cpp:43–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43void CPlayer::Reset()
44{
45 m_DieTick = Server()->Tick();
46 m_PreviousDieTick = m_DieTick;
47 m_JoinTick = Server()->Tick();
48 delete m_pCharacter;
49 m_pCharacter = nullptr;
50 SetSpectatorId(SPEC_FREEVIEW);
51 m_LastActionTick = Server()->Tick();
52 m_TeamChangeTick = Server()->Tick();
53 m_LastSetTeam = 0;
54 m_LastInvited = 0;
55 m_WeakHookSpawn = false;
56
57 int *pIdMap = Server()->GetIdMap(m_ClientId);
58 for(int i = 1; i < VANILLA_MAX_CLIENTS; i++)
59 {
60 pIdMap[i] = -1;
61 }
62 pIdMap[0] = m_ClientId;
63
64 // DDRace
65
66 m_LastCommandPos = 0;
67 m_LastPlaytime = 0;
68 m_ChatScore = 0;
69 m_Moderating = false;
70 m_EyeEmoteEnabled = true;
71 if(Server()->IsSixup(m_ClientId))
72 m_TimerType = TIMERTYPE_SIXUP;
73 else
74 m_TimerType = (g_Config.m_SvDefaultTimerType == TIMERTYPE_GAMETIMER || g_Config.m_SvDefaultTimerType == TIMERTYPE_GAMETIMER_AND_BROADCAST) ? TIMERTYPE_BROADCAST : g_Config.m_SvDefaultTimerType;
75
76 m_DefEmote = EMOTE_NORMAL;
77 m_Afk = true;
78 m_LastWhisperTo = -1;
79 m_LastSetSpectatorMode = 0;
80 m_aTimeoutCode[0] = '\0';
81 delete m_pLastTarget;
82 m_pLastTarget = new CNetObj_PlayerInput({0});
83 m_LastTargetInit = false;
84 m_TuneZone = 0;
85 m_TuneZoneOld = m_TuneZone;
86 m_Halloween = false;
87 m_FirstPacket = true;
88
89 m_SendVoteIndex = -1;
90
91 if(g_Config.m_Events)
92 {
93 const ETimeSeason Season = time_season();
94 if(Season == SEASON_NEWYEAR)
95 {
96 m_DefEmote = EMOTE_HAPPY;
97 }
98 else if(Season == SEASON_HALLOWEEN)
99 {
100 m_DefEmote = EMOTE_ANGRY;

Callers

nothing calls this directly

Calls 8

time_seasonFunction · 0.85
GetIdMapMethod · 0.80
PlayerDataMethod · 0.80
TickSpeedMethod · 0.80
ServerClass · 0.50
TickMethod · 0.45
IsSixupMethod · 0.45
ScoreMethod · 0.45

Tested by

no test coverage detected