@@ -101,31 +101,40 @@ func pOneElemPerRowWithRandomX(world, blueprint):
101
101
var structure = blueprint [2 ]
102
102
var rx = []
103
103
var foundPlace = true
104
+ var foundx
104
105
for row in range (len (world )):
105
- foundPlace = true
106
106
for x in range (chunkWidth ):
107
107
rx .append (x )
108
108
rx .shuffle ()
109
109
for x in rx :
110
+ foundPlace = true
111
+ # print("checking ", row, " x = ", x)
110
112
for i in range (len (structure )):
111
113
for j in range (len (structure [0 ])):
112
114
if row + i < chunkHeight and x + j < chunkWidth :
113
115
if typeof (world [row + i ][x + j ]) != 2 :
114
116
foundPlace = false
117
+ foundx = null
115
118
else :
116
119
foundPlace = false
120
+ foundx = null
117
121
if ! foundPlace :
118
122
break
123
+ foundx = null
119
124
if foundPlace :
120
- for i in range (len (structure )):
121
- for j in range (len (structure [0 ])):
122
- if structure [i ][j ] != null :
123
- if typeof (structure [i ][j ]) != 2 :
124
- world [row + i ][x + j ] = [] + structure [i ][j ]
125
- else :
126
- world [row + i ][x + j ] = 0
125
+ foundx = x
126
+ break
127
+ if foundx != null :
128
+ # print("found place ", row, " ", foundx)
129
+ for i in range (len (structure )):
130
+ for j in range (len (structure [0 ])):
131
+ if structure [i ][j ] != null :
132
+ if typeof (structure [i ][j ]) != 2 :
133
+ world [row + i ][foundx + j ] = [] + structure [i ][j ]
127
134
else :
128
- world [row + i ][x + j ] = null
135
+ world [row + i ][foundx + j ] = 0
136
+ else :
137
+ world [row + i ][foundx + j ] = null
129
138
return world
130
139
131
140
func newData (region ):
0 commit comments