Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function DeltaLock(inst, comp, subfn, flrfn)
- local oldfn = inst.components[comp][subfn]
- inst.components[comp][subfn] = function(first, secnd, ...)
- oldfn(first, type(secnd) == "number" and math.max(secnd, flrfn()) or secnd, ...)
- end
- end
- GLOBAL.InitInfinite = function(inst)
- if not inst then return end
- inst:AddTag("infiniteforged")
- local components = inst.components
- -- armors fix
- if components.armor then
- components.armor.indestructible = true
- end
- -- tools and weapons fix
- local finiteuses = components.finiteuses
- if finiteuses then
- DeltaLock(
- inst,
- "finiteuses",
- "SetUses",
- function() return finiteuses.current end
- )
- end
- if components.weapon then
- components.weapon.attackwear = 0
- end
- -- fueled equipments fix
- local fueled = components.fueled
- if fueled then
- DeltaLock(
- inst,
- "fueled",
- "DoDelta",
- function() return 0 end
- )
- end
- end
- AddPrefabPostInitAny(function(inst)
- if inst:HasTag("infiniteforged") then
- GLOBAL.InitInfinite(inst)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement