diff --git a/src/server/main/Elevators/InitElevator/init.luau b/src/server/main/Elevators/InitElevator/init.luau index 6ec09b6..0cd69fc 100644 --- a/src/server/main/Elevators/InitElevator/init.luau +++ b/src/server/main/Elevators/InitElevator/init.luau @@ -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 diff --git a/src/server/main/Elevators/Otis1960/init.luau b/src/server/main/Elevators/Otis1960/init.luau index 6bd8e2c..354a12c 100644 --- a/src/server/main/Elevators/Otis1960/init.luau +++ b/src/server/main/Elevators/Otis1960/init.luau @@ -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