def draw_splatter(position, render_at): _has_splatter = has_splatter(position) if not _has_splatter: return False gfx.tint_tile(render_at[0],render_at[1],_has_splatter['color'],_has_splatter['coef'])
def draw_vapor(pos, vapor): gfx.tint_tile( pos[0], pos[1], vapor['color'], bad_numbers.clip( vapor['max_intensity'] * (1 - (vapor['age'] / float(vapor['age_max']))), 0, vapor['max_intensity']))
def rain(size): _running_time = WORLD_INFO['real_time_of_day'] - WORLD_INFO[ 'real_time_of_day'] / (WORLD_INFO['length_of_day'] / len(WORLD_INFO['weather']['colors'])) * ( WORLD_INFO['length_of_day'] / len(WORLD_INFO['weather']['colors'])) _rate = .009 for i in range(0, int(round(_running_time * _rate))): _x = random.randint(0, size[0] - 1) _y = random.randint(0, size[1] - 1) _skip = False if not alife.sight.is_in_fov(LIFE[SETTINGS['controlling']], (CAMERA_POS[0] + _x, CAMERA_POS[1] + _y)): continue for z in range(LIFE[SETTINGS['controlling']]['pos'][2] + 1, MAP_SIZE[2]): if maps.is_solid((CAMERA_POS[0] + _x, CAMERA_POS[1] + _y, z)): _skip = True break if _skip: continue REFRESH_POSITIONS.append((_x, _y)) gfx.tint_tile(_x, _y, tcod.blue, random.uniform(0.1, 0.6)) #"Wind" if logic.can_tick(): for i in range(random.randint(1, 4)): _x = random.randint(0, size[0] - 1) _y = random.randint(0, size[1] - 1) _skip = False if not alife.sight.is_in_fov( LIFE[SETTINGS['controlling']], (CAMERA_POS[0] + _x, CAMERA_POS[1] + _y)): continue for z in range(LIFE[SETTINGS['controlling']]['pos'][2] + 1, MAP_SIZE[2]): if maps.is_solid((CAMERA_POS[0] + _x, CAMERA_POS[1] + _y, z)): _skip = True break if _skip: continue effects.create_smoke((CAMERA_POS[0] + _x, CAMERA_POS[1] + _y), color=tcod.white, grow=0.1, decay=0.03, direction=195, speed=random.uniform(0.35, 0.8), max_opacity=.3)
def draw_splatter(position, render_at): _has_splatter = has_splatter(position) if not _has_splatter: return False gfx.tint_tile(render_at[0], render_at[1], _has_splatter['color'], _has_splatter['coef'])
def rain(size): _running_time = WORLD_INFO['real_time_of_day'] - WORLD_INFO['real_time_of_day']/(WORLD_INFO['length_of_day']/len(WORLD_INFO['weather']['colors']))*(WORLD_INFO['length_of_day']/len(WORLD_INFO['weather']['colors'])) _rate = .009 for i in range(0, int(round(_running_time*_rate))): _x = random.randint(0, size[0]-1) _y = random.randint(0, size[1]-1) _skip = False if not alife.sight.is_in_fov(LIFE[SETTINGS['controlling']], (CAMERA_POS[0]+_x, CAMERA_POS[1]+_y)): continue for z in range(LIFE[SETTINGS['controlling']]['pos'][2]+1, MAP_SIZE[2]): if maps.is_solid((CAMERA_POS[0]+_x, CAMERA_POS[1]+_y, z)): _skip = True break if _skip: continue REFRESH_POSITIONS.append((_x, _y)) gfx.tint_tile(_x, _y, tcod.blue, random.uniform(0.1, 0.6)) #"Wind" if logic.can_tick(): for i in range(random.randint(1, 4)): _x = random.randint(0, size[0]-1) _y = random.randint(0, size[1]-1) _skip = False if not alife.sight.is_in_fov(LIFE[SETTINGS['controlling']], (CAMERA_POS[0]+_x, CAMERA_POS[1]+_y)): continue for z in range(LIFE[SETTINGS['controlling']]['pos'][2]+1, MAP_SIZE[2]): if maps.is_solid((CAMERA_POS[0]+_x, CAMERA_POS[1]+_y, z)): _skip = True break if _skip: continue effects.create_smoke((CAMERA_POS[0]+_x, CAMERA_POS[1]+_y), color=tcod.white, grow=0.1, decay=0.03, direction=195, speed=random.uniform(0.35, 0.8), max_opacity=.3)
def draw_fire(pos, fire): _intensity = fire['intensity'] / float(8) _rand_intensity = bad_numbers.clip(_intensity - random.uniform(0, .2), 0, 1) gfx.tint_tile(pos[0], pos[1], fire['color'], _rand_intensity)
def draw_smoke(pos, smoke): gfx.tint_tile( pos[0], pos[1], smoke['color'], bad_numbers.clip(smoke['intensity'], 0, smoke['max_intensity']))
def draw_ash(pos, ash): gfx.tint_tile(pos[0], pos[1], ash['color'], ash['intensity'])
def draw_fire(pos, fire): _intensity = fire['intensity']/float(8) _rand_intensity = numbers.clip(_intensity-random.uniform(0, .2), 0, 1) gfx.tint_tile(pos[0], pos[1], fire['color'], _rand_intensity)
def draw_vapor(pos, vapor): gfx.tint_tile(pos[0], pos[1], vapor['color'], numbers.clip(vapor['max_intensity']*(1-(vapor['age']/float(vapor['age_max']))), 0, vapor['max_intensity']))
def draw_smoke(pos, smoke): gfx.tint_tile(pos[0], pos[1], smoke['color'], numbers.clip(smoke['intensity'], 0, smoke['max_intensity']))