local function h(h)local o=0 for h,W in pairs(h)do o+=1 end return o end local function o(h,o,W)local Q=h[o]if not Q then Q={}h[o]=Q end Q[W]=W.Character or true end local W={player=function(h)return ZoneController._getZonesAndPlayers(activeZones,activeZonesTotalVolume,true,h)end;localPlayer=function(h)local W={}local Q=ZoneController.getTouchingZones(localPlayer,true,h)for h,Q in pairs(Q)do if Q.activeTriggers.localPlayer then o(W,Q,localPlayer)end end return W end}

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
	occupantsDict[occupant] = (occupant.Character or true)
end

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


