mirror of
https://github.com/unixtensor/Roblox-Elevator-Game.git
synced 2026-02-04 03:56:50 +00:00
light switch work and new prompt system
This commit is contained in:
@@ -2,12 +2,13 @@
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local Elevators = script.Parent
|
||||
local ElevatorsDir = script.Parent
|
||||
local MainDir = ElevatorsDir.Parent
|
||||
local TagService = require(MainDir:WaitForChild("TagService"))
|
||||
|
||||
local RS: ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||
|
||||
local TagsModule = require(RS:WaitForChild("Tags"))
|
||||
local Enums = require(Elevators:WaitForChild("Enums"))
|
||||
local Storage: ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||
local TagsModule = require(Storage:WaitForChild("Tags"))
|
||||
local Enums = require(Storage:WaitForChild("Enums"))
|
||||
|
||||
type TagsConstructor = TagsModule.TagsConstructor
|
||||
type TagProduct = TagsModule.TagProduct
|
||||
@@ -20,9 +21,7 @@ type Impl_Constructor = {
|
||||
constructor: Constructor_Fun,
|
||||
--Class functions
|
||||
DecodeCarTag: (self: ClassConstructor, FloorTag: string) -> number?,
|
||||
Get: (self: ClassConstructor) -> GetButtons,
|
||||
CreatePromptButtons: (self: ClassConstructor) -> ButtonsTree,
|
||||
HookPromptButtonsGroup: (self: ClassConstructor, Prompt: ProximityPrompt?, Inst: BasePart?, PromptCallback: PromptCallback) -> (),
|
||||
CreatePromptButtons: (self: ClassConstructor) -> TagService.ButtonsTree,
|
||||
AestheticActivateButton: (self: ClassConstructor, Button: BasePart, ActivatedState: boolean, ActivatedColor: Color3) -> ()
|
||||
} & Impl_Static_Props
|
||||
|
||||
@@ -34,7 +33,7 @@ type Constructor_Fun = (TagsConstructor: TagsConstructor, Model: Enums.ElevatorV
|
||||
type Constructor_Return_Props = {
|
||||
Tags: TagsConstructor,
|
||||
Model: Enums.ElevatorValues,
|
||||
Buttons: ButtonsTree
|
||||
Buttons: TagService.ButtonsTree
|
||||
}
|
||||
|
||||
export type ButtonsConstructor = ClassConstructor
|
||||
@@ -118,12 +117,6 @@ function ButtonsModule:CreatePromptButtons()
|
||||
Attachment = Attachment
|
||||
}
|
||||
elseif ButtonType == Enums.Button.Relay then
|
||||
--RelayButton_F1
|
||||
|
||||
if self.Model == Enums.Elevator.Otis1960 then --This is bad...
|
||||
Attachment.Position-=Vector3.new(.1,.3,0)
|
||||
end
|
||||
|
||||
Prompt.MaxActivationDistance = 4
|
||||
Prompt.Exclusivity = Enum.ProximityPromptExclusivity.OneGlobally --why does this not work...
|
||||
Prompt.ActionText = `Relay {tostring(Split[3])}`
|
||||
@@ -146,29 +139,6 @@ function ButtonsModule:CreatePromptButtons()
|
||||
return self.Buttons
|
||||
end
|
||||
|
||||
function ButtonsModule:HookPromptButtonsGroup(Prompt, Inst, PromptCallback)
|
||||
if Prompt then
|
||||
if Inst then
|
||||
Prompt.Triggered:Connect(function(Player)
|
||||
local PlayerCharacter = Player.Character
|
||||
local Root = PlayerCharacter and PlayerCharacter:FindFirstChild("HumanoidRootPart") :: HumanoidRootPart?
|
||||
|
||||
if Root then
|
||||
if (Root.Position-Inst.Position).Magnitude<=Prompt.MaxActivationDistance+1 then
|
||||
PromptCallback(Player)
|
||||
else
|
||||
warn(`{Player.Name}, {Player.UserId} activated a prompt without being in range of MaxActivationDistance.`)
|
||||
end
|
||||
end
|
||||
end)
|
||||
else
|
||||
warn("Button Hook Error! Inst is missing", debug.traceback())
|
||||
end
|
||||
else
|
||||
warn("Button Hook Error! Prompt is missing", debug.traceback())
|
||||
end
|
||||
end
|
||||
|
||||
function ButtonsModule:AestheticActivateButton(Button, ActivatedState, ActivatedColor)
|
||||
task.spawn(function()
|
||||
local Glass = Button:FindFirstChild("Glass") :: BasePart
|
||||
|
||||
Reference in New Issue
Block a user