-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhausvomnikolaus_3D.py
executable file
·108 lines (88 loc) · 2.65 KB
/
hausvomnikolaus_3D.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/usr/bin/env python3
import sys
import math
import numpy as np
import os
import miney
import miney_toolbox as mtb
if not miney.is_miney_available():
raise miney.MinetestRunError("Please start Minetest with the miney game")
if not "MINETEST_USER" in os.environ:
print("Please specific the player name in the 'MINETEST_USER' env variable.")
exit(1)
if not "MINETEST_PASSWORD" in os.environ:
print("Please specific the player name in the 'MINETEST_PASSWORD' env variable.")
exit(1)
#mt = mt.Minetest( "localhost", "playername", "password", port= 29999 )
mt = miney.Minetest("localhost",
os.environ['MINETEST_USER'], os.environ['MINETEST_PASSWORD'] )
playername= ""
# playername must be given
if len(sys.argv) > 1:
playername= sys.argv[1]
else:
print( "Playername not given, exit" )
print( "Available players are" )
for p in mt.player:
print( p )
exit(1)
player= mt.player[playername]
# haus vom nikolaus
pos= mtb.pos_as_int( player )
material= "wool:blue"
a=20
h=10
material= "wool:blue"
polygon= []
# nur eine Dimension ändert sich pro Zug
polygon.append( [0,0,0] )
polygon.append( [0,a,0] )
polygon.append( [a,a,0] )
polygon.append( [a,0,0] )
polygon.append( [a,0,a] )
polygon.append( [0,0,a] )
polygon.append( [0,a,a] )
polygon.append( [a,a,a] )
for i in range(len(polygon)-1):
print(i,polygon[i],polygon[i+1])
mtb.line( mt, pos, np.array(polygon[i]), np.array(polygon[i+1]), material )
material= "wool:yellow"
polygon= []
# zwei Dimension ändern sich pro Zug
polygon.append( [a,a,a] )
polygon.append( [a,a,0] )
polygon.append( [h,a+h,h] )
polygon.append( [0,a,a] )
polygon.append( [a,0,a] )
polygon.append( [a,a,0] )
polygon.append( [0,0,0] )
for i in range(len(polygon)-1):
print(i,polygon[i],polygon[i+1])
mtb.line( mt, pos, np.array(polygon[i]), np.array(polygon[i+1]), material )
material= "wool:orange"
polygon= []
# zwei Dimension ändern sich pro Zug
polygon.append( [0,0,0] )
polygon.append( [0,0,a] )
polygon.append( [a,0,0] )
for i in range(len(polygon)-1):
print(i,polygon[i],polygon[i+1])
mtb.line( mt, pos, np.array(polygon[i]), np.array(polygon[i+1]), material )
material= "wool:green"
polygon= []
# zwei Dimension ändern sich pro Zug
polygon.append( [a,0,0] )
polygon.append( [0,0,0] )
polygon.append( [0,a,a] )
polygon.append( [0,a,0] )
polygon.append( [0,0,a] )
polygon.append( [a,a,a] )
polygon.append( [h,a+h,h] )
polygon.append( [0,a,0] )
polygon.append( [a,0,0] )
polygon.append( [a,a,a] )
polygon.append( [a,0,a] )
polygon.append( [0,0,0] )
for i in range(len(polygon)-1):
print(i,polygon[i],polygon[i+1])
mtb.line( mt, pos, np.array(polygon[i]), np.array(polygon[i+1]), material )