function ServerGame.onEnter(a,n,t,H)SystemManager.createSystems()local O=SystemManager.getSystemByName("\101\110\103\105\110\101")local function z()a:finishGame()end connections.crashedIntoSun=O.crashedIntoSun:Connect(z)connections.escapedSun=O.escapedSun:Connect(z)spawnToolsAsync()tagMap();(coroutine.wrap(function()while true do local n=METEOR_FREQUENCY_PER_PLAYER/1+#Players:GetPlayers()/5 wait(math.random(n/1.5,n*1.5))if a.current~="\103\097\109\101"then return end local t=SystemManager.getSystemByName("\115\104\105\101\108\100")if t:isOn()and math.random(1,100)>SHIELD_DEFLECT_RATE then sendAlert(Constants.Alert.Success,translate("\083\104\105\101\108\100\115 \104\097\118\101 \100\101\102\108\101\099\116\101\100 \097 \109\101\116\101\111\114\033"))else spawnMeteor()end end end))()end
--[[
	Function called upon entering the state - creates the systems, and initialises the game loop.
]]
function ServerGame.onEnter(stateMachine, event, from, to)
	SystemManager.createSystems()

	local engine = SystemManager.getSystemByName("engine")

	local function completeGame()
		stateMachine:finishGame()
	end
	connections.crashedIntoSun = engine.crashedIntoSun:Connect(completeGame)

	connections.escapedSun = engine.escapedSun:Connect(completeGame)

	spawnToolsAsync()
	tagMap()

	coroutine.wrap(function()
		while true do
			local waitTime = METEOR_FREQUENCY_PER_PLAYER / 1 + (#Players:GetPlayers() / 5)

			wait(math.random(waitTime / 1.5, waitTime * 1.5))
			if stateMachine.current ~= "game" then
				return
			end

			local shield = SystemManager.getSystemByName("shield")

			if shield:isOn() and math.random(1, 100) > SHIELD_DEFLECT_RATE then
				sendAlert(Constants.Alert.Success, translate("Shields have deflected a meteor!"))
			else
				spawnMeteor()
			end
		end
	end)()
end
