Tag service module

This commit is contained in:
2024-04-12 01:27:06 -04:00
parent 53e383cbb1
commit 5556006c83
6 changed files with 144 additions and 95 deletions

View File

@@ -14,8 +14,6 @@ type TagProduct = TagsModule.TagProduct
type HumanoidRootPart = BasePart
type PromptCallback = (Player: Player) -> ()
type GetButtons = {[string]: Instance}
type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor))
type Impl_Constructor = {
__index: Impl_Constructor,
@@ -39,17 +37,6 @@ type Constructor_Return_Props = {
Buttons: ButtonsTree
}
export type ButtonsTree = {
Landing: ButtonProperties,
Car: ButtonProperties,
Special: ButtonProperties,
Relays: ButtonProperties
}
export type ButtonProperties = {
Inst: Instance?,
Prompt: ProximityPrompt?,
Attachment: Attachment?
}
export type ButtonsConstructor = ClassConstructor
local ButtonsModule = {} :: Impl_Constructor
@@ -68,30 +55,6 @@ function ButtonsModule.constructor(TagsConstructor, Model)
}, ButtonsModule)
end
--Button parsing
function ButtonsModule:DecodeCarTag(FloorTag)
local Match = FloorTag:match('%d+$')
return Match and tonumber(Match)
end
function ButtonsModule:Get()
local Buttons: GetButtons = {}
for TagName: string, Inst: TagProduct in self.Tags.__export do
local Split = TagName:split('_')
if Split[1] == self.Model and (Split[2] == "ElevatorButton" or Split[2] == "RelayButton") then
if typeof(Inst) == "Instance" then
Buttons[TagName] = Inst
else
warn("TODO block hit,", debug.traceback())
end
end
end
return Buttons
end
--[[
CarButton = Model_ElevatorButton_1
LandingButton = Model_ElevatorButton_Floor_1_Up