function ZoneController._registerZone(h)registeredZones[h]=true local k=h._maid:give(Maid.new())h._registeredMaid=k k:give(h.updated:Connect(function()ZoneController._updateZoneDetails()end))ZoneController._updateZoneDetails()end function ZoneController._deregisterZone(h)registeredZones[h]=nil h._registeredMaid:clean()h._registeredMaid=nil ZoneController._updateZoneDetails()end function ZoneController._registerConnection(h,k)local V=dictLength(h.activeTriggers)activeConnections+=1 if V==0 then activeZones[h]=true ZoneController._updateZoneDetails()end local O=activeTriggers[k]activeTriggers[k]=O and O+1 or 1 h.activeTriggers[k]=true if h.touchedConnectionActions[k]then h:_formTouchedConnection(k)end if heartbeatActions[k]then ZoneController._formHeartbeat(k)end end
-- PRIVATE FUNCTIONS
function ZoneController._registerZone(zone)
	registeredZones[zone] = true
	local registeredMaid = zone._maid:give(Maid.new())
	zone._registeredMaid = registeredMaid
	registeredMaid:give(zone.updated:Connect(function()
		ZoneController._updateZoneDetails()
	end))
	ZoneController._updateZoneDetails()
end

function ZoneController._deregisterZone(zone)
	registeredZones[zone] = nil
	zone._registeredMaid:clean()
	zone._registeredMaid = nil
	ZoneController._updateZoneDetails()
end

function ZoneController._registerConnection(registeredZone, registeredTriggerType)
	local originalItems = dictLength(registeredZone.activeTriggers)
	activeConnections += 1
	if originalItems == 0 then
		activeZones[registeredZone] = true
		ZoneController._updateZoneDetails()
	end
	local currentTriggerCount = activeTriggers[registeredTriggerType]
	activeTriggers[registeredTriggerType] = (currentTriggerCount and currentTriggerCount + 1) or 1
	registeredZone.activeTriggers[registeredTriggerType] = true
	if registeredZone.touchedConnectionActions[registeredTriggerType] then
		registeredZone:_formTouchedConnection(registeredTriggerType)
	end
	if heartbeatActions[registeredTriggerType] then
		ZoneController._formHeartbeat(registeredTriggerType)
	end
end
