Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from feature_server.scripts.avx import AVX
- import json
- from pyspades.common import make_color
- def rotate_all(dct, fm, to):
- amt = (to - fm) % 4
- if amt == 0:
- rot = lambda t: t
- elif amt == 1:
- rot = lambda t: (-t[1], t[0]) + t[2:]
- elif amt == 2:
- rot = lambda t: (-t[0], -t[1]) + t[2:]
- elif amt == 3:
- rot = lambda t: ( t[1], -t[0]) + t[2:]
- if isinstance(dct, dict):
- dct = dct.iteritems()
- for k,v in dct:
- yield rot(k), v
- def shift_origin(dct, new_origin):
- new_origin = tuple(new_origin)
- shift = lambda tpl: tuple(a-b for a,b in zip(tpl, new_origin))
- if isinstance(dct, dict):
- dct = dct.iteritems()
- for k,v in dct:
- yield shift(k), v
- def build(px, py, structure, default_color):
- if isinstance(structure, dict):
- structure = structure.iteritems()
- pz = int(hmap.get(px,py)*63)
- for xyz, color in structure:
- x, y, z = xyz
- x, y, z = x + px, y + py, z + pz
- vxl.set_point(x, y, z, make_color(*(color or default_color)))
- penis_settings = json.load(open('./qb/penis.avx.txt', 'r'))
- penis = AVX.fromfile('./qb/penis.avx').tosparsedict()
- penis = dict(shift_origin(penis, penis_settings['origin']))
- for x in xrange(0, bmap.width):
- for y in xrange(0, bmap.height):
- if bmap.get_repeat(x, y) is hill_biome:
- left, top, right, bottom = bmap.rect_of_point(x,y)
- for ct in xrange(random.randint(1,3)):
- build(random.randint(left,right)
- , random.randint(top,bottom)
- , rotate_all(penis, 0, random.randint(0,3)) #rotate it different every time
- , (255,0,216))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement