-- Called once to start the FpsCamera logic.
-- Binds and overloads everything necessary.


local started = false

function FpsCamera:Start()
	if started then
		return
	else
		started = true
	end
	
	local player = Players.LocalPlayer
	local character = player.Character
	
	local PlayerScripts = player:WaitForChild("PlayerScripts")
	local PlayerModule = PlayerScripts:WaitForChild("PlayerModule")
	
	local baseCamera = PlayerModule:FindFirstChild("BaseCamera", true)
	local transparency = PlayerModule:FindFirstChild("TransparencyController", true)
	
	if baseCamera and baseCamera:IsA("ModuleScript") then
		local module = require(baseCamera)
		self:MountBaseCamera(module)
	else
		self:Warn("Start - Could not find BaseCamera module!")
	end
	
	if transparency and transparency:IsA("ModuleScript") then
		local module = require(transparency)
		self:MountTransparency(module)
	else
		self:Warn("Start - Cound not find TransparencyController module!")
	end
	
	local rotListener = UserGameSettings:GetPropertyChangedSignal("RotationType")
	self:Connect("OnRotationTypeChanged", rotListener)
	
	self.MirrorBin = Instance.new("Folder")
	self.MirrorBin.Name = "HeadMirrors"
	
	if character then
		self:OnCharacterAdded(character)
	end
	
	self:Connect("OnCharacterAdded", player.CharacterAdded)
end

return FpsCamera
