require("PGStateMachine")
require("PGBase")

function Definitions()
	ServiceRate = 1
	Define_State("State_Init", State_Init);
end

function State_Init(message)
	if message == OnEnter then
		Sleep(1)
		
		-- prevent this from doing anything in galactic mode
		if Get_Game_Mode() ~= "Space" then
			ScriptExit()
		end

		-- Don't spawn another marker after the asteroid has respawned
		if GetCurrentTime() >= 30 then
			ScriptExit()
		end

		marker = Find_First_Object("Spectator_Reveal_Marker")
		if TestValid(marker) then
			spectator_player = marker.Get_Owner()
			indicator = Create_Generic_Object("Spectator_Range_Marker_Asteroid_Pad", Object.Get_Position(), spectator_player)
			indicator.Suspend_Locomotor(true)
		else
			ScriptExit()
		end
	end
	ScriptExit()
end