diff options
| author | oy <Tom_Adams@web.de> | 2011-03-26 22:38:05 +0100 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2011-03-26 22:38:05 +0100 |
| commit | 722644008f05dee4994c955b89be1d2342077d32 (patch) | |
| tree | 9beb034cddfd8d1e145f70258346aad1787777bb /src/game | |
| parent | 5b328e54842b128881237ed608705b596f310ce8 (diff) | |
| download | zcatch-722644008f05dee4994c955b89be1d2342077d32.tar.gz zcatch-722644008f05dee4994c955b89be1d2342077d32.zip | |
added a respawn delay command for tdm
Diffstat (limited to 'src/game')
| -rw-r--r-- | src/game/server/entities/character.cpp | 5 | ||||
| -rw-r--r-- | src/game/server/gamecontext.cpp | 1 | ||||
| -rw-r--r-- | src/game/server/gamecontroller.cpp | 2 | ||||
| -rw-r--r-- | src/game/server/gamemodes/tdm.cpp | 4 | ||||
| -rw-r--r-- | src/game/variables.h | 2 |
5 files changed, 10 insertions, 4 deletions
diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp index 49bd4ee4..b40e768b 100644 --- a/src/game/server/entities/character.cpp +++ b/src/game/server/entities/character.cpp @@ -664,6 +664,8 @@ bool CCharacter::IncreaseArmor(int Amount) void CCharacter::Die(int Killer, int Weapon) { + // we got to wait 0.5 secs before respawning + m_pPlayer->m_RespawnTick = Server()->Tick()+Server()->TickSpeed()/2; int ModeSpecial = GameServer()->m_pController->OnCharacterDeath(this, GameServer()->m_apPlayers[Killer], Weapon); char aBuf[256]; @@ -690,9 +692,6 @@ void CCharacter::Die(int Killer, int Weapon) GameServer()->m_World.RemoveEntity(this); GameServer()->m_World.m_Core.m_apCharacters[m_pPlayer->GetCID()] = 0; GameServer()->CreateDeath(m_Pos, m_pPlayer->GetCID()); - - // we got to wait 0.5 secs before respawning - m_pPlayer->m_RespawnTick = Server()->Tick()+Server()->TickSpeed()/2; } bool CCharacter::TakeDamage(vec2 Force, int Dmg, int From, int Weapon) diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index 907542f2..6a7cc1f9 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -948,7 +948,6 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID) pPlayer->m_LastKill = Server()->Tick(); pPlayer->KillCharacter(WEAPON_SELF); - pPlayer->m_RespawnTick = Server()->Tick()+Server()->TickSpeed()*3; } } diff --git a/src/game/server/gamecontroller.cpp b/src/game/server/gamecontroller.cpp index e37bde65..c61168f9 100644 --- a/src/game/server/gamecontroller.cpp +++ b/src/game/server/gamecontroller.cpp @@ -391,6 +391,8 @@ int IGameController::OnCharacterDeath(class CCharacter *pVictim, class CPlayer * else pKiller->m_Score++; // normal kill } + if(Weapon == WEAPON_SELF) + pVictim->GetPlayer()->m_RespawnTick = Server()->Tick()+Server()->TickSpeed()*3.0f; return 0; } diff --git a/src/game/server/gamemodes/tdm.cpp b/src/game/server/gamemodes/tdm.cpp index ef5302c6..fb0ff783 100644 --- a/src/game/server/gamemodes/tdm.cpp +++ b/src/game/server/gamemodes/tdm.cpp @@ -1,5 +1,7 @@ /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ /* If you are missing that file, acquire a complete release at teeworlds.com. */ +#include <engine/shared/config.h> + #include <game/server/entities/character.h> #include <game/server/player.h> #include "tdm.h" @@ -23,6 +25,8 @@ int CGameControllerTDM::OnCharacterDeath(class CCharacter *pVictim, class CPlaye else m_aTeamscore[pKiller->GetTeam()&1]++; // good shit } + + pVictim->GetPlayer()->m_RespawnTick = max(pVictim->GetPlayer()->m_RespawnTick, Server()->Tick()+Server()->TickSpeed()*g_Config.m_SvRespawnDelayTDM); return 0; } diff --git a/src/game/variables.h b/src/game/variables.h index ce8e6ccb..d69b56d3 100644 --- a/src/game/variables.h +++ b/src/game/variables.h @@ -64,6 +64,8 @@ MACRO_CONFIG_STR(SvGametype, sv_gametype, 32, "dm", CFGFLAG_SERVER, "Game type ( MACRO_CONFIG_INT(SvTournamentMode, sv_tournament_mode, 0, 0, 1, CFGFLAG_SERVER, "Tournament mode. When enabled, players joins the server as spectator") MACRO_CONFIG_INT(SvSpamprotection, sv_spamprotection, 1, 0, 1, CFGFLAG_SERVER, "Spam protection") +MACRO_CONFIG_INT(SvRespawnDelayTDM, sv_respawn_delay_tdm, 3, 0, 10, CFGFLAG_SERVER, "Time needed to respawn after death in tdm gametype") + MACRO_CONFIG_INT(SvSpectatorSlots, sv_spectator_slots, 0, 0, MAX_CLIENTS, CFGFLAG_SERVER, "Number of slots to reserve for spectators") MACRO_CONFIG_INT(SvTeambalanceTime, sv_teambalance_time, 1, 0, 1000, CFGFLAG_SERVER, "How many minutes to wait before autobalancing teams") MACRO_CONFIG_INT(SvInactiveKickTime, sv_inactivekick_time, 3, 0, 1000, CFGFLAG_SERVER, "How many minutes to wait before taking care of inactive players") |