Advertisement
HaoDZ

Infinite Test Build

May 3rd, 2024
776
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.21 KB | Gaming | 0 0
  1. local function DeltaLock(inst, comp, subfn, flrfn)
  2.     local oldfn = inst.components[comp][subfn]
  3.     inst.components[comp][subfn] = function(first, secnd, ...)
  4.         oldfn(first, type(secnd) == "number" and math.max(secnd, flrfn()) or secnd, ...)
  5.     end
  6. end
  7.  
  8.  
  9. GLOBAL.InitInfinite = function(inst)
  10.     if not inst then return end
  11.     inst:AddTag("infiniteforged")
  12.     local components = inst.components
  13.  
  14.     -- armors fix
  15.     if components.armor then
  16.         components.armor.indestructible = true
  17.     end
  18.  
  19.     -- tools and weapons fix
  20.     local finiteuses = components.finiteuses
  21.     if finiteuses then
  22.         DeltaLock(
  23.             inst,
  24.             "finiteuses",
  25.             "SetUses",
  26.             function() return finiteuses.current end
  27.         )
  28.     end
  29.     if components.weapon then
  30.         components.weapon.attackwear = 0
  31.     end
  32.  
  33.     -- fueled equipments fix
  34.     local fueled = components.fueled
  35.     if fueled then
  36.         DeltaLock(
  37.             inst,
  38.             "fueled",
  39.             "DoDelta",
  40.             function() return 0 end
  41.         )
  42.     end
  43. end
  44.  
  45.  
  46. AddPrefabPostInitAny(function(inst)
  47.     if inst:HasTag("infiniteforged") then
  48.         GLOBAL.InitInfinite(inst)
  49.     end
  50. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement