MCPcopy Create free account
hub / github.com/assaultcube/AC / tryrespawn

Function tryrespawn

source/src/clientgame.cpp:818–855  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

816int waiting_permission = 0;
817
818bool tryrespawn()
819{
820 if(spawnpermission > SP_OK_NUM)
821 {
822 hudeditf(HUDMSG_TIMER, "\f%s", spawn_message());
823 }
824 else if(player1->state==CS_DEAD || player1->state==CS_SPECTATE)
825 {
826 if(team_isspect(player1->team))
827 {
828 respawnself();
829 return true;
830 }
831 else
832 {
833 int respawnmillis = player1->lastdeath + (m_arena ? 0 : (m_flags_ ? 5000 : 2000));
834 if(lastmillis>respawnmillis)
835 {
836 player1->attacking = false;
837 if(m_arena)
838 {
839 if(!arenaintermission) hudeditf(HUDMSG_TIMER, "waiting for new round to start...");
840 else lastspawnattempt = lastmillis;
841 return false;
842 }
843 if (lastmillis > waiting_permission)
844 {
845 waiting_permission = lastmillis + 1000;
846 respawnself();
847 }
848 else hudeditf(HUDMSG_TIMER, "\f%s", spawn_message());
849 return true;
850 }
851 else lastspawnattempt = lastmillis;
852 }
853 }
854 return false;
855}
856
857VARP(hitsound, 0, 0, 2);
858

Callers 2

attackFunction · 0.85
spectateFunction · 0.85

Calls 3

hudeditfFunction · 0.85
spawn_messageFunction · 0.85
respawnselfFunction · 0.85

Tested by

no test coverage detected