-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhausvomnikolaus_2D.py
executable file
·89 lines (73 loc) · 2.24 KB
/
hausvomnikolaus_2D.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
#!/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= ""
material= "wool:black"
# 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
b=20
c=10
#start= np.array([1,1,1])
#end= np.array([1+a,1,1])
#mtb.line( mt, pos, start, end, material )
#start= np.array([1+a,1,1])
#end= np.array([1,1+b,1])
#mtb.line( mt, pos, start, end, material )
#start= np.array([1,1+b,1])
#end= np.array([1+a//2,1+b+c,1])
#mtb.line( mt, pos, start, end, material )
#start= np.array([1+a//2,1+b+c,1])
#end= np.array([1+a,1+b,1])
#mtb.line( mt, pos, start, end, material )
#start= np.array([1+a,1+b,1])
#end= np.array([1,1,1])
#mtb.line( mt, pos, start, end, material )
#start= np.array([1,1,1])
#end= np.array([1,1+b,1])
#mtb.line( mt, pos, start, end, material )
#start= np.array([1,1+b,1])
#end= np.array([1+a,1+b,1])
#mtb.line( mt, pos, start, end, material )
#start= np.array([1+a,1+b,1])
#end= np.array([1+a,1,1])
#mtb.line( mt, pos, start, end, material )
polygon= []
polygon.append( [1,1,1] )
polygon.append( [1+a,1,1] )
polygon.append( [1,1+b,1] )
polygon.append( [1+a//2,1+b+c,1] )
polygon.append( [1+a,1+b,1] )
polygon.append( [1,1,1] )
polygon.append( [1,1+b,1] )
polygon.append( [1+a,1+b,1] )
polygon.append( [1+a,1,1] )
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 )