-- Compiled with roblox-ts v3.0.0 local TS = _G[script] local _utilities = TS.import(script, script.Parent.Parent, "utilities") local GetConstructorIdentifier = _utilities.GetConstructorIdentifier local logAssert = _utilities.logAssert local Pointer do Pointer = setmetatable({}, { __tostring = function() return "Pointer" end, }) Pointer.__index = Pointer function Pointer.new(...) local self = setmetatable({}, Pointer) return self:constructor(...) or self end function Pointer:constructor() end function Pointer:Create(id) local _pointers = Pointer.pointers local _id = id logAssert(not (_pointers[_id] ~= nil), `Pointer with name {id} already exists`) local newPointer = Pointer.new() local _pointers_1 = Pointer.pointers local _id_1 = id _pointers_1[_id_1] = newPointer local _pointerID = Pointer.pointerID local _id_2 = id _pointerID[newPointer] = _id_2 return newPointer end function Pointer:getConstructor(component) local constructor = getmetatable(component) return if TS.instanceof(component, constructor) then (getmetatable(component)) else component end function Pointer:AddComponent(component) local constructor = self:getConstructor(component) local identifier = GetConstructorIdentifier(constructor) if self.componentMetadata == identifier then return nil end local _value = self.componentMetadata logAssert(not (_value ~= "" and _value), "Pointer already has a component") self.componentMetadata = identifier end function Pointer:RemoveComponent() self.componentMetadata = nil end function Pointer:GetComponentMetadata() logAssert(self.componentMetadata, "Pointer has no component") return self.componentMetadata end Pointer.pointers = {} Pointer.pointerID = {} Pointer.GetPointer = function(id) local _pointers = Pointer.pointers local _id = id return _pointers[_id] end Pointer.GetPointerID = function(pointer) local _pointerID = Pointer.pointerID local _pointer = pointer return _pointerID[_pointer] end end local CreatePointer = function(id) return Pointer:Create(id) end return { Pointer = Pointer, CreatePointer = CreatePointer, }