working lanterns

This commit is contained in:
2024-05-07 22:17:49 -04:00
parent 81941420d8
commit f905a4251d
2 changed files with 18 additions and 19 deletions

File diff suppressed because one or more lines are too long

View File

@@ -77,6 +77,7 @@ type Constructor_Return_Props = {
GovernorFlyballs: Part,
PieplatePulley: UnionOperation,
MachineRoom: MovingObjects.MachineRoom,
HallDisplays: {Instance},
__MovingConnection: RBXScriptConnection?,
}
@@ -169,11 +170,12 @@ end
function Otis1960.constructor(TagsConstructor, ButtonsTags, LanternsTags, LandingDoors)
local self = {} :: Constructor_Return_Props
self.ElevatorBox_1960 = TagsConstructor:Request("ElevatorMover_1960") :: UnionOperation
self.ElevatorDoor1 = TagsConstructor:Request("ElevatorDoor_1960_1") :: BasePart
self.ElevatorDoor2 = TagsConstructor:Request("ElevatorDoor_1960_2") :: BasePart
self.ElevatorDoorSensor = TagsConstructor:Request("ElevatorDoor_Sensor_1960") :: Folder
self.Ropes = TagsConstructor:Request("1960_ElevatorPulleyRope") :: {Instance}
self.ElevatorBox_1960 = TagsConstructor:Request("ElevatorMover_1960") :: UnionOperation
self.ElevatorDoor1 = TagsConstructor:Request("ElevatorDoor_1960_1") :: BasePart
self.ElevatorDoor2 = TagsConstructor:Request("ElevatorDoor_1960_2") :: BasePart
self.ElevatorDoorSensor = TagsConstructor:Request("ElevatorDoor_Sensor_1960") :: Folder
self.Ropes = TagsConstructor:Request("1960_ElevatorPulleyRope") :: {Instance}
self.HallDisplays = TagsConstructor:Request("Otis1960_LandingFloorDisplay") :: {Instance}
--Rotation objects
self.MachineRoom = {_CFrame = {}} :: MovingObjects.MachineRoom
@@ -211,7 +213,8 @@ function Otis1960.constructor(TagsConstructor, ButtonsTags, LanternsTags, Landin
--Open the elevator doors on server start
task.spawn(function()
self.ElevatorDoors:ToggleElevatorDoors(true, 1)
self.LanternsConstructor:Toggle(true, Attributes.CurrentFloor.Value)
self.ElevatorDoors:ToggleElevatorDoors(true, Attributes.CurrentFloor.Value)
end)
print("🔝 Otis1960 initialized and ready")
@@ -233,24 +236,22 @@ local function FloorLeveled(self: ClassConstructor, RequestedLevel: number)
self.LanternsConstructor:Reset(Attributes.CurrentFloor.Value)
end
local FloorPassingLookAhead = Attributes.CurrentFloor.Value+1
local function FloorPassingUp(self: ClassConstructor, ElevatorPositionY: number, RequestedLevel: number)
if ElevatorPositionY>=Leveling[FloorPassingLookAhead] then
FloorPassingLookAhead+=1
if ElevatorPositionY>=Leveling[Attributes.CurrentFloor.Value+1] then
Attributes.CurrentFloor.Value+=1
if Attributes.CurrentFloor.Value ~= RequestedLevel then
self.LanternsConstructor:Toggle(true, Attributes.CurrentFloor.Value)
self.LanternsConstructor:Toggle(false, Attributes.CurrentFloor.Value-1)
end
self.LanternsConstructor:Toggle(true, Attributes.CurrentFloor.Value)
self.LanternsConstructor:Toggle(false, Attributes.CurrentFloor.Value-1)
end
end
local function FloorPassingDown(self: ClassConstructor, ElevatorPositionY: number, RequestedLevel: number)
--Attributes.CurrentFloor.Value -= 1
if ElevatorPositionY<=Leveling[Attributes.CurrentFloor.Value-1] then
Attributes.CurrentFloor.Value-=1
self.LanternsConstructor:Toggle(true, Attributes.CurrentFloor.Value)
self.LanternsConstructor:Toggle(false, Attributes.CurrentFloor.Value+1)
end
end
function Otis1960:__MoveFloors(GoalLevelVEC, RequestedLevel, GoingUp)
@@ -271,8 +272,6 @@ function Otis1960:__MoveFloors(GoalLevelVEC, RequestedLevel, GoingUp)
local DoorsOpeningEvent = false
local ElevatorBoxCurrentPos = self.ElevatorBox_1960.Position
FloorPassingLookAhead = Attributes.CurrentFloor.Value
--Otis1960_ShaftGovernor
self.__MovingConnection = RS.Heartbeat:Connect(function(_dt)
Delta+=1