mirror of
https://github.com/unixtensor/Roblox-Elevator-Game.git
synced 2025-12-14 06:41:55 +00:00
Prepare the module for the big rewrite
This commit is contained in:
@@ -23,28 +23,14 @@ local Elevators = script.Parent
|
|||||||
local MainDir = Elevators.Parent
|
local MainDir = Elevators.Parent
|
||||||
local EnumsDir = MainDir:WaitForChild("Enums")
|
local EnumsDir = MainDir:WaitForChild("Enums")
|
||||||
local LoadDir = MainDir:WaitForChild("Load")
|
local LoadDir = MainDir:WaitForChild("Load")
|
||||||
local TagsDir = LoadDir:WaitForChild("Tags")
|
|
||||||
|
|
||||||
local Storage = game:GetService("ReplicatedStorage")
|
local StorageService = game:GetService("ReplicatedStorage")
|
||||||
local RS = game:GetService("RunService")
|
local RunService = game:GetService("RunService")
|
||||||
|
|
||||||
local ButtonTags = require(TagsDir:WaitForChild("Buttons"))
|
local Enums = require(StorageService:WaitForChild("Enums"))
|
||||||
|
|
||||||
local Enums = require(Storage:WaitForChild("Enums"))
|
|
||||||
local SoundEnums = require(EnumsDir:WaitForChild("Sounds"))
|
local SoundEnums = require(EnumsDir:WaitForChild("Sounds"))
|
||||||
|
|
||||||
local LevelingModule = require(script:WaitForChild("Leveling"))
|
local LevelingModule = require(script:WaitForChild("Leveling"))
|
||||||
local Doors = require(script:WaitForChild("Doors"))
|
|
||||||
local MovingObjects = require(script:WaitForChild("MovingObjects"))
|
|
||||||
local RelayAlgorithm = require(script:WaitForChild("RelayAlgorithm"))
|
|
||||||
local Relay = require(script:WaitForChild("Relay"))
|
|
||||||
local PhysicalRelays = require(script:WaitForChild("PhysicalRelay"))
|
|
||||||
|
|
||||||
local HallDisplays = require(Elevators:WaitForChild("HallDisplays"))
|
|
||||||
local ElevatorMover = require(Elevators:WaitForChild("Mover"))
|
|
||||||
local TractionRopes = require(Elevators:WaitForChild("TractionRopes"))
|
|
||||||
local Lanterns = require(Elevators:WaitForChild("Lanterns"))
|
|
||||||
local Buttons = require(Elevators:WaitForChild("ButtonsManager"))
|
|
||||||
|
|
||||||
local Tags = require(LoadDir:WaitForChild("Tags"))
|
local Tags = require(LoadDir:WaitForChild("Tags"))
|
||||||
|
|
||||||
@@ -60,7 +46,7 @@ type Impl_Constructor = {
|
|||||||
__TravelToFloor: (self: ClassConstructor, LevelInt: number, LevelVec3: number, ElevatorGoingUp: boolean) -> (),
|
__TravelToFloor: (self: ClassConstructor, LevelInt: number, LevelVec3: number, ElevatorGoingUp: boolean) -> (),
|
||||||
} & Impl_Static_Props
|
} & Impl_Static_Props
|
||||||
|
|
||||||
type Impl_Static_Props = {
|
type ElevatorConfigurationTable = {
|
||||||
Name: Enums.ElevatorValues,
|
Name: Enums.ElevatorValues,
|
||||||
Responsiveness: number,
|
Responsiveness: number,
|
||||||
MaxVelocity: number,
|
MaxVelocity: number,
|
||||||
@@ -69,10 +55,9 @@ type Impl_Static_Props = {
|
|||||||
ParkedDistance: number,
|
ParkedDistance: number,
|
||||||
LevelingVelocity: number,
|
LevelingVelocity: number,
|
||||||
Phase3LevelingVelocity: number,
|
Phase3LevelingVelocity: number,
|
||||||
|
|
||||||
Sounds: {
|
Sounds: {
|
||||||
LanternChimeDirection: SoundEnums.Otis1960LanternChimeDirection,
|
LanternChimeDirection: SoundEnums.ElevatorSoundValues,
|
||||||
LanternChimeLanding: SoundEnums.Otis1960LanternChimeLanding,
|
LanternChimeLanding: SoundEnums.ElevatorSoundValues,
|
||||||
},
|
},
|
||||||
Colors: {
|
Colors: {
|
||||||
ButtonActivated: Color3,
|
ButtonActivated: Color3,
|
||||||
@@ -80,6 +65,13 @@ type Impl_Static_Props = {
|
|||||||
LanternDisplayOn: Color3,
|
LanternDisplayOn: Color3,
|
||||||
LanternDisplayOff: Color3,
|
LanternDisplayOff: Color3,
|
||||||
},
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
type Impl_Static_Props = {}
|
||||||
|
|
||||||
|
type Constructor_Fun = (ElevatorConfigurationTable: ElevatorConfigurationTable) -> ClassConstructor
|
||||||
|
|
||||||
|
type Constructor_Return_Props = {
|
||||||
Attributes: {
|
Attributes: {
|
||||||
PreviousFloor: IntValue,
|
PreviousFloor: IntValue,
|
||||||
CurrentFloor: IntValue,
|
CurrentFloor: IntValue,
|
||||||
@@ -95,42 +87,7 @@ type Impl_Static_Props = {
|
|||||||
Parked: BindableEvent,
|
Parked: BindableEvent,
|
||||||
Leveling: BindableEvent,
|
Leveling: BindableEvent,
|
||||||
Leveling3Phase: BindableEvent,
|
Leveling3Phase: BindableEvent,
|
||||||
}
|
},
|
||||||
}
|
|
||||||
|
|
||||||
type Constructor_Fun = (
|
|
||||||
TagsConstructor: TagsConstructor,
|
|
||||||
ButtonsTags: Tags.ElevatorButtons,
|
|
||||||
LanternsTags: Tags.Lanterns,
|
|
||||||
LandingDoors: Tags.LandingTags
|
|
||||||
) -> ClassConstructor
|
|
||||||
|
|
||||||
type Constructor_Return_Props = {
|
|
||||||
Tags: Tags,
|
|
||||||
MOConstructor: MovingObjects.MovingObjectsConstructor,
|
|
||||||
LanternsConstructor: Lanterns.LanternsConstructor,
|
|
||||||
HallDisplaysConstructor: HallDisplays.HallDisplaysConstructor,
|
|
||||||
ElevatorBox_1960: UnionOperation,
|
|
||||||
ElevatorDoor1: BasePart,
|
|
||||||
ElevatorDoor2: BasePart,
|
|
||||||
ElevatorDoorSensor: Folder,
|
|
||||||
BoxAttachment: Attachment,
|
|
||||||
BoxAlignPosition: AlignPosition,
|
|
||||||
BoxAlignOrientation: AlignOrientation,
|
|
||||||
ElevatorDoorsConstructor: Doors.DoorConstructor,
|
|
||||||
Ropes: {Instance},
|
|
||||||
TractionRopesConstructor: TractionRopes.TractionRopesConstructor,
|
|
||||||
Pulley: UnionOperation,
|
|
||||||
Pulley2: UnionOperation,
|
|
||||||
Governor: UnionOperation,
|
|
||||||
GovernorFlyballs: Part,
|
|
||||||
PieplatePulley: UnionOperation,
|
|
||||||
MachineRoom: MovingObjects.MachineRoom,
|
|
||||||
HallDisplays: {Instance},
|
|
||||||
ButtonsConstructor: Buttons.ButtonsConstructor,
|
|
||||||
RelayAlgorithmConstructor: RelayAlgorithm.RelayAlgorithmConstructor,
|
|
||||||
RelayConstructor: Relay.RelayConstructor,
|
|
||||||
PhysicalRelays: PhysicalRelays.PhysicalRelayConstructor,
|
|
||||||
|
|
||||||
__Connections: {
|
__Connections: {
|
||||||
Moving: RBXScriptConnection?,
|
Moving: RBXScriptConnection?,
|
||||||
@@ -140,61 +97,13 @@ type Constructor_Return_Props = {
|
|||||||
local Elevator = {} :: Impl_Constructor
|
local Elevator = {} :: Impl_Constructor
|
||||||
Elevator.__index = Elevator
|
Elevator.__index = Elevator
|
||||||
|
|
||||||
Elevator.Name = Enums.Elevator.Otis1960
|
|
||||||
Elevator.FloorLevelingDistance = 4
|
|
||||||
Elevator.FloorLeveling3PhaseDistance = 1.5
|
|
||||||
Elevator.ParkedDistance = 0.2
|
|
||||||
Elevator.Responsiveness = 20
|
|
||||||
Elevator.MaxVelocity = 7
|
|
||||||
Elevator.LevelingVelocity = 2
|
|
||||||
Elevator.Phase3LevelingVelocity = .5
|
|
||||||
|
|
||||||
Elevator.Sounds = {
|
|
||||||
LanternChimeDirection = SoundEnums.Otis1960.LanternChimeDirection,
|
|
||||||
LanternChimeLanding = SoundEnums.Otis1960.LanternChimeLanding
|
|
||||||
}
|
|
||||||
|
|
||||||
Elevator.Colors = {
|
|
||||||
ButtonActivated = Color3.fromRGB(180,0,0),
|
|
||||||
ButtonDeactivated = Color3.fromRGB(139,139,139),
|
|
||||||
LanternDisplayOn = Color3.fromRGB(255,114,71),
|
|
||||||
LanternDisplayOff = Color3.fromRGB(55,55,55),
|
|
||||||
}
|
|
||||||
|
|
||||||
Elevator.Events = {
|
|
||||||
CabProgression = Instance.new("BindableEvent") :: BindableEvent,
|
|
||||||
CabTraveling = Instance.new("BindableEvent") :: BindableEvent,
|
|
||||||
Parked = Instance.new("BindableEvent") :: BindableEvent,
|
|
||||||
Leveling = Instance.new("BindableEvent") :: BindableEvent,
|
|
||||||
Leveling3Phase = Instance.new("BindableEvent") :: BindableEvent,
|
|
||||||
}
|
|
||||||
|
|
||||||
Elevator.Attributes = {
|
|
||||||
PreviousFloor = Instance.new("IntValue") :: IntValue,
|
|
||||||
CurrentFloor = Instance.new("IntValue") :: IntValue,
|
|
||||||
NextFloor = Instance.new("IntValue") :: IntValue,
|
|
||||||
Moving = Instance.new("BoolValue") :: BoolValue,
|
|
||||||
GoingUp = Instance.new("BoolValue") :: BoolValue,
|
|
||||||
Stopped = Instance.new("BoolValue") :: BoolValue,
|
|
||||||
Goal = Instance.new("IntValue") :: IntValue,
|
|
||||||
}
|
|
||||||
|
|
||||||
Elevator.Attributes.CurrentFloor.Value = 1
|
|
||||||
Elevator.Attributes.NextFloor.Value = Elevator.Attributes.CurrentFloor.Value+1
|
|
||||||
Elevator.Attributes.Moving.Value = false
|
|
||||||
Elevator.Attributes.GoingUp.Value = false
|
|
||||||
Elevator.Attributes.Goal.Value = 1
|
|
||||||
|
|
||||||
local Attributes = Elevator.Attributes
|
|
||||||
local Events = Elevator.Events
|
|
||||||
|
|
||||||
local function ElevatorGoingUpDirection(CurrentFloor: number, RequestedFloor: number): boolean
|
local function ElevatorGoingUpDirection(CurrentFloor: number, RequestedFloor: number): boolean
|
||||||
-- -(CurrentFloor-RequestedFloor)>0
|
-- -(CurrentFloor-RequestedFloor)>0
|
||||||
-- -CurrentFloor+RequestedFloor>0
|
-- -CurrentFloor+RequestedFloor>0
|
||||||
return CurrentFloor<RequestedFloor
|
return CurrentFloor<RequestedFloor
|
||||||
end
|
end
|
||||||
|
|
||||||
function Elevator.constructor(TagsConstructor, ButtonsTags, LanternsTags, LandingDoors)
|
function Elevator.constructor(ElevatorConfigurationTable: ElevatorConfigurationTable)
|
||||||
local self = {} :: Constructor_Return_Props
|
local self = {} :: Constructor_Return_Props
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,14 @@ export type Otis1960BigRelayDeActivated = "rbxassetid://17701712012"
|
|||||||
|
|
||||||
export type Otis1960SoundValues = Otis1960LanternChimeDirection |
|
export type Otis1960SoundValues = Otis1960LanternChimeDirection |
|
||||||
Otis1960LanternChimeLanding |
|
Otis1960LanternChimeLanding |
|
||||||
Otis1960DoorClosingClick
|
Otis1960DoorClosingClick |
|
||||||
|
Otis1960RelayHighActivated |
|
||||||
|
Otis1960RelayLowActivated |
|
||||||
|
Otis1960RelayDeActivated |
|
||||||
|
Otis1960BigRelayActivated |
|
||||||
|
Otis1960BigRelayDeActivated
|
||||||
|
|
||||||
|
export type ElevatorSoundValues = Otis1960SoundValues
|
||||||
|
|
||||||
SoundEnums.Otis1960 = {
|
SoundEnums.Otis1960 = {
|
||||||
LanternChimeDirection = "rbxassetid://16990287228" :: Otis1960LanternChimeDirection,
|
LanternChimeDirection = "rbxassetid://16990287228" :: Otis1960LanternChimeDirection,
|
||||||
@@ -30,4 +37,4 @@ SoundEnums.Otis1960 = {
|
|||||||
BigRelayDeActivated = "rbxassetid://17701712012" :: Otis1960BigRelayDeActivated,
|
BigRelayDeActivated = "rbxassetid://17701712012" :: Otis1960BigRelayDeActivated,
|
||||||
}
|
}
|
||||||
|
|
||||||
return SoundEnums
|
return SoundEnums
|
||||||
|
|||||||
Reference in New Issue
Block a user