Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --SynapseX Decompiler
- local module = {}
- local network = require(script.Parent:WaitForChild("network"))
- local utilities = require(script.Parent:WaitForChild("utilities"))
- local placeSetup = require(script.Parent:WaitForChild("placeSetup"))
- local entityManifestCollectionFolder = placeSetup.awaitPlaceFolder("entityManifestCollection")
- local runService = game:GetService("RunService")
- local rand = Random.new(os.time())
- function module.getDamagableTargets(playerDoingDamage)
- local damagableTargets = {}
- for i, entityManifest in pairs(entityManifestCollectionFolder:GetChildren()) do
- if entityManifest:IsA("BasePart") and not entityManifest:FindFirstChild("pet") and entityManifest:FindFirstChild("entityType") and entityManifest.entityType.Value == "monster" then
- table.insert(damagableTargets, entityManifest)
- end
- end
- local nonSerializeData
- if runService:IsServer() then
- local playerData = network:invoke("getPlayerData", playerDoingDamage)
- if playerData then
- nonSerializeData = playerData.nonSerializeData
- end
- elseif runService:IsClient() then
- nonSerializeData = network:invoke("getCacheValueByNameTag", "nonSerializeData")
- end
- if not nonSerializeData then
- print("no serialize")
- return damagableTargets
- end
- if nonSerializeData.isGlobalPVPEnabled or #nonSerializeData.whitelistPVPEnabled > 0 then
- local playersToScan = nonSerializeData.isGlobalPVPEnabled and game.Players:GetPlayers() or nonSerializeData.whitelistPVPEnabled
- for i, playerToScan in pairs(playersToScan) do
- if playerToScan ~= playerDoingDamage and playerToScan:FindFirstChild("isInPVP") and playerToScan.isInPVP.Value and playerToScan.Character and playerToScan.Character.PrimaryPart then
- table.insert(damagableTargets, playerToScan.Character.PrimaryPart)
- end
- end
- end
- return damagableTargets
- end
- function module.canPlayerDamageTarget(playerDoingDamage, target)
- if not target then
- return false, nil
- end
- local damagableTargets = module.getDamagableTargets(playerDoingDamage)
- local trueTarget = target
- if runService:IsClient() and target:IsDescendantOf(workspace.placeFolders.entityRenderCollection) then
- local currentLocation = target
- local clientHitboxToServerHitboxReference
- while not currentLocation:FindFirstChild("clientHitboxToServerHitboxReference") and currentLocation ~= workspace.placeFolders.entityRenderCollection do
- currentLocation = currentLocation.Parent
- end
- if currentLocation:FindFirstChild("clientHitboxToServerHitboxReference") then
- trueTarget = currentLocation.clientHitboxToServerHitboxReference.Value
- end
- end
- for i, damagableTarget in pairs(damagableTargets) do
- if trueTarget == damagableTarget then
- return true, trueTarget
- end
- end
- return false, trueTarget
- end
- return module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement