RelayAlgorithm .Sorted event

This commit is contained in:
2024-07-20 16:28:24 -04:00
parent 96db25fcce
commit eead1a260d

View File

@@ -18,6 +18,10 @@ type Constructor_Return_Props = {
ElevatorAttributes: ElevatorAttributes, ElevatorAttributes: ElevatorAttributes,
DoorAttributes: DoorAttributes, DoorAttributes: DoorAttributes,
__FloorQueue: FloorQueue, __FloorQueue: FloorQueue,
Events: {
Sorted: BindableEvent
},
} }
type ElevatorAttributes = { type ElevatorAttributes = {
@@ -51,6 +55,10 @@ function RelayAlgorithm.constructor(BoxAlignPosition, ElevatorAttributes, DoorAt
ElevatorAttributes = ElevatorAttributes, ElevatorAttributes = ElevatorAttributes,
DoorAttributes = DoorAttributes, DoorAttributes = DoorAttributes,
__FloorQueue = {}, __FloorQueue = {},
Events = {
Sorted = Instance.new("BindableEvent") :: BindableEvent
},
}, RelayAlgorithm) }, RelayAlgorithm)
end end
@@ -64,6 +72,7 @@ function RelayAlgorithm:Sort(ElevatorGoingUp)
end end
return a>b return a>b
end) end)
self.Events.Sorted:Fire()
end end
function RelayAlgorithm:Check(ElevatorGoingUp) function RelayAlgorithm:Check(ElevatorGoingUp)
@@ -82,4 +91,4 @@ function RelayAlgorithm:AddFloor(ElevatorGoingUp, RequestedLevel)
self:Sort(ElevatorGoingUp) self:Sort(ElevatorGoingUp)
end end
return RelayAlgorithm return RelayAlgorithm