def explosion(x, y, size): _solids = zones.get_active_solids({}, no_life=True) for pos in shapes.circle_smooth(x, y, size + .1, 0.05): _c_mod = 1 - (numbers.float_distance((x, y), pos) / size) _c_mod_clip = numbers.clip(1 - numbers.float_distance((x, y), pos) / size, random.uniform(.3, .45), 1) if pos in _solids or set(shapes.line((x, y), (int(round(pos[0])), int(round(pos[1]))))) & _solids: continue smoke(pos[0], pos[1], _c_mod_clip) if random.uniform(0, 1) < numbers.clip(_c_mod, 0, .75) and not pos in _solids: fire(pos[0], pos[1], _c_mod) for i in range(random.randint(2 * size, 3*size)): smoke_shooter(x, y, random.randint(0, 359)) light(x, y, random.randint(7, 9), r=2.5, g=1.5, b=1.5) light(x, y, random.randint(13, 15), r=1.3, g=1.3, b=1.3)
def smoke_cloud(x, y, size, start_alpha=.0, decay_amount=1.0): for pos in shapes.circle_smooth(x, y, size + .1, 0.1): _c_mod = numbers.clip(1 - numbers.float_distance((x, y), pos) / size, start_alpha, 1) smoke(pos[0], pos[1], 1, start_amount=_c_mod, decay_amount=decay_amount)