mirror of
https://github.com/unixtensor/Roblox-Elevator-Game.git
synced 2025-12-14 06:41:55 +00:00
working car buttons, get leveling to accept strings and not just numbers
This commit is contained in:
@@ -45,27 +45,29 @@ local function CarButtonActivated(ButtonFloor: number | string)
|
|||||||
print("Activated", ButtonFloor)
|
print("Activated", ButtonFloor)
|
||||||
end
|
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()
|
function Buttons:Hook()
|
||||||
local ButtonManagerConstructor = ButtonManager.constructor(self.CurrentFloor)
|
local ButtonManagerConstructor = ButtonManager.constructor(self.CurrentFloor)
|
||||||
local ButtonTagsConstructor = ButtonTags.constructor(self.ButtonTags, self.ElevatorModel)
|
local ButtonTagsConstructor = ButtonTags.constructor(self.ButtonTags, self.ElevatorModel)
|
||||||
local Prompt = ButtonTagsConstructor:CreatePromptButtons()
|
local Prompt = ButtonTagsConstructor:CreatePromptButtons()
|
||||||
|
|
||||||
for ButtonID: string, ButtonInstance: Instance in self.ButtonTags do
|
--
|
||||||
local CarButtonPrompts = Prompt[self.ElevatorModel].Car
|
local CarButtonPrompts = Prompt[self.ElevatorModel].Car
|
||||||
|
|
||||||
for PromptType, PromptProperties in CarButtonPrompts do
|
for PromptType, PromptProperties in CarButtonPrompts do
|
||||||
if PromptProperties.Attachment and PromptProperties.Inst and PromptProperties.Prompt then
|
if PromptProperties.Attachment and PromptProperties.Inst and PromptProperties.Prompt then
|
||||||
PromptProperties.Prompt.MaxActivationDistance = 2
|
PromptProperties.Prompt.MaxActivationDistance = 2
|
||||||
PromptProperties.Attachment.Position-=Vector3.new(.01,0,0)
|
PromptProperties.Attachment.Position-=Vector3.new(.05,0,0)
|
||||||
|
ButtonManagerConstructor:CarButton(PromptType, PromptProperties, CarButtonActivated, CarButtonFallback)
|
||||||
ButtonManagerConstructor:CarButton(ButtonID, PromptProperties, CarButtonActivated, function(ButtonFloor: number | string)
|
|
||||||
print("Fallback", ButtonFloor)
|
|
||||||
end)
|
|
||||||
else
|
else
|
||||||
warn()
|
warn()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
-- end
|
||||||
end
|
end
|
||||||
|
|
||||||
return Buttons
|
return Buttons
|
||||||
@@ -3,12 +3,12 @@
|
|||||||
--!strict
|
--!strict
|
||||||
|
|
||||||
return {
|
return {
|
||||||
[1] = 1.163, --Basement
|
["B"] = 1.163,
|
||||||
[2] = 19.163,
|
[1] = 19.163,
|
||||||
[3] = 37.507,
|
[2] = 37.507,
|
||||||
[4] = 55.464,
|
[3] = 55.464,
|
||||||
[5] = 73.383,
|
[4] = 73.383,
|
||||||
[6] = 91.301,
|
[5] = 91.301,
|
||||||
[7] = 109.243,
|
[6] = 109.24,
|
||||||
[8] = 127.185,
|
[7] = 127.185,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,11 @@ type Impl_Constructor = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type FloorLevelingPositions = {number}
|
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 = {
|
type Constructor_Return_Props = {
|
||||||
RelayAlgorithm: RelayAlgorithm.RelayAlgorithmConstructor,
|
RelayAlgorithm: RelayAlgorithm.RelayAlgorithmConstructor,
|
||||||
|
|||||||
Reference in New Issue
Block a user