floor goal and start testing the stop button

This commit is contained in:
2024-05-14 18:00:30 -04:00
parent 756ba64a0b
commit 490a002d5c
2 changed files with 15 additions and 4 deletions

View File

@@ -14,7 +14,7 @@ local PromptModule = require(Main:WaitForChild("Map"):WaitForChild("Prompts"))
local Tags = require(Load:WaitForChild("Tags")) local Tags = require(Load:WaitForChild("Tags"))
type FloorButtonActivatedCallback = (ButtonFloor: number) -> () type FloorButtonActivatedCallback = (ButtonFloor: number) -> ()
type StopButtonActivatedCallback = <T>(Toggled: T) -> () type StopButtonActivatedCallback = (Toggled: SpecialButtonToggle) -> ()
type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor)) type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor))
type Impl_Constructor = { type Impl_Constructor = {
@@ -57,6 +57,8 @@ type ElevatorButtonColors = {
LanternDisplayOff: Color3, LanternDisplayOff: Color3,
} }
export type SpecialButtonToggle = boolean
export type ButtonsConstructor = ClassConstructor export type ButtonsConstructor = ClassConstructor
local ButtonFunctions = {} :: Impl_Constructor local ButtonFunctions = {} :: Impl_Constructor

View File

@@ -53,6 +53,7 @@ type Impl_Constructor = {
constructor: Constructor_Fun, constructor: Constructor_Fun,
--Class functions --Class functions
__GoToFloor: (self: ClassConstructor, Level: number, GoingUp: boolean) -> (), __GoToFloor: (self: ClassConstructor, Level: number, GoingUp: boolean) -> (),
__MovingHeartbeat: (self: ClassConstructor, GoingUp: boolean) -> (),
RequestLevelAsync: (self: ClassConstructor, RequestedLevel: number) -> boolean RequestLevelAsync: (self: ClassConstructor, RequestedLevel: number) -> boolean
} & Impl_Static_Props } & Impl_Static_Props
@@ -200,14 +201,22 @@ local function HookButtons(self: ClassConstructor, ButtonNameType: Enums.ButtonT
end end
end end
self.ButtonsConstructor:SpecialButton(ButtonTree.Name :: Enums.SpecialButtonValues, ButtonID, ButtonTree, function<boolean>(Toggled: boolean) self.ButtonsConstructor:SpecialButton(ButtonTree.Name :: Enums.SpecialButtonValues, ButtonID, ButtonTree, function(Toggled: Buttons.SpecialButtonToggle)
Attributes.Stopped.Value = Toggled Attributes.Stopped.Value = Toggled
if Toggled then if Toggled then
(ButtonTree.Inst :: BasePart).Position+=Vector3.new(0,0,.05) (ButtonTree.Inst :: BasePart).Position+=Vector3.new(0,0,.05)
if self.__MovingConnection and self.__MovingConnection.Connected then
self.__MovingConnection:Disconnect()
end
else else
(ButtonTree.Inst :: BasePart).Position-=Vector3.new(0,0,.05) (ButtonTree.Inst :: BasePart).Position-=Vector3.new(0,0,.05)
if self.__MovingConnection and self.__MovingConnection.Connected then
self.__MovingConnection:Disconnect()
end
self.__MovingConnection = self:__MovingHeartbeat(ElevatorGoingUpDirection(Attributes.CurrentFloor.Value, Attributes.GoalFloor.Value))
end end
end) end)
elseif ButtonNameType == Enums.ButtonTree.Relays then elseif ButtonNameType == Enums.ButtonTree.Relays then
@@ -394,7 +403,7 @@ local function FloorPassingDown(self: ClassConstructor, ElevatorPositionY: numbe
end end
end end
local function ElevatorHeartbeat(self: ClassConstructor, GoingUp: boolean) function Elevator:__MovingHeartbeat(GoingUp: boolean)
local Delta = 0 local Delta = 0
local DoorsOpeningEvent = false local DoorsOpeningEvent = false
@@ -466,7 +475,7 @@ function Elevator:__GoToFloor(GoalLevelVEC, GoingUp)
self.MOConstructor:UpdateCFrame() self.MOConstructor:UpdateCFrame()
local ElevatorBoxCurrentPos = self.ElevatorBox_1960.Position local ElevatorBoxCurrentPos = self.ElevatorBox_1960.Position
ElevatorHeartbeat(self, GoingUp) self:__MovingHeartbeat(GoingUp)
self.BoxAlignPosition.Position = Vector3.new(ElevatorBoxCurrentPos.X, GoalLevelVEC, ElevatorBoxCurrentPos.Z) self.BoxAlignPosition.Position = Vector3.new(ElevatorBoxCurrentPos.X, GoalLevelVEC, ElevatorBoxCurrentPos.Z)
end end