Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local _G = GLOBAL
- local EQUIPSLOTS = _G.EQUIPSLOTS
- local items_list = require("equip_list")
- --[[ Get Configs ]]
- local ITEM_PREFABS = {}
- local FX_PREFABS = {}
- local function CategoryConfigs(data)
- for _, v in pairs(data) do
- local prefab = v.prefab
- if prefab then
- ITEM_PREFABS[prefab] = GetModConfigData(prefab)
- end
- if v.fx and v.fx.prefab then
- FX_PREFABS[v.fx.prefab] = GetModConfigData(v.fx.prefab)
- end
- end
- end
- for _, category in pairs(items_list) do
- CategoryConfigs(category.data)
- end
- --[[ Hide Visuals ]]
- local function HideHeadSlot(anim)
- anim:ClearOverrideSymbol("headbase_hat")
- anim:ClearOverrideSymbol("swap_hat")
- anim:ClearOverrideSymbol("face")
- anim:Show("HAIR_NOHAT")
- anim:Show("HAIR")
- anim:Show("HEAD")
- anim:Show("FACE")
- end
- local function HideBodySlot(anim)
- anim:ClearOverrideSymbol("backpack")
- anim:ClearOverrideSymbol("swap_body_tall")
- anim:ClearOverrideSymbol("swap_body")
- end
- --[[ Safe FX Removal ]]
- local function RemovePlayerFX(inst)
- for _, ent in pairs(_G.Ents) do
- if ent and ent.entity and ent.entity:IsValid() and ent.prefab and FX_PREFABS[ent.prefab] then
- -- Check if it's following the player
- if ent.entity:GetParent() == inst and ent.Remove then
- ent:Remove()
- end
- end
- end
- end
- --[[ Main Hide Function ]]
- local function Hide(inst)
- if not inst or not inst.replica or not inst.replica.inventory then return end
- local anim = inst.AnimState
- local inv = inst.replica.inventory
- local head = inv:GetEquippedItem(EQUIPSLOTS.HEAD)
- if head and ITEM_PREFABS[head.prefab] then
- HideHeadSlot(anim)
- end
- local body = inv:GetEquippedItem(EQUIPSLOTS.BODY)
- if body and ITEM_PREFABS[body.prefab] then
- HideBodySlot(anim)
- end
- RemovePlayerFX(inst)
- end
- AddPlayerPostInit(function(inst)
- inst:ListenForEvent("equip", Hide)
- inst:ListenForEvent("unequip", Hide)
- end)
- items_list = nil
Advertisement
Add Comment
Please, Sign In to add comment