Skip to content

Commit c3f81a4

Browse files
v02.07.03-alpha.2
1 parent 8a654d4 commit c3f81a4

File tree

1 file changed

+35
-42
lines changed

1 file changed

+35
-42
lines changed

bps/bp.py

Lines changed: 35 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -81,57 +81,50 @@
8181
def place(queue):
8282
# Group datapoints by modifier first, then by color within each modifier group
8383
modifier_groups = {}
84+
color_groups = {}
8485
for datapoint in queue:
8586
modifier = datapoint[0]
8687
if modifier not in modifier_groups:
87-
modifier_groups[modifier] = {}
88+
modifier_groups[modifier] = []
89+
modifier_groups[modifier].append(datapoint)
8890
color = datapoint[1]
89-
if color not in modifier_groups[modifier]:
90-
modifier_groups[modifier][color] = []
91-
modifier_groups[modifier][color].append(datapoint)
91+
if color not in color_groups:
92+
color_groups[color] = []
93+
color_groups[color].append(datapoint)
9294

93-
# Process each modifier group
94-
for modifier in modifier_groups:
95-
# Set modifier once for this group
96-
controller.press("`")
97-
time.sleep(0.01)
98-
controller.tap("x")
99-
time.sleep(0.01)
100-
controller.press("z")
101-
time.sleep(0.01)
102-
exec(modifierinstructions[modifiers.index(modifier)])
103-
time.sleep(0.01)
104-
controller.release("z")
105-
time.sleep(0.01)
106-
controller.tap("x")
107-
time.sleep(0.01)
108-
109-
# Process each color group within this modifier
110-
for color in modifier_groups[modifier]:
111-
# Set color once for this group
112-
controller.tap("x")
113-
time.sleep(0.01)
114-
controller.press("c")
115-
time.sleep(0.01)
116-
exec(colorinstructions[colors.index(color)])
117-
time.sleep(0.01)
118-
controller.release("c")
95+
# 404 179
96+
global modifierheld, colorheld
97+
for modifier_group in modifier_groups.values():
98+
for obj in modifier_group:
99+
mouse.position = (404 + obj[2], 179 + obj[3])
119100
time.sleep(0.01)
120101
controller.tap("x")
121-
time.sleep(0.01)
122-
123-
# Place all walls with this modifier+color combination
124-
for datapoint in modifier_groups[modifier][color]:
125-
x = datapoint[2]
126-
y = datapoint[3]
127-
mouse.position = (int(x) + 404, int(y) + 179)
102+
if modifierheld != obj[0]:
128103
time.sleep(0.01)
129-
controller.press("x")
104+
controller.press("z")
105+
time.sleep(0.01)
106+
exec(modifierinstructions[modifiers.index(obj[0])])
107+
time.sleep(0.01)
108+
controller.release("z")
109+
modifierheld = obj[0]
110+
else:
111+
controller.press("z")
130112
time.sleep(0.03)
131-
controller.release("x")
113+
controller.release("z")
114+
for color_group in color_groups.values():
115+
for obj in color_group:
116+
mouse.position = (404 + obj[2], 179 + obj[3])
117+
time.sleep(0.01)
118+
if colorheld != obj[1]:
119+
controller.press("c")
132120
time.sleep(0.01)
133-
134-
controller.release("`")
135-
time.sleep(0.01)
121+
exec(colorinstructions[colors.index(obj[1])])
122+
time.sleep(0.01)
123+
controller.release("c")
124+
colorheld = obj[1]
125+
else:
126+
controller.press("c")
127+
time.sleep(0.03)
128+
controller.release("c")
136129

137130
place(buildqueue)

0 commit comments

Comments
 (0)