Huge structural change and plumbing

This commit is contained in:
2024-09-14 21:23:39 -04:00
parent fa948897ef
commit d3ae66bb89
16 changed files with 94 additions and 184 deletions

File diff suppressed because one or more lines are too long

View File

@@ -3,17 +3,17 @@
local ParentDir = script.Parent local ParentDir = script.Parent
local ElevatorDir = ParentDir.Parent local ElevatorDir = ParentDir.Parent
local ElevatorsDir = ElevatorDir.Parent local MainDir = ElevatorDir.Parent
local MainDir = ElevatorsDir.Parent local MapDir = MainDir.Parent
local StorageService = game:GetService("ReplicatedStorage") local StorageService = game:GetService("ReplicatedStorage")
local InitElevator = require(ElevatorDir)
local Enums = require(StorageService:WaitForChild("Enums")) local Enums = require(StorageService:WaitForChild("Enums"))
local InitElevator = require(ElevatorsDir:WaitForChild("System"))
local Buttons = require(ElevatorDir:WaitForChild("Buttons")) local Buttons = require(ElevatorDir:WaitForChild("Buttons"))
local Doors = require(ElevatorDir:WaitForChild("Doors")) local Doors = require(ElevatorDir:WaitForChild("Doors"))
local TagsModule = require(MainDir:WaitForChild("Map"):WaitForChild("Load"):WaitForChild("Tags")) local TagsModule = require(MapDir:WaitForChild("Load"):WaitForChild("Tags"))
local ElevatorTypes = require(MainDir:WaitForChild("Types"):WaitForChild("Elevator")) local ElevatorTypes = require(MapDir:WaitForChild("Types"):WaitForChild("Elevator"))
type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor)) type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor))
type Impl_Constructor = { type Impl_Constructor = {

View File

@@ -2,13 +2,12 @@
--!strict --!strict
local Elevators = script.Parent.Parent.Parent local Elevators = script.Parent.Parent.Parent
local Main = Elevators.Parent local Map = Elevators.Parent
local Storage = game:GetService("ReplicatedStorage") local Storage = game:GetService("ReplicatedStorage")
local Enums = require(Storage:WaitForChild("Enums")) local Enums = require(Storage:WaitForChild("Enums"))
local Map = Main:WaitForChild("Map")
local PromptModule = require(Map:WaitForChild("Prompts")) local PromptModule = require(Map:WaitForChild("Prompts"))
local Tags = require(Map:WaitForChild("Load"):WaitForChild("Tags")) local Tags = require(Map:WaitForChild("Load"):WaitForChild("Tags"))
@@ -37,7 +36,9 @@ ButtonFunctions.__index = ButtonFunctions
--ButtonTags.ButtonsConstructor --ButtonTags.ButtonsConstructor
function ButtonFunctions.constructor(CurrentFloor) function ButtonFunctions.constructor(CurrentFloor)
return setmetatable({CurrentFloor = CurrentFloor}, ButtonFunctions) return setmetatable({
CurrentFloor = CurrentFloor
}, ButtonFunctions)
end end
function ButtonFunctions:CarButton(ButtonID, ButtonTree, Callback, Fallback) function ButtonFunctions:CarButton(ButtonID, ButtonTree, Callback, Fallback)

View File

@@ -4,7 +4,7 @@
local ParentDir = script.Parent local ParentDir = script.Parent
local ElevatorDir = ParentDir.Parent local ElevatorDir = ParentDir.Parent
local MainDir = ElevatorDir.Parent local MainDir = ElevatorDir.Parent
local TagsModule = MainDir:WaitForChild("Map"):WaitForChild("Load"):WaitForChild("Tags") local TagsModule = MainDir:WaitForChild("Load"):WaitForChild("Tags")
local StorageService = game:GetService("ReplicatedStorage") local StorageService = game:GetService("ReplicatedStorage")

View File

@@ -2,17 +2,16 @@
--!strict --!strict
local ParentDir = script.Parent local ParentDir = script.Parent
local ElevatorsDir = ParentDir.Parent local ElevatorsDir = ParentDir.Parent.Parent
local MainDir = ElevatorsDir.Parent local MainDir = ElevatorsDir.Parent
local Storage = game:GetService("ReplicatedStorage") local Storage = game:GetService("ReplicatedStorage")
local RS = game:GetService("RunService") local RS = game:GetService("RunService")
local Types = MainDir:WaitForChild("Types") local Types = ElevatorsDir:WaitForChild("Types")
local GCSignal = require(Storage:WaitForChild("GCSignal")) local GCSignal = require(Storage:WaitForChild("GCSignal"))
local DoorEnums = require(Types:WaitForChild("Enums"):WaitForChild("Doors")) local ElevatorTypes = require(Types:WaitForChild("Elevator"))
local ElevatorEnums = require(Types:WaitForChild("Elevator"))
local Tags = require(MainDir:WaitForChild("Map"):WaitForChild("Load"):WaitForChild("Tags")) local Tags = require(MainDir:WaitForChild("Map"):WaitForChild("Load"):WaitForChild("Tags"))
local Algebra = require(Storage:WaitForChild("Algebra")) local Algebra = require(Storage:WaitForChild("Algebra"))
@@ -28,9 +27,8 @@ type Impl_Constructor = {
} }
type Constructor_Fun = ( type Constructor_Fun = (
LevelingFloors: {number}, Config: ElevatorTypes.ElevatorConfigurationTable,
ElevatorBox: BasePart, ElevatorBox: BasePart,
DoorConfig: ElevatorEnums.DoorsConfig,
DoorsTree: Tags.LandingTags DoorsTree: Tags.LandingTags
) -> ClassConstructor ) -> ClassConstructor
@@ -46,7 +44,7 @@ type Attributes = {
} }
type Constructor_Return_Props = { type Constructor_Return_Props = {
DoorConfig: ElevatorEnums.DoorsConfig, Config: ElevatorTypes.ElevatorConfigurationTable,
ElevatorBox: BasePart, ElevatorBox: BasePart,
DoorsTree: Tags.LandingTags, DoorsTree: Tags.LandingTags,
Attributes: Attributes, Attributes: Attributes,
@@ -64,7 +62,7 @@ export type constructor = ClassConstructor
local Doors = {} :: Impl_Constructor local Doors = {} :: Impl_Constructor
Doors.__index = Doors Doors.__index = Doors
function Doors.constructor(LevelingFloors, ElevatorBox, DoorConfig, DoorsTree) function Doors.constructor(Config, ElevatorBox, DoorsTree)
local CabOpenAttribute = Instance.new("BoolValue") :: BoolValue local CabOpenAttribute = Instance.new("BoolValue") :: BoolValue
local DoorAttributes = { local DoorAttributes = {
Hall = {}, Hall = {},
@@ -72,14 +70,14 @@ function Doors.constructor(LevelingFloors, ElevatorBox, DoorConfig, DoorsTree)
Open = CabOpenAttribute Open = CabOpenAttribute
} }
} }
for n: number = 1, #LevelingFloors do for n: number = 1, #Config.Leveling do
DoorAttributes.Hall[n] = { DoorAttributes.Hall[n] = {
Open = Instance.new("BoolValue") :: BoolValue Open = Instance.new("BoolValue") :: BoolValue
} }
end end
return setmetatable({ return setmetatable({
DoorConfig = DoorConfig, Config = Config,
ElevatorBox = ElevatorBox, ElevatorBox = ElevatorBox,
DoorsTree = DoorsTree, DoorsTree = DoorsTree,
Attributes = DoorAttributes, Attributes = DoorAttributes,
@@ -88,7 +86,7 @@ function Doors.constructor(LevelingFloors, ElevatorBox, DoorConfig, DoorsTree)
end end
type DoorAnimationCallback<T...> = (self: ClassConstructor, Time: number, T...) -> () type DoorAnimationCallback<T...> = (self: ClassConstructor, Time: number, T...) -> ()
local function DoorAnimationRuntime(self: ClassConstructor, Time: number, Type: DoorEnums.DoorLocationValues, Callback: DoorAnimationCallback<()>): Signal local function DoorAnimationRuntime(self: ClassConstructor, Time: number, Type: ElevatorTypes.DoorLocations, Callback: DoorAnimationCallback<()>): Signal
if self.__Connections[Type] and self.__Connections[Type].Connected then if self.__Connections[Type] and self.__Connections[Type].Connected then
self.__Connections[Type]:Disconnect() self.__Connections[Type]:Disconnect()
end end
@@ -189,16 +187,16 @@ end
--- ---
--this is ridiculous optimization tech --this is ridiculous optimization tech
local function OpenVecTuple(self: ClassConstructor, Opening: boolean, Type: DoorEnums.DoorLocationValues, HallFloor: number?): ...Vector3? local function OpenVecTuple(self: ClassConstructor, Opening: boolean, Type: ElevatorTypes.DoorLocations, HallFloor: number?): ...Vector3?
if Type == DoorEnums.DoorLocation.Landing and not HallFloor then if Type == "Landing" and not HallFloor then
warn("Hall/landing doors were called but no HallFloor number was received") warn("Hall/landing doors were called but no HallFloor number was received")
return nil return nil
end end
local DoorsType: {Instance?}? = Type == DoorEnums.DoorLocation.Cab and self.DoorsTree.Cab or self.DoorsTree.Hall[HallFloor :: number] local DoorsType: {Instance?}? = Type == "Cab" and self.DoorsTree.Cab or self.DoorsTree.Hall[HallFloor :: number]
local ConfType = Type == DoorEnums.DoorLocation.Cab and self.DoorConfig.Cab or self.DoorConfig.Landing local ConfType = Type == "Cab" and self.Config.Doors.Cab or self.Config.Doors.Landing
if ConfType.Type == DoorEnums.Door.SingleSpeed then if ConfType.Type == "SingleSpeed" then
if DoorsType and DoorsType[1] then if DoorsType and DoorsType[1] then
local P = (DoorsType[1] :: BasePart).Position local P = (DoorsType[1] :: BasePart).Position
local Direction = Opening and -ConfType.Goal or ConfType.Goal local Direction = Opening and -ConfType.Goal or ConfType.Goal
@@ -208,7 +206,7 @@ local function OpenVecTuple(self: ClassConstructor, Opening: boolean, Type: Door
Direction Direction
}) })
end end
elseif ConfType.Type == DoorEnums.Door.DoubleSpeed then elseif ConfType.Type == "DoubleSpeed" then
if DoorsType and DoorsType[1] and DoorsType[2] then if DoorsType and DoorsType[1] and DoorsType[2] then
local P = (DoorsType[1] :: BasePart).Position local P = (DoorsType[1] :: BasePart).Position
local P2 = (DoorsType[2] :: BasePart).Position local P2 = (DoorsType[2] :: BasePart).Position
@@ -221,7 +219,7 @@ local function OpenVecTuple(self: ClassConstructor, Opening: boolean, Type: Door
Direction/2 Direction/2
}) })
end end
elseif ConfType.Type == DoorEnums.Door.TripleSpeed then elseif ConfType.Type == "TripleSpeed" then
--idk man --idk man
if DoorsType and DoorsType[1] and DoorsType[2] and DoorsType[3] then if DoorsType and DoorsType[1] and DoorsType[2] and DoorsType[3] then
local P = (DoorsType[1] :: BasePart).Position local P = (DoorsType[1] :: BasePart).Position
@@ -243,12 +241,12 @@ local function OpenVecTuple(self: ClassConstructor, Opening: boolean, Type: Door
end end
--this module is built off my insanity --this module is built off my insanity
local function ToggleDoors(self: ClassConstructor, Type: DoorEnums.DoorLocationValues, Opening: boolean, Floor: number?): boolean local function ToggleDoors(self: ClassConstructor, Type: ElevatorTypes.DoorLocations, Opening: boolean, Floor: number?): boolean
local Config: ElevatorEnums.DoorsConfigProperties? = Type == DoorEnums.DoorLocation.Cab and self.DoorConfig.Cab or self.DoorConfig.Landing local Config: ElevatorTypes.DoorsConfigProperties? = Type == "Cab" and self.Config.Doors.Cab or self.Config.Doors.Landing
if Config then if Config then
local P1, P2, P3, P4, P5, P6 = OpenVecTuple(self, Opening, Type, Floor) local P1, P2, P3, P4, P5, P6 = OpenVecTuple(self, Opening, Type, Floor)
if P1 then if P1 then
if Type == DoorEnums.DoorLocation.Cab then if Type == "Cab" then
local FinishedSignal = DoorAnimationRuntime(self, Config.Time, Type, function(self, AnimationTime) local FinishedSignal = DoorAnimationRuntime(self, Config.Time, Type, function(self, AnimationTime)
DoorAnimations.Cab[Config.Type](self, AnimationTime, P1, P2, P3, P4, P5, P6) DoorAnimations.Cab[Config.Type](self, AnimationTime, P1, P2, P3, P4, P5, P6)
end) end)
@@ -256,7 +254,7 @@ local function ToggleDoors(self: ClassConstructor, Type: DoorEnums.DoorLocationV
self.Attributes.Cab.Open.Value = Opening self.Attributes.Cab.Open.Value = Opening
end) end)
return true return true
elseif Type == DoorEnums.DoorLocation.Landing then elseif Type == "Landing" then
local FinishedSignal = DoorAnimationRuntime(self, Config.Time, Type, function(self, AnimationTime) local FinishedSignal = DoorAnimationRuntime(self, Config.Time, Type, function(self, AnimationTime)
DoorAnimations.Landing[Config.Type](self, Floor, AnimationTime, P1, P2, P3, P4, P5, P6) DoorAnimations.Landing[Config.Type](self, Floor, AnimationTime, P1, P2, P3, P4, P5, P6)
end) end)
@@ -278,7 +276,7 @@ function Doors:OpenCabAsync()
warn("Elevator doors already open") warn("Elevator doors already open")
return false return false
end end
return ToggleDoors(self, DoorEnums.DoorLocation.Cab, true) return ToggleDoors(self, "Cab", true)
end end
function Doors:CloseCabAsync() function Doors:CloseCabAsync()
@@ -286,7 +284,7 @@ function Doors:CloseCabAsync()
warn("Elevator doors already closed") warn("Elevator doors already closed")
return false return false
end end
return ToggleDoors(self, DoorEnums.DoorLocation.Cab, false) return ToggleDoors(self, "Cab", false)
end end
function Doors:OpenAtFloor(Floor) function Doors:OpenAtFloor(Floor)
@@ -294,7 +292,7 @@ function Doors:OpenAtFloor(Floor)
warn(`Elevator doors at floor "{Floor}" already open`) warn(`Elevator doors at floor "{Floor}" already open`)
return false return false
end end
return ToggleDoors(self, DoorEnums.DoorLocation.Landing, true, Floor) return ToggleDoors(self, "Landing", true, Floor)
end end
function Doors:CloseAtFloor(Floor) function Doors:CloseAtFloor(Floor)
@@ -302,7 +300,7 @@ function Doors:CloseAtFloor(Floor)
warn(`Elevator doors at floor "{Floor}" already closed`) warn(`Elevator doors at floor "{Floor}" already closed`)
return false return false
end end
return ToggleDoors(self, DoorEnums.DoorLocation.Landing, false, Floor) return ToggleDoors(self, "Landing", false, Floor)
end end
return Doors return Doors

View File

@@ -1,9 +1,10 @@
--!optimize 2 --!optimize 2
--!strict --!strict
local MainDir = script.Parent.Parent.Parent.Parent local MainDir = script.Parent.Parent.Parent
local TagsModule = require(MainDir:WaitForChild("Map"):WaitForChild("Load"):WaitForChild("Tags")) local MapDir = MainDir.Parent
local ElevatorTypes = require(MainDir:WaitForChild("Types"):WaitForChild("Elevator")) local TagsModule = require(MapDir:WaitForChild("Load"):WaitForChild("Tags"))
local ElevatorTypes = require(MapDir:WaitForChild("Types"):WaitForChild("Elevator"))
local TS = game:GetService("TweenService") local TS = game:GetService("TweenService")

View File

@@ -2,9 +2,8 @@
--!strict --!strict
local Elevators = script.Parent local Elevators = script.Parent
local MainDir = Elevators.Parent local MapDir = Elevators.Parent
local MapDir = MainDir:WaitForChild("Map") local LoadDir = MapDir:WaitForChild("Load")
local LoadDir = MapDir:WaitForChild("Load")
local RunService = game:GetService("RunService") local RunService = game:GetService("RunService")
local StorageService = game:GetService("ReplicatedStorage") local StorageService = game:GetService("ReplicatedStorage")
@@ -13,7 +12,7 @@ local TweenService = game:GetService("TweenService")
local Enums = require(StorageService:WaitForChild("Enums")) local Enums = require(StorageService:WaitForChild("Enums"))
local Out = require(StorageService:WaitForChild("Output")) local Out = require(StorageService:WaitForChild("Output"))
local Algebra = require(StorageService:WaitForChild("Algebra")) local Algebra = require(StorageService:WaitForChild("Algebra"))
local ElevatorTypes = require(MainDir:WaitForChild("Types"):WaitForChild("Elevator")) local ElevatorTypes = require(MapDir:WaitForChild("Types"):WaitForChild("Elevator"))
local Tags = require(LoadDir:WaitForChild("Tags")) local Tags = require(LoadDir:WaitForChild("Tags"))
local RelayAlgorithm = require(script:WaitForChild("RelayAlgorithm")) local RelayAlgorithm = require(script:WaitForChild("RelayAlgorithm"))
@@ -34,13 +33,11 @@ type Impl_Constructor = {
type FloorLevelingPositions = {number} type FloorLevelingPositions = {number}
type Constructor_Fun = ( type Constructor_Fun = (
ElevatorBoxModel: BasePart, ElevatorBoxModel: BasePart,
ElevatorConfigurationTable: ElevatorTypes.ElevatorConfigurationTable, ElevatorConfigurationTable: ElevatorTypes.ElevatorConfigurationTable
FloorLevelingPositions: FloorLevelingPositions
) -> ClassConstructor ) -> ClassConstructor
type Constructor_Return_Props = { type Constructor_Return_Props = {
RelayAlgorithm: RelayAlgorithm.RelayAlgorithmConstructor, RelayAlgorithm: RelayAlgorithm.RelayAlgorithmConstructor,
FloorLevelingPositions: FloorLevelingPositions,
eprint: <T...>(T...) -> (), eprint: <T...>(T...) -> (),
ewarn: <T...>(T...) -> (), ewarn: <T...>(T...) -> (),
eprintStudio: <T...>(T...) -> (), eprintStudio: <T...>(T...) -> (),
@@ -100,8 +97,8 @@ local function ElevatorGoingUpDirection(CurrentFloor: number, RequestedFloor: nu
return CurrentFloor<RequestedFloor return CurrentFloor<RequestedFloor
end end
function Elevator.constructor(ElevatorBoxModel, ElevatorConfigurationTable, FloorLevelingPositions) function Elevator.constructor(ElevatorBoxModel, ElevatorConfigurationTable)
assert(#FloorLevelingPositions>1, `"{ElevatorConfigurationTable.Name}" requires more floors to operate. Floors={FloorLevelingPositions}, #Floors={#FloorLevelingPositions}.`) assert(#ElevatorConfigurationTable.Leveling>1, `"{ElevatorConfigurationTable.Name}" requires more floors to operate. Floors={ElevatorConfigurationTable.Leveling}, #Floors={#ElevatorConfigurationTable.Leveling}.`)
local function eprint<T...>(...: T...) local function eprint<T...>(...: T...)
print(`[{ElevatorConfigurationTable.Name}]:`, ...) print(`[{ElevatorConfigurationTable.Name}]:`, ...)
@@ -162,12 +159,11 @@ function Elevator.constructor(ElevatorBoxModel, ElevatorConfigurationTable, Floo
Attributes.Goal.Value = 1 Attributes.Goal.Value = 1
local ElevatorClass = setmetatable({ local ElevatorClass = setmetatable({
RelayAlgorithm = RelayAlgorithmConstructor, RelayAlgorithm = RelayAlgorithmConstructor,
FloorLevelingPositions = FloorLevelingPositions, eprint = eprint,
eprint = eprint, ewarn = ewarn,
ewarn = ewarn, eprintStudio = eprintStudio,
eprintStudio = eprintStudio, ewarnStudio = ewarnStudio,
ewarnStudio = ewarnStudio,
Elevator = { Elevator = {
BoxModel = ElevatorBoxModel, BoxModel = ElevatorBoxModel,
@@ -204,7 +200,7 @@ function Elevator.constructor(ElevatorBoxModel, ElevatorConfigurationTable, Floo
if AddedFloorDirection == (ElevatorClass.Attributes.TravelingUpwards.Value and Enums.ElevatorCallDirection.Up or Enums.ElevatorCallDirection.Down) then if AddedFloorDirection == (ElevatorClass.Attributes.TravelingUpwards.Value and Enums.ElevatorCallDirection.Up or Enums.ElevatorCallDirection.Down) then
local NextFloorAsTraveling = FloorDirectionQueue[1] local NextFloorAsTraveling = FloorDirectionQueue[1]
if NextFloorAsTraveling then if NextFloorAsTraveling then
local Level = FloorLevelingPositions[NextFloorAsTraveling] local Level = ElevatorConfigurationTable.Leveling[NextFloorAsTraveling]
ElevatorClass:__TravelToFloorAsync(Level, Vector3.new(0, Level, 0)) ElevatorClass:__TravelToFloorAsync(Level, Vector3.new(0, Level, 0))
end end
ElevatorClass.eprintStudio(`Floors sorted in proceeding direction. direction={AddedFloorDirection}, FloorDirectionQueue={FloorDirectionQueue}`) ElevatorClass.eprintStudio(`Floors sorted in proceeding direction. direction={AddedFloorDirection}, FloorDirectionQueue={FloorDirectionQueue}`)
@@ -289,7 +285,7 @@ local function CheckFloorQueue(self: ClassConstructor)
end end
local function FloorsClamp(self: ClassConstructor, n: number): number local function FloorsClamp(self: ClassConstructor, n: number): number
return Algebra.minmax(1, n, #self.FloorLevelingPositions) return Algebra.minmax(1, n, #self.Elevator.Configuration.Leveling)
end end
local Debounce = { local Debounce = {
@@ -300,7 +296,7 @@ local Debounce = {
@native @native
local function CabTraveling(self: ClassConstructor, deltaTime: number, LEVEL_VEC3_Y_WRAP: Vector3) local function CabTraveling(self: ClassConstructor, deltaTime: number, LEVEL_VEC3_Y_WRAP: Vector3)
local ElevatorPosition = self.Elevator.BoxModel.Position local ElevatorPosition = self.Elevator.BoxModel.Position
local AtFloorY = self.FloorLevelingPositions[FloorsClamp(self, self.Attributes.TravelingUpwards.Value and self.Attributes.CurrentFloor.Value+1 or self.Attributes.CurrentFloor.Value-1)] local AtFloorY = self.Elevator.Configuration.Leveling[FloorsClamp(self, self.Attributes.TravelingUpwards.Value and self.Attributes.CurrentFloor.Value+1 or self.Attributes.CurrentFloor.Value-1)]
if self.Attributes.TravelingUpwards.Value then if self.Attributes.TravelingUpwards.Value then
--Detecting between the floors --Detecting between the floors
@@ -373,7 +369,7 @@ local function CabTraveling(self: ClassConstructor, deltaTime: number, LEVEL_VEC
end end
function Elevator:GetLevel(Level_Int) function Elevator:GetLevel(Level_Int)
local Level = self.FloorLevelingPositions[Level_Int] local Level = self.Elevator.Configuration.Leveling[Level_Int]
if Level then if Level then
--local VEC3_Y_WRAP_LOSSY = Vector3.yAxis*Level --local VEC3_Y_WRAP_LOSSY = Vector3.yAxis*Level
return Vector3.new(0, Level, 0) return Vector3.new(0, Level, 0)
@@ -418,7 +414,7 @@ function Elevator:RequestLevelAsync(RequestedLevel, Direction)
if (RequestedLevel == 1 and Direction == Enums.ElevatorCallDirection.Down) then if (RequestedLevel == 1 and Direction == Enums.ElevatorCallDirection.Down) then
self.ewarnStudio(`Impossible direction requested, Direction={Direction}, RequestedLevel={RequestedLevel}. correcting...`) self.ewarnStudio(`Impossible direction requested, Direction={Direction}, RequestedLevel={RequestedLevel}. correcting...`)
Direction = Enums.ElevatorCallDirection.Up Direction = Enums.ElevatorCallDirection.Up
elseif (RequestedLevel == #self.FloorLevelingPositions and Direction == Enums.ElevatorCallDirection.Up) then elseif (RequestedLevel == #self.Elevator.Configuration.Leveling and Direction == Enums.ElevatorCallDirection.Up) then
self.ewarnStudio(`Impossible direction requested, Direction={Direction}, RequestedLevel={RequestedLevel}. correcting...`) self.ewarnStudio(`Impossible direction requested, Direction={Direction}, RequestedLevel={RequestedLevel}. correcting...`)
Direction = Enums.ElevatorCallDirection.Down Direction = Enums.ElevatorCallDirection.Down
end end

View File

@@ -9,7 +9,6 @@ local StorageService = game:GetService("ReplicatedStorage")
local Types = MainDir:WaitForChild("Types") local Types = MainDir:WaitForChild("Types")
local Enums = require(StorageService:WaitForChild("Enums")) local Enums = require(StorageService:WaitForChild("Enums"))
local ElevatorTypes = require(Types:WaitForChild("Elevator")) local ElevatorTypes = require(Types:WaitForChild("Elevator"))
local DoorEnums = require(Types:WaitForChild("Enums"):WaitForChild("Doors"))
--local SoundEnums = require(Types:WaitForChild("Enums"):WaitForChild("Sounds")) --local SoundEnums = require(Types:WaitForChild("Enums"):WaitForChild("Sounds"))
local HaughtonConfig = {} :: ElevatorTypes.ElevatorConfigurationTable local HaughtonConfig = {} :: ElevatorTypes.ElevatorConfigurationTable
@@ -25,9 +24,11 @@ HaughtonConfig.ParkedSmoothingTime = 1
HaughtonConfig.Responsiveness = 5 HaughtonConfig.Responsiveness = 5
HaughtonConfig.MaxVelocity = 7 HaughtonConfig.MaxVelocity = 7
HaughtonConfig.MaxVelocitySmoothingTime = 5 HaughtonConfig.MaxVelocitySmoothingTime = 5
HaughtonConfig.Functions = { HaughtonConfig.Functions = {
ManualTravelStart = true ManualTravelStart = true
} }
HaughtonConfig.Colors = { HaughtonConfig.Colors = {
ButtonActivated = { ButtonActivated = {
Color = Color3.fromRGB(162,106,76), Color = Color3.fromRGB(162,106,76),
@@ -38,6 +39,7 @@ HaughtonConfig.Colors = {
Material = Enum.Material.SmoothPlastic Material = Enum.Material.SmoothPlastic
} }
} }
HaughtonConfig.Lanterns = { HaughtonConfig.Lanterns = {
On = { On = {
Up = { Up = {
@@ -64,55 +66,30 @@ HaughtonConfig.Lanterns = {
}, },
} }
} }
HaughtonConfig.Doors = { HaughtonConfig.Doors = {
Cab = { Cab = {
Type = DoorEnums.Door.DoubleSpeed, Type = "DoubleSpeed",
Time = 5, Time = 5,
Goal = Vector3.new(4.027) Goal = Vector3.new(4.027)
}, },
Landing = { Landing = {
Type = DoorEnums.Door.SingleSpeed, Type = "SingleSpeed",
Time = 5, Time = 5,
Goal = Vector3.new(4.221) Goal = Vector3.new(4.221)
} }
} }
--config to JSON needs work HaughtonConfig.Leveling = {
--[[ [1] = 1.163, --Basement
{ [2] = 19.163,
"Doors": { [3] = 36.053,
"Landing": { "Type": "SingleSpeed", "Time": 5, "Goal": null }, [4] = 53.005,
"Cab": { "Type": "DoubleSpeed", "Time": 5, "Goal": null } [5] = 69.977,
}, [6] = 86.948,
"FloorLeveling3PhaseDistance": 1.5, [7] = 103.913,
"Lanterns": { [8] = 120.891,
"On": {
"Down": { "Color": null, "Material": null, "Time": 1 },
"Up": { "Color": null, "Material": null, "Time": 1 }
},
"Off": {
"Down": { "Color": null, "Material": null, "Time": 1 },
"Up": { "Color": null, "Material": null, "Time": 1 }
}
},
"TravelType": "Traction",
"Responsiveness": 5,
"Phase3LevelingVelocity": 0.5,
"ParkedSmoothingTime": 1,
"Colors": {
"ButtonDeactivated": { "Color": null, "Material": null },
"ButtonActivated": { "Color": null, "Material": null }
},
"Functions": { "ManualTravelStart": true },
"MaxVelocitySmoothingTime": 5,
"Name": "Haughton",
"MaxVelocity": 7,
"LevelingVelocity": 0.5,
"ParkedDistance": 0.2,
"LevelingVelocitySmoothingTime": 1,
"FloorLevelingDistance": 6
} }
]]
return { return {
HaughtonConfig = HaughtonConfig HaughtonConfig = HaughtonConfig

View File

@@ -5,7 +5,7 @@ local ParentDir = script.Parent
local ElevatorsDir = ParentDir.Parent.Parent local ElevatorsDir = ParentDir.Parent.Parent
local MainDir = ElevatorsDir.Parent local MainDir = ElevatorsDir.Parent
local ElevatorSystem = ElevatorsDir:WaitForChild("System") local ElevatorSystem = ElevatorsDir:WaitForChild("Elevator")
local InitElevator = require(ElevatorSystem) local InitElevator = require(ElevatorSystem)
local ArrowLanterns = require(ElevatorSystem:WaitForChild("Lanterns"):WaitForChild("Arrows")) local ArrowLanterns = require(ElevatorSystem:WaitForChild("Lanterns"):WaitForChild("Arrows"))
@@ -31,7 +31,6 @@ type Constructor_Fun = (
ArrowLanternsConstructor: ArrowLanterns.constructor, ArrowLanternsConstructor: ArrowLanterns.constructor,
ButtonsConstructor: Buttons.constructor, ButtonsConstructor: Buttons.constructor,
ElevatorBoxModel: BasePart, ElevatorBoxModel: BasePart,
Leveling: {number},
MovingObjectsConstructor: MovingObjects.constructor, MovingObjectsConstructor: MovingObjects.constructor,
TractionRopesConstructor: TractionRopes.constructor TractionRopesConstructor: TractionRopes.constructor
) -> ClassConstructor ) -> ClassConstructor
@@ -43,7 +42,6 @@ type Constructor_Return_Props = {
ArrowLanternsConstructor: ArrowLanterns.constructor, ArrowLanternsConstructor: ArrowLanterns.constructor,
ButtonsConstructor: Buttons.constructor, ButtonsConstructor: Buttons.constructor,
ElevatorBoxModel: BasePart, ElevatorBoxModel: BasePart,
Leveling: {number},
MovingObjectsConstructor: MovingObjects.constructor, MovingObjectsConstructor: MovingObjects.constructor,
TractionRopesConstructor: TractionRopes.constructor TractionRopesConstructor: TractionRopes.constructor
} }
@@ -58,7 +56,6 @@ function Events.constructor(
ArrowLanternsConstructor, ArrowLanternsConstructor,
ButtonsConstructor, ButtonsConstructor,
ElevatorBoxModel, ElevatorBoxModel,
Leveling,
MovingObjectsConstructor, MovingObjectsConstructor,
TractionRopesConstructor TractionRopesConstructor
) )
@@ -69,7 +66,6 @@ function Events.constructor(
ArrowLanternsConstructor = ArrowLanternsConstructor, ArrowLanternsConstructor = ArrowLanternsConstructor,
ButtonsConstructor = ButtonsConstructor, ButtonsConstructor = ButtonsConstructor,
ElevatorBoxModel = ElevatorBoxModel, ElevatorBoxModel = ElevatorBoxModel,
Leveling = Leveling,
MovingObjectsConstructor = MovingObjectsConstructor, MovingObjectsConstructor = MovingObjectsConstructor,
TractionRopesConstructor = TractionRopesConstructor TractionRopesConstructor = TractionRopesConstructor
}, Events) }, Events)

View File

@@ -1,13 +0,0 @@
--!optimize 2
--!strict
return {
[1] = 1.163, --Basement
[2] = 19.163,
[3] = 36.053,
[4] = 53.005,
[5] = 69.977,
[6] = 86.948,
[7] = 103.913,
[8] = 120.891,
}

View File

@@ -5,7 +5,7 @@ local ParentDir = script.Parent
local ElevatorsDir = ParentDir.Parent local ElevatorsDir = ParentDir.Parent
local MainDir = ElevatorsDir.Parent.Parent local MainDir = ElevatorsDir.Parent.Parent
local TagsModule = require(MainDir:WaitForChild("Map"):WaitForChild("Load"):WaitForChild("Tags")) local TagsModule = require(MainDir:WaitForChild("Load"):WaitForChild("Tags"))
type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor)) type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor))
type Impl_Constructor = { type Impl_Constructor = {

View File

@@ -7,7 +7,7 @@ local ParentDir = script.Parent
local ElevatorsDir = ParentDir.Parent local ElevatorsDir = ParentDir.Parent
local MainDir = ElevatorsDir.Parent local MainDir = ElevatorsDir.Parent
local ElevatorSystem = ElevatorsDir:WaitForChild("System") local ElevatorSystem = ElevatorsDir:WaitForChild("Elevator")
local ElevatorTypes = require(MainDir:WaitForChild("Types"):WaitForChild("Elevator")) local ElevatorTypes = require(MainDir:WaitForChild("Types"):WaitForChild("Elevator"))
local InitElevator = require(ElevatorSystem) local InitElevator = require(ElevatorSystem)
@@ -16,9 +16,8 @@ local Buttons = require(ElevatorSystem:WaitForChild("Buttons"))
local TractionRopes = require(ElevatorSystem:WaitForChild("TractionRopes")) local TractionRopes = require(ElevatorSystem:WaitForChild("TractionRopes"))
local Doors = require(ElevatorSystem:WaitForChild("Doors")) local Doors = require(ElevatorSystem:WaitForChild("Doors"))
local Events = require(script:WaitForChild("Events")) local Events = require(script:WaitForChild("Events"))
local Leveling = require(script:WaitForChild("Leveling"))
local MovingObjects = require(script:WaitForChild("MovingObjects")) local MovingObjects = require(script:WaitForChild("MovingObjects"))
local TagsModule = require(MainDir:WaitForChild("Map"):WaitForChild("Load"):WaitForChild("Tags")) local TagsModule = require(MainDir:WaitForChild("Load"):WaitForChild("Tags"))
return function( return function(
Config: ElevatorTypes.ElevatorConfigurationTable, Config: ElevatorTypes.ElevatorConfigurationTable,
@@ -31,36 +30,35 @@ return function(
local CabRopesObject = TagsConstructor:Request(`{Config.Name}_Rope_Cab`) :: BasePart local CabRopesObject = TagsConstructor:Request(`{Config.Name}_Rope_Cab`) :: BasePart
local ElevatorBoxModel = ElevatorModel:WaitForChild("Mover") :: BasePart local ElevatorBoxModel = ElevatorModel:WaitForChild("Mover") :: BasePart
local Elevator = InitElevator.constructor(ElevatorBoxModel, Config, Leveling) local Elevator = InitElevator.constructor(ElevatorBoxModel, Config)
local MovingObjectsConstructor = MovingObjects.constructor(TagsConstructor) local MovingObjectsConstructor = MovingObjects.constructor(TagsConstructor)
local ButtonsConstructor = Buttons.constructor(Config.Name, ButtonTags, Elevator.Attributes.CurrentFloor) local ButtonsConstructor = Buttons.constructor(Config.Name, ButtonTags, Elevator.Attributes.CurrentFloor)
ButtonsConstructor:InitForElevator(2, ButtonPromptsDistance) ButtonsConstructor:InitForElevator(2, ButtonPromptsDistance)
local ArrowLanternConstructor = ArrowLantern.constructor(LanternTags, Config) local ArrowLanternConstructor = ArrowLantern.constructor(LanternTags, Config)
local DoorsConstructor = Doors.constructor(Leveling, ElevatorBoxModel, Config.Doors, DoorTags) local DoorsConstructor = Doors.constructor(Config, ElevatorBoxModel, DoorTags)
if Config.TravelType == "Traction" then if Config.TravelType == "Traction" then
local PulleyRopesObject = TagsConstructor:Request(`{Config.Name}_Rope_Pulley`) :: BasePart local PulleyRopesObject = TagsConstructor:Request(`{Config.Name}_Rope_Pulley`) :: BasePart
local TractionRopesConstructor = TractionRopes.constructor(CabRopesObject, PulleyRopesObject) local TractionRopesConstructor = TractionRopes.constructor(CabRopesObject, PulleyRopesObject)
TractionRopesConstructor:Update() TractionRopesConstructor:Update()
local EventsConstructor = Events.constructor(
Elevator,
Config,
DoorsConstructor,
ArrowLanternConstructor,
ButtonsConstructor,
ElevatorBoxModel,
MovingObjectsConstructor,
TractionRopesConstructor
)
EventsConstructor:Init()
elseif Config.TravelType == "Hydraulic" then elseif Config.TravelType == "Hydraulic" then
end end
local EventsConstructor = Events.constructor(
Elevator,
Config,
DoorsConstructor,
ArrowLanternConstructor,
ButtonsConstructor,
ElevatorBoxModel,
Leveling,
MovingObjectsConstructor,
TractionRopesConstructor
)
EventsConstructor:Init()
ArrowLanternConstructor:Toggle(true, true) ArrowLanternConstructor:Toggle(true, true)
if DoorsConstructor:OpenAtFloor(Elevator.Attributes.CurrentFloor.Value) then if DoorsConstructor:OpenAtFloor(Elevator.Attributes.CurrentFloor.Value) then

View File

@@ -1,15 +0,0 @@
--!optimize 2
--!strict
return {
[1] = 13.041,
[2] = 37.973,
[3] = 62.978,
[4] = 87.968,
[5] = 112.952,
[6] = 137.988,
[7] = 163.009,
[8] = 188.007,
[9] = 213.058,
[10] = 239.245,
}

View File

@@ -1,33 +0,0 @@
--!optimize 2
--!strict
-- 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}
-- self.MachineRoom.Pulley = TagsConstructor:Request("Otis1960_Pulley") :: UnionOperation
-- self.MachineRoom.Pulley2 = TagsConstructor:Request("Otis1960_Pulley2") :: UnionOperation
-- self.MachineRoom.Governor = TagsConstructor:Request("Otis1960_Governor") :: UnionOperation
-- self.MachineRoom.GovernorFlyballs = TagsConstructor:Request("Otis1960_GovernorFlyballs") :: Part
-- self.MachineRoom.PiePlatePulley = TagsConstructor:Request("Otis1960_PieplatePulley") :: UnionOperation
-- self.MachineRoom.PiePlatePlates = TagsConstructor:Request("Otis1960_PiePlatePlates") :: UnionOperation
-- self.MachineRoom.PiePlateSelector = TagsConstructor:Request("Otis1960_PiePlateSelector") :: UnionOperation
local ParentDir = script.Parent
local ElevatorsDir = ParentDir.Parent
local MainDir = ElevatorsDir.Parent
local StorageService = game:GetService("ReplicatedStorage")
local InitElevator = require(ElevatorsDir:WaitForChild("System"))
local Config = require(script:WaitForChild("Config"))
local Leveling = require(script:WaitForChild("Leveling"))
local Enums = require(StorageService:WaitForChild("Enums"))
local TagsModule = require(MainDir:WaitForChild("Map"):WaitForChild("Load"):WaitForChild("Tags"))
return function(TagsConstructor: TagsModule.TagsConstructor, ButtonTags: TagsModule.ElevatorButtons, LanternTags: TagsModule.Lanterns, LandingDoorTags: TagsModule.LandingTags)
end

View File

@@ -13,6 +13,9 @@ local SoundEnums = require(EnumsDir:WaitForChild("Sounds"))
export type TravelTypes = "Traction" | "Hydraulic" export type TravelTypes = "Traction" | "Hydraulic"
export type DoorSpeeds = "SingleSpeed" | "DoubleSpeed" | "TripleSpeed" export type DoorSpeeds = "SingleSpeed" | "DoubleSpeed" | "TripleSpeed"
export type DoorLocations = "Cab" | "Landing" export type DoorLocations = "Cab" | "Landing"
export type Leveling = {
[number]: number
}
export type ElevatorConfigurationTable = { export type ElevatorConfigurationTable = {
Name: Enums.ElevatorValues, Name: Enums.ElevatorValues,
@@ -36,7 +39,8 @@ export type ElevatorConfigurationTable = {
}, },
Colors: ButtonColors, Colors: ButtonColors,
Lanterns: Lanterns, Lanterns: Lanterns,
Doors: DoorsConfig Doors: DoorsConfig,
Leveling: Leveling
} }
export type LanternProperties = ButtonProperties & {Time: number} export type LanternProperties = ButtonProperties & {Time: number}
export type ButtonProperties = { export type ButtonProperties = {

View File

@@ -49,7 +49,7 @@ local LightSwitchesConstructor = LightSwitches.constructor(Interactables.LightSw
LightSwitchesConstructor:Init() LightSwitchesConstructor:Init()
--Start the elevators --Start the elevators
local Buttons = TagsConstructor:__ElevatorButtons() local Buttons = TagsConstructor:__ElevatorButtons()
print("[DEBUG] Buttons=", Buttons) print("[DEBUG] Buttons=", Buttons)
local Lanterns = TagsConstructor:__ElevatorLanterns() local Lanterns = TagsConstructor:__ElevatorLanterns()
print("[DEBUG] Lanterns=", Lanterns) print("[DEBUG] Lanterns=", Lanterns)