mirror of
https://github.com/unixtensor/Roblox-Elevator-Game.git
synced 2025-12-14 06:41:55 +00:00
Landing Doors parser
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -183,8 +183,6 @@ function Otis1960.constructor(TagsConstructor, ButtonsTags, LanternsTags)
|
|||||||
local ClassConstructor = setmetatable(self, Otis1960)
|
local ClassConstructor = setmetatable(self, Otis1960)
|
||||||
HookButtons(ClassConstructor, ButtonsConstructor, Enums.ButtonTree.Car)
|
HookButtons(ClassConstructor, ButtonsConstructor, Enums.ButtonTree.Car)
|
||||||
|
|
||||||
print("[DEBUG] Otis1960 Lanterns=", LanternsTags)
|
|
||||||
print("[DEBUG] Otis1960 Buttons=", Otis1960_Buttons)
|
|
||||||
print("🔝 Otis1960 initialized and ready")
|
print("🔝 Otis1960 initialized and ready")
|
||||||
return ClassConstructor
|
return ClassConstructor
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -19,14 +19,13 @@ type Impl_Constructor = {
|
|||||||
Request: (self: ClassConstructor, Name: string) -> TagProduct | Error,
|
Request: (self: ClassConstructor, Name: string) -> TagProduct | Error,
|
||||||
__ElevatorLanterns: (self: ClassConstructor) -> LanternsTree,
|
__ElevatorLanterns: (self: ClassConstructor) -> LanternsTree,
|
||||||
__ElevatorButtons: (self: ClassConstructor) -> ElevatorModelButtons,
|
__ElevatorButtons: (self: ClassConstructor) -> ElevatorModelButtons,
|
||||||
__ElevatorDoors: (self: ClassConstructor) -> any,
|
__ElevatorDoors: (self: ClassConstructor) -> DoorTags,
|
||||||
__Interactables: (self: ClassConstructor) -> InteractablesTree
|
__Interactables: (self: ClassConstructor) -> InteractablesTree
|
||||||
} & Impl_Static_Props
|
} & Impl_Static_Props
|
||||||
|
|
||||||
type Impl_Static_Props = {
|
type Impl_Static_Props = {
|
||||||
Decoders: {
|
Decoders: {
|
||||||
CarTag: (FloorTag: string) -> number?,
|
CarTag: (FloorTag: string) -> number?
|
||||||
FloorTag: (FloorTag: string) -> string?
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,6 +109,12 @@ export type ExportedTags = {
|
|||||||
[string]: TagProduct
|
[string]: TagProduct
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type DoorTags = {
|
||||||
|
[Enums.ElevatorValues]: {
|
||||||
|
[number]: {Instance}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export type TagProduct = Instance | {Instance}
|
export type TagProduct = Instance | {Instance}
|
||||||
export type TagsConstructor = ClassConstructor
|
export type TagsConstructor = ClassConstructor
|
||||||
|
|
||||||
@@ -120,10 +125,6 @@ Tags.Decoders = {
|
|||||||
CarTag = function(FloorTag)
|
CarTag = function(FloorTag)
|
||||||
local Match = FloorTag:match('^%d+$')
|
local Match = FloorTag:match('^%d+$')
|
||||||
return Match and tonumber(Match)
|
return Match and tonumber(Match)
|
||||||
end,
|
|
||||||
|
|
||||||
FloorTag = function(FloorTag)
|
|
||||||
return FloorTag:match('^Floor%d+$')
|
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -227,7 +228,7 @@ function Tags:__ElevatorButtons()
|
|||||||
if typeof(Inst) == "Instance" then
|
if typeof(Inst) == "Instance" then
|
||||||
Buttons[EnumValue :: Enums.ElevatorValues][TagName] = Inst
|
Buttons[EnumValue :: Enums.ElevatorValues][TagName] = Inst
|
||||||
else
|
else
|
||||||
warn("TODO block hit,", debug.traceback())
|
warn(`TODO block hit. Inst={Inst},`, debug.traceback())
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -236,22 +237,54 @@ function Tags:__ElevatorButtons()
|
|||||||
return Buttons
|
return Buttons
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--Model_Floor10_Door_2
|
||||||
function Tags:__ElevatorDoors()
|
function Tags:__ElevatorDoors()
|
||||||
local Doors = {}
|
local Doors: DoorTags = {}
|
||||||
|
|
||||||
for _, EnumValue in Enums.Elevator do
|
for _, EnumValue in Enums.Elevator do
|
||||||
Doors[EnumValue :: Enums.ElevatorValues] = {}
|
Doors[EnumValue :: Enums.ElevatorValues] = {}
|
||||||
|
|
||||||
for TagName: string, Inst: TagProduct in self.__export do
|
for TagName: string, Inst: TagProduct in self.__export do
|
||||||
local Split = TagName:split('_')
|
local Split = TagName:split('_')
|
||||||
local ModelHint = Split[1]
|
local ModelHint = Split[1]
|
||||||
local FloorHint = Split[2]
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return Doors
|
||||||
end
|
end
|
||||||
|
|
||||||
function Tags:__Interactables()
|
function Tags:__Interactables()
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ local Buttons = TagsConstructor:__ElevatorButtons()
|
|||||||
print("[DEBUG] Buttons=", Buttons)
|
print("[DEBUG] Buttons=", Buttons)
|
||||||
local Lanterns = TagsConstructor:__ElevatorLanterns()
|
local Lanterns = TagsConstructor:__ElevatorLanterns()
|
||||||
print("[DEBUG] Lanterns=", Lanterns)
|
print("[DEBUG] Lanterns=", Lanterns)
|
||||||
|
local LandingDoors = TagsConstructor:__ElevatorDoors()
|
||||||
|
print("[DEBUG] Elevator Landing Doors=", LandingDoors)
|
||||||
|
|
||||||
local Otis1960Lanterns = Lanterns[Enums.Elevator.Otis1960]
|
local Otis1960Lanterns = Lanterns[Enums.Elevator.Otis1960]
|
||||||
local Otis1960Buttons = Buttons[Enums.Elevator.Otis1960]
|
local Otis1960Buttons = Buttons[Enums.Elevator.Otis1960]
|
||||||
|
|||||||
Reference in New Issue
Block a user