mirror of
https://github.com/unixtensor/Roblox-Elevator-Game.git
synced 2025-12-14 14:51:55 +00:00
big error going to 10
This commit is contained in:
@@ -194,6 +194,7 @@ local function ProceedToNextLevel(self: ClassConstructor, Level: number, Directi
|
||||
local VEC3_Y_WRAP = self:GetLevel(Level, Direction)
|
||||
if VEC3_Y_WRAP then
|
||||
self:__TravelToFloor(Level, VEC3_Y_WRAP, Direction)
|
||||
self.eprintStudio(`Traveling to Level={Level} VEC3_Y_WRAP={VEC3_Y_WRAP} Direct={Direction}`)
|
||||
else
|
||||
self.ewarn(`Failed to get the requested level's Y position. VEC3_Y_WRAP={VEC3_Y_WRAP} Level={Level} Direction={Direction}`)
|
||||
end
|
||||
@@ -223,18 +224,20 @@ local function CheckFloorQueue(self: ClassConstructor, Direction: Enums.Elevator
|
||||
self.eprintStudio(`No more floors in the direction "{Direction}" checking the opposite direction floors`)
|
||||
if Direction == Enums.ElevatorCallDirection.Up then
|
||||
if #self.RelayAlgorithm.FloorQueue.Down ~= 0 then
|
||||
self.RelayAlgorithm:Sort(Enums.ElevatorCallDirection.Down)
|
||||
local NextLevelDown = self.RelayAlgorithm.FloorQueue.Down[1]
|
||||
if NextLevelDown then
|
||||
local NewDirection = ElevatorGoingUpDirection(self.Attributes.CurrentFloor.Value, NextLevelDown) and Enums.ElevatorCallDirection.Up or Enums.ElevatorCallDirection.Down
|
||||
self.RelayAlgorithm:Sort(NewDirection :: Enums.ElevatorCallDirectionValues)
|
||||
self.eprint("Floors found in the opposite direction. Direction=", Enums.ElevatorCallDirection.Down, "NextLevel=", NextLevelDown)
|
||||
ProceedToNextLevel(self, NextLevelDown, Enums.ElevatorCallDirection.Down)
|
||||
end
|
||||
end
|
||||
else
|
||||
if #self.RelayAlgorithm.FloorQueue.Up ~= 0 then
|
||||
self.RelayAlgorithm:Sort(Enums.ElevatorCallDirection.Up)
|
||||
local NextLevelUp = self.RelayAlgorithm.FloorQueue.Up[1]
|
||||
if NextLevelUp then
|
||||
local NewDirection = ElevatorGoingUpDirection(self.Attributes.CurrentFloor.Value, NextLevelUp) and Enums.ElevatorCallDirection.Up or Enums.ElevatorCallDirection.Down
|
||||
self.RelayAlgorithm:Sort(NewDirection :: Enums.ElevatorCallDirectionValues)
|
||||
self.eprint("Floors found in the opposite direction. Direction=", Enums.ElevatorCallDirection.Up, "NextLevel=", NextLevelUp)
|
||||
ProceedToNextLevel(self, NextLevelUp, Enums.ElevatorCallDirection.Up)
|
||||
end
|
||||
|
||||
@@ -51,9 +51,6 @@ return function(TagsConstructor: TagsModule.TagsConstructor, ButtonTags: TagsMod
|
||||
end)
|
||||
|
||||
task.wait(1)
|
||||
Elevator:RequestLevel(2, Enums.ElevatorCallDirection.Up)
|
||||
Elevator:RequestLevel(8, Enums.ElevatorCallDirection.Up)
|
||||
|
||||
Elevator:RequestLevel(10, Enums.ElevatorCallDirection.Down)
|
||||
Elevator:RequestLevel(6, Enums.ElevatorCallDirection.Down)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user