mirror of
https://github.com/unixtensor/Roblox-Elevator-Game.git
synced 2025-12-14 14:51:55 +00:00
Landing Doors parser
This commit is contained in:
@@ -183,8 +183,6 @@ function Otis1960.constructor(TagsConstructor, ButtonsTags, LanternsTags)
|
||||
local ClassConstructor = setmetatable(self, Otis1960)
|
||||
HookButtons(ClassConstructor, ButtonsConstructor, Enums.ButtonTree.Car)
|
||||
|
||||
print("[DEBUG] Otis1960 Lanterns=", LanternsTags)
|
||||
print("[DEBUG] Otis1960 Buttons=", Otis1960_Buttons)
|
||||
print("🔝 Otis1960 initialized and ready")
|
||||
return ClassConstructor
|
||||
end
|
||||
|
||||
@@ -19,14 +19,13 @@ type Impl_Constructor = {
|
||||
Request: (self: ClassConstructor, Name: string) -> TagProduct | Error,
|
||||
__ElevatorLanterns: (self: ClassConstructor) -> LanternsTree,
|
||||
__ElevatorButtons: (self: ClassConstructor) -> ElevatorModelButtons,
|
||||
__ElevatorDoors: (self: ClassConstructor) -> any,
|
||||
__ElevatorDoors: (self: ClassConstructor) -> DoorTags,
|
||||
__Interactables: (self: ClassConstructor) -> InteractablesTree
|
||||
} & Impl_Static_Props
|
||||
|
||||
type Impl_Static_Props = {
|
||||
Decoders: {
|
||||
CarTag: (FloorTag: string) -> number?,
|
||||
FloorTag: (FloorTag: string) -> string?
|
||||
CarTag: (FloorTag: string) -> number?
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,6 +109,12 @@ export type ExportedTags = {
|
||||
[string]: TagProduct
|
||||
}
|
||||
|
||||
export type DoorTags = {
|
||||
[Enums.ElevatorValues]: {
|
||||
[number]: {Instance}
|
||||
}
|
||||
}
|
||||
|
||||
export type TagProduct = Instance | {Instance}
|
||||
export type TagsConstructor = ClassConstructor
|
||||
|
||||
@@ -120,10 +125,6 @@ Tags.Decoders = {
|
||||
CarTag = function(FloorTag)
|
||||
local Match = FloorTag:match('^%d+$')
|
||||
return Match and tonumber(Match)
|
||||
end,
|
||||
|
||||
FloorTag = function(FloorTag)
|
||||
return FloorTag:match('^Floor%d+$')
|
||||
end
|
||||
}
|
||||
|
||||
@@ -227,7 +228,7 @@ function Tags:__ElevatorButtons()
|
||||
if typeof(Inst) == "Instance" then
|
||||
Buttons[EnumValue :: Enums.ElevatorValues][TagName] = Inst
|
||||
else
|
||||
warn("TODO block hit,", debug.traceback())
|
||||
warn(`TODO block hit. Inst={Inst},`, debug.traceback())
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -236,22 +237,54 @@ function Tags:__ElevatorButtons()
|
||||
return Buttons
|
||||
end
|
||||
|
||||
--Model_Floor10_Door_2
|
||||
function Tags:__ElevatorDoors()
|
||||
local Doors = {}
|
||||
local Doors: DoorTags = {}
|
||||
|
||||
for _, EnumValue in Enums.Elevator do
|
||||
Doors[EnumValue :: Enums.ElevatorValues] = {}
|
||||
|
||||
for TagName: string, Inst: TagProduct in self.__export do
|
||||
local Split = TagName:split('_')
|
||||
local ModelHint = Split[1]
|
||||
local FloorHint = Split[2]
|
||||
local ModelHint = Split[1]
|
||||
local FloorHint = Split[2]
|
||||
local DoorHint = Split[3]
|
||||
local DoorNumber = Split[4]
|
||||
|
||||
if ModelHint == (EnumValue :: Enums.ElevatorValues) and Tags.Decoders.FloorTag(ModelHint) then
|
||||
if ModelHint == (EnumValue :: Enums.ElevatorValues) then
|
||||
if FloorHint:match('^Floor%d+$') then
|
||||
if DoorHint == "Door" then
|
||||
local FloorNumberMatch = FloorHint:match('%d+$')
|
||||
local FloorNumber = FloorNumberMatch and tonumber(FloorNumberMatch)
|
||||
|
||||
if FloorNumber then
|
||||
local DoorNumberPlacement = tonumber(DoorNumber)
|
||||
|
||||
if DoorNumberPlacement then
|
||||
if not Doors[ModelHint][FloorNumber] then
|
||||
Doors[ModelHint][FloorNumber] = {}
|
||||
end
|
||||
|
||||
if typeof(Inst) ~= "Instance" then
|
||||
Inst = Inst[1]
|
||||
warn(`[{ModelHint}] Door {Inst} was not a single instance, duplicate doors detected Tag={TagName}`)
|
||||
end
|
||||
table.insert(Doors[ModelHint][FloorNumber], DoorNumberPlacement, Inst :: Instance)
|
||||
else
|
||||
|
||||
end
|
||||
else
|
||||
warn(`Invalid floor label {FloorHint} for door {TagName},`, debug.traceback())
|
||||
end
|
||||
else
|
||||
warn(`TODO block hit. Inst={Inst},`, debug.traceback())
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return Doors
|
||||
end
|
||||
|
||||
function Tags:__Interactables()
|
||||
|
||||
@@ -47,6 +47,8 @@ local Buttons = TagsConstructor:__ElevatorButtons()
|
||||
print("[DEBUG] Buttons=", Buttons)
|
||||
local Lanterns = TagsConstructor:__ElevatorLanterns()
|
||||
print("[DEBUG] Lanterns=", Lanterns)
|
||||
local LandingDoors = TagsConstructor:__ElevatorDoors()
|
||||
print("[DEBUG] Elevator Landing Doors=", LandingDoors)
|
||||
|
||||
local Otis1960Lanterns = Lanterns[Enums.Elevator.Otis1960]
|
||||
local Otis1960Buttons = Buttons[Enums.Elevator.Otis1960]
|
||||
|
||||
Reference in New Issue
Block a user