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