--[[
	Creates a new cooldown, with specified cooldownTime. cooldown:hasExpired returns true or false depending on if the cooldown has expired or not. There
	is also an optional callbackFunction that will be called as soon as the cooldown expires.
]]

function Cooldown.new(cooldownTime, callbackFunction)
	local startTick = tick()

	local cooldownObject = {
		_endTick = startTick + cooldownTime
	}
	setmetatable(cooldownObject, {__index = Cooldown})

	if callbackFunction then
		delay(cooldownTime, callbackFunction)
	end

	return cooldownObject
end

function Cooldown:hasExpired()
	return self._endTick < tick() and true or false
end

return Cooldown
