mirror of
https://github.com/unixtensor/Roblox-Elevator-Game.git
synced 2025-12-14 06:41:55 +00:00
work on door opening possibility while the elevator is stopped
This commit is contained in:
@@ -28,27 +28,23 @@ type Impl_Constructor = {
|
|||||||
|
|
||||||
type Constructor_Fun = (FloorDoorsTags: Tags.LandingTags, ElevatorBox: BasePart, ElevatorDoor1: BasePart, ElevatorDoor2: BasePart, ElevatorDoorSensor: Folder) -> ClassConstructor
|
type Constructor_Fun = (FloorDoorsTags: Tags.LandingTags, ElevatorBox: BasePart, ElevatorDoor1: BasePart, ElevatorDoor2: BasePart, ElevatorDoorSensor: Folder) -> ClassConstructor
|
||||||
type Impl_Static_Props = {
|
type Impl_Static_Props = {
|
||||||
Sensors: boolean,
|
Sensors: boolean,
|
||||||
Door1Stopped_X: Vector3,
|
Door1Stopped_X: Vector3,
|
||||||
Door2Stopped_X: Vector3,
|
Door2Stopped_X: Vector3,
|
||||||
ElevatorDoorTime: number,
|
ElevatorDoorTime: number,
|
||||||
ElevatorDoorStyle: Enum.EasingStyle,
|
ElevatorDoorStyle: Enum.EasingStyle,
|
||||||
__DontLeakMemory: RBXScriptConnection?,
|
__DontLeakMemory: RBXScriptConnection?,
|
||||||
|
|
||||||
Attributes: {
|
Attributes: {} & RelayAttributes
|
||||||
Relay: {
|
|
||||||
Open: BoolValue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
type Constructor_Return_Props = {
|
type Constructor_Return_Props = {
|
||||||
FloorDoorsTags: Tags.LandingTags,
|
FloorDoorsTags: Tags.LandingTags,
|
||||||
DoorTween1: CustomTween,
|
DoorTween1: CustomTween,
|
||||||
DoorTween2: CustomTween,
|
DoorTween2: CustomTween,
|
||||||
DoorSensor: DoorSensors,
|
DoorSensor: DoorSensors,
|
||||||
ElevatorBox: BasePart,
|
ElevatorBox: BasePart,
|
||||||
ElevatorDoor1: BasePart,
|
ElevatorDoor1: BasePart,
|
||||||
ElevatorDoor2: BasePart,
|
ElevatorDoor2: BasePart,
|
||||||
DoorClosingClick: Sound
|
DoorClosingClick: Sound
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,6 +53,12 @@ type FloorDoors = {
|
|||||||
[Floor]: {Vector3}?
|
[Floor]: {Vector3}?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type RelayAttributes = {
|
||||||
|
Relay: {
|
||||||
|
Open: BoolValue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export type DoorConstructor = ClassConstructor
|
export type DoorConstructor = ClassConstructor
|
||||||
|
|
||||||
local Doors = {} :: Impl_Constructor
|
local Doors = {} :: Impl_Constructor
|
||||||
|
|||||||
@@ -15,10 +15,15 @@ local Leveling: {number} = {
|
|||||||
[10] = 239.245,
|
[10] = 239.245,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
--Mainly used for the lanterns
|
||||||
local LevelingBetween: {number} = {}
|
local LevelingBetween: {number} = {}
|
||||||
|
|
||||||
--Calculate between leveling
|
--Calculate between leveling
|
||||||
for n: number = 1, #Leveling, 2 do
|
for n: number = 1, #Leveling do
|
||||||
LevelingBetween[n] = (Leveling[n]+Leveling[n+1])/2
|
local FloorAhead: number? = Leveling[n+1]
|
||||||
|
if FloorAhead then
|
||||||
|
LevelingBetween[n] = (Leveling[n]+FloorAhead)/2
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -3,9 +3,10 @@
|
|||||||
--!strict
|
--!strict
|
||||||
|
|
||||||
local RelayAlgorithmModule = require(script.Parent:WaitForChild("RelayAlgorithm"))
|
local RelayAlgorithmModule = require(script.Parent:WaitForChild("RelayAlgorithm"))
|
||||||
|
local DoorsModule = require(script.Parent:WaitForChild("Doors"))
|
||||||
|
|
||||||
type Leveling = {
|
type Leveling = {
|
||||||
Leveling: {number},
|
Leveling: {number},
|
||||||
LevelingBetween: {number}
|
LevelingBetween: {number}
|
||||||
}
|
}
|
||||||
type ElevatorBox = BasePart
|
type ElevatorBox = BasePart
|
||||||
@@ -34,10 +35,12 @@ type Constructor_Return_Props = {
|
|||||||
BoxAlignPosition: BoxAlignPosition,
|
BoxAlignPosition: BoxAlignPosition,
|
||||||
ElevatorBox: ElevatorBox,
|
ElevatorBox: ElevatorBox,
|
||||||
|
|
||||||
__ReadyConnection: RBXScriptConnection?,
|
__Connections: {
|
||||||
__OpenConnection: RBXScriptConnection?,
|
Ready: RBXScriptConnection?,
|
||||||
__GoalYLevelConnection: RBXScriptConnection?,
|
Open: RBXScriptConnection?,
|
||||||
__GoalConnection: RBXScriptConnection?,
|
GoalYLevel: RBXScriptConnection?,
|
||||||
|
Goal: RBXScriptConnection?
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type ElevatorAttributes = {
|
type ElevatorAttributes = {
|
||||||
@@ -50,11 +53,7 @@ type ElevatorAttributes = {
|
|||||||
Stopped: BoolValue
|
Stopped: BoolValue
|
||||||
}
|
}
|
||||||
|
|
||||||
type DoorAttributes = {
|
type DoorAttributes = DoorsModule.RelayAttributes
|
||||||
Relay: {
|
|
||||||
Open: BoolValue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export type RelayConstructor = ClassConstructor
|
export type RelayConstructor = ClassConstructor
|
||||||
|
|
||||||
@@ -68,7 +67,9 @@ function Relay.constructor(RelayAlgorthm, ElevatorAttributes, DoorAttributes, Le
|
|||||||
DoorAttributes = DoorAttributes,
|
DoorAttributes = DoorAttributes,
|
||||||
LevelingModule = LevelingModule,
|
LevelingModule = LevelingModule,
|
||||||
BoxAlignPosition = BoxAlignPosition,
|
BoxAlignPosition = BoxAlignPosition,
|
||||||
ElevatorBox = ElevatorBox
|
ElevatorBox = ElevatorBox,
|
||||||
|
|
||||||
|
__Connections = {}
|
||||||
}, Relay)
|
}, Relay)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -101,25 +102,25 @@ function Relay:__Goal()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Relay:BulkConnect()
|
function Relay:BulkConnect()
|
||||||
self.__ReadyConnection = self.ElevatorAttributes.Relay.Ready:GetPropertyChangedSignal("Value"):Connect(function()
|
self.__Connections.Ready = self.ElevatorAttributes.Relay.Ready:GetPropertyChangedSignal("Value"):Connect(function()
|
||||||
if not self.ElevatorAttributes.Stopped.Value then
|
if not self.ElevatorAttributes.Stopped.Value then
|
||||||
self:__Ready()
|
self:__Ready()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
self.__OpenConnection = self.DoorAttributes.Relay.Open:GetPropertyChangedSignal("Value"):Connect(function()
|
self.__Connections.Open = self.DoorAttributes.Relay.Open:GetPropertyChangedSignal("Value"):Connect(function()
|
||||||
if not self.ElevatorAttributes.Stopped.Value then
|
if not self.ElevatorAttributes.Stopped.Value then
|
||||||
self:__Open()
|
self:__Open()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
self.__GoalYLevelConnection = self.ElevatorAttributes.Relay.GoalYLevel:GetPropertyChangedSignal("Value"):Connect(function()
|
self.__Connections.GoalYLevel = self.ElevatorAttributes.Relay.GoalYLevel:GetPropertyChangedSignal("Value"):Connect(function()
|
||||||
if not self.ElevatorAttributes.Stopped.Value then
|
if not self.ElevatorAttributes.Stopped.Value then
|
||||||
self:__GoalYLevel()
|
self:__GoalYLevel()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
self.__GoalConnection = self.ElevatorAttributes.Relay.Goal:GetPropertyChangedSignal("Value"):Connect(function()
|
self.__Connections.Goal = self.ElevatorAttributes.Relay.Goal:GetPropertyChangedSignal("Value"):Connect(function()
|
||||||
if not self.ElevatorAttributes.Stopped.Value then
|
if not self.ElevatorAttributes.Stopped.Value then
|
||||||
self:__Goal()
|
self:__Goal()
|
||||||
end
|
end
|
||||||
@@ -127,17 +128,17 @@ function Relay:BulkConnect()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Relay:BulkDisconnect()
|
function Relay:BulkDisconnect()
|
||||||
if self.__ReadyConnection and self.__ReadyConnection.Connected then
|
if self.__Connections.Ready and self.__Connections.Ready.Connected then
|
||||||
self.__ReadyConnection:Disconnect()
|
self.__Connections.Ready:Disconnect()
|
||||||
end
|
end
|
||||||
if self.__OpenConnection and self.__OpenConnection.Connected then
|
if self.__Connections.Open and self.__Connections.Open.Connected then
|
||||||
self.__OpenConnection:Disconnect()
|
self.__Connections.Open:Disconnect()
|
||||||
end
|
end
|
||||||
if self.__GoalYLevelConnection and self.__GoalYLevelConnection.Connected then
|
if self.__Connections.GoalYLevel and self.__Connections.GoalYLevel.Connected then
|
||||||
self.__GoalYLevelConnection:Disconnect()
|
self.__Connections.GoalYLevel:Disconnect()
|
||||||
end
|
end
|
||||||
if self.__GoalConnection and self.__GoalConnection.Connected then
|
if self.__Connections.Goal and self.__Connections.Goal.Connected then
|
||||||
self.__GoalConnection:Disconnect()
|
self.__Connections.Goal:Disconnect()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,9 @@ type ElevatorAttributes = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type DoorAttributes = {
|
type DoorAttributes = {
|
||||||
Open: BoolValue
|
Relay: {
|
||||||
|
Open: BoolValue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export type RelayAlgorithmConstructor = ClassConstructor
|
export type RelayAlgorithmConstructor = ClassConstructor
|
||||||
@@ -78,7 +80,7 @@ end
|
|||||||
function RelayAlgorithm:AddFloor(ElevatorGoingUp, RequestedLevel)
|
function RelayAlgorithm:AddFloor(ElevatorGoingUp, RequestedLevel)
|
||||||
self:RawInsert(ElevatorGoingUp, RequestedLevel)
|
self:RawInsert(ElevatorGoingUp, RequestedLevel)
|
||||||
|
|
||||||
return not self.ElevatorAttributes.Moving.Value and self.DoorAttributes.Open.Value
|
return not self.ElevatorAttributes.Moving.Value and self.DoorAttributes.Relay.Open.Value
|
||||||
end
|
end
|
||||||
|
|
||||||
return RelayAlgorithm
|
return RelayAlgorithm
|
||||||
@@ -179,7 +179,18 @@ local Attributes = Elevator.Attributes
|
|||||||
|
|
||||||
--My clever math function for determining if the elevator goal is to move upwards or not
|
--My clever math function for determining if the elevator goal is to move upwards or not
|
||||||
local function ElevatorGoingUpDirection(Floor: number, RequestedFloor: number): boolean
|
local function ElevatorGoingUpDirection(Floor: number, RequestedFloor: number): boolean
|
||||||
return -(Floor-RequestedFloor)>0
|
--(Floor-RequestedFloor)>0
|
||||||
|
return -Floor+RequestedFloor>0 --Simplified equation for less computation
|
||||||
|
end
|
||||||
|
|
||||||
|
local function OpenElevatorDoorsSafe(self: ClassConstructor)
|
||||||
|
print("Relay.Open=",Doors.Attributes.Relay.Open.Value,"Relay.Ready=",Attributes.Relay.Ready.Value)
|
||||||
|
|
||||||
|
if not Doors.Attributes.Relay.Open.Value and not Attributes.Relay.Ready.Value then
|
||||||
|
task.spawn(function()
|
||||||
|
self.ElevatorDoorsConstructor:ToggleElevatorDoorsAsync(true, Attributes.CurrentFloor.Value)
|
||||||
|
end)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function _ActivatedFloorButton(self: ClassConstructor, ButtonFloor: number, ButtonTree: Tags.ButtonPropertiesSafe)
|
local function _ActivatedFloorButton(self: ClassConstructor, ButtonFloor: number, ButtonTree: Tags.ButtonPropertiesSafe)
|
||||||
@@ -193,8 +204,12 @@ local function _ActivatedFloorButton(self: ClassConstructor, ButtonFloor: number
|
|||||||
if Attributes.CurrentFloor.Value == ButtonFloor and Attributes.Relay.Goal.Value == ButtonFloor then
|
if Attributes.CurrentFloor.Value == ButtonFloor and Attributes.Relay.Goal.Value == ButtonFloor then
|
||||||
FloorTracker:Disconnect()
|
FloorTracker:Disconnect()
|
||||||
|
|
||||||
|
--If the elevator is fully stopped at the floor and the hall button or the same cab button for the same floor is pressed,
|
||||||
|
--then open the doors
|
||||||
|
OpenElevatorDoorsSafe(self)
|
||||||
|
|
||||||
self.ButtonsConstructor:__DeactivateButton(ButtonTree.Inst :: BasePart, (ButtonTree.Inst :: BasePart):FindFirstChild("Glass") :: BasePart?)
|
self.ButtonsConstructor:__DeactivateButton(ButtonTree.Inst :: BasePart, (ButtonTree.Inst :: BasePart):FindFirstChild("Glass") :: BasePart?)
|
||||||
ButtonTree.Prompt.Enabled = true
|
ButtonTree.Prompt.Enabled = true
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
else
|
else
|
||||||
@@ -262,6 +277,20 @@ local function IterateButtons(self: ClassConstructor, ButtonsTagsConstructor: Bu
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function ElevatorInit(self: ClassConstructor)
|
||||||
|
task.spawn(function()
|
||||||
|
self.LanternsConstructor:Toggle(true, Attributes.CurrentFloor.Value)
|
||||||
|
self.HallDisplaysConstructor:SetHallDisplays(Attributes.CurrentFloor.Value)
|
||||||
|
|
||||||
|
--Open the elevator doors on server start
|
||||||
|
self.ElevatorDoorsConstructor:ToggleElevatorDoorsAsync(true, Attributes.CurrentFloor.Value)
|
||||||
|
|
||||||
|
--Some hacks
|
||||||
|
Doors.Attributes.Relay.Open.Value = true
|
||||||
|
self:RequestLevel(1)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
function Elevator.constructor(TagsConstructor, ButtonsTags, LanternsTags, LandingDoors)
|
function Elevator.constructor(TagsConstructor, ButtonsTags, LanternsTags, LandingDoors)
|
||||||
local self = {} :: Constructor_Return_Props
|
local self = {} :: Constructor_Return_Props
|
||||||
|
|
||||||
@@ -302,29 +331,31 @@ function Elevator.constructor(TagsConstructor, ButtonsTags, LanternsTags, Landin
|
|||||||
|
|
||||||
self.BoxAttachment,
|
self.BoxAttachment,
|
||||||
self.BoxAlignPosition,
|
self.BoxAlignPosition,
|
||||||
self.BoxAlignOrientation = ElevatorMover(self.ElevatorBox_1960, self.ElevatorBox_1960.Position, Elevator.Responsiveness, Elevator.MaxVelocity)
|
self.BoxAlignOrientation = ElevatorMover(
|
||||||
|
self.ElevatorBox_1960,
|
||||||
|
Vector3.new(self.ElevatorBox_1960.Position.X, LevelingModule.Leveling[1], self.ElevatorBox_1960.Position.Z),
|
||||||
|
Elevator.Responsiveness,
|
||||||
|
Elevator.MaxVelocity
|
||||||
|
)
|
||||||
|
|
||||||
self.RelayAlgorithmConstructor = RelayAlgorithm.constructor(self.BoxAlignPosition, Attributes, Doors.Attributes.Relay)
|
self.RelayAlgorithmConstructor = RelayAlgorithm.constructor(self.BoxAlignPosition, Attributes, Doors.Attributes)
|
||||||
self.RelayConstructor = Relay.constructor(self.RelayAlgorithmConstructor, Attributes, Doors.Attributes, LevelingModule, self.BoxAlignPosition, self.ElevatorBox_1960)
|
self.RelayConstructor = Relay.constructor(
|
||||||
|
self.RelayAlgorithmConstructor,
|
||||||
|
Attributes,
|
||||||
|
Doors.Attributes,
|
||||||
|
LevelingModule,
|
||||||
|
self.BoxAlignPosition,
|
||||||
|
self.ElevatorBox_1960
|
||||||
|
)
|
||||||
|
|
||||||
self.RelayConstructor:BulkConnect()
|
self.RelayConstructor:BulkConnect()
|
||||||
|
|
||||||
local ClassConstructor = setmetatable(self, Elevator)
|
local ClassConstructor = setmetatable(self, Elevator)
|
||||||
IterateButtons(ClassConstructor, ButtonsTagsConstructor)
|
IterateButtons(ClassConstructor, ButtonsTagsConstructor)
|
||||||
|
|
||||||
--Open the elevator doors on server start
|
ElevatorInit(self)
|
||||||
task.spawn(function()
|
|
||||||
self.LanternsConstructor:Toggle(true, Attributes.CurrentFloor.Value)
|
|
||||||
self.HallDisplaysConstructor:SetHallDisplays(Attributes.CurrentFloor.Value)
|
|
||||||
self.ElevatorDoorsConstructor:ToggleElevatorDoorsAsync(true, Attributes.CurrentFloor.Value)
|
|
||||||
|
|
||||||
--Some hacks
|
|
||||||
Doors.Attributes.Relay.Open.Value = true
|
|
||||||
end)
|
|
||||||
|
|
||||||
print(LevelingModule.LevelingBetween)
|
|
||||||
|
|
||||||
print(`🔝 {Elevator.Name} initialized and ready`)
|
print(`🔝 {Elevator.Name} initialized and ready`)
|
||||||
|
|
||||||
return ClassConstructor
|
return ClassConstructor
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -332,7 +363,7 @@ function Elevator:Leveled(RequestedLevel)
|
|||||||
(self.__MovingConnection :: RBXScriptConnection):Disconnect()
|
(self.__MovingConnection :: RBXScriptConnection):Disconnect()
|
||||||
Attributes.Moving.Value = false
|
Attributes.Moving.Value = false
|
||||||
Attributes.CurrentFloor.Value = RequestedLevel
|
Attributes.CurrentFloor.Value = RequestedLevel
|
||||||
self.BoxAlignPosition.MaxVelocity = Elevator.MaxVelocity
|
self.BoxAlignPosition.MaxVelocity = 0
|
||||||
self.LanternsConstructor:Reset(Attributes.CurrentFloor.Value)
|
self.LanternsConstructor:Reset(Attributes.CurrentFloor.Value)
|
||||||
|
|
||||||
task.wait(Elevator.QueueWaitTime)
|
task.wait(Elevator.QueueWaitTime)
|
||||||
@@ -351,7 +382,9 @@ function Elevator:Leveling(RequestedLevel)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Elevator:FloorPassingUp(ElevatorPositionY, RequestedLevel)
|
function Elevator:FloorPassingUp(ElevatorPositionY, RequestedLevel)
|
||||||
if ElevatorPositionY>=LevelingModule.Leveling[Attributes.CurrentFloor.Value+1] then
|
local NextLevelBetweenFloors: number? = LevelingModule.LevelingBetween[Attributes.CurrentFloor.Value+1]
|
||||||
|
|
||||||
|
if NextLevelBetweenFloors and ElevatorPositionY>=NextLevelBetweenFloors then
|
||||||
Attributes.CurrentFloor.Value+=1
|
Attributes.CurrentFloor.Value+=1
|
||||||
|
|
||||||
self.LanternsConstructor:Toggle(true, Attributes.CurrentFloor.Value)
|
self.LanternsConstructor:Toggle(true, Attributes.CurrentFloor.Value)
|
||||||
@@ -360,7 +393,7 @@ function Elevator:FloorPassingUp(ElevatorPositionY, RequestedLevel)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Elevator:FloorPassingDown(ElevatorPositionY, RequestedLevel)
|
function Elevator:FloorPassingDown(ElevatorPositionY, RequestedLevel)
|
||||||
if ElevatorPositionY<=LevelingModule.Leveling[Attributes.CurrentFloor.Value-1] then
|
if ElevatorPositionY<=LevelingModule.LevelingBetween[Attributes.CurrentFloor.Value-1] then
|
||||||
Attributes.CurrentFloor.Value-=1
|
Attributes.CurrentFloor.Value-=1
|
||||||
|
|
||||||
self.LanternsConstructor:Toggle(true, Attributes.CurrentFloor.Value)
|
self.LanternsConstructor:Toggle(true, Attributes.CurrentFloor.Value)
|
||||||
@@ -374,7 +407,9 @@ function Elevator:__MovingHeartbeat(GoingUp, GoalFloor_Y)
|
|||||||
if self.__MovingConnection and self.__MovingConnection.Connected then
|
if self.__MovingConnection and self.__MovingConnection.Connected then
|
||||||
self.__MovingConnection:Disconnect()
|
self.__MovingConnection:Disconnect()
|
||||||
end
|
end
|
||||||
|
|
||||||
self.MOConstructor:UpdateCFrame()
|
self.MOConstructor:UpdateCFrame()
|
||||||
|
self.BoxAlignPosition.MaxVelocity = Elevator.MaxVelocity
|
||||||
|
|
||||||
local Delta = 0
|
local Delta = 0
|
||||||
local DoorsOpeningEvent = false
|
local DoorsOpeningEvent = false
|
||||||
@@ -445,7 +480,7 @@ end
|
|||||||
function Elevator:RequestLevel(RequestedLevel)
|
function Elevator:RequestLevel(RequestedLevel)
|
||||||
local GoalFloor_Y: number? = LevelingModule.Leveling[RequestedLevel]
|
local GoalFloor_Y: number? = LevelingModule.Leveling[RequestedLevel]
|
||||||
|
|
||||||
if GoalFloor_Y and RequestedLevel ~= Attributes.CurrentFloor.Value then
|
if GoalFloor_Y --[[and RequestedLevel ~= Attributes.CurrentFloor.Value]] then
|
||||||
local ElevatorGoingUp = ElevatorGoingUpDirection(Attributes.CurrentFloor.Value, RequestedLevel)
|
local ElevatorGoingUp = ElevatorGoingUpDirection(Attributes.CurrentFloor.Value, RequestedLevel)
|
||||||
local Proceeding = self.RelayAlgorithmConstructor:AddFloor(ElevatorGoingUp, RequestedLevel)
|
local Proceeding = self.RelayAlgorithmConstructor:AddFloor(ElevatorGoingUp, RequestedLevel)
|
||||||
|
|
||||||
@@ -456,7 +491,6 @@ function Elevator:RequestLevel(RequestedLevel)
|
|||||||
warn(`[{Elevator.Name}]: landing out of range or equals the same range as the goal, requested landing: {tostring(RequestedLevel)}`)
|
warn(`[{Elevator.Name}]: landing out of range or equals the same range as the goal, requested landing: {tostring(RequestedLevel)}`)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ local function SwitchAnimation(EnabledState: boolean, LightProperties: LightProp
|
|||||||
|
|
||||||
if EnabledState then
|
if EnabledState then
|
||||||
local Tween = LightSwitchTween:Start(Switch, {
|
local Tween = LightSwitchTween:Start(Switch, {
|
||||||
CFrame = CFrame.new(Switch.Position)*CFrame.Angles(0,math.rad(90),0)+Vector3.new(0,.15,0)
|
CFrame = CFrame.new(Switch.Position)*CFrame.Angles(0, math.rad(90), 0)+Vector3.new(0,.15,0)
|
||||||
})
|
})
|
||||||
Tween.Completed:Once(function()
|
Tween.Completed:Once(function()
|
||||||
ToggleSwitchLight(EnabledState, LightProperties :: LightPropertiesSafe)
|
ToggleSwitchLight(EnabledState, LightProperties :: LightPropertiesSafe)
|
||||||
@@ -87,7 +87,7 @@ local function SwitchAnimation(EnabledState: boolean, LightProperties: LightProp
|
|||||||
end)
|
end)
|
||||||
else
|
else
|
||||||
local Tween = LightSwitchTween:Start(Switch, {
|
local Tween = LightSwitchTween:Start(Switch, {
|
||||||
CFrame = CFrame.new(Switch.Position)*CFrame.Angles(0,math.rad(90),math.rad(70))-Vector3.new(0,.15,0)
|
CFrame = CFrame.new(Switch.Position)*CFrame.Angles(0, math.rad(90), math.rad(70))-Vector3.new(0,.15,0)
|
||||||
})
|
})
|
||||||
Tween.Completed:Once(function()
|
Tween.Completed:Once(function()
|
||||||
ToggleSwitchLight(EnabledState, LightProperties :: LightPropertiesSafe)
|
ToggleSwitchLight(EnabledState, LightProperties :: LightPropertiesSafe)
|
||||||
@@ -135,8 +135,8 @@ function Lights:Init()
|
|||||||
LightProperties.Prompt.ActionText = "Toggle On"
|
LightProperties.Prompt.ActionText = "Toggle On"
|
||||||
end
|
end
|
||||||
|
|
||||||
local ActivatedMaterial = table.find(EnumMaterialsNames, LightProperties.ActivatedMaterial) :: number
|
local ActivatedMaterial = table.find(EnumMaterialsNames, LightProperties.ActivatedMaterial)
|
||||||
local DeactivatedMaterial = table.find(EnumMaterialsNames, LightProperties.DeactivatedMaterial) :: number
|
local DeactivatedMaterial = table.find(EnumMaterialsNames, LightProperties.DeactivatedMaterial)
|
||||||
|
|
||||||
if not ActivatedMaterial then
|
if not ActivatedMaterial then
|
||||||
ActivatedMaterial = 1
|
ActivatedMaterial = 1
|
||||||
@@ -147,8 +147,8 @@ function Lights:Init()
|
|||||||
warn()
|
warn()
|
||||||
end
|
end
|
||||||
|
|
||||||
LightProperties.ActivatedMaterial = EnumMaterialsNames[ActivatedMaterial]
|
LightProperties.ActivatedMaterial = EnumMaterialsNames[ActivatedMaterial :: number]
|
||||||
LightProperties.DeactivatedMaterial = EnumMaterialsNames[DeactivatedMaterial]
|
LightProperties.DeactivatedMaterial = EnumMaterialsNames[DeactivatedMaterial :: number]
|
||||||
|
|
||||||
ToggleSwitch(EnabledState, LightProperties :: LightPropertiesSafe, false)
|
ToggleSwitch(EnabledState, LightProperties :: LightPropertiesSafe, false)
|
||||||
|
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ type Impl_Constructor = {
|
|||||||
|
|
||||||
type Constructor_Fun = (TweenSettings: TweenInfo?, Object: Instance?, PreProperties: TweenAnimation?) -> ClassConstructor
|
type Constructor_Fun = (TweenSettings: TweenInfo?, Object: Instance?, PreProperties: TweenAnimation?) -> ClassConstructor
|
||||||
type Constructor_Return_Props = {
|
type Constructor_Return_Props = {
|
||||||
TweenInfo: TweenInfo?,
|
TweenInfo: TweenInfo?,
|
||||||
Instance: Instance?,
|
Instance: Instance?,
|
||||||
PreProperties: TweenAnimation?,
|
PreProperties: TweenAnimation?,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user