-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGenLayerAddIsland.py
65 lines (56 loc) · 2.34 KB
/
GenLayerAddIsland.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
from genLayer import Main
import numpy as np
class GenLayerAddIsland(Main):
def __init__(self, seed, layer,goup):
super().__init__(seed)
self.parent = [(layer,goup)]
def getInts(self, aX, aY, aW, aH):
i, j, k, l = aX - 1, aY - 1, aW + 2, aH + 2
aint = self.parent[0][0].getInts(i, j, k, l)
aint1 = np.empty(aW*aH,dtype=int)
for i1 in range(aH):
for j1 in range(aW):
k1 = aint[j1 + i1 * k]
l1 = aint[j1 + 2 + i1 * k]
i2 = aint[j1 + (i1 + 2) * k]
j2 = aint[j1 + 2 + (i1 + 2) * k]
k2 = aint[j1 + 1 + (i1 + 1) * k]
self.initChunkSeed((j1 + aX, i1 + aY))
if k2 or ((not k1) and (not l1) and (not i2) and (not j2)):
if k2 > 0 and ((not k1) or (not l1) or (not i2) or (not j2)):
if not self.nextIntGen(5):
if k2 == 4:
aint1[j1 + i1 * aW] = 4
else:
aint1[j1 + i1 * aW] = 0
else:
aint1[j1 + i1 * aW] = k2
else:
aint1[j1 + i1 * aW] = k2
else:
i3 = 1
inc=1
if k1:
if not self.nextIntGen(inc):
i3 = k1
inc += 1
if l1:
if not self.nextIntGen(inc):
i3 = l1
inc += 1
if i2:
if not self.nextIntGen(inc):
i3 = i2
inc += 1
if j2:
if not self.nextIntGen(inc):
i3 = j2
inc += 1
if not self.nextIntGen(3):
aint1[j1 + i1 * aW] = i3
elif i3 == 4:
aint1[j1 + i1 * aW] = 4
else:
aint1[j1 + i1 * aW] = 0
#print(i3, self.chunkSeed,self.baseSeed,self.worldGenSeed,k1,l1,i2,j2,aint1[j1 + i1 * aW])
return aint1