Commit ec5932e1 authored by Petter Reinholdtsen's avatar Petter Reinholdtsen

New upstream version 0.16

parent e78fc43d
# #
# Code under the MIT license by Alexander Pruss # Code under the MIT license by Alexander Pruss
# #
......
#The software in this file is copyright 2003,2004 Simon Tatham and copyright 2015 Alexander Pruss #The software in this file is copyright 2003,2004 Simon Tatham and copyright 2015 Alexander Pruss
#Based on code from # http://www.chiark.greenend.org.uk/~sgtatham/polyhedra/ #Based on code from http://www.chiark.greenend.org.uk/~sgtatham/polyhedra/
# #
#Permission is hereby granted, free of charge, to any person #Permission is hereby granted, free of charge, to any person
#obtaining a copy of this software and associated documentation files #obtaining a copy of this software and associated documentation files
...@@ -755,4 +755,3 @@ if __name__ == "__main__": ...@@ -755,4 +755,3 @@ if __name__ == "__main__":
pos = d.mc.player.getPos() pos = d.mc.player.getPos()
polyhedron(d,n,faceMode,pos.x, pos.y, pos.z, size,drawing.GLASS,drawing.STONE) polyhedron(d,n,faceMode,pos.x, pos.y, pos.z, size,drawing.GLASS,drawing.STONE)
...@@ -851,4 +851,4 @@ if __name__ == "__main__": ...@@ -851,4 +851,4 @@ if __name__ == "__main__":
mainloop() mainloop()
else: else:
go("models/" + sys.argv[1] + ".txt", sys.argv[2:]) go(os.path.dirname(os.path.realpath(sys.argv[0])) + "/" + "models/" + sys.argv[1] + ".txt", sys.argv[2:])
...@@ -6,12 +6,19 @@ from mc import * ...@@ -6,12 +6,19 @@ from mc import *
import drawing import drawing
from sys import argv from sys import argv
import mcpi.settings as settings import mcpi.settings as settings
import ast
RAINBOW = (WOOL_RED,WOOL_PINK,WOOL_ORANGE,WOOL_YELLOW,WOOL_GREEN,WOOL_BLUE,WOOL_LIGHT_BLUE,WOOL_PURPLE) RAINBOW = (WOOL_RED,WOOL_PINK,WOOL_ORANGE,WOOL_YELLOW,WOOL_GREEN,WOOL_BLUE,WOOL_LIGHT_BLUE,WOOL_PURPLE)
TAN30 = sqrt(3.)/3 TAN30 = sqrt(3.)/3
SQRT32 = sqrt(3./2) SQRT32 = sqrt(3./2)
def parseBlock(s):
try:
return ast.literal_eval(s)
except:
return globals()[s.upper()]
def distance(a,b): def distance(a,b):
return sqrt((a[0]-b[0])**2+(a[1]-b[1])**2+(a[2]-b[2])**2) return sqrt((a[0]-b[0])**2+(a[1]-b[1])**2+(a[2]-b[2])**2)
...@@ -59,7 +66,8 @@ mc.player.setPos(tetrahedronBottom(height,(pos.x,pos.y+height,pos.z))[0]) ...@@ -59,7 +66,8 @@ mc.player.setPos(tetrahedronBottom(height,(pos.x,pos.y+height,pos.z))[0])
tetrahedra = sierpinski(height,pos.x,pos.y+height,pos.z,levels) tetrahedra = sierpinski(height,pos.x,pos.y+height,pos.z,levels)
mc.postToChat("Drawing") mc.postToChat("Drawing")
if len(argv) >= 2 and '__' not in argv[1]: if len(argv) >= 2 and '__' not in argv[1]:
block = lambda level : eval(argv[1]) specifiedBlock = parseBlock(argv[1])
block = lambda level : specifiedBlock
else: else:
block = lambda level : RAINBOW[level % len(RAINBOW)] block = lambda level : RAINBOW[level % len(RAINBOW)]
for tet in tetrahedra: for tet in tetrahedra:
......
...@@ -299,7 +299,9 @@ class Vehicle(): ...@@ -299,7 +299,9 @@ class Vehicle():
return Block(block.id, (block.data & ~0x03) | (((block.data & 0x03) + amount) & 0x03)) return Block(block.id, (block.data & ~0x03) | (((block.data & 0x03) + amount) & 0x03))
elif block.id == 96 or block.id == 167: elif block.id == 96 or block.id == 167:
# trapdoors # trapdoors
return Block(block.id, (block.data & ~0x03) | (((block.data & 0x03) - amount) & 0x03)) meta = block.data
return Block(block.id, (meta & ~0x03) |
Vehicle.stairDirectionsClockwise[(Vehicle.stairToClockwise[meta & 0x03] - amount) % 4])
elif block.id in Vehicle.DOORS: elif block.id in Vehicle.DOORS:
meta = block.data meta = block.data
if meta & 0x08: if meta & 0x08:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment