function ZoneController._registerZone(g)registeredZones[g]=true local r=g._maid:give(Maid.new())g._registeredMaid=r r:give(g.updated:Connect(function()ZoneController._updateZoneDetails()end))ZoneController._updateZoneDetails()end function ZoneController._deregisterZone(g)registeredZones[g]=nil g._registeredMaid:clean()g._registeredMaid=nil ZoneController._updateZoneDetails()end function ZoneController._registerConnection(g,r)local J=dictLength(g.activeTriggers)activeConnections+=1 if J==0 then activeZones[g]=true ZoneController._updateZoneDetails()end local Q=activeTriggers[r]activeTriggers[r]=Q and Q+1 or 1 g.activeTriggers[r]=true if g.touchedConnectionActions[r]then g:_formTouchedConnection(r)end if heartbeatActions[r]then ZoneController._formHeartbeat(r)end end

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
