mirror of
https://github.com/unixtensor/Roblox-Elevator-Game.git
synced 2025-12-15 21:51:55 +00:00
relay system
This commit is contained in:
@@ -23,9 +23,8 @@ type Constructor_Return_Props = {
|
||||
|
||||
type ElevatorAttributes = {
|
||||
CurrentFloor: IntValue,
|
||||
Goal: IntValue,
|
||||
GoingUp: BoolValue,
|
||||
Moving: BoolValue
|
||||
Moving: BoolValue,
|
||||
}
|
||||
|
||||
type DoorAttributes = {
|
||||
@@ -77,17 +76,9 @@ function RelayAlgorithm:RawInsert(ElevatorGoingUp, RequestedLevel)
|
||||
end
|
||||
|
||||
function RelayAlgorithm:AddFloor(ElevatorGoingUp, RequestedLevel)
|
||||
if self.ElevatorAttributes.Moving.Value then
|
||||
self:RawInsert(ElevatorGoingUp, RequestedLevel)
|
||||
else
|
||||
if self.DoorAttributes.Open.Value then
|
||||
self:RawInsert(ElevatorGoingUp, RequestedLevel)
|
||||
return true
|
||||
else
|
||||
self:RawInsert(ElevatorGoingUp, RequestedLevel)
|
||||
end
|
||||
end
|
||||
return false
|
||||
self:RawInsert(ElevatorGoingUp, RequestedLevel)
|
||||
|
||||
return not self.ElevatorAttributes.Moving.Value and self.DoorAttributes.Open.Value
|
||||
end
|
||||
|
||||
return RelayAlgorithm
|
||||
Reference in New Issue
Block a user