mirror of
https://github.com/unixtensor/Roblox-Elevator-Game.git
synced 2025-12-15 21:41:53 +00:00
work on door opening possibility while the elevator is stopped
This commit is contained in:
@@ -3,9 +3,10 @@
|
||||
--!strict
|
||||
|
||||
local RelayAlgorithmModule = require(script.Parent:WaitForChild("RelayAlgorithm"))
|
||||
local DoorsModule = require(script.Parent:WaitForChild("Doors"))
|
||||
|
||||
type Leveling = {
|
||||
Leveling: {number},
|
||||
Leveling: {number},
|
||||
LevelingBetween: {number}
|
||||
}
|
||||
type ElevatorBox = BasePart
|
||||
@@ -34,10 +35,12 @@ type Constructor_Return_Props = {
|
||||
BoxAlignPosition: BoxAlignPosition,
|
||||
ElevatorBox: ElevatorBox,
|
||||
|
||||
__ReadyConnection: RBXScriptConnection?,
|
||||
__OpenConnection: RBXScriptConnection?,
|
||||
__GoalYLevelConnection: RBXScriptConnection?,
|
||||
__GoalConnection: RBXScriptConnection?,
|
||||
__Connections: {
|
||||
Ready: RBXScriptConnection?,
|
||||
Open: RBXScriptConnection?,
|
||||
GoalYLevel: RBXScriptConnection?,
|
||||
Goal: RBXScriptConnection?
|
||||
}
|
||||
}
|
||||
|
||||
type ElevatorAttributes = {
|
||||
@@ -50,11 +53,7 @@ type ElevatorAttributes = {
|
||||
Stopped: BoolValue
|
||||
}
|
||||
|
||||
type DoorAttributes = {
|
||||
Relay: {
|
||||
Open: BoolValue
|
||||
}
|
||||
}
|
||||
type DoorAttributes = DoorsModule.RelayAttributes
|
||||
|
||||
export type RelayConstructor = ClassConstructor
|
||||
|
||||
@@ -68,7 +67,9 @@ function Relay.constructor(RelayAlgorthm, ElevatorAttributes, DoorAttributes, Le
|
||||
DoorAttributes = DoorAttributes,
|
||||
LevelingModule = LevelingModule,
|
||||
BoxAlignPosition = BoxAlignPosition,
|
||||
ElevatorBox = ElevatorBox
|
||||
ElevatorBox = ElevatorBox,
|
||||
|
||||
__Connections = {}
|
||||
}, Relay)
|
||||
end
|
||||
|
||||
@@ -101,25 +102,25 @@ function Relay:__Goal()
|
||||
end
|
||||
|
||||
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
|
||||
self:__Ready()
|
||||
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
|
||||
self:__Open()
|
||||
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
|
||||
self:__GoalYLevel()
|
||||
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
|
||||
self:__Goal()
|
||||
end
|
||||
@@ -127,17 +128,17 @@ function Relay:BulkConnect()
|
||||
end
|
||||
|
||||
function Relay:BulkDisconnect()
|
||||
if self.__ReadyConnection and self.__ReadyConnection.Connected then
|
||||
self.__ReadyConnection:Disconnect()
|
||||
if self.__Connections.Ready and self.__Connections.Ready.Connected then
|
||||
self.__Connections.Ready:Disconnect()
|
||||
end
|
||||
if self.__OpenConnection and self.__OpenConnection.Connected then
|
||||
self.__OpenConnection:Disconnect()
|
||||
if self.__Connections.Open and self.__Connections.Open.Connected then
|
||||
self.__Connections.Open:Disconnect()
|
||||
end
|
||||
if self.__GoalYLevelConnection and self.__GoalYLevelConnection.Connected then
|
||||
self.__GoalYLevelConnection:Disconnect()
|
||||
if self.__Connections.GoalYLevel and self.__Connections.GoalYLevel.Connected then
|
||||
self.__Connections.GoalYLevel:Disconnect()
|
||||
end
|
||||
if self.__GoalConnection and self.__GoalConnection.Connected then
|
||||
self.__GoalConnection:Disconnect()
|
||||
if self.__Connections.Goal and self.__Connections.Goal.Connected then
|
||||
self.__Connections.Goal:Disconnect()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user