def pop_tts(self, player, needs_short_time = False): last_tts = player.__dict__.get('fh2_kitlim_last_tts', None) if DEBUG: print 'popping tts', last_tts if last_tts is None and not needs_short_time: return dst = defaultspawntime(player) if 'deathtime' in player.__dict__: if DEBUG: print 'deathtime is', player.deathtime rst = host.timer_getWallTime() - player.deathtime if DEBUG: print 'time since death is', rst rst = dst - rst if DEBUG: print 'remaining spawn time is', rst else: rst = dst if rst < 0: rst = 0 if rst > dst: rst = dst rst += 1 # Changing rst to be compatible with spawnwave system - Spit. try: if not player.isManDown(): player.is_first_waiting = False if (host.timer_getWallTime() - player.deathtime) < player.stod + spawnwave.waveTime(): player.is_first_waiting = True # Change the spawntime only if HUGE_TTS is applied: if player.getTimeToSpawn() > 400 and int(game.utilities.rconExec('sv.spawntime')) > spawnwave.minTime(): rst = game.utilities.getSpawnTime(rstime = round_start_time, dt = player.command_time) if not player.is_first_waiting: # Not first waiting if rst < (dst - spawnwave.waveTime()): # Spawnwave does not last player.setTimeToSpawn(rst) else: # Spawnave lasts player.setTimeToSpawn(0) else: # First waiting ovv = player.stod - int(game.utilities.rconExec('sv.spawntime')) if ovv < 0: ovv = 0 if rst < spawnwave.minTime() and (host.timer_getWallTime() - player.deathtime) < ovv: # Apply minimum time fix only in proper moment. rst = rst + int(game.utilities.rconExec('sv.spawntime')) if (host.timer_getWallTime() - player.deathtime) >= (player.stod - 2): player.setTimeToSpawn(0) else: player.setTimeToSpawn(rst) else: player.setTimeToSpawn(rst) except Exception, e: player.setTimeToSpawn(rst)
def deathhook(self, player, soldier): player.deathtime = host.timer_getWallTime() # Spawntime on death: player.stod = game.utilities.getSpawnTime(rstime = round_start_time, dt = player.deathtime) if player.stod < spawnwave.minTime(): player.stod = player.stod + int(game.utilities.rconExec('sv.spawntime')) selected = player.__dict__.get('fh2_kitlim_selected', None) if selected is None: return player.deathtime = host.timer_getWallTime() self.rconhook(player.index, 'selectkit %d'%selected)