BACKGROUND = "black"
FOREGROUND = "brown"
BUTTON_COLOR = "black"
+ BUTTON_GLOW_COLOR = "red"
DOOR_MARGIN = (0.01, 0.05)
PADDING = Vec(0.014, 0.022)
WIDTH = 0.3
self.button_rect.center,
self.button_rect.height // 2,
)
+ if self.level in {*self.elevator.call_queue, self.elevator.destination}:
+ pygame.draw.circle(
+ surf,
+ self.BUTTON_GLOW_COLOR,
+ self.button_rect.center,
+ self.button_rect.height // 2,
+ 2,
+ )
class Elevator:
If we are at the destination and the door is open, disregard
If level is not already a destination, add it to the call_queue
"""
- if self.doors[call_level].state == Door.OPEN:
+ current = self.get_whole_level()
+ if call_level == current and self.doors[call_level].state == Door.OPEN:
return
level_queue = {
- self.get_whole_level(),
+ current,
*self.call_queue,
self.queued_dest,
self.destination,
}
if call_level not in level_queue:
self.call_queue.append(call_level)
+ elif call_level == current:
+ self.doors[call_level].open()
def open(self):
"""
for i, door in enumerate(self.elevator.doors):
if door.button_rect.collidepoint(pos):
self.elevator.call_from(i)
+ self.dirty = True
return
for i, button in enumerate(self.elevator_panel.buttons):
if button.collidepoint(pos):