local p=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 N=p("\067\097\109\101\114\097\083\116\097\116\101")local q=p("\083\112\114\105\110\103")local k=p("\083\117\109\109\101\100\067\097\109\101\114\097")local a={}a.ClassName="\073\109\112\117\108\115\101\067\097\109\101\114\097"function a.new()local p=setmetatable({},a)p.Spring=q.new(Vector3.new())p.Damper=.5 p.Speed=20 return p end function a.__add(N,p)return k.new(N,p)end function a.__newindex(q,p,N)if p=="\068\097\109\112\101\114"then q.Spring.Damper=N elseif p=="\083\112\101\101\100"then q.Spring.Speed=N elseif p=="\083\112\114\105\110\103"then rawset(q,p,N)else error(p.." \105\115 \110\111\116 \097 \118\097\108\105\100 \109\101\109\098\101\114 \111\102 \105\109\112\117\108\115\101 \099\097\109\101\114\097")end end function a.Impulse(N,p)N.Spring:Impulse(p)end function a.__index(q,p)if p=="\083\116\097\116\101"or p=="\067\097\109\101\114\097\083\116\097\116\101"or p=="\067\097\109\101\114\097"then local p=N.new()local k=q.Spring.Value p.CFrame=(CFrame.Angles(0,k.y,0)*CFrame.Angles(k.x,0,0))*CFrame.Angles(0,0,k.z)return p elseif p=="\068\097\109\112\101\114"then return q.Spring.Damper elseif p=="\083\112\101\101\100"then return q.Spring.Speed else return a[p]end end return a
--- Add another layer of effects over any other camera by allowing an "impulse"
-- to be applied. Good for shockwaves, camera shake, and recoil
-- @classmod ImpulseCamera

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

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

local ImpulseCamera = {}
ImpulseCamera.ClassName = "ImpulseCamera"

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

	self.Spring = Spring.new(Vector3.new())

	self.Damper = 0.5
	self.Speed = 20

	return self
end

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

function ImpulseCamera:__newindex(Index, Value)
	if Index == "Damper" then
		self.Spring.Damper = Value
	elseif Index == "Speed" then
		self.Spring.Speed = Value
	elseif Index == "Spring" then
		rawset(self, Index, Value)
	else
		error(Index .. " is not a valid member of impulse camera")
	end
end

function ImpulseCamera:Impulse(Velocity)
	self.Spring:Impulse(Velocity)
end

function ImpulseCamera:__index(Index)
	if Index == "State" or Index == "CameraState" or Index == "Camera" then
		local State = CameraState.new()
		local Value = self.Spring.Value
		State.CFrame = CFrame.Angles(0, Value.y, 0) * CFrame.Angles(Value.x, 0, 0) * CFrame.Angles(0, 0, Value.z)
		return State
	elseif Index == "Damper" then
		return self.Spring.Damper
	elseif Index == "Speed" then
		return self.Spring.Speed
	else
		return ImpulseCamera[Index]
	end
end

return ImpulseCamera