Advertisement
ExodiaForce

partcache

Dec 9th, 2024
7
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.47 KB | None | 0 0
  1. -- Decompiler will be improved soon!
  2. -- Decompiled with Konstant V2.1, a fast Luau decompiler made in Luau by plusgiant5 (https://discord.gg/wyButjTMhM)
  3. -- Decompiled on 2024-12-09 07:19:48
  4. -- Luau version 6, Types version 3
  5. -- Time taken: 0.004543 seconds
  6.  
  7. local module_upvr = require(script:WaitForChild("Table"))
  8. local module_upvr_2 = {}
  9. module_upvr_2.__index = module_upvr_2
  10. module_upvr_2.__type = "PartCache"
  11. local cframe_upvr = CFrame.new(0, 1000000000, 0)
  12. local function _(arg1, arg2) -- Line 60, Named "assertwarn"
  13. if arg1 == false then
  14. warn(arg2)
  15. end
  16. end
  17. local function _(arg1, arg2) -- Line 67, Named "MakeFromTemplate"
  18. --[[ Upvalues[1]:
  19. [1]: cframe_upvr (readonly)
  20. ]]
  21. local clone = arg1:Clone()
  22. clone.CFrame = cframe_upvr
  23. clone.Anchored = true
  24. clone.Parent = arg2
  25. return clone
  26. end
  27. function module_upvr_2.new(arg1, arg2, arg3) -- Line 77
  28. --[[ Upvalues[3]:
  29. [1]: module_upvr_2 (readonly)
  30. [2]: module_upvr (readonly)
  31. [3]: cframe_upvr (readonly)
  32. ]]
  33. -- KONSTANTWARNING: Variable analysis failed. Output will have some incorrect variable assignments
  34. local var9
  35. if not arg3 then
  36. end
  37. if 0 >= arg2 then
  38. var9 = false
  39. else
  40. var9 = true
  41. end
  42. assert(var9, "PrecreatedParts can not be negative!")
  43. if arg2 == 0 then
  44. else
  45. end
  46. if true == false then
  47. var9 = warn
  48. var9("PrecreatedParts is 0! This may have adverse effects when initially using the cache.")
  49. end
  50. if arg1.Archivable == false then
  51. var9 = warn
  52. var9("The template's Archivable property has been set to false, which prevents it from being cloned. It will temporarily be set to true.")
  53. end
  54. var9 = true
  55. arg1.Archivable = var9
  56. var9 = arg1:Clone()
  57. arg1.Archivable = arg1.Archivable
  58. local var10 = var9
  59. local tbl = {
  60. Open = {};
  61. InUse = {};
  62. CurrentCacheParent = workspace;
  63. Template = var10;
  64. ExpansionSize = 10;
  65. }
  66. setmetatable(tbl, module_upvr_2)
  67. for _ = 1, arg2 or 5 do
  68. local clone_3 = var10:Clone()
  69. clone_3.CFrame = cframe_upvr
  70. clone_3.Anchored = true
  71. clone_3.Parent = tbl.CurrentCacheParent
  72. module_upvr.insert(tbl.Open, clone_3)
  73. local var13
  74. end
  75. var13.Template.Parent = nil
  76. return var13
  77. end
  78. function module_upvr_2.GetPart(arg1) -- Line 115
  79. --[[ Upvalues[3]:
  80. [1]: module_upvr_2 (readonly)
  81. [2]: module_upvr (readonly)
  82. [3]: cframe_upvr (readonly)
  83. ]]
  84. local var16
  85. if getmetatable(arg1) ~= module_upvr_2 then
  86. var16 = false
  87. else
  88. var16 = true
  89. end
  90. assert(var16, "Cannot statically invoke method '%s' - It is an instance method. Call it on an instance of this class created via %s":format("GetPart", "PartCache.new"))
  91. var16 = arg1.Open
  92. if #var16 == 0 then
  93. var16 = 1
  94. for _ = 1, arg1.ExpansionSize, var16 do
  95. local clone_2 = arg1.Template:Clone()
  96. clone_2.CFrame = cframe_upvr
  97. clone_2.Anchored = true
  98. clone_2.Parent = arg1.CurrentCacheParent
  99. module_upvr.insert(arg1.Open, clone_2)
  100. end
  101. end
  102. var16 = arg1.Open
  103. local var18 = var16[#arg1.Open]
  104. var16 = arg1.Open
  105. var16[#arg1.Open] = nil
  106. var16 = module_upvr.insert
  107. var16(arg1.InUse, var18)
  108. return var18
  109. end
  110. function module_upvr_2.ReturnPart(arg1, arg2) -- Line 131
  111. --[[ Upvalues[3]:
  112. [1]: module_upvr_2 (readonly)
  113. [2]: module_upvr (readonly)
  114. [3]: cframe_upvr (readonly)
  115. ]]
  116. local var19
  117. if getmetatable(arg1) ~= module_upvr_2 then
  118. var19 = false
  119. else
  120. var19 = true
  121. end
  122. assert(var19, "Cannot statically invoke method '%s' - It is an instance method. Call it on an instance of this class created via %s":format("ReturnPart", "PartCache.new"))
  123. var19 = module_upvr
  124. var19 = arg1.InUse
  125. local any_indexOf_result1 = var19.indexOf(var19, arg2)
  126. if any_indexOf_result1 ~= nil then
  127. var19 = module_upvr.remove
  128. var19(arg1.InUse, any_indexOf_result1)
  129. var19 = module_upvr.insert
  130. var19(arg1.Open, arg2)
  131. var19 = cframe_upvr
  132. arg2.CFrame = var19
  133. var19 = true
  134. arg2.Anchored = var19
  135. else
  136. var19 = error
  137. var19("Attempted to return part \""..arg2.Name.."\" ("..arg2:GetFullName()..") to the cache, but it's not in-use! Did you call this on the wrong part?")
  138. end
  139. end
  140. function module_upvr_2.SetCacheParent(arg1, arg2) -- Line 146
  141. --[[ Upvalues[1]:
  142. [1]: module_upvr_2 (readonly)
  143. ]]
  144. local var25
  145. if getmetatable(arg1) ~= module_upvr_2 then
  146. var25 = false
  147. else
  148. var25 = true
  149. end
  150. assert(var25, "Cannot statically invoke method '%s' - It is an instance method. Call it on an instance of this class created via %s":format("SetCacheParent", "PartCache.new"))
  151. var25 = arg2:IsDescendantOf(workspace)
  152. if not var25 then
  153. if arg2 ~= workspace then
  154. var25 = false
  155. else
  156. var25 = true
  157. end
  158. end
  159. assert(var25, "Cache parent is not a descendant of Workspace! Parts should be kept where they will remain in the visible world.")
  160. arg1.CurrentCacheParent = arg2
  161. var25 = 1
  162. for i_3 = 1, #arg1.Open, var25 do
  163. arg1.Open[i_3].Parent = arg2
  164. end
  165. var25 = 1
  166. for i_4 = 1, #arg1.InUse, var25 do
  167. arg1.InUse[i_4].Parent = arg2
  168. end
  169. end
  170. function module_upvr_2.Expand(arg1, arg2) -- Line 160
  171. --[[ Upvalues[3]:
  172. [1]: module_upvr_2 (readonly)
  173. [2]: module_upvr (readonly)
  174. [3]: cframe_upvr (readonly)
  175. ]]
  176. -- KONSTANTWARNING: Variable analysis failed. Output will have some incorrect variable assignments
  177. local var30
  178. if getmetatable(arg1) ~= module_upvr_2 then
  179. var30 = false
  180. else
  181. var30 = true
  182. end
  183. assert(var30, "Cannot statically invoke method '%s' - It is an instance method. Call it on an instance of this class created via %s":format("Expand", "PartCache.new"))
  184. if arg2 == nil then
  185. end
  186. var30 = 1
  187. for _ = 1, arg1.ExpansionSize, var30 do
  188. local clone_4 = arg1.Template:Clone()
  189. clone_4.CFrame = cframe_upvr
  190. clone_4.Anchored = true
  191. clone_4.Parent = arg1.CurrentCacheParent
  192. module_upvr.insert(arg1.Open, clone_4)
  193. end
  194. end
  195. function module_upvr_2.Dispose(arg1) -- Line 172
  196. --[[ Upvalues[1]:
  197. [1]: module_upvr_2 (readonly)
  198. ]]
  199. local var36
  200. if getmetatable(arg1) ~= module_upvr_2 then
  201. var36 = false
  202. else
  203. var36 = true
  204. end
  205. assert(var36, "Cannot statically invoke method '%s' - It is an instance method. Call it on an instance of this class created via %s":format("Dispose", "PartCache.new"))
  206. var36 = 1
  207. for i_6 = 1, #arg1.Open, var36 do
  208. arg1.Open[i_6]:Destroy()
  209. end
  210. var36 = 1
  211. for i_7 = 1, #arg1.InUse, var36 do
  212. arg1.InUse[i_7]:Destroy()
  213. end
  214. arg1.Template:Destroy()
  215. arg1.Open = {}
  216. arg1.InUse = {}
  217. arg1.CurrentCacheParent = nil
  218. arg1.GetPart = nil
  219. arg1.ReturnPart = nil
  220. arg1.SetCacheParent = nil
  221. arg1.Expand = nil
  222. arg1.Dispose = nil
  223. end
  224. return module_upvr_2
  225.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement