relay system

This commit is contained in:
2024-05-22 22:18:28 -04:00
parent b5f214f3b8
commit 7387e759c8
2 changed files with 59 additions and 40 deletions

View File

@@ -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