Restructure and get a working state for the Haughton elevator

This commit is contained in:
2024-08-13 01:45:03 -04:00
parent a1a455fb78
commit 9d081a2084
18 changed files with 96 additions and 440 deletions

View File

@@ -18,14 +18,13 @@ end
local UI = script:WaitForChild("UI")
local CrosshairSettings = require(UI:WaitForChild("Crosshair"))
local VignetteSettings = require(UI:WaitForChild("Vignette"))
local HealthSettings = require(UI:WaitForChild("Health"))
local CoreGuis = require(script:WaitForChild("CoreGuis"))
local Mouse = require(script:WaitForChild("Mouse"))
local Character = require(script:WaitForChild("Character"))
local function LoadCharacter(CharacterModel)
local CharacterConstructor = Character.constructor(CharacterModel)
CharacterConstructor:DisableRobloxSounds()
CharacterConstructor:SetWalkSpeed()
CharacterConstructor:SetJumpHeight()
@@ -61,7 +60,7 @@ local Crosshair = CrosshairSettings.constructor(PlayerGui)
--Keybinds
local function CameraBinds()
local CameraBindMap = KeyBindsModule.constructor(false)
CameraBindMap:AddInputBegan({Enum.KeyCode.C, Enum.KeyCode.Z}, function(_KeyPressed)
Camera:ZoomIn(Vignette, Crosshair)
end)
@@ -84,10 +83,9 @@ CoreGuis:Off()
Camera:FirstPerson()
Mouse:DisablePointer()
Crosshair:Enable()
HealthSettings:Enable()
CameraBinds()
Crosshair3DEffect()
LoadCharacter(PlayerCharacter)
Player.CharacterAdded:Connect(LoadCharacter)
Player.CharacterAdded:Connect(LoadCharacter)

View File

@@ -22,7 +22,6 @@ type Scalar = {
type GuiDependencies = {
IntroGui: ScreenGui,
Frame: Frame,
FrameGradient: UIGradient,
TextShadow: TextLabel,
ShadowGradient: UIGradient,
FrameworkText: TextLabel,
@@ -45,7 +44,6 @@ local function GuiDependencies(IntroGui: ScreenGui): GuiDependencies
local Frame = IntroGui:WaitForChild("Frame") :: Frame
local FrameGradient = Frame:WaitForChild("UIGradient") :: UIGradient
local TextShadow = Frame:WaitForChild("TextShadow") :: TextLabel
local FrameworkText = Frame:WaitForChild("Framework") :: TextLabel
local SandboxText = Frame:WaitForChild("Sandbox") :: TextLabel
@@ -63,7 +61,6 @@ local function GuiDependencies(IntroGui: ScreenGui): GuiDependencies
return {
IntroGui = IntroGui,
Frame = Frame,
FrameGradient = FrameGradient,
TextShadow = TextShadow,
ShadowGradient = ShadowGradient,
FrameworkText = FrameworkText,
@@ -158,12 +155,12 @@ local function UI_3D_Rotation(Gui: GuiDependencies, Delta: number)
local mX = Delta/1.5
local mY = Delta/1.5
local mZ = -7.65
local RMatrix = RotationMatrix(mX,mY,mZ)
local X = {Size*RMatrix.Ixx, Size*RMatrix.Ixy}
local Y = {Size*RMatrix.Iyx, Size*RMatrix.Iyy}
local Z = {Size*RMatrix.Izx, Size*RMatrix.Izy}
local AXIS_R_3DScalar_X = Scalar(CenterX+X[1],CenterY+X[2],CenterX,CenterY)
local AXIS_R_3DScalar_Y = Scalar(CenterX+Y[1],CenterY+Y[2],CenterX,CenterY)
local AXIS_R_3DScalar_Z = Scalar(CenterX+Z[1],CenterY+Z[2],CenterX,CenterY)
@@ -171,19 +168,19 @@ local function UI_3D_Rotation(Gui: GuiDependencies, Delta: number)
Gui.Xframe.Position = UDim2.fromOffset(AXIS_R_3DScalar_X.Center.X, AXIS_R_3DScalar_X.Center.Y)
Gui.Yframe.Position = UDim2.fromOffset(AXIS_R_3DScalar_Y.Center.X, AXIS_R_3DScalar_Y.Center.Y)
Gui.Zframe.Position = UDim2.fromOffset(AXIS_R_3DScalar_Z.Center.X, AXIS_R_3DScalar_Z.Center.Y)
Gui.Xframe_text.Position = UDim2.fromOffset(AXIS_R_3DScalar_X.Center.X, AXIS_R_3DScalar_X.Center.Y)
Gui.Yframe_text.Position = UDim2.fromOffset(AXIS_R_3DScalar_Y.Center.X, AXIS_R_3DScalar_Y.Center.Y)
Gui.Zframe_text.Position = UDim2.fromOffset(AXIS_R_3DScalar_Z.Center.X, AXIS_R_3DScalar_Z.Center.Y)
Gui.Xframe.Size = UDim2.fromOffset(AXIS_R_3DScalar_X.Distance, WorldSize)
Gui.Yframe.Size = UDim2.fromOffset(AXIS_R_3DScalar_Y.Distance, WorldSize)
Gui.Zframe.Size = UDim2.fromOffset(AXIS_R_3DScalar_Z.Distance, WorldSize)
Gui.Xframe.Rotation = AXIS_R_3DScalar_X.Rotation
Gui.Yframe.Rotation = AXIS_R_3DScalar_Y.Rotation
Gui.Zframe.Rotation = AXIS_R_3DScalar_Z.Rotation
Gui.Xframe_text.Rotation = Gui.Xframe.Rotation
Gui.Yframe_text.Rotation = Gui.Yframe.Rotation
Gui.Zframe_text.Rotation = Gui.Zframe.Rotation
@@ -206,4 +203,4 @@ return function(IntroGui: ScreenGui, load_elapse_start: number)
GUI_LoadFinish(Gui)
end)
end
end

View File

@@ -32,8 +32,26 @@ Otis1960Configuration.Colors = {
LanternDisplayOff = Color3.fromRGB(55,55,55),
}
local HaughtonConfiguration = {} :: ElevatorTypes.ElevatorConfigurationTable
HaughtonConfiguration.Name = Enums.Elevator.Haughton
HaughtonConfiguration.FloorLevelingDistance = 4
HaughtonConfiguration.FloorLeveling3PhaseDistance = 1.5
HaughtonConfiguration.ParkedDistance = 0.2
HaughtonConfiguration.Responsiveness = 20
HaughtonConfiguration.MaxVelocity = 7
HaughtonConfiguration.LevelingVelocity = 2
HaughtonConfiguration.Phase3LevelingVelocity = .5
HaughtonConfiguration.Functions = {
ManualTravelStart = true
}
HaughtonConfiguration.Colors = {
ButtonActivated = Color3.fromRGB(180,0,0),
ButtonDeactivated = Color3.fromRGB(139,139,139),
LanternDisplayOn = Color3.fromRGB(44,255,157),
LanternDisplayOff = Color3.fromRGB(255,29,101),
}
return {
Otis1960Configuration = Otis1960Configuration
Otis1960Configuration = Otis1960Configuration,
HaughtonConfiguration = HaughtonConfiguration
}

View File

@@ -1,282 +0,0 @@
--!optimize 2
--!native
--!strict
local RS: RunService = game:GetService("RunService")
local Storage: ReplicatedStorage = game:GetService("ReplicatedStorage")
local Main = script.Parent.Parent.Parent
local Load = Main:WaitForChild("Load")
local Tween = require(Storage:WaitForChild("Tween"))
local Algebra = require(Storage:WaitForChild("Algebra"))
local Tags = require(Load:WaitForChild("Tags"))
local SoundEnums = require(Main:WaitForChild("Enums"):WaitForChild("Sounds"))
type DoorSensors = {
[string]: BasePart
}
type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor))
type Impl_Constructor = {
__index: Impl_Constructor,
constructor: Constructor_Fun,
--Class functions
__DetectSensorHit: (self: ClassConstructor, DoorTween1: Tween, DoorTween2: Tween) -> RBXScriptConnection,
ToggleElevatorDoorsAsync: (self: ClassConstructor, opening: boolean, floor: number) -> ()
} & Impl_Static_Props
type Constructor_Fun = (FloorDoorsTags: Tags.LandingTags, ElevatorBox: BasePart, ElevatorDoor1: BasePart, ElevatorDoor2: BasePart, ElevatorDoorSensor: Folder) -> ClassConstructor
type Impl_Static_Props = {
Sensors: boolean,
Door1Stopped_X: Vector3,
Door2Stopped_X: Vector3,
ElevatorDoorTime: number,
ElevatorDoorStyle: Enum.EasingStyle,
__DoorSensors: RBXScriptConnection?,
Attributes: {} & RelayAttributes
}
type Constructor_Return_Props = {
FloorDoorsTags: Tags.LandingTags,
DoorSensor: DoorSensors,
ElevatorBox: BasePart,
ElevatorDoor1: BasePart,
ElevatorDoor2: BasePart,
DoorClosingClick: Sound
}
type Floor = number
type FloorDoors = {
[Floor]: {Vector3}?
}
export type RelayAttributes = {
Relay: {
Open: BoolValue
}
}
export type DoorConstructor = ClassConstructor
local Doors = {} :: Impl_Constructor
Doors.__index = Doors
Doors.Sensors = true
Doors.Door1Stopped_X = Vector3.xAxis*2.9
Doors.Door2Stopped_X = Vector3.xAxis*5.8
Doors.ElevatorDoorTime = 4
Doors.ElevatorDoorStyle = Enum.EasingStyle.Quad
Doors.Attributes = {
Relay = {
Open = Instance.new("BoolValue") :: BoolValue
}
}
Doors.Attributes.Relay.Open.Value = false
local Attributes = Doors.Attributes
function Doors.constructor(FloorDoorsTags, ElevatorBox, ElevatorDoor1, ElevatorDoor2, ElevatorDoorSensor)
local DoorSensor: DoorSensors = {
Start = ElevatorDoorSensor:WaitForChild("Start") :: BasePart,
End = ElevatorDoorSensor:WaitForChild("End") :: BasePart
}
local DoorClosingClick = Instance.new("Sound") :: Sound
DoorClosingClick.SoundId = SoundEnums.Otis1960.DoorClosingClick
DoorClosingClick.Volume = .1
DoorClosingClick.Parent = ElevatorDoor2
return setmetatable({
FloorDoorsTags = FloorDoorsTags,
DoorSensor = DoorSensor,
ElevatorBox = ElevatorBox,
ElevatorDoor1 = ElevatorDoor1,
ElevatorDoor2 = ElevatorDoor2,
DoorClosingClick = DoorClosingClick
}, Doors)
end
--speed
local init_floors_opened: FloorDoors = {}
local init_floors_closed: FloorDoors = {}
local function DoorsAnimationFloor(FloorDoors: {Instance?}, Floor: number, opening: boolean?, activated_via_censor: boolean?): (Tween?, Tween?)
local Door2Tween_Floor: Tween?
local Door1Tween_Floor: Tween?
local FloorDoor1 = FloorDoors[1] :: BasePart?
local FloorDoor2 = FloorDoors[2] :: BasePart?
local FloorDoor1_P = FloorDoor1 and FloorDoor1.Position
local FloorDoor2_P = FloorDoor2 and FloorDoor2.Position
if opening then
if not init_floors_closed[Floor] then
init_floors_closed[Floor] = {}
end
if not (init_floors_closed[Floor] :: {})[1] and not (init_floors_closed[Floor] :: {})[2] then
if FloorDoor1_P then
(init_floors_closed[Floor] :: {})[1] = FloorDoor1_P-Doors.Door1Stopped_X
end
if FloorDoor2_P then
(init_floors_closed[Floor] :: {})[2] = FloorDoor2_P-Doors.Door2Stopped_X
end
end
else
if not init_floors_opened[Floor] then
init_floors_opened[Floor] = {}
end
if not (init_floors_opened[Floor] :: {})[1] and not (init_floors_opened[Floor] :: {})[2] then
if FloorDoor1_P then
(init_floors_opened[Floor] :: {})[1] = FloorDoor1_P+Doors.Door1Stopped_X
end
if FloorDoor2_P then
(init_floors_opened[Floor] :: {})[2] = FloorDoor2_P+Doors.Door2Stopped_X
end
end
end
if FloorDoor1 then
local DoorTween1 = Tween.constructor(TweenInfo.new(
Doors.ElevatorDoorTime,
activated_via_censor and Enum.EasingStyle.Linear or Doors.ElevatorDoorStyle,
Enum.EasingDirection.Out
), FloorDoor1)
Door1Tween_Floor = DoorTween1:Start(nil, {
Position = opening and (init_floors_closed[Floor] :: {Vector3})[1] or (init_floors_opened[Floor] :: {Vector3})[1]
})
end
if FloorDoor2 then
local DoorTween2 = Tween.constructor(TweenInfo.new(
Doors.ElevatorDoorTime,
activated_via_censor and Enum.EasingStyle.Linear or Doors.ElevatorDoorStyle,
Enum.EasingDirection.Out
), FloorDoor2)
Door2Tween_Floor = DoorTween2:Start(nil, {
Position = opening and (init_floors_closed[Floor] :: {Vector3})[2] or (init_floors_opened[Floor] :: {Vector3})[2]
})
end
return Door1Tween_Floor, Door2Tween_Floor
end
local function ElevatorDoorsAnimationAsync(self: ClassConstructor, opening: boolean, activated_via_censor: boolean?)
--Roblox physics will freak out
self.ElevatorDoor1.CanCollide = false
self.ElevatorDoor2.CanCollide = false
local ElevatorDoor1_P = self.ElevatorDoor1.Position
local ElevatorDoor2_P = self.ElevatorDoor2.Position
local StartTime = os.clock()
local Timing = Doors.ElevatorDoorTime-1
if opening then
while task.wait() do
local Time = Algebra.LinearElapse(StartTime, Timing)
local Ease = Algebra.Easing.InOutQuart(Time)
local ElevatorBoxY = Vector3.new(0, self.ElevatorBox.Position.Y, 0)
local Door1Vector = Vector3.new(ElevatorDoor1_P.X, 0, ElevatorDoor1_P.Z)
local Door2Vector = Vector3.new(ElevatorDoor2_P.X, 0, ElevatorDoor2_P.Z)
self.ElevatorDoor1.Position = ElevatorBoxY+Door1Vector:Lerp(Door1Vector-Doors.Door1Stopped_X, Ease)
self.ElevatorDoor2.Position = ElevatorBoxY+Door2Vector:Lerp(Door2Vector-Doors.Door2Stopped_X, Ease)
if Time>=1 then
break
end
end
else
while task.wait() do
local Time = Algebra.LinearElapse(StartTime, Timing)
local Ease = Algebra.Easing.InOutQuart(Time)
local ElevatorBoxY = Vector3.new(0, self.ElevatorBox.Position.Y, 0)
local Door1Vector = Vector3.new(ElevatorDoor1_P.X, 0, ElevatorDoor1_P.Z)
local Door2Vector = Vector3.new(ElevatorDoor2_P.X, 0, ElevatorDoor2_P.Z)
self.ElevatorDoor1.Position = ElevatorBoxY+Door1Vector:Lerp(Door1Vector+Doors.Door1Stopped_X, Ease)
self.ElevatorDoor2.Position = ElevatorBoxY+Door2Vector:Lerp(Door2Vector+Doors.Door2Stopped_X, Ease)
if Time>=1 then
break
end
end
end
end
local raycastParams = RaycastParams.new()
raycastParams.FilterType = Enum.RaycastFilterType.Exclude
--heh..
local RayIgnoring = {}
local workspace_items = workspace:GetChildren()
for n: number = 1, #workspace_items do
local Inst = workspace_items[n]
if Inst:IsA("Folder") or Inst:IsA("BasePart") then
table.insert(RayIgnoring, workspace_items[n])
end
end
function Doors:__DetectSensorHit(DoorTween1, DoorTween2)
local Step = nil
if Doors.Sensors and Attributes.Relay.Open.Value then
raycastParams.FilterDescendantsInstances = {self.ElevatorBox, table.unpack(RayIgnoring)}
Step = RS.Heartbeat:Connect(function(_dt)
local DoorSensor = workspace:Raycast(self.DoorSensor.Start.Position, self.DoorSensor.End.Position, raycastParams)
if DoorSensor and DoorSensor.Instance and DoorSensor.Instance:IsA("BasePart") then
Step:Disconnect()
DoorTween1:Pause()
DoorTween2:Pause()
task.wait(1) --elevators irl have this delay
ElevatorDoorsAnimationAsync(self, true, true)
end
end)
end
return Step
end
function Doors:ToggleElevatorDoorsAsync(opening, floor)
--short circuiting central
if opening then
if Attributes.Relay.Open.Value then
warn("Doors are already closed, doing nothing")
return
end
else
if not Attributes.Relay.Open.Value then
warn("Doors are already open, doing nothing")
return
end
end
local FloorDoorsObjects = self.FloorDoorsTags[floor]
if FloorDoorsObjects then
DoorsAnimationFloor(FloorDoorsObjects, floor, opening)
end
Attributes.Relay.Open.Value = opening
ElevatorDoorsAnimationAsync(self, opening)
self.ElevatorDoor1.CanCollide = true
self.ElevatorDoor2.CanCollide = true
if Doors.__DoorSensors and Doors.__DoorSensors.Connected then
Doors.__DoorSensors:Disconnect()
end
end
return Doors

View File

@@ -25,9 +25,6 @@ type Impl_Constructor = {
CarButton: (self: ClassConstructor, ButtonID: string, ButtonTree: Tags.ButtonProperties, Callback: FloorButtonActivatedCallback, Fallback: FloorButtonActivatedFallback) -> (),
LandingButton: (self: ClassConstructor, ButtonID: string, ButtonTree: Tags.ButtonProperties, Callback: FloorButtonActivatedCallback, Fallback: FloorButtonActivatedFallback) -> (),
SpecialButton: (self: ClassConstructor, ButtonName: Enums.SpecialButtonValues, ButtonID: string, ButtonTree: Tags.ButtonProperties, Callback: StopButtonActivatedCallback) -> (),
AestheticActivateButton: (self: ClassConstructor, Button: BasePart, Glass: BasePart?) -> (),
__DeactivateButton: (self: ClassConstructor, Button: BasePart, Glass: BasePart?) -> (),
__ActivateButton: (self: ClassConstructor, Button: BasePart, Glass: BasePart?) -> (),
} & Impl_Static_Props
type Impl_Static_Props = {
@@ -135,38 +132,4 @@ function ButtonFunctions:SpecialButton(ButtonID, ButtonName, ButtonTree, Callbac
end
end
function ButtonFunctions:__DeactivateButton(Button, Glass)
local Part = Glass or Button
Part.Material = Enum.Material.Glass
Part.Color = self.ElevatorButtonColors.ButtonDeactivated
Part.Transparency = 0.3
end
function ButtonFunctions:__ActivateButton(Button, Glass)
local Part = Glass or Button
Part.Material = Enum.Material.Neon
Part.Color = self.ElevatorButtonColors.ButtonActivated
Part.Transparency = 0
end
function ButtonFunctions:AestheticActivateButton(Button)
local Glass = Button:FindFirstChild("Glass") :: BasePart?
local LookVec = (Glass or Button).CFrame.LookVector/50
if Glass then
Glass.Position+=LookVec
self:__ActivateButton(Button, Glass)
end
Button.Position+=LookVec
task.delay(ButtonFunctions.ButtonHoldDuration, function()
if Glass then
Glass.Position-=LookVec
end
Button.Position-=LookVec
end)
end
return ButtonFunctions
return ButtonFunctions

View File

@@ -0,0 +1,38 @@
--!optimize 2
--!native
--!strict
local ParentDir = script.Parent
local ElevatorDir = ParentDir.Parent
local MainDir = ElevatorDir.Parent
local StorageService = game:GetService("ReplicatedStorage")
local InitElevator = require(ParentDir)
local TagsModule = require(MainDir:WaitForChild("Load"):WaitForChild("Tags"))
local Enums = require(StorageService:WaitForChild("Enums"))
local ElevatorConfigurationTable = require(ElevatorDir:WaitForChild("Configs"))
local FloorLevelingPositions = require(ElevatorDir:WaitForChild("Leveling"))
local TractionRopes = require(ElevatorDir:WaitForChild("TractionRopes"))
return function(TagsConstructor: TagsModule.TagsConstructor, ButtonTags: TagsModule.ElevatorButtons, LanternTags: TagsModule.Lanterns, LandingDoorTags: TagsModule.LandingTags)
local ElevatorBoxModel = TagsConstructor:Request("ElevatorMover_Haughton") :: BasePart
local RopeTags = TagsConstructor:Request("ElevatorRope_Haughton") :: {Instance}
local Elevator = InitElevator.constructor(ElevatorBoxModel, ElevatorConfigurationTable.HaughtonConfiguration, FloorLevelingPositions.HaughtonLeveling)
local TractionRopesConstructor = TractionRopes.constructor(RopeTags, ElevatorBoxModel, FloorLevelingPositions.HaughtonLeveling)
task.wait(3)
task.spawn(function()
Elevator:RequestLevelAsync(2, Enums.ElevatorCallDirection.Down)
end)
Elevator.Events.Traveling:Connect(function(deltaTime: number, cabPosition: Vector3)
--TractionRopesConstructor:Move(10, cabPosition)
warn("This is impossible to be firing during parked")
end)
Elevator:StartTraveling()
Elevator.Events.Parked:Wait()
Elevator.__Connections.Moving:Disconnect()
end

View File

@@ -7,18 +7,18 @@ local MainDir = ParentDir.Parent
local StorageService = game:GetService("ReplicatedStorage")
local Enums = require(StorageService:WaitForChild("Enums"))
local InitElevator = require(ParentDir:WaitForChild("InitElevator"))
local TagsModule = require(MainDir:WaitForChild("Load"):WaitForChild("Tags"))
local Enums = require(StorageService:WaitForChild("Enums"))
local InitElevator = require(ParentDir:WaitForChild("InitElevator"))
local TagsModule = require(MainDir:WaitForChild("Load"):WaitForChild("Tags"))
local ElevatorConfigurationTable = require(ParentDir:WaitForChild("Config"))
local ElevatorConfigurationTable = require(ParentDir:WaitForChild("Configs"))
local FloorLevelingPositions = require(ParentDir:WaitForChild("Leveling"))
-- 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.Ropes = TagsConstructor:Request("1960_ElevatorPulleyRope") :: {Instance}
-- self.HallDisplays = TagsConstructor:Request("Otis1960_LandingFloorDisplay") :: {Instance}
-- self.MachineRoom.Pulley = TagsConstructor:Request("Otis1960_Pulley") :: UnionOperation
@@ -30,21 +30,7 @@ local FloorLevelingPositions = require(ParentDir:WaitForChild("Leveling"))
-- self.MachineRoom.PiePlateSelector = TagsConstructor:Request("Otis1960_PiePlateSelector") :: UnionOperation
return function(TagsConstructor: TagsModule.TagsConstructor, ButtonTags: TagsModule.ElevatorButtons, LanternTags: TagsModule.Lanterns, LandingDoorTags: TagsModule.LandingTags)
local ElevatorBoxModel = TagsConstructor:Request("ElevatorMover_1960") :: UnionOperation
--local ElevatorBoxModel = TagsConstructor:Request("ElevatorMover_1960") :: UnionOperation
local Elevator = InitElevator.constructor(ElevatorBoxModel, ElevatorConfigurationTable.Otis1960Configuration, FloorLevelingPositions)
Elevator.Events.Progression:Connect(function(PreviousFloor: number, CurrentFloor: number, NextFloor: number)
print(CurrentFloor)
end)
Elevator.Attributes.Goal:GetPropertyChangedSignal("Value"):Connect(function()
print("Goal=", Elevator.Attributes.Goal.Value)
end)
task.wait(1)
task.spawn(function()
Elevator:RequestLevelAsync(2, Enums.ElevatorCallDirection.Up)
end)
print(Elevator.RelayAlgorithm.FloorQueue.Up)
--local Elevator = InitElevator.constructor(ElevatorBoxModel, ElevatorConfigurationTable.Otis1960Configuration, FloorLevelingPositions)
end

View File

@@ -31,7 +31,7 @@ type Impl_Constructor = {
}
type FloorLevelingPositions = {number}
type Constructor_Fun = (ElevatorBoxModel: UnionOperation, ElevatorConfigurationTable: ElevatorTypes.ElevatorConfigurationTable, FloorLevelingPositions: FloorLevelingPositions) -> ClassConstructor
type Constructor_Fun = (ElevatorBoxModel: BasePart, ElevatorConfigurationTable: ElevatorTypes.ElevatorConfigurationTable, FloorLevelingPositions: FloorLevelingPositions) -> ClassConstructor
type Constructor_Return_Props = {
RelayAlgorithm: RelayAlgorithm.RelayAlgorithmConstructor,
@@ -86,7 +86,7 @@ local function ElevatorGoingUpDirection(CurrentFloor: number, RequestedFloor: nu
return CurrentFloor<RequestedFloor
end
local function Mover(ElevatorBoxModel: UnionOperation, Responsiveness: number, MaxVelocity: number): (Attachment, AlignPosition, AlignOrientation)
local function Mover(ElevatorBoxModel: BasePart, Responsiveness: number, MaxVelocity: number): (Attachment, AlignPosition, AlignOrientation)
local BoxAttachment = Instance.new("Attachment")
BoxAttachment.Parent = ElevatorBoxModel
@@ -106,7 +106,7 @@ local function Mover(ElevatorBoxModel: UnionOperation, Responsiveness: number, M
BoxAlignOrientation.Mode = Enum.OrientationAlignmentMode.OneAttachment
BoxAlignOrientation.Attachment0 = BoxAttachment
BoxAlignOrientation.RigidityEnabled = true
BoxAlignOrientation.CFrame = CFrame.new(0,0,0)*CFrame.fromOrientation(0,0,0)
BoxAlignOrientation.CFrame = ElevatorBoxModel.CFrame
BoxAlignOrientation.Parent = ElevatorBoxModel
return BoxAttachment, BoxAlignPosition, BoxAlignOrientation
@@ -120,6 +120,7 @@ function Elevator.constructor(ElevatorBoxModel, ElevatorConfigurationTable, Floo
end
local function ewarn<T...>(...: T...)
warn(`[{ElevatorConfigurationTable.Name}]:`, ...)
warn(debug.traceback())
end
local function eprintStudio<T...>(...: T...)
Out.printStudio(`[{ElevatorConfigurationTable.Name}]:`, ...)
@@ -342,7 +343,8 @@ function Elevator:__TravelToFloorAsync(Level_Int, LEVEL_VEC3_Y_WRAP)
self.__Connections.Moving:Disconnect()
end
print("TravelingToFloorAsync")
assert(not self.Elevator.BoxModel.Anchored, "The elevator cannot move! Its box model is Anchored.")
local ElevatorTravelingUpwards = ElevatorGoingUpDirection(self.Attributes.CurrentFloor.Value, Level_Int)
self.Attributes.Goal.Value = Level_Int
self.Attributes.TravelingUpwards.Value = ElevatorTravelingUpwards

View File

@@ -1,57 +0,0 @@
--!optimize 2
--!native
--!strict
type HallDisplays = {Instance}
type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor))
type Impl_Constructor = {
__index: Impl_Constructor,
constructor: Constructor_Fun,
--Class functions
BindHallDisplays: (self: ClassConstructor) -> (),
UnBindHallDisplays: (self: ClassConstructor) -> (),
SetHallDisplays: (self: ClassConstructor, floor: string | number) -> ()
}
type Constructor_Fun = (CurrentFloorAttribute: IntValue, HallDisplayTags: HallDisplays) -> ClassConstructor
type Constructor_Return_Props = {
CurrentFloorAttribute: IntValue,
HallDisplayTags: HallDisplays,
__CurrentFloorConnection: RBXScriptConnection?
}
export type HallDisplaysConstructor = ClassConstructor
local HallDisplays = {} :: Impl_Constructor
HallDisplays.__index = HallDisplays
function HallDisplays.constructor(CurrentFloorAttribute, HallDisplayTags)
return setmetatable({
CurrentFloorAttribute = CurrentFloorAttribute,
HallDisplayTags = HallDisplayTags
}, HallDisplays)
end
function HallDisplays:SetHallDisplays(floor)
local FloorString = tostring(floor)
for i = 1, #self.HallDisplayTags do
(self.HallDisplayTags[i] :: TextLabel).Text = FloorString
end
end
function HallDisplays:BindHallDisplays()
self:UnBindHallDisplays()
self.__CurrentFloorConnection = self.CurrentFloorAttribute:GetPropertyChangedSignal("Value"):Connect(function()
self:SetHallDisplays(self.CurrentFloorAttribute.Value)
end)
end
function HallDisplays:UnBindHallDisplays()
if self.__CurrentFloorConnection and self.__CurrentFloorConnection.Connected then
self.__CurrentFloorConnection:Disconnect()
end
end
return HallDisplays

View File

@@ -16,11 +16,8 @@ local Otis1960Leveling: {number} = {
}
local HaughtonLeveling: {number} = {
[1] = 0,
[2] = 0,
[3] = 0,
[4] = 0,
[5] = 0,
[1] = 1.163,
[2] = 19.163,
}
return {

View File

@@ -14,7 +14,7 @@ type Impl_Constructor = {
Stopped: (self: ClassConstructor) -> (),
}
type Constructor_Fun = (RopeTags: RopeTags, ElevatorBox: UnionOperation, Leveling: Leveling) -> ClassConstructor
type Constructor_Fun = (RopeTags: RopeTags, ElevatorBox: BasePart, Leveling: Leveling) -> ClassConstructor
type Constructor_Return_Props = {
Ropes: RopeTags,
Leveling: Leveling,
@@ -50,4 +50,4 @@ function TractionRopes:Stopped()
end
return TractionRopes
return TractionRopes

View File

@@ -16,11 +16,14 @@ local Workspace_Stuff = require(Load:WaitForChild("Workspace"))
local StarterPlayer_Stuff = require(Load:WaitForChild("StarterPlayer"))
local Elevators = script:WaitForChild("Elevators")
local Elevator = Elevators:WaitForChild("Elevator")
local Maps = script:WaitForChild("Map")
local Interactions = Maps:WaitForChild("Interactions")
local LightSwitches = require(Interactions:WaitForChild("LightSwitches"))
local Otis1960 = require(Elevators:WaitForChild("Otis1960"))
--local Otis1960 = require(Elevators:WaitForChild("Elevator"):WaitForChild("Otis1960"))
local Haughton = require(Elevator:WaitForChild("Haughton"))
local Enums = require(Storage:WaitForChild("Enums"))
@@ -50,4 +53,5 @@ print("[DEBUG] Lanterns=", Lanterns)
local LandingDoors = TagsConstructor:__ElevatorDoors()
print("[DEBUG] Elevator Landing Doors=", LandingDoors)
Otis1960(TagsConstructor, Buttons[Enums.Elevator.Otis1960], Lanterns[Enums.Elevator.Otis1960], LandingDoors[Enums.Elevator.Otis1960])
-- Otis1960(TagsConstructor, Buttons[Enums.Elevator.Otis1960], Lanterns[Enums.Elevator.Otis1960], LandingDoors[Enums.Elevator.Otis1960])
Haughton(TagsConstructor, Buttons[Enums.Elevator.Haughton], Lanterns[Enums.Elevator.Haughton], LandingDoors[Enums.Elevator.Haughton])

View File

@@ -23,16 +23,19 @@ end
local function warnStudio<T...>(...: T...)
if RunService:IsStudio() then
warn(...)
warn(debug.traceback())
end
end
local function warnServer<T...>(...: T...)
if RunService:IsServer() then
warn(...)
warn(debug.traceback())
end
end
local function warnClient<T...>(...: T...)
if RunService:IsClient() then
warn(...)
warn(debug.traceback())
end
end

View File

@@ -1,11 +0,0 @@
--!optimize 2
--!native
--!strict
local function MakeEvent<T,U>()
end
return {
MakeEvent = MakeEvent
}