mirror of
https://github.com/unixtensor/Roblox-Elevator-Game.git
synced 2025-12-13 22:31:55 +00:00
Working car button system, need to figure out some phantom data on the relay algorithm events for hall station buttons to recognize and pick up the heading direction
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
# Lights
|
||||
#### Properties
|
||||
## Lights
|
||||
##### Properties / Attributes
|
||||
- Activated #Color3
|
||||
- The color that is shown on the <a>Light Props</a> once
|
||||
- ActivatedMaterial #string / #MaterialName
|
||||
- ActivatedMaterial #string
|
||||
- Deactivated #Color3
|
||||
- DeactivatedMaterial #string / #MaterialName
|
||||
- DeactivatedMaterial #string
|
||||
- Enabled #boolean
|
||||
#### Tag
|
||||
* `Interact_LightSwitch_*AreaName*`
|
||||
* `Interact` - *Interact Initializer* [`Not Changable`]
|
||||
##### Tag
|
||||
* ### Interact_LightSwitch_Area
|
||||
* `Interact` - *Interact Initialize* [`Not Changable`]
|
||||
* `LightSwitch` - *Interaction Type* [`Not Changable`]
|
||||
* `*AreaName*` - *Area name, must be unique and cannot use the same names* [`Changable`]
|
||||
|
||||
* `AreaName` - *Area name, must be unique and cannot use the same names* [`Changable`]
|
||||
## Elevator
|
||||
* ##### Cab
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -13,7 +13,7 @@ local Map = Main:WaitForChild("Map")
|
||||
local PromptModule = require(Map:WaitForChild("Prompts"))
|
||||
local Tags = require(Map:WaitForChild("Load"):WaitForChild("Tags"))
|
||||
|
||||
type FloorButtonActivatedCallback = (ButtonFloor: number | string) -> ()
|
||||
type FloorButtonActivatedCallback = (ButtonFloor: number) -> ()
|
||||
type StopButtonActivatedCallback = (Toggled: boolean) -> ()
|
||||
|
||||
type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor))
|
||||
|
||||
@@ -20,7 +20,8 @@ type Impl_Constructor = {
|
||||
__index: Impl_Constructor,
|
||||
constructor: Constructor_Fun,
|
||||
--Class functions
|
||||
InitForElevator: (self: ClassConstructor, MaxActivationDistance: number?, AddedOffset: Vector3?) -> ()
|
||||
InitForElevator: (self: ClassConstructor, MaxActivationDistance: number?, AddedOffset: Vector3?) -> (),
|
||||
Get: (self: ClassConstructor, ButtonType: Enums.ButtonTreeValues, ButtonID: number) -> Tags.ButtonProperties?
|
||||
}
|
||||
|
||||
type Constructor_Fun = (
|
||||
@@ -33,21 +34,24 @@ type Constructor_Return_Props = {
|
||||
ElevatorModel: Enums.ElevatorValues,
|
||||
ButtonTags: Tags.ElevatorButtons,
|
||||
CurrentFloor: IntValue,
|
||||
Events: Events
|
||||
Events: Events,
|
||||
__PromptButtons__: Tags.ButtonsTree?
|
||||
}
|
||||
|
||||
export type Events = {
|
||||
FloorButtonActivated: RBXScriptSignal<boolean, number | string, Tags.ButtonPropertiesSafe>,
|
||||
FloorButtonActivated: RBXScriptSignal<boolean, number, Tags.ButtonProperties>,
|
||||
__eventInstances__: {
|
||||
FloorButtonActivated: BindableEvent
|
||||
}
|
||||
}
|
||||
|
||||
export type constructor = ClassConstructor
|
||||
|
||||
local Buttons = {} :: Impl_Constructor
|
||||
Buttons.__index = Buttons
|
||||
|
||||
function Buttons.constructor(ElevatorModel, ButtonTags, CurrentFloor)
|
||||
local ButtonActivated = Instance.new("BindableEvent")
|
||||
local ButtonActivated = Instance.new("BindableEvent") :: BindableEvent
|
||||
|
||||
return setmetatable({
|
||||
ElevatorModel = ElevatorModel,
|
||||
@@ -69,24 +73,36 @@ function Buttons:InitForElevator(MaxActivationDistance, AddedOffset)
|
||||
|
||||
local ButtonManagerConstructor = ButtonManager.constructor(self.CurrentFloor)
|
||||
local ButtonTagsConstructor = ButtonTags.constructor(self.ButtonTags, self.ElevatorModel)
|
||||
local Prompt = ButtonTagsConstructor:CreatePromptButtons()
|
||||
|
||||
local CarButtonPrompts = Prompt[self.ElevatorModel].Car
|
||||
self.__PromptButtons__ = ButtonTagsConstructor:CreatePromptButtons()
|
||||
|
||||
local CarButtonPrompts = (self.__PromptButtons__ :: Tags.ButtonsTree)[self.ElevatorModel].Car
|
||||
|
||||
for PromptType, PromptProperties in CarButtonPrompts do
|
||||
if PromptProperties.Attachment and PromptProperties.Inst and PromptProperties.Prompt then
|
||||
PromptProperties.Prompt.MaxActivationDistance = MaxActivationDistance :: number
|
||||
PromptProperties.Attachment.Position+=AddedOffset :: Vector3
|
||||
PromptProperties.Prompt.MaxActivationDistance = MaxActivationDistance :: number
|
||||
PromptProperties.Attachment.Position+=AddedOffset :: Vector3
|
||||
|
||||
ButtonManagerConstructor:CarButton(PromptType, PromptProperties, function(ButtonFloor: number | string)
|
||||
self.Events.__eventInstances__.FloorButtonActivated:Fire(true, ButtonFloor, PromptProperties :: Tags.ButtonPropertiesSafe)
|
||||
end, function(ButtonFloor: number | string)
|
||||
self.Events.__eventInstances__.FloorButtonActivated:Fire(false, ButtonFloor, PromptProperties :: Tags.ButtonPropertiesSafe)
|
||||
end)
|
||||
else
|
||||
warn()
|
||||
end
|
||||
ButtonManagerConstructor:CarButton(PromptType, PromptProperties, function(ButtonFloor: number)
|
||||
self.Events.__eventInstances__.FloorButtonActivated:Fire(true, ButtonFloor, PromptProperties)
|
||||
end, function(ButtonFloor: number)
|
||||
self.Events.__eventInstances__.FloorButtonActivated:Fire(false, ButtonFloor, PromptProperties)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function Buttons:Get(ButtonType, ButtonName)
|
||||
assert(self.__PromptButtons__, `Initialize the elevator buttons first before using :Get, self.__PromptButtons__={self.__PromptButtons__}`)
|
||||
|
||||
local Button = self.__PromptButtons__[self.ElevatorModel][ButtonType] :: Tags.ButtonDictionary?
|
||||
if Button then
|
||||
--mega cringe
|
||||
for ButtonFullName: string, ButtonProps: Tags.ButtonProperties in Button do
|
||||
if ButtonProps.ID == ButtonName then
|
||||
return ButtonProps
|
||||
end
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
return Buttons
|
||||
48
src/server/main/Elevators/Map/Haughton/Doors.luau
Normal file
48
src/server/main/Elevators/Map/Haughton/Doors.luau
Normal file
@@ -0,0 +1,48 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local ParentDir = script.Parent
|
||||
local ElevatorsDir = ParentDir.Parent.Parent
|
||||
local MainDir = ElevatorsDir.Parent
|
||||
|
||||
local DoorEnums = require(MainDir:WaitForChild("Types"):WaitForChild("Enums"):WaitForChild("Doors"))
|
||||
|
||||
type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor))
|
||||
type Impl_Constructor = {
|
||||
__index: Impl_Constructor,
|
||||
constructor: Constructor_Fun,
|
||||
--Class functions
|
||||
}
|
||||
|
||||
type LandingDoorsTree = {
|
||||
[number]: {BasePart}
|
||||
}
|
||||
type CabDoorsTree = {
|
||||
[number]: {BasePart}
|
||||
}
|
||||
|
||||
type Constructor_Fun = (
|
||||
|
||||
) -> ClassConstructor
|
||||
|
||||
type Constructor_Return_Props = {
|
||||
|
||||
}
|
||||
|
||||
local Doors = {}
|
||||
Doors.__index = Doors
|
||||
|
||||
function Doors.constructor(CabDoorsType, LandingDoorsType, LandingDoorsTree, CabDoorsTree)
|
||||
return setmetatable({}, Doors)
|
||||
end
|
||||
|
||||
function Doors:Open()
|
||||
|
||||
end
|
||||
|
||||
function Doors:Close()
|
||||
|
||||
end
|
||||
|
||||
return Doors
|
||||
@@ -1,131 +0,0 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local ParentDir = script.Parent
|
||||
local ElevatorsDir = ParentDir.Parent.Parent
|
||||
local MainDir = ElevatorsDir.Parent
|
||||
|
||||
local StorageService = game:GetService("ReplicatedStorage")
|
||||
|
||||
local Enums = require(StorageService:WaitForChild("Enums"))
|
||||
local InitElevator = require(ElevatorsDir:WaitForChild("System"))
|
||||
local Buttons = require(ParentDir:WaitForChild("Buttons"))
|
||||
local MovingObjects = require(ParentDir:WaitForChild("MovingObjects"))
|
||||
local TagsModule = require(MainDir:WaitForChild("Map"):WaitForChild("Load"):WaitForChild("Tags"))
|
||||
local ElevatorTypes = require(MainDir:WaitForChild("Types"):WaitForChild("Elevator"))
|
||||
|
||||
type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor))
|
||||
|
||||
type Impl_Constructor = {
|
||||
__index: Impl_Constructor,
|
||||
constructor: Constructor_Fun,
|
||||
--Class functions
|
||||
Elevator: (self: ClassConstructor) -> (),
|
||||
Buttons: (self: ClassConstructor) -> ()
|
||||
}
|
||||
|
||||
type Constructor_Fun = (
|
||||
InitElevatorConstructor: InitElevator.constructor,
|
||||
ElevatorConfig: ElevatorTypes.ElevatorConfigurationTable,
|
||||
ElevatorEvents: InitElevator.Events,
|
||||
ElevatorAttributes: InitElevator.Attributes,
|
||||
ButtonEvents: Buttons.Events,
|
||||
ElevatorBoxModel: BasePart,
|
||||
Leveling: {number},
|
||||
MovingObjectsConstructor: MovingObjects.constructor
|
||||
) -> ClassConstructor
|
||||
|
||||
type Constructor_Return_Props = {
|
||||
InitElevatorConstructor: InitElevator.constructor,
|
||||
ElevatorConfig: ElevatorTypes.ElevatorConfigurationTable,
|
||||
ElevatorEvents: InitElevator.Events,
|
||||
ElevatorAttributes: InitElevator.Attributes,
|
||||
ButtonEvents: Buttons.Events,
|
||||
ElevatorBoxModel: BasePart,
|
||||
Leveling: {number},
|
||||
MovingObjectsConstructor: MovingObjects.constructor
|
||||
}
|
||||
|
||||
local Events = {} :: Impl_Constructor
|
||||
Events.__index = Events
|
||||
|
||||
function Events.constructor(InitElevatorConstructor, ElevatorConfig, ElevatorEvents, ElevatorAttributes, ButtonEvents, ElevatorBoxModel, Leveling, MovingObjectsConstructor)
|
||||
return setmetatable({
|
||||
InitElevatorConstructor = InitElevatorConstructor,
|
||||
ElevatorConfig = ElevatorConfig,
|
||||
ElevatorEvents = ElevatorEvents,
|
||||
ElevatorAttributes = ElevatorAttributes,
|
||||
ButtonEvents = ButtonEvents,
|
||||
ElevatorBoxModel = ElevatorBoxModel,
|
||||
Leveling = Leveling,
|
||||
MovingObjectsConstructor = MovingObjectsConstructor
|
||||
}, Events)
|
||||
end
|
||||
|
||||
function Events:Elevator()
|
||||
self.ElevatorEvents.Traveling:Connect(function(_DeltaTime: number, CabPosition: Vector3)
|
||||
local CabVelocity = self.ElevatorBoxModel:GetVelocityAtPosition(CabPosition)
|
||||
local TravelingUpwards = self.ElevatorAttributes.TravelingUpwards.Value
|
||||
|
||||
self.MovingObjectsConstructor:RotatePulleyWheel(TravelingUpwards, CabVelocity.Y)
|
||||
self.MovingObjectsConstructor:RotateRotodials(CabVelocity.Y)
|
||||
end)
|
||||
self.ElevatorEvents.Progression:Connect(function(previousFloor: number, CurrentFloor: number, NextFloor: number)
|
||||
|
||||
end)
|
||||
self.ElevatorEvents.Leveling:Connect(function()
|
||||
self.MovingObjectsConstructor:RotateRelayCogs2Async()
|
||||
end)
|
||||
self.ElevatorEvents.Leveling3Phase:Connect(function()
|
||||
|
||||
end)
|
||||
self.ElevatorEvents.ManualTravelRequested:Connect(function()
|
||||
self.MovingObjectsConstructor:ControllerStartAsync()
|
||||
task.wait(1)
|
||||
self.MovingObjectsConstructor:RotateRelayCogs1Async().Completed:Wait()
|
||||
self.InitElevatorConstructor:StartTraveling()
|
||||
end)
|
||||
self.ElevatorEvents.TravelStart:Connect(function()
|
||||
|
||||
end)
|
||||
self.ElevatorEvents.Parked:Connect(function()
|
||||
self.MovingObjectsConstructor:RotateRelayCogs3()
|
||||
end)
|
||||
end
|
||||
|
||||
local function ElevatorGoingUpDirection(CurrentFloor: number, RequestedFloor: number): boolean
|
||||
return CurrentFloor<RequestedFloor
|
||||
end
|
||||
|
||||
function Events:Buttons()
|
||||
self.ButtonEvents.FloorButtonActivated:Connect(function(Success: boolean, Floor: number | string, Properties: TagsModule.ButtonPropertiesSafe)
|
||||
Properties.Prompt.Enabled = false
|
||||
(Properties.Inst :: BasePart).Color = self.ElevatorConfig.Colors.ButtonActivated.Color;
|
||||
(Properties.Inst :: BasePart).Material = self.ElevatorConfig.Colors.ButtonActivated.Material
|
||||
|
||||
if Success then
|
||||
local CorrectFloor: number = 0
|
||||
if type(Floor) == "string" then
|
||||
if Floor == "B" then
|
||||
CorrectFloor = 1
|
||||
end
|
||||
else
|
||||
-- CorrectFloor = Floor~=#self.Leveling and Floor+1 or Floor
|
||||
CorrectFloor = Floor
|
||||
end
|
||||
if CorrectFloor ~= 0 then
|
||||
local Direction = ElevatorGoingUpDirection(self.ElevatorAttributes.CurrentFloor.Value, CorrectFloor) and Enums.ElevatorCallDirection.Up or Enums.ElevatorCallDirection.Down
|
||||
task.spawn(function()
|
||||
self.InitElevatorConstructor:RequestLevelAsync(CorrectFloor, Direction :: Enums.ElevatorCallDirectionValues)
|
||||
end)
|
||||
else
|
||||
warn(`[{self.ElevatorConfig.Name}]: The floor index was 0. Call={Floor}`)
|
||||
end
|
||||
else
|
||||
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
return Events
|
||||
93
src/server/main/Elevators/Map/Haughton/Events/Buttons.luau
Normal file
93
src/server/main/Elevators/Map/Haughton/Events/Buttons.luau
Normal file
@@ -0,0 +1,93 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local ParentDir = script.Parent
|
||||
local ElevatorDir = ParentDir.Parent
|
||||
local ElevatorsDir = ElevatorDir.Parent.Parent
|
||||
local MainDir = ElevatorsDir.Parent
|
||||
|
||||
local StorageService = game:GetService("ReplicatedStorage")
|
||||
|
||||
local Enums = require(StorageService:WaitForChild("Enums"))
|
||||
local InitElevator = require(ElevatorsDir:WaitForChild("System"))
|
||||
local Buttons = require(ElevatorDir:WaitForChild("Buttons"))
|
||||
local TagsModule = require(MainDir:WaitForChild("Map"):WaitForChild("Load"):WaitForChild("Tags"))
|
||||
local ElevatorTypes = require(MainDir:WaitForChild("Types"):WaitForChild("Elevator"))
|
||||
|
||||
type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor))
|
||||
type Impl_Constructor = {
|
||||
__index: Impl_Constructor,
|
||||
constructor: Constructor_Fun,
|
||||
--Class functions
|
||||
Events: (self: ClassConstructor) -> ()
|
||||
}
|
||||
|
||||
type Constructor_Fun = (ElevatorConfig: ElevatorTypes.ElevatorConfigurationTable, ElevatorConstructor: InitElevator.constructor, ButtonsConstructor: Buttons.constructor) -> ClassConstructor
|
||||
|
||||
type Constructor_Return_Props = {
|
||||
ElevatorConfig: ElevatorTypes.ElevatorConfigurationTable,
|
||||
ElevatorConstructor: InitElevator.constructor,
|
||||
ButtonsConstructor: Buttons.constructor
|
||||
}
|
||||
|
||||
local ButtonEvents = {} :: Impl_Constructor
|
||||
ButtonEvents.__index = ButtonEvents
|
||||
|
||||
function ButtonEvents.constructor(ElevatorConfig, ElevatorConstructor, ButtonsConstructor)
|
||||
return setmetatable({
|
||||
ElevatorConfig = ElevatorConfig,
|
||||
ElevatorConstructor = ElevatorConstructor,
|
||||
ButtonsConstructor = ButtonsConstructor
|
||||
}, ButtonEvents)
|
||||
end
|
||||
|
||||
local function ElevatorGoingUpDirection(CurrentFloor: number, RequestedFloor: number): boolean
|
||||
return CurrentFloor<RequestedFloor
|
||||
end
|
||||
|
||||
local function DeactivateButton(self: ClassConstructor, Properties: TagsModule.ButtonProperties)
|
||||
(Properties.Inst :: BasePart).Color = self.ElevatorConfig.Colors.ButtonDeactivated.Color;
|
||||
(Properties.Inst :: BasePart).Material = self.ElevatorConfig.Colors.ButtonDeactivated.Material
|
||||
Properties.Prompt.Enabled = true
|
||||
end
|
||||
|
||||
local function ActivateButton(self: ClassConstructor, Properties: TagsModule.ButtonProperties)
|
||||
Properties.Prompt.Enabled = false
|
||||
(Properties.Inst :: BasePart).Color = self.ElevatorConfig.Colors.ButtonActivated.Color;
|
||||
(Properties.Inst :: BasePart).Material = self.ElevatorConfig.Colors.ButtonActivated.Material
|
||||
end
|
||||
|
||||
local function ButtonAttributes(self: ClassConstructor)
|
||||
self.ElevatorConstructor.Attributes.CurrentFloor:GetPropertyChangedSignal("Value"):Connect(function()
|
||||
if self.ElevatorConstructor.Attributes.CurrentFloor.Value == self.ElevatorConstructor.Attributes.Goal.Value then
|
||||
local FloorButton = self.ButtonsConstructor:Get(Enums.ButtonTree.Car, self.ElevatorConstructor.Attributes.CurrentFloor.Value)
|
||||
if FloorButton then
|
||||
DeactivateButton(self, FloorButton)
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function ButtonEvents:Events()
|
||||
self.ElevatorConstructor.RelayAlgorithm.Events.Added:Connect(function(_Direction: Enums.ElevatorCallDirectionValues, AddedFloor: number)
|
||||
local FloorButton = self.ButtonsConstructor:Get(Enums.ButtonTree.Car, AddedFloor)
|
||||
if FloorButton then
|
||||
ActivateButton(self, FloorButton)
|
||||
end
|
||||
end)
|
||||
self.ButtonsConstructor.Events.FloorButtonActivated:Connect(function(Success: boolean, Floor: number, Properties: TagsModule.ButtonProperties)
|
||||
if Success then
|
||||
local Direction = ElevatorGoingUpDirection(self.ElevatorConstructor.Attributes.CurrentFloor.Value, Floor) and Enums.ElevatorCallDirection.Up or Enums.ElevatorCallDirection.Down
|
||||
self.ElevatorConstructor:RequestLevelAsync(Floor, Direction :: Enums.ElevatorCallDirectionValues)
|
||||
else
|
||||
ActivateButton(self, Properties)
|
||||
task.wait(.45)
|
||||
DeactivateButton(self, Properties)
|
||||
end
|
||||
end)
|
||||
|
||||
ButtonAttributes(self)
|
||||
end
|
||||
|
||||
return ButtonEvents
|
||||
106
src/server/main/Elevators/Map/Haughton/Events/init.luau
Normal file
106
src/server/main/Elevators/Map/Haughton/Events/init.luau
Normal file
@@ -0,0 +1,106 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local ParentDir = script.Parent
|
||||
local ElevatorsDir = ParentDir.Parent.Parent
|
||||
local MainDir = ElevatorsDir.Parent
|
||||
|
||||
local ButtonEvents = require(script:WaitForChild("Buttons"))
|
||||
local InitElevator = require(ElevatorsDir:WaitForChild("System"))
|
||||
local Buttons = require(ParentDir:WaitForChild("Buttons"))
|
||||
local MovingObjects = require(ParentDir:WaitForChild("MovingObjects"))
|
||||
local TractionRopes = require(ParentDir:WaitForChild("TractionRopes"))
|
||||
local ElevatorTypes = require(MainDir:WaitForChild("Types"):WaitForChild("Elevator"))
|
||||
|
||||
type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor))
|
||||
type Impl_Constructor = {
|
||||
__index: Impl_Constructor,
|
||||
constructor: Constructor_Fun,
|
||||
--Class functions
|
||||
InitButtons: (self: ClassConstructor) -> ()
|
||||
}
|
||||
|
||||
type Constructor_Fun = (
|
||||
ElevatorConstructor: InitElevator.constructor,
|
||||
ElevatorConfig: ElevatorTypes.ElevatorConfigurationTable,
|
||||
ButtonsConstructor: Buttons.constructor,
|
||||
ElevatorBoxModel: BasePart,
|
||||
Leveling: {number},
|
||||
MovingObjectsConstructor: MovingObjects.constructor,
|
||||
TractionRopesConstructor: TractionRopes.constructor
|
||||
) -> ClassConstructor
|
||||
|
||||
type Constructor_Return_Props = {
|
||||
ElevatorConstructor: InitElevator.constructor,
|
||||
ElevatorConfig: ElevatorTypes.ElevatorConfigurationTable,
|
||||
ButtonsConstructor: Buttons.constructor,
|
||||
ElevatorBoxModel: BasePart,
|
||||
Leveling: {number},
|
||||
MovingObjectsConstructor: MovingObjects.constructor,
|
||||
TractionRopesConstructor: TractionRopes.constructor
|
||||
}
|
||||
|
||||
local Events = {} :: Impl_Constructor
|
||||
Events.__index = Events
|
||||
|
||||
function Events.constructor(
|
||||
ElevatorConstructor,
|
||||
ElevatorConfig,
|
||||
ButtonsConstructor,
|
||||
ElevatorBoxModel,
|
||||
Leveling,
|
||||
MovingObjectsConstructor,
|
||||
TractionRopesConstructor
|
||||
)
|
||||
return setmetatable({
|
||||
ElevatorConstructor = ElevatorConstructor,
|
||||
ElevatorConfig = ElevatorConfig,
|
||||
ButtonsConstructor = ButtonsConstructor,
|
||||
ElevatorBoxModel = ElevatorBoxModel,
|
||||
Leveling = Leveling,
|
||||
MovingObjectsConstructor = MovingObjectsConstructor,
|
||||
TractionRopesConstructor = TractionRopesConstructor
|
||||
}, Events)
|
||||
end
|
||||
|
||||
local function ElevatorEvents(self: ClassConstructor)
|
||||
self.ElevatorConstructor.Events.Traveling:Connect(function(_DeltaTime: number, CabPosition: Vector3)
|
||||
local CabVelocity = self.ElevatorBoxModel:GetVelocityAtPosition(CabPosition)
|
||||
local TravelingUpwards = self.ElevatorConstructor.Attributes.TravelingUpwards.Value
|
||||
|
||||
self.TractionRopesConstructor:Update()
|
||||
self.MovingObjectsConstructor:RotatePulleyWheel(TravelingUpwards, CabVelocity.Y)
|
||||
self.MovingObjectsConstructor:RotateRotodials(CabVelocity.Y)
|
||||
end)
|
||||
-- self.ElevatorConstructor.Events.Progression:Connect(function(previousFloor: number, CurrentFloor: number, NextFloor: number)
|
||||
|
||||
-- end)
|
||||
self.ElevatorConstructor.Events.Leveling:Connect(function()
|
||||
self.MovingObjectsConstructor:RotateRelayCogs2Async()
|
||||
end)
|
||||
-- self.ElevatorConstructor.Events.Leveling3Phase:Connect(function()
|
||||
|
||||
-- end)
|
||||
self.ElevatorConstructor.Events.ManualTravelRequested:Connect(function()
|
||||
self.MovingObjectsConstructor:ControllerStartAsync()
|
||||
task.wait(1)
|
||||
self.MovingObjectsConstructor:RotateRelayCogs1Async().Completed:Wait()
|
||||
self.ElevatorConstructor:StartTraveling()
|
||||
end)
|
||||
-- self.ElevatorConstructor.Events.TravelStart:Connect(function()
|
||||
|
||||
-- end)
|
||||
self.ElevatorConstructor.Events.Parked:Connect(function()
|
||||
self.MovingObjectsConstructor:RotateRelayCogs3()
|
||||
end)
|
||||
end
|
||||
|
||||
function Events:InitButtons()
|
||||
ElevatorEvents(self)
|
||||
|
||||
local ButtonEventsConstructor = ButtonEvents.constructor(self.ElevatorConfig, self.ElevatorConstructor, self.ButtonsConstructor)
|
||||
ButtonEventsConstructor:Events()
|
||||
end
|
||||
|
||||
return Events
|
||||
@@ -60,9 +60,16 @@ type Constructor_Return_Props = {
|
||||
Rotodials: {Instance}
|
||||
}
|
||||
|
||||
type LowPassSoundeffects = {
|
||||
SoundGroup: SoundGroup,
|
||||
EqualizerSoundEffect: EqualizerSoundEffect
|
||||
}
|
||||
|
||||
export type constructor = ClassConstructor
|
||||
|
||||
local TS = game:GetService("TweenService")
|
||||
local SS = game:GetService("SoundService")
|
||||
local RandomNew = Random.new()
|
||||
|
||||
local MovingObjects = {} :: Impl_Constructor
|
||||
MovingObjects.__index = MovingObjects
|
||||
@@ -70,7 +77,32 @@ MovingObjects.__index = MovingObjects
|
||||
MovingObjects.RotateRotodialsSensitivity = 40
|
||||
MovingObjects.PulleyWheelRotationSensitivity = 2
|
||||
|
||||
local function LowPassSoundEffects(): LowPassSoundeffects
|
||||
local SoundGroup = Instance.new("SoundGroup") :: SoundGroup
|
||||
SoundGroup.Volume = 1
|
||||
local EqualizerSoundEffect = Instance.new("EqualizerSoundEffect") :: EqualizerSoundEffect
|
||||
EqualizerSoundEffect.HighGain = -15
|
||||
EqualizerSoundEffect.LowGain = 0
|
||||
EqualizerSoundEffect.MidGain = -35
|
||||
|
||||
EqualizerSoundEffect.Parent = SoundGroup
|
||||
SoundGroup.Parent = SS
|
||||
|
||||
return {
|
||||
SoundGroup = SoundGroup,
|
||||
EqualizerSoundEffect = EqualizerSoundEffect
|
||||
}
|
||||
end
|
||||
|
||||
local function SmoothAudioRollin(Audio: Sound, Time: number, Goal: number)
|
||||
TS:Create(Audio, TweenInfo.new(Time, Enum.EasingStyle.Linear), {
|
||||
Volume = Goal
|
||||
}):Play()
|
||||
end
|
||||
|
||||
function MovingObjects.constructor(TagsConstructor)
|
||||
local AudioEffect = LowPassSoundEffects()
|
||||
|
||||
local PulleyWheel = TagsConstructor:Request("Haughton_PulleyWheel") :: BasePart
|
||||
|
||||
local Cog2_Row1 = TagsConstructor:Request("Haughton_Cog2_Row1") :: BasePart
|
||||
@@ -87,7 +119,16 @@ function MovingObjects.constructor(TagsConstructor)
|
||||
local Controller_Clicks = TagsConstructor:Request("Haughton_Controller_Clicks") :: Sound
|
||||
local Pulley_Moving = TagsConstructor:Request("Haughton_Pulley_Moving") :: Sound
|
||||
local Pulley_Start = TagsConstructor:Request("Haughton_Pulley_Start") :: Sound
|
||||
Controller_Hum.Looped = true
|
||||
|
||||
-- Haughton_Relay_Close.SoundGroup = AudioEffect.SoundGroup
|
||||
-- Haughton_Relay_FullOpen.SoundGroup = AudioEffect.SoundGroup
|
||||
-- Haughton_Relay_Open.SoundGroup = AudioEffect.SoundGroup
|
||||
-- Controller_Start.SoundGroup = AudioEffect.SoundGroup
|
||||
-- Controller_Hum.SoundGroup = AudioEffect.SoundGroup
|
||||
-- Controller_End.SoundGroup = AudioEffect.SoundGroup
|
||||
-- Controller_Clicks.SoundGroup = AudioEffect.SoundGroup
|
||||
-- Pulley_Moving.SoundGroup = AudioEffect.SoundGroup
|
||||
-- Pulley_Start.SoundGroup = AudioEffect.SoundGroup
|
||||
|
||||
local MagnetCog_Row1 = TagsConstructor:Request("Haughton_MagnetCog_Row1") :: BasePart
|
||||
local MagnetCog_Row2 = TagsConstructor:Request("Haughton_MagnetCog_Row2") :: BasePart
|
||||
@@ -176,10 +217,12 @@ local function ElectricalFlash(Flash: PointLight)
|
||||
end
|
||||
|
||||
function MovingObjects:ControllerStartAsync()
|
||||
if math.random(1,30) == 1 then
|
||||
if RandomNew:NextInteger(1,30) == 1 then
|
||||
self.Controller_Start.SoundId = "rbxassetid://108739293674278"
|
||||
self.Controller_Start.Volume = 1
|
||||
else
|
||||
self.Controller_Start.SoundId = "rbxassetid://75136143926200"
|
||||
self.Controller_Start.Volume = 1.8
|
||||
end
|
||||
self.Controller_Start:Play()
|
||||
self.Controller_Start.Ended:Wait()
|
||||
@@ -192,9 +235,13 @@ function MovingObjects:RotateRelayCogs1Async()
|
||||
task.wait(.30)
|
||||
RotateRelayCogs(true, false, self.MagnetCog_Row2, self.Cog2_Row2, self.Row2_CounterWeight, self.Row2_Relays)
|
||||
task.wait(.30)
|
||||
|
||||
self.Pulley_Start:Play()
|
||||
SmoothAudioRollin(self.Pulley_Start, 2, 1.8)
|
||||
|
||||
task.spawn(function()
|
||||
self.Pulley_Start.Ended:Wait()
|
||||
self.Pulley_Start.Volume = 0
|
||||
self.Pulley_Moving:Play()
|
||||
end)
|
||||
return RotateRelayCogs(true, true, self.MagnetCog_Row4, self.Cog2_Row4, self.Row4_CounterWeight, self.Row4_Relays)
|
||||
@@ -210,7 +257,7 @@ function MovingObjects:RotateRelayCogs2Async()
|
||||
RotateRelayCogs(false, true,self.MagnetCog_Row4, self.Cog2_Row4, self.Row4_CounterWeight, self.Row4_Relays)
|
||||
ElectricalFlash(self.Row4_Flash)
|
||||
self.Pulley_Moving:Stop()
|
||||
task.wait(2)
|
||||
task.wait(RandomNew:NextNumber(2,4))
|
||||
self.Controller_Clicks:Play()
|
||||
end
|
||||
|
||||
@@ -226,8 +273,9 @@ function MovingObjects:RotateRelayCogs3()
|
||||
end
|
||||
|
||||
function MovingObjects:RotateRotodials(Elevator_Y_Velocity)
|
||||
local rad = math.rad(Elevator_Y_Velocity/MovingObjects.RotateRotodialsSensitivity)
|
||||
for n: number = 1, #self.Rotodials do
|
||||
(self.Rotodials[n] :: BasePart).CFrame*=CFrame.Angles(math.rad(Elevator_Y_Velocity/MovingObjects.RotateRotodialsSensitivity),0,0)
|
||||
(self.Rotodials[n] :: BasePart).CFrame*=CFrame.Angles(rad,0,0)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
56
src/server/main/Elevators/Map/Haughton/TractionRopes.luau
Normal file
56
src/server/main/Elevators/Map/Haughton/TractionRopes.luau
Normal file
@@ -0,0 +1,56 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor))
|
||||
|
||||
type Impl_Constructor = {
|
||||
__index: Impl_Constructor,
|
||||
constructor: Constructor_Fun,
|
||||
--Class functions
|
||||
Update: (self: ClassConstructor) -> ()
|
||||
}
|
||||
|
||||
type Constructor_Fun = (CabRopesObject: BasePart, PulleyRopesObject: BasePart) -> ClassConstructor
|
||||
|
||||
type Constructor_Return_Props = {
|
||||
CabRopesObject: BasePart,
|
||||
PulleyRopesObject: BasePart,
|
||||
PulleyCables: {RopeConstraint}
|
||||
}
|
||||
|
||||
export type constructor = ClassConstructor
|
||||
|
||||
local TractionRopes = {} :: Impl_Constructor
|
||||
TractionRopes.__index = TractionRopes
|
||||
|
||||
function TractionRopes.constructor(CabRopesObject, PulleyRopesObject)
|
||||
local PulleyCables = {}
|
||||
local PulleyCablesChildren = PulleyRopesObject:GetChildren()
|
||||
|
||||
for n: number = 1, #PulleyCablesChildren do
|
||||
local Object = PulleyCablesChildren[n] :: Instance
|
||||
if Object:IsA("BasePart") then
|
||||
local Rope = Object:FindFirstChildOfClass("RopeConstraint")
|
||||
if Rope then
|
||||
table.insert(PulleyCables, Rope)
|
||||
end
|
||||
end
|
||||
end
|
||||
assert(#PulleyCables>0, "0 RopeConstraint's were found for an elevator with traction ropes!")
|
||||
|
||||
return setmetatable({
|
||||
CabRopesObject = CabRopesObject,
|
||||
PulleyRopesObject = PulleyRopesObject,
|
||||
PulleyCables = PulleyCables
|
||||
}, TractionRopes)
|
||||
end
|
||||
|
||||
function TractionRopes:Update()
|
||||
local StudLength = (self.PulleyRopesObject.Position-self.CabRopesObject.Position).Magnitude+1
|
||||
for n: number = 1, #self.PulleyCables do
|
||||
self.PulleyCables[n].Length = StudLength
|
||||
end
|
||||
end
|
||||
|
||||
return TractionRopes
|
||||
@@ -12,21 +12,29 @@ local Config = require(script:WaitForChild("Config"))
|
||||
local Buttons = require(script:WaitForChild("Buttons"))
|
||||
local Leveling = require(script:WaitForChild("Leveling"))
|
||||
local MovingObjects = require(script:WaitForChild("MovingObjects"))
|
||||
local TractionRopes = require(script:WaitForChild("TractionRopes"))
|
||||
local TagsModule = require(MainDir:WaitForChild("Map"):WaitForChild("Load"):WaitForChild("Tags"))
|
||||
|
||||
return function(TagsConstructor: TagsModule.TagsConstructor, ButtonTags: TagsModule.ElevatorButtons, LanternTags: TagsModule.Lanterns, LandingDoorTags: TagsModule.LandingTags)
|
||||
local ElevatorModel = TagsConstructor:Request("Elevator_Haughton") :: Model
|
||||
local CabRopesObject = TagsConstructor:Request("Haughton_Rope_Cab") :: BasePart
|
||||
local PulleyRopesObject = TagsConstructor:Request("Haughton_Rope_Pulley") :: BasePart
|
||||
local ElevatorBoxModel = ElevatorModel:WaitForChild("Mover") :: BasePart
|
||||
|
||||
local Elevator = InitElevator.constructor(ElevatorBoxModel, Config, Leveling)
|
||||
local MovingObjectsConstructor = MovingObjects.constructor(TagsConstructor)
|
||||
local ButtonsConstructor = Buttons.constructor(Config.Name, ButtonTags, Elevator.Attributes.CurrentFloor)
|
||||
local EventsConstructor = Events.constructor(Elevator, Config, Elevator.Events, Elevator.Attributes, ButtonsConstructor.Events, ElevatorBoxModel, Leveling, MovingObjectsConstructor)
|
||||
local TractionRopesConstructor = TractionRopes.constructor(CabRopesObject, PulleyRopesObject)
|
||||
local EventsConstructor = Events.constructor(
|
||||
Elevator,
|
||||
Config,
|
||||
ButtonsConstructor,
|
||||
ElevatorBoxModel,
|
||||
Leveling,
|
||||
MovingObjectsConstructor,
|
||||
TractionRopesConstructor
|
||||
)
|
||||
|
||||
EventsConstructor:Elevator()
|
||||
EventsConstructor:Buttons()
|
||||
EventsConstructor:InitButtons()
|
||||
ButtonsConstructor:InitForElevator(2, Vector3.new(-.05,0,0))
|
||||
|
||||
-- task.wait(3)
|
||||
-- Elevator:RequestLevelAsync(7, "Down")
|
||||
end
|
||||
|
||||
@@ -252,7 +252,7 @@ local function GoingUpDirectionToDirectionEnum(CurrentFloor: number, RequestedFl
|
||||
end
|
||||
|
||||
local function CheckFloorQueue(self: ClassConstructor)
|
||||
self.Elevator.AlignPosition.MaxVelocity = 0
|
||||
SmoothVelocity(self, 0, 1)
|
||||
|
||||
local DirectionToDirectionQueue = self.Attributes.TravelingUpwards.Value and self.RelayAlgorithm.FloorQueue.Up or self.RelayAlgorithm.FloorQueue.Down
|
||||
local DirectionToOppositeDirectionQueue = self.Attributes.TravelingUpwards.Value and self.RelayAlgorithm.FloorQueue.Down or self.RelayAlgorithm.FloorQueue.Up
|
||||
@@ -413,13 +413,14 @@ function Elevator:__TravelToFloorAsync(Level_Int, LEVEL_VEC3_Y_WRAP)
|
||||
--Set the elevator's AlignPosition to the floor Y vector
|
||||
self.Elevator.AlignPosition.Position = Vector3.new(self.Elevator.AlignPosition.Position.X, LEVEL_VEC3_Y_WRAP.Y, self.Elevator.AlignPosition.Position.Z)
|
||||
--Set the elevator's velocity
|
||||
SmoothVelocity(self, self.Elevator.Configuration.MaxVelocity, 3)
|
||||
SmoothVelocity(self, self.Elevator.Configuration.MaxVelocity, 5)
|
||||
end
|
||||
|
||||
function Elevator:RequestLevelAsync(RequestedLevel, Direction)
|
||||
local Level = self:GetLevel(RequestedLevel)
|
||||
|
||||
if Level then
|
||||
--Some patch solution for cab calls
|
||||
if (RequestedLevel == 1 and Direction == Enums.ElevatorCallDirection.Down) then
|
||||
self.ewarnStudio(`Impossible direction requested, Direction={Direction}, RequestedLevel={RequestedLevel}. correcting...`)
|
||||
Direction = Enums.ElevatorCallDirection.Up
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
type RopeTags = {Instance}
|
||||
type Leveling = {number}
|
||||
|
||||
type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor))
|
||||
type Impl_Constructor = {
|
||||
__index: Impl_Constructor,
|
||||
constructor: Constructor_Fun,
|
||||
--Class functions
|
||||
Move: (self: ClassConstructor, Offset: number, ElevatorPosition: Vector3) -> (),
|
||||
Stopped: (self: ClassConstructor) -> (),
|
||||
}
|
||||
|
||||
type Constructor_Fun = (RopeTags: RopeTags, ElevatorBox: BasePart, Leveling: Leveling) -> ClassConstructor
|
||||
type Constructor_Return_Props = {
|
||||
Ropes: RopeTags,
|
||||
Leveling: Leveling,
|
||||
BiggestRopeLength: number,
|
||||
}
|
||||
|
||||
export type TractionRopesConstructor = ClassConstructor
|
||||
|
||||
local TractionRopes = {} :: Impl_Constructor
|
||||
TractionRopes.__index = TractionRopes
|
||||
|
||||
function TractionRopes.constructor(RopeTags, ElevatorBox, Leveling)
|
||||
local ArbitraryRopeContact = RopeTags[1].Parent :: BasePart
|
||||
local HighestLevel = Leveling[#Leveling]
|
||||
local BiggestRopeLength = HighestLevel-(ArbitraryRopeContact.Position.Y-HighestLevel)
|
||||
|
||||
return setmetatable({
|
||||
Ropes = RopeTags,
|
||||
Leveling = Leveling,
|
||||
BiggestRopeLength = BiggestRopeLength
|
||||
}, TractionRopes)
|
||||
end
|
||||
|
||||
function TractionRopes:Move(Offset, ElevatorPosition)
|
||||
local l = self.BiggestRopeLength-ElevatorPosition.Y+Offset
|
||||
|
||||
for i: number = 1, #self.Ropes do
|
||||
(self.Ropes[i] :: RopeConstraint).Length = l
|
||||
end
|
||||
end
|
||||
|
||||
function TractionRopes:Stopped()
|
||||
|
||||
end
|
||||
|
||||
return TractionRopes
|
||||
@@ -20,20 +20,20 @@ type Impl_Constructor = {
|
||||
__index: Impl_Constructor,
|
||||
constructor: Constructor_Fun,
|
||||
--Class functions
|
||||
DecodeCarTag: (self: ClassConstructor, FloorTag: string) -> number?,
|
||||
DecodeCarTag: (self: ClassConstructor, FloorTag: string) -> number?,
|
||||
CreatePromptButtons: (self: ClassConstructor) -> Tags.ButtonsTree,
|
||||
} & Impl_Static_Props
|
||||
|
||||
type Impl_Static_Props = {
|
||||
DefaultMaxActivationDistance: number,
|
||||
DefaultHoldDuration: number
|
||||
DefaultHoldDuration: number
|
||||
}
|
||||
|
||||
type Constructor_Fun = (ModelButtons: Tags.ElevatorButtons, ElevatorModel: Enums.ElevatorValues) -> ClassConstructor
|
||||
type Constructor_Return_Props = {
|
||||
ModelButtons: Tags.ElevatorButtons,
|
||||
ModelButtons: Tags.ElevatorButtons,
|
||||
ElevatorModel: Enums.ElevatorValues,
|
||||
Buttons: Tags.ButtonsTree
|
||||
Buttons: Tags.ButtonsTree
|
||||
}
|
||||
|
||||
export type ButtonsTagsConstructor = ClassConstructor
|
||||
@@ -42,7 +42,7 @@ local ButtonsModule = {} :: Impl_Constructor
|
||||
ButtonsModule.__index = ButtonsModule
|
||||
|
||||
ButtonsModule.DefaultMaxActivationDistance = 3
|
||||
ButtonsModule.DefaultHoldDuration = .30
|
||||
ButtonsModule.DefaultHoldDuration = 0
|
||||
|
||||
function ButtonsModule.constructor(ModelButtons, ElevatorModel)
|
||||
return setmetatable({
|
||||
@@ -79,7 +79,7 @@ function ButtonsModule:CreatePromptButtons()
|
||||
|
||||
local ButtonType: Enums.ButtonValues? = if tonumber(Split[3]) then
|
||||
Enums.Button.Car
|
||||
elseif Split[3] == "Floor" and Split[4]:match('%d') then
|
||||
elseif Split[3] == "Floor" and Split[4]:match('%d') then --how do i stop opinionated info
|
||||
Enums.Button.Landing
|
||||
elseif Split[2] == "ElevatorButton" then
|
||||
Enums.Button.Special
|
||||
@@ -90,22 +90,29 @@ function ButtonsModule:CreatePromptButtons()
|
||||
|
||||
if ButtonType == Enums.Button.Car then
|
||||
--ElevatorButton_1
|
||||
local ID = tonumber(Split[3])
|
||||
if ID then
|
||||
local Name = (Inst:GetAttribute("Name") :: string?) or tostring(Split[3])
|
||||
Inst:SetAttribute("Name", nil)
|
||||
|
||||
Prompt.ActionText = tostring(Split[3])
|
||||
Prompt.ObjectText = "Floor"
|
||||
|
||||
self.Buttons[self.ElevatorModel].Car[`{Split[2]}_{Split[3]}`] = {
|
||||
Inst = Inst,
|
||||
Prompt = Prompt,
|
||||
Attachment = Attachment
|
||||
}
|
||||
Prompt.ActionText = Name
|
||||
Prompt.ObjectText = "Floor"
|
||||
self.Buttons[self.ElevatorModel].Car[`{Split[2]}_{Split[3]}`] = {
|
||||
Inst = Inst,
|
||||
Prompt = Prompt,
|
||||
Attachment = Attachment,
|
||||
ID = ID,
|
||||
Name = Name
|
||||
}
|
||||
else
|
||||
warn(`Button ID failed! {Split[1]}: button: "{Split[3]}" did not represent a number, ID={ID}`)
|
||||
end
|
||||
elseif ButtonType == Enums.Button.Landing then
|
||||
--ElevatorButton_Floor_1_Up
|
||||
|
||||
local Name = tostring(Split[5])
|
||||
Prompt.ActionText = `Send Elevator {Name}`
|
||||
Prompt.ObjectText = `Floor {tostring(Split[4])}`
|
||||
|
||||
self.Buttons[self.ElevatorModel].Landing[`{Split[2]}_{Split[3]}_{Split[4]}_{Split[5]}`] = {
|
||||
Inst = Inst,
|
||||
Prompt = Prompt,
|
||||
@@ -118,7 +125,6 @@ function ButtonsModule:CreatePromptButtons()
|
||||
local Name = tostring(Split[3])
|
||||
Prompt.ActionText = Name
|
||||
Prompt.ObjectText = "Elevator"
|
||||
|
||||
self.Buttons[self.ElevatorModel].Special[`{Split[2]}_{Split[3]}`] = {
|
||||
Inst = Inst,
|
||||
Prompt = Prompt,
|
||||
@@ -131,7 +137,6 @@ function ButtonsModule:CreatePromptButtons()
|
||||
Prompt.Exclusivity = Enum.ProximityPromptExclusivity.OneGlobally --why does this not work...
|
||||
Prompt.ActionText = "Activate"
|
||||
Prompt.ObjectText = "Relay"
|
||||
|
||||
self.Buttons[self.ElevatorModel].Relays[`{Split[2]}_{Split[3]}`] = {
|
||||
Inst = Inst,
|
||||
Prompt = Prompt,
|
||||
|
||||
@@ -87,11 +87,11 @@ function Lights:Functionality(DefinedProperties)
|
||||
ClickSound.SoundId = LightProperties.LightSwitchActivateSoundId
|
||||
ClickSound.Parent = self.Switch
|
||||
|
||||
LightAddresses.ColorActivated = self.Switch:GetAttribute("Activated")
|
||||
LightAddresses.ColorDeactivated = self.Switch:GetAttribute("Deactivated")
|
||||
LightAddresses.ActivatedMaterial = self.Switch:GetAttribute("ActivatedMaterial")
|
||||
LightAddresses.DeactivatedMaterial = self.Switch:GetAttribute("DeactivatedMaterial")
|
||||
LightAddresses.Enabled = self.Switch:GetAttribute("Enabled")
|
||||
LightAddresses.ColorActivated = self.Switch:GetAttribute("Activated") :: Color3?
|
||||
LightAddresses.ColorDeactivated = self.Switch:GetAttribute("Deactivated") :: Color3?
|
||||
LightAddresses.ActivatedMaterial = self.Switch:GetAttribute("ActivatedMaterial") :: string?
|
||||
LightAddresses.DeactivatedMaterial = self.Switch:GetAttribute("DeactivatedMaterial") :: string?
|
||||
LightAddresses.Enabled = self.Switch:GetAttribute("Enabled") :: boolean?
|
||||
LightAddresses.Attachment = Attachment
|
||||
LightAddresses.Prompt = Prompt
|
||||
LightAddresses.ClickSound = ClickSound
|
||||
|
||||
@@ -25,7 +25,7 @@ type Impl_Constructor = {
|
||||
|
||||
type Impl_Static_Props = {
|
||||
Decoders: {
|
||||
CarTag: (FloorTag: string) -> (number | string)?,
|
||||
CarTag: (FloorTag: string) -> number?,
|
||||
HallTag: (FloorTag: string) -> number?
|
||||
}
|
||||
}
|
||||
@@ -98,7 +98,7 @@ export type ButtonDictionary = {
|
||||
[string]: ButtonProperties
|
||||
}
|
||||
|
||||
export type RelayProperties = ButtonProperties & {
|
||||
export type RelayProperties = Properties & {
|
||||
Unique: boolean,
|
||||
ActiveState: boolean,
|
||||
PhysicalSound: {
|
||||
@@ -114,24 +114,25 @@ export type RelayDictionary = {
|
||||
export type ButtonsTree = {
|
||||
[Enums.ElevatorValues]: {
|
||||
Car: ButtonDictionary,
|
||||
Landing: ButtonDictionary,
|
||||
Special: ButtonDictionary,
|
||||
Landing: Properties,
|
||||
Special: Properties,
|
||||
Relays: RelayDictionary
|
||||
}
|
||||
}
|
||||
|
||||
export type ButtonProperties = {
|
||||
Inst: Instance?,
|
||||
Prompt: ProximityPrompt?,
|
||||
Attachment: Attachment?,
|
||||
Name: string?
|
||||
}
|
||||
|
||||
export type ButtonPropertiesSafe = {
|
||||
Inst: Instance,
|
||||
Prompt: ProximityPrompt,
|
||||
Attachment: Attachment,
|
||||
Name: string?
|
||||
ID: number,
|
||||
Name: string
|
||||
}
|
||||
|
||||
export type Properties = {
|
||||
Inst: Instance,
|
||||
Prompt: ProximityPrompt,
|
||||
Attachment: Attachment,
|
||||
Name: string
|
||||
}
|
||||
|
||||
export type ExportedTags = {
|
||||
@@ -154,9 +155,8 @@ Tags.__index = Tags
|
||||
|
||||
Tags.Decoders = {
|
||||
CarTag = function(FloorTag)
|
||||
local Match = FloorTag:match('%w+$')
|
||||
|
||||
return Match and (tonumber(Match) or tostring(Match))
|
||||
local Match = FloorTag:match('%d+$')
|
||||
return Match and tonumber(Match)
|
||||
end,
|
||||
|
||||
HallTag = function(FloorTag)
|
||||
@@ -201,8 +201,6 @@ function Tags:Nuke()
|
||||
warn("☢️ nuked all in-game tags. Left-over tags="..table.concat(CS:GetAllTags(), ", "))
|
||||
end
|
||||
|
||||
--Parsers:
|
||||
|
||||
function Tags:__ElevatorLanterns()
|
||||
local Lanterns: LanternsTree = {}
|
||||
|
||||
|
||||
17
src/server/main/Types/Enums/Doors.luau
Normal file
17
src/server/main/Types/Enums/Doors.luau
Normal file
@@ -0,0 +1,17 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local DoorEnums = {}
|
||||
|
||||
export type DoorEnumValues = typeof(DoorEnums.Door)
|
||||
export type SingleSpeed = "SingleSpeed"
|
||||
export type DoubleSpeed = "DoubleSpeed"
|
||||
export type TripleSpeed = "TripleSpeed"
|
||||
DoorEnums.Door = {
|
||||
SingleSpeed = "SingleSpeed" :: SingleSpeed,
|
||||
DoubleSpeed = "DoubleSpeed" :: DoubleSpeed,
|
||||
TripleSpeed = "TripleSpeed" :: TripleSpeed
|
||||
}
|
||||
|
||||
return DoorEnums
|
||||
@@ -51,7 +51,8 @@ export type EnumElevatorCallDirections = typeof(Enums.ElevatorCallDirection)
|
||||
export type ElevatorCallDirectionValues = typeof(Enums.ElevatorCallDirection.Up) | typeof(Enums.ElevatorCallDirection.Down)
|
||||
Enums.ElevatorCallDirection = {
|
||||
Up = "Up" :: "Up",
|
||||
Down = "Down" :: "Down"
|
||||
Down = "Down" :: "Down",
|
||||
Cab = "Cab" :: "Cab"
|
||||
}
|
||||
|
||||
return Enums
|
||||
|
||||
Reference in New Issue
Block a user