working car buttons, get leveling to accept strings and not just numbers

This commit is contained in:
2024-08-22 15:39:33 -04:00
parent 8af537f9de
commit b6bb2bddf1
3 changed files with 22 additions and 16 deletions

View File

@@ -45,27 +45,29 @@ local function CarButtonActivated(ButtonFloor: number | string)
print("Activated", ButtonFloor)
end
local function CarButtonFallback(ButtonFloor: number | string)
--Fires when the button is pressed at its own floor
print("Already at floor:", ButtonFloor)
end
function Buttons:Hook()
local ButtonManagerConstructor = ButtonManager.constructor(self.CurrentFloor)
local ButtonTagsConstructor = ButtonTags.constructor(self.ButtonTags, self.ElevatorModel)
local Prompt = ButtonTagsConstructor:CreatePromptButtons()
for ButtonID: string, ButtonInstance: Instance in self.ButtonTags do
--
local CarButtonPrompts = Prompt[self.ElevatorModel].Car
for PromptType, PromptProperties in CarButtonPrompts do
if PromptProperties.Attachment and PromptProperties.Inst and PromptProperties.Prompt then
PromptProperties.Prompt.MaxActivationDistance = 2
PromptProperties.Attachment.Position-=Vector3.new(.01,0,0)
ButtonManagerConstructor:CarButton(ButtonID, PromptProperties, CarButtonActivated, function(ButtonFloor: number | string)
print("Fallback", ButtonFloor)
end)
PromptProperties.Attachment.Position-=Vector3.new(.05,0,0)
ButtonManagerConstructor:CarButton(PromptType, PromptProperties, CarButtonActivated, CarButtonFallback)
else
warn()
end
end
end
-- end
end
return Buttons

View File

@@ -3,12 +3,12 @@
--!strict
return {
[1] = 1.163, --Basement
[2] = 19.163,
[3] = 37.507,
[4] = 55.464,
[5] = 73.383,
[6] = 91.301,
[7] = 109.243,
[8] = 127.185,
["B"] = 1.163,
[1] = 19.163,
[2] = 37.507,
[3] = 55.464,
[4] = 73.383,
[5] = 91.301,
[6] = 109.24,
[7] = 127.185,
}

View File

@@ -33,7 +33,11 @@ type Impl_Constructor = {
}
type FloorLevelingPositions = {number}
type Constructor_Fun = (ElevatorBoxModel: BasePart, ElevatorConfigurationTable: ElevatorTypes.ElevatorConfigurationTable, FloorLevelingPositions: FloorLevelingPositions) -> ClassConstructor
type Constructor_Fun = (
ElevatorBoxModel: BasePart,
ElevatorConfigurationTable: ElevatorTypes.ElevatorConfigurationTable,
FloorLevelingPositions: FloorLevelingPositions
) -> ClassConstructor
type Constructor_Return_Props = {
RelayAlgorithm: RelayAlgorithm.RelayAlgorithmConstructor,