mirror of
https://github.com/unixtensor/Roblox-Elevator-Game.git
synced 2025-12-15 21:51:55 +00:00
Relays are broken
This commit is contained in:
@@ -15,10 +15,14 @@ type Impl_Constructor = {
|
||||
|
||||
type Constructor_Fun = (BoxAlignPosition: AlignPosition, ElevatorAttributes: ElevatorAttributes, DoorAttributes: DoorAttributes) -> ClassConstructor
|
||||
type Constructor_Return_Props = {
|
||||
BoxAlignPosition: AlignPosition,
|
||||
BoxAlignPosition: AlignPosition,
|
||||
ElevatorAttributes: ElevatorAttributes,
|
||||
DoorAttributes: DoorAttributes,
|
||||
__FloorQueue: {number}
|
||||
DoorAttributes: DoorAttributes,
|
||||
__FloorQueue: FloorQueue,
|
||||
|
||||
Events: {
|
||||
Sorted: BindableEvent
|
||||
}
|
||||
}
|
||||
|
||||
type ElevatorAttributes = {
|
||||
@@ -33,6 +37,8 @@ type DoorAttributes = {
|
||||
}
|
||||
}
|
||||
|
||||
export type FloorQueue = {number?}
|
||||
|
||||
export type RelayAlgorithmConstructor = ClassConstructor
|
||||
|
||||
local RelayAlgorithm = {} :: Impl_Constructor
|
||||
@@ -40,10 +46,13 @@ RelayAlgorithm.__index = RelayAlgorithm
|
||||
|
||||
function RelayAlgorithm.constructor(BoxAlignPosition, ElevatorAttributes, DoorAttributes)
|
||||
return setmetatable({
|
||||
Events = {
|
||||
Sorted = Instance.new("BindableEvent")
|
||||
},
|
||||
BoxAlignPosition = BoxAlignPosition,
|
||||
ElevatorAttributes = ElevatorAttributes,
|
||||
DoorAttributes = DoorAttributes,
|
||||
__FloorQueue = {}
|
||||
__FloorQueue = {},
|
||||
}, RelayAlgorithm)
|
||||
end
|
||||
|
||||
@@ -51,14 +60,14 @@ end
|
||||
--https://youtu.be/BCN9mQOT3RQ
|
||||
|
||||
function RelayAlgorithm:Sort(ElevatorGoingUp)
|
||||
table.sort(self.__FloorQueue, function(a: number, b: number): boolean
|
||||
table.sort(self.__FloorQueue, function(a, b): boolean
|
||||
if ElevatorGoingUp then
|
||||
return a<b
|
||||
else
|
||||
return a>b
|
||||
end
|
||||
end)
|
||||
print(table.unpack(self.__FloorQueue))
|
||||
self.Events.Sorted:Fire(self.__FloorQueue)
|
||||
end
|
||||
|
||||
function RelayAlgorithm:Check(ElevatorGoingUp)
|
||||
|
||||
Reference in New Issue
Block a user