This commit is contained in:
2024-09-13 17:05:12 -04:00
parent 5bb88afa87
commit 763cac4501
5 changed files with 30 additions and 37 deletions

View File

@@ -48,7 +48,7 @@ type Constructor_Return_Props = {
Elevator: {
TravelingDirection: Enums.ElevatorCallDirectionValues,
BoxModel: UnionOperation,
BoxModel: BasePart,
AlignPosition: AlignPosition,
Configuration: ElevatorTypes.ElevatorConfigurationTable
},
@@ -157,6 +157,7 @@ function Elevator.constructor(ElevatorBoxModel, ElevatorConfigurationTable, Floo
local Parked = Instance.new("BindableEvent") :: BindableEvent
local Leveling = Instance.new("BindableEvent") :: BindableEvent
local Leveling3Phase = Instance.new("BindableEvent") :: BindableEvent
local Attributes = {
PreviousFloor = Instance.new("IntValue") :: IntValue,
CurrentFloor = Instance.new("IntValue") :: IntValue,
@@ -251,7 +252,7 @@ local function GoingUpDirectionToDirectionEnum(CurrentFloor: number, RequestedFl
end
local function CheckFloorQueue(self: ClassConstructor)
SmoothVelocity(self, 0, 1)
SmoothVelocity(self, 0, self.Elevator.Configuration.ParkedSmoothingTime)
local DirectionToDirectionQueue = self.Attributes.TravelingUpwards.Value and self.RelayAlgorithm.FloorQueue.Up or self.RelayAlgorithm.FloorQueue.Down
local DirectionToOppositeDirectionQueue = self.Attributes.TravelingUpwards.Value and self.RelayAlgorithm.FloorQueue.Down or self.RelayAlgorithm.FloorQueue.Up
@@ -323,7 +324,7 @@ local function CabTraveling(self: ClassConstructor, deltaTime: number, LEVEL_VEC
if ElevatorPosition.Y>=LEVEL_VEC3_Y_WRAP.Y-self.Elevator.Configuration.FloorLevelingDistance then
if not Debounce.Leveling then
self.Events.__eventInstances__.Leveling:Fire()
SmoothVelocity(self, self.Elevator.Configuration.LevelingVelocity, 1)
SmoothVelocity(self, self.Elevator.Configuration.LevelingVelocity, self.Elevator.Configuration.LevelingVelocitySmoothingTime)
Debounce.Leveling = true
end
@@ -355,7 +356,7 @@ local function CabTraveling(self: ClassConstructor, deltaTime: number, LEVEL_VEC
if ElevatorPosition.Y<=LEVEL_VEC3_Y_WRAP.Y+self.Elevator.Configuration.FloorLevelingDistance then
if not Debounce.Leveling then
self.Events.__eventInstances__.Leveling:Fire()
SmoothVelocity(self, self.Elevator.Configuration.LevelingVelocity, 1)
SmoothVelocity(self, self.Elevator.Configuration.LevelingVelocity, self.Elevator.Configuration.LevelingVelocitySmoothingTime)
Debounce.Leveling = true
end
@@ -413,7 +414,7 @@ function Elevator:__TravelToFloorAsync(Level_Int, LEVEL_VEC3_Y_WRAP)
--Set the elevator's AlignPosition to the floor Y vector
self.Elevator.AlignPosition.Position = Vector3.new(self.Elevator.AlignPosition.Position.X, LEVEL_VEC3_Y_WRAP.Y, self.Elevator.AlignPosition.Position.Z)
--Set the elevator's velocity
SmoothVelocity(self, self.Elevator.Configuration.MaxVelocity, 5)
SmoothVelocity(self, self.Elevator.Configuration.MaxVelocity, self.Elevator.Configuration.MaxVelocitySmoothingTime)
end
function Elevator:RequestLevelAsync(RequestedLevel, Direction)