light switch work and new prompt system

This commit is contained in:
2024-04-14 21:40:04 -04:00
parent f670e19c3c
commit 0fa054f97d
8 changed files with 256 additions and 90 deletions

View File

@@ -3,23 +3,26 @@
--!strict
local Elevators = script.Parent
local MainDir = Elevators.Parent
local Storage: ReplicatedStorage = game:GetService("ReplicatedStorage")
local RS: RunService = game:GetService("RunService")
local TagsModule = require(Storage:WaitForChild("Tags"))
local Easings = require(Storage:WaitForChild("Algebra"))
local Enums = require(Storage:WaitForChild("Enums"))
local Leveling = require(script:WaitForChild("Leveling"))
local Doors = require(script:WaitForChild("Doors"))
local MovingObjects = require(script:WaitForChild("MovingObjects"))
local Enums = require(Elevators:WaitForChild("Enums"))
local ElevatorMover = require(Elevators:WaitForChild("Mover"))
local ButtonTags = require(Elevators:WaitForChild("Buttons"))
local TractionRopes = require(Elevators:WaitForChild("TractionRopes"))
local Lanterns = require(Elevators:WaitForChild("Lanterns"))
local PromptModule = require(MainDir:WaitForChild("Map"):WaitForChild("Prompts"))
local TagService = require(MainDir:WaitForChild("TagService"))
type rbxassetid = string
type Tags = TagsModule.ExportedTags
@@ -46,7 +49,7 @@ type Impl_Static_Props = {
__CurrentFloor: number
}
type Constructor_Fun = (TagsConstructor: TagsConstructor) -> ClassConstructor
type Constructor_Fun = (TagsConstructor: TagsConstructor, TagServiceConstructor: TagService.TagsServiceConstructor) -> ClassConstructor
type Constructor_Return_Props = {
Tags: Tags,
MOConstructor: MovingObjects.MovingObjectsConstructor,
@@ -92,14 +95,15 @@ local ButtonFunctions: {[Enums.ButtonTreeValues]: ButtonFunction} = {
end,
[Enums.ButtonTree.Car] = function(self, ButtonName, ButtonsConstructor, ButtonTree)
local DecodedFloor = ButtonsConstructor:DecodeCarTag(ButtonName)
local DecodedFloor = TagService.Decoder.CarTag(ButtonName)
if not DecodedFloor then
end
ButtonsConstructor:HookPromptButtonsGroup(ButtonTree.Prompt, ButtonTree.Inst :: BasePart?, function(_Player: Player)
local Prompt = PromptModule.constructor(ButtonTree.Prompt, ButtonTree.Instance)
Prompt:AddHookTriggered(function(Player: Player)
if DecodedFloor then
--ButtonTree.Prompt.Enabled = false
ButtonsConstructor:AestheticActivateButton(ButtonTree.Inst :: BasePart, false, Otis1960.ButtonActivatedColor)
self:GoToLevel(DecodedFloor)
end
@@ -130,13 +134,13 @@ local function HookButtons(self: ClassConstructor, ButtonsConstructor: ButtonTag
end
end
function Otis1960.constructor(TagsConstructor)
function Otis1960.constructor(TagsConstructor, TagServiceConstructor)
local self = {} :: Constructor_Return_Props
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.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}
--Rotation objects
self.MachineRoom = {_CFrame = {}} :: MovingObjects.MachineRoom
@@ -151,8 +155,8 @@ function Otis1960.constructor(TagsConstructor)
self.MOConstructor = MovingObjects.constructor({MachineRoom = self.MachineRoom} :: MovingObjects.InstanceTree)
--Audio
local LanternDisplay = TagsConstructor:Request("Otis1960_LanternDisplayMain") :: UnionOperation
local LaternTags = Lanterns.Get(TagsConstructor, Enums.Elevator.Otis1960) :: Lanterns.Lanterns
local LanternDisplay = TagsConstructor:Request("Otis1960_LanternDisplayMain") :: UnionOperation
local LaternTags = TagServiceConstructor:Lanterns(Enums.Elevator.Otis1960) :: TagService.Lanterns
self.LanternsConstructor = Lanterns.constructor(LanternDisplay, Otis1960.LanternChimeDirection, Otis1960.LanternChimeLanding, LaternTags, {
Active = Otis1960.LanternDisplayColorOn,