def draw_status_line(): _flashing_text = [] _non_flashing_text = [] if LIFE[SETTINGS['following']]['dead']: return False if not SETTINGS['following']: return False if LIFE[SETTINGS['following']]['targeting']: _flashing_text.append('Firing') if LIFE[SETTINGS['following']]['strafing']: _non_flashing_text.append('Strafing') if SETTINGS['paused']: if life.is_target_of(LIFE[SETTINGS['following']]): _non_flashing_text.append('Combat') else: _non_flashing_text.append('Paused') if not LIFE[SETTINGS['following']]['stance'] == 'standing': _non_flashing_text.append(LIFE[SETTINGS['following']]['stance'].title()) blit_string(0, MAP_WINDOW_SIZE[1]-1, ' - '.join(_non_flashing_text), 'map') if time.time()%1>=0.5: blit_string(len(_non_flashing_text)+1, MAP_WINDOW_SIZE[1]-1, ' - '.join(_flashing_text), 'map')
def can_tick(ignore_tickrate=False, ignore_pause=False): if SETTINGS['controlling'] and not EVENTS and not sum( [abs(i) for i in LIFE[SETTINGS['controlling']]['velocity']]): if life.is_target_of(LIFE[SETTINGS['controlling']]): if not SETTINGS['paused']: gfx.message('An enemy appears.', style='important') SETTINGS['paused'] = True if not ignore_pause and SETTINGS['paused'] and not LIFE[ SETTINGS['controlling']]['actions'] and not LIFE[ SETTINGS['controlling']]['dead']: return False if not ignore_tickrate: if process_events(): return False elif EVENTS and not ignore_pause: return False if SETTINGS['controlling'] and not ignore_pause and not sum( [abs(i) for i in LIFE[SETTINGS['controlling']]['velocity']]): if MENUS: return False if LIFE[SETTINGS['controlling']]['targeting']: return False if life.has_dialog(LIFE[SETTINGS['controlling']]): return False if not ignore_tickrate: if time.time() - WORLD_INFO['last_update_time'] < 1: if WORLD_INFO['tps'] < 30: WORLD_INFO['tps'] += 1 else: return False else: WORLD_INFO['last_update_time'] = time.time() WORLD_INFO['tps'] = 0 return True
def can_tick(ignore_tickrate=False, ignore_pause=False): if SETTINGS['controlling'] and not EVENTS and not sum([abs(i) for i in LIFE[SETTINGS['controlling']]['velocity']]): if life.is_target_of(LIFE[SETTINGS['controlling']]): if not SETTINGS['paused']: gfx.message('An enemy appears.', style='important') SETTINGS['paused'] = True if not ignore_pause and SETTINGS['paused'] and not LIFE[SETTINGS['controlling']]['actions'] and not LIFE[SETTINGS['controlling']]['dead']: return False if not ignore_tickrate: if process_events(): return False elif EVENTS and not ignore_pause: return False if SETTINGS['controlling'] and not ignore_pause and not sum([abs(i) for i in LIFE[SETTINGS['controlling']]['velocity']]): if MENUS: return False if LIFE[SETTINGS['controlling']]['targeting']: return False if life.has_dialog(LIFE[SETTINGS['controlling']]): return False if not ignore_tickrate: if time.time()-WORLD_INFO['last_update_time']<1: if WORLD_INFO['tps']<30: WORLD_INFO['tps'] += 1 else: return False else: WORLD_INFO['last_update_time'] = time.time() WORLD_INFO['tps'] = 0 return True
def draw_status_line(): _flashing_text = [] _non_flashing_text = [] if LIFE[SETTINGS['following']]['dead']: return False if not SETTINGS['following']: return False if LIFE[SETTINGS['following']]['targeting']: _flashing_text.append('Firing') if LIFE[SETTINGS['following']]['strafing']: _non_flashing_text.append('Strafing') if SETTINGS['loading']: _non_flashing_text.append( str(TICKER[int(round(3 * (time.time() % 1)))])) if SETTINGS['paused']: if life.is_target_of(LIFE[SETTINGS['following']]): _non_flashing_text.append('Combat') else: _non_flashing_text.append('Paused') if not LIFE[SETTINGS['following']]['stance'] == 'standing': _non_flashing_text.append( LIFE[SETTINGS['following']]['stance'].title()) blit_string(0, MAP_WINDOW_SIZE[1] - 1, ' - '.join(_non_flashing_text), 'map') if time.time() % 1 >= 0.5: blit_string( len(_non_flashing_text) + 1, MAP_WINDOW_SIZE[1] - 1, ' - '.join(_flashing_text), 'map') if SETTINGS['glitch_text']: _max_glitch_progress = SETTINGS['glitch_text_time_max'] / 2 _glitch_progress = SETTINGS['glitch_text_time'] / float( _max_glitch_progress) _i = 0 for c in SETTINGS['glitch_text']: _g = random.randint(120, 150) _gray = tcod.Color(_g, _g, _g) if random.randint(0, 1): _gray = random.choice( [tcod.dark_pink, tcod.dark_purple, tcod.dark_red]) if _i / float(len(SETTINGS['glitch_text'])) < _glitch_progress: blit_char_to_view(_i + 1, 1, c, (tcod.white, None), 'map') else: blit_char_to_view(_i + 1, 1, chr(random.randint(0, 255)), (_gray, None), 'map') _i += 1 if SETTINGS['glitch_text_fade']: SETTINGS['glitch_text_time'] -= 1 else: SETTINGS['glitch_text_time'] += 1 if SETTINGS['glitch_text_time'] > SETTINGS['glitch_text_time_max']: SETTINGS['glitch_text_fade'] = True elif SETTINGS['glitch_text_fade'] and SETTINGS['glitch_text_time'] <= 0: SETTINGS['glitch_text'] = '' refresh_view('map')
def draw_status_line(): _flashing_text = [] _non_flashing_text = [] if LIFE[SETTINGS['following']]['dead']: return False if not SETTINGS['following']: return False if LIFE[SETTINGS['following']]['targeting']: _flashing_text.append('Firing') if LIFE[SETTINGS['following']]['strafing']: _non_flashing_text.append('Strafing') if SETTINGS['loading']: _non_flashing_text.append(str(TICKER[int(round(3*(time.time()%1)))])) if SETTINGS['paused']: if life.is_target_of(LIFE[SETTINGS['following']]): _non_flashing_text.append('Combat') else: _non_flashing_text.append('Paused') if not LIFE[SETTINGS['following']]['stance'] == 'standing': _non_flashing_text.append(LIFE[SETTINGS['following']]['stance'].title()) blit_string(0, MAP_WINDOW_SIZE[1]-1, ' - '.join(_non_flashing_text), 'map') if time.time()%1>=0.5: blit_string(len(_non_flashing_text)+1, MAP_WINDOW_SIZE[1]-1, ' - '.join(_flashing_text), 'map') if SETTINGS['glitch_text']: _max_glitch_progress = SETTINGS['glitch_text_time_max']/2 _glitch_progress = SETTINGS['glitch_text_time']/float(_max_glitch_progress) _i = 0 for c in SETTINGS['glitch_text']: _g = random.randint(120, 150) _gray = tcod.Color(_g, _g, _g) if random.randint(0, 1): _gray = random.choice([tcod.dark_pink, tcod.dark_purple, tcod.dark_red]) if _i/float(len(SETTINGS['glitch_text']))<_glitch_progress: blit_char_to_view(_i+1, 1, c, (tcod.white, None), 'map') else: blit_char_to_view(_i+1, 1, chr(random.randint(0, 255)), (_gray, None), 'map') _i += 1 if SETTINGS['glitch_text_fade']: SETTINGS['glitch_text_time'] -= 1 else: SETTINGS['glitch_text_time'] += 1 if SETTINGS['glitch_text_time']>SETTINGS['glitch_text_time_max']: SETTINGS['glitch_text_fade'] = True elif SETTINGS['glitch_text_fade'] and SETTINGS['glitch_text_time']<=0: SETTINGS['glitch_text'] = '' refresh_view('map')