mirror of
https://github.com/unixtensor/Roblox-Elevator-Game.git
synced 2025-12-15 21:51:55 +00:00
need a serial loop function for everything and pieplate selector module
This commit is contained in:
@@ -15,6 +15,7 @@ local Doors = require(script:WaitForChild("Doors"))
|
||||
local Enums = require(Elevators:WaitForChild("Enums"))
|
||||
local ElevatorMover = require(Elevators:WaitForChild("Mover"))
|
||||
local ButtonTags = require(Elevators:WaitForChild("Buttons"))
|
||||
local TractionRopes = require(Elevators:WaitForChild("TractionRopes"))
|
||||
|
||||
type Tags = TagsModule.ExportedTags
|
||||
|
||||
@@ -28,14 +29,15 @@ type Impl_Constructor = {
|
||||
} & Impl_Static_Props
|
||||
|
||||
type Impl_Static_Props = {
|
||||
Moving: boolean
|
||||
Moving: boolean,
|
||||
Responsiveness: number,
|
||||
MaxVelocity: number
|
||||
}
|
||||
|
||||
type Constructor_Fun = (Tags: Tags) -> ClassConstructor
|
||||
type Constructor_Return_Props = {
|
||||
Tags: Tags,
|
||||
ElevatorBox_1960: BasePart,
|
||||
ElevatorBox: BasePart,
|
||||
ElevatorBox_1960: UnionOperation,
|
||||
ElevatorDoor1: BasePart,
|
||||
ElevatorDoor2: BasePart,
|
||||
ElevatorDoorSensor: Folder,
|
||||
@@ -44,12 +46,18 @@ type Constructor_Return_Props = {
|
||||
BoxAlignPosition: AlignPosition,
|
||||
BoxAlignOrientation: AlignOrientation,
|
||||
ElevatorDoors: Doors.DoorConstructor,
|
||||
Ropes: {Instance},
|
||||
TractionRopes: TractionRopes.TractionRopesConstructor,
|
||||
PiePlateSelector: UnionOperation,
|
||||
__RopeConnection: RBXScriptConnection?
|
||||
}
|
||||
|
||||
local Otis1960 = {} :: Impl_Constructor
|
||||
Otis1960.__index = Otis1960
|
||||
|
||||
Otis1960.Moving = false
|
||||
Otis1960.Responsiveness = 50
|
||||
Otis1960.MaxVelocity = 10
|
||||
|
||||
local function ButtonPress(Button: BasePart, Activated: boolean)
|
||||
task.spawn(function()
|
||||
@@ -83,7 +91,7 @@ local function HookButtons(self: ClassConstructor, ButtonsConstructor: ButtonTag
|
||||
|
||||
ButtonsConstructor:HookPromptButtonsGroup(ButtonTree.Prompt, ButtonTree.Inst, function(_Player: Player)
|
||||
if DecodedFloor then
|
||||
ButtonTree.Prompt.Enabled = false
|
||||
--ButtonTree.Prompt.Enabled = false
|
||||
ButtonPress(ButtonTree.Inst, false)
|
||||
|
||||
self:GoToLevel(DecodedFloor)
|
||||
@@ -112,16 +120,21 @@ end
|
||||
function Otis1960.constructor(Tags)
|
||||
local self = {} :: Constructor_Return_Props
|
||||
self.Tags = Tags
|
||||
self.ElevatorBox_1960 = Tags.ElevatorMover_1960 :: BasePart
|
||||
self.ElevatorBox = Tags.ElevatorMover_1960 :: BasePart
|
||||
self.ElevatorDoor1 = Tags.ElevatorDoor_1960_1 :: BasePart
|
||||
self.ElevatorDoor2 = Tags.ElevatorDoor_1960_2 :: BasePart
|
||||
self.ElevatorDoorSensor = Tags.ElevatorDoor_Sensor_1960 :: Folder
|
||||
self.ProximityButtons = Tags.ProximityElevatorButton :: {Instance}
|
||||
self.ElevatorBox_1960 = Tags.ElevatorMover_1960 :: UnionOperation
|
||||
self.ElevatorDoor1 = Tags.ElevatorDoor_1960_1 :: BasePart
|
||||
self.ElevatorDoor2 = Tags.ElevatorDoor_1960_2 :: BasePart
|
||||
self.ElevatorDoorSensor = Tags.ElevatorDoor_Sensor_1960 :: Folder
|
||||
self.ProximityButtons = Tags.ProximityElevatorButton :: {Instance}
|
||||
self.Ropes = Tags["1960_ElevatorPulleyRope"] :: {Instance}
|
||||
self.PiePlateSelector = Tags.Otis1960_PiePlateSelector :: UnionOperation
|
||||
|
||||
self.BoxAttachment, self.BoxAlignPosition, self.BoxAlignOrientation = ElevatorMover(self.ElevatorBox_1960, self.ElevatorBox_1960.Position)
|
||||
self.ElevatorDoors = Doors.constructor(self.ElevatorBox, self.ElevatorDoor1, self.ElevatorDoor2, self.ElevatorDoorSensor)
|
||||
self.BoxAttachment,
|
||||
self.BoxAlignPosition,
|
||||
self.BoxAlignOrientation = ElevatorMover(self.ElevatorBox_1960, self.ElevatorBox_1960.Position, Otis1960.Responsiveness, Otis1960.MaxVelocity)
|
||||
|
||||
self.ElevatorDoors = Doors.constructor(self.ElevatorBox_1960, self.ElevatorDoor1, self.ElevatorDoor2, self.ElevatorDoorSensor)
|
||||
self.TractionRopes = TractionRopes.constructor(self.Ropes, self.ElevatorBox_1960, Leveling)
|
||||
|
||||
--Buttons
|
||||
local ButtonsConstructor = ButtonTags.constructor(Tags, Enums.Elevator.Otis1960)
|
||||
local Otis1960_Buttons = ButtonsConstructor:CreatePromptButtons()
|
||||
@@ -134,20 +147,10 @@ function Otis1960.constructor(Tags)
|
||||
return ClassConstructor
|
||||
end
|
||||
|
||||
local BiggestRopeLength = Leveling[#Leveling]-2
|
||||
|
||||
function Otis1960:__MoveFloors(Level)
|
||||
local ElevatorBoxCurrentPos = self.ElevatorBox.Position
|
||||
|
||||
local RopeConnection = RS.Heartbeat:Connect(function(_dt)
|
||||
local Ropes = self.Tags["1960_ElevatorPulleyRope"] :: {Instance}
|
||||
|
||||
for i: number = 1, #Ropes do
|
||||
(Ropes[i] :: RopeConstraint).Length = (BiggestRopeLength-self.ElevatorBox.Position.Y)*10
|
||||
print((Ropes[i] :: RopeConstraint).Length)
|
||||
end
|
||||
end)
|
||||
|
||||
local ElevatorBoxCurrentPos = self.ElevatorBox_1960.Position
|
||||
self.TractionRopes:Moving(Level, 26)
|
||||
|
||||
self.BoxAlignPosition.Position = Vector3.new(ElevatorBoxCurrentPos.X, Level, ElevatorBoxCurrentPos.Z)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user