local function Y(Y)local w=0 for Y,s in pairs(Y)do w+=1 end return w end local function w(Y,w,s)local M=Y[w]if not M then M={}Y[w]=M end local x=s:IsA("\080\108\097\121\101\114")and s.Character M[s]=x or true end local s={player=function(Y)return ZoneController._getZonesAndItems("\112\108\097\121\101\114",activeZones,activeZonesTotalVolume,true,Y)end,localPlayer=function(Y)local s={}local M=localPlayer.Character if not M then return s end local x=ZoneController.getTouchingZones(M,true,Y,trackers.player)for Y,M in pairs(x)do if M.activeTriggers.localPlayer then w(s,M,localPlayer)end end return s end;item=function(Y)return ZoneController._getZonesAndItems("\105\116\101\109",activeZones,activeZonesTotalVolume,true,Y)end}
-- LOCAL FUNCTIONS
local function dictLength(dictionary)
	local count = 0
	for _, _ in pairs(dictionary) do
		count += 1
	end
	return count
end

local function fillOccupants(zonesAndOccupantsTable, zone, occupant)
	local occupantsDict = zonesAndOccupantsTable[zone]
	if not occupantsDict then
		occupantsDict = {}
		zonesAndOccupantsTable[zone] = occupantsDict
	end
	local prevCharacter = occupant:IsA("Player") and occupant.Character
	occupantsDict[occupant] = (prevCharacter or true)
end

local heartbeatActions = {
	["player"] = function(recommendedDetection)
		return ZoneController._getZonesAndItems(
			"player",
			activeZones,
			activeZonesTotalVolume,
			true,
			recommendedDetection
		)
	end,
	["localPlayer"] = function(recommendedDetection)
		local zonesAndOccupants = {}
		local character = localPlayer.Character
		if not character then
			return zonesAndOccupants
		end
		local touchingZones = ZoneController.getTouchingZones(character, true, recommendedDetection, trackers.player)
		for _, zone in pairs(touchingZones) do
			if zone.activeTriggers["localPlayer"] then
				fillOccupants(zonesAndOccupants, zone, localPlayer)
			end
		end
		return zonesAndOccupants
	end,
	["item"] = function(recommendedDetection)
		return ZoneController._getZonesAndItems("item", activeZones, activeZonesTotalVolume, true, recommendedDetection)
	end,
}
