package.loaded.Constants = nil; require("Constants")

TurretBehaviors = {}

function TurretBehaviors.Patrol(self)
	local TurnTimer = Timer()
	local turn = 3000
	
	while true do
		if TurnTimer:IsPastSimMS(turn) then
			TurnTimer:Reset()
			turn = RangeRand(2000, 6000)
			self:SetAimAngle(RangeRand(-0.7, 0.7))
			
			self.HFlipped = not self.HFlipped
		end
		
		coroutine.yield()	-- wait until next frame
	end
	
	return true
end

-- stop the user fom inadvertently modifying the storage table
local Proxy = {}
local Mt = {
	__index = TurretBehaviors,
	__newindex = function(Table, k, v)
		error("The TurretBehaviors table is read-only.", 2)
	end
}
setmetatable(Proxy, Mt)
TurretBehaviors = Proxy
