local N=require((game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")):WaitForChild("\078\101\118\101\114\109\111\114\101"))local C=N("\067\097\109\101\114\097\083\116\097\116\101")local F=N("\083\117\109\109\101\100\067\097\109\101\114\097")local h={}h.ClassName="\090\111\111\109\101\100\067\097\109\101\114\097"h._MaxZoom=100 h._MinZoom=.5 h._zoom=10 function h.new()local N=setmetatable({},h)return N end function h.__add(C,N)return F.new(C,N)end function h.ZoomIn(h,N,C,F)if C or F then h.Zoom=h.Zoom-math.clamp(N,C or-math.huge,F or math.huge)else h.Zoom=h.Zoom-N end end function h.__newindex(F,N,C)if N=="\090\111\111\109"or N=="\084\097\114\103\101\116\090\111\111\109"then F._zoom=math.clamp(C,F.MinZoom,F.MaxZoom)elseif N=="\077\097\120\090\111\111\109"then assert(C>F.MinZoom,"\077\097\120\090\111\111\109 \099\097\110\'\116 \098\101 \108\101\115\115 \116\104\097\110 \077\105\110\090\111\111\109")F._MaxZoom=C F.Zoom=F.Zoom elseif N=="\077\105\110\090\111\111\109"then assert(C<F.MaxZoom,"\077\105\110\090\111\111\109 \099\097\110\'\116 \098\101 \103\114\101\097\116\101\114 \116\104\097\110 \077\105\110\090\111\111\109")F._MinZoom=C F.Zoom=F.Zoom else rawset(F,N,C)end end function h.__index(F,N)if N=="\083\116\097\116\101"or N=="\067\097\109\101\114\097\083\116\097\116\101"or N=="\067\097\109\101\114\097"then local N=C.new()N.Position=Vector3.new(0,0,F.Zoom)return N elseif N=="\090\111\111\109"or N=="\084\097\114\103\101\116\090\111\111\109"then return F._zoom elseif N=="\077\097\120\090\111\111\109"then return F._MaxZoom elseif N=="\077\105\110\090\111\111\109"then return F._MinZoom else return h[N]end end return h
--- Allow freedom of movement around a current place, much like the classic script works now.
-- Not intended to be use with the current character script
-- Intended to be used with a SummedCamera, relative.
-- @classmod ZoomedCamera
-- @usage
-- local Zoom = ZoomedCamera.new()
-- Zoom.Zoom = 30 -- Distance from original point
-- Zoom.MaxZoom = 100 -- max distance away
-- Zoom.MinZoom = 0.5 -- min distance away
-- Assigning .Zoom will automatically clamp

local require = require(game:GetService("ReplicatedStorage"):WaitForChild("Nevermore"))

local CameraState = require("CameraState")
local SummedCamera = require("SummedCamera")

local ZoomedCamera = {}
ZoomedCamera.ClassName = "ZoomedCamera"
ZoomedCamera._MaxZoom = 100
ZoomedCamera._MinZoom = 0.5
ZoomedCamera._zoom = 10

function ZoomedCamera.new()
	local self = setmetatable({}, ZoomedCamera)

	return self
end

function ZoomedCamera:__add(other)
	return SummedCamera.new(self, other)
end

function ZoomedCamera:ZoomIn(value, min, max)
	if min or max then
		self.Zoom = self.Zoom - math.clamp(value, min or -math.huge, max or math.huge)
	else
		self.Zoom = self.Zoom - value
	end
end

function ZoomedCamera:__newindex(index, value)
	if index == "Zoom" or index == "TargetZoom" then
		self._zoom = math.clamp(value, self.MinZoom, self.MaxZoom)
	elseif index == "MaxZoom" then
		assert(value > self.MinZoom, "MaxZoom can't be less than MinZoom")

		self._MaxZoom = value
		self.Zoom = self.Zoom -- Reset the zoom with new constraints.
	elseif index == "MinZoom" then
		assert(value < self.MaxZoom, "MinZoom can't be greater than MinZoom")

		self._MinZoom = value
		self.Zoom = self.Zoom -- Reset the zoom with new constraints.
	else
		rawset(self, index, value)
	end
end

function ZoomedCamera:__index(index)
	if index == "State" or index == "CameraState" or index == "Camera" then
		local State = CameraState.new()
		State.Position = Vector3.new(0, 0, self.Zoom)
		return State
	elseif index == "Zoom" or index == "TargetZoom" then
		return self._zoom
	elseif index == "MaxZoom" then
		return self._MaxZoom
	elseif index == "MinZoom" then
		return self._MinZoom
	else
		return ZoomedCamera[index]
	end
end

return ZoomedCamera