function SpreadSimulator.New(c)local X={}setmetatable(X,SpreadSimulator)X.runtimeData=c X.weaponDefinition=c:GetWeaponDefinition()if not X.weaponDefinition:GetSpreadRange()then return nil end X.minSpread=(X.weaponDefinition:GetSpreadRange()).x X.maxSpread=(X.weaponDefinition:GetSpreadRange()).y X.spreadIntensity=X.weaponDefinition:GetSpreadIntensity()X.spreadReduction=X.weaponDefinition:GetSpreadReduction()X.rng=Random.new()X.currentSpread=X.minSpread return X end
-- Creates a spread simulator based on the weapons runtime data
-- @param WeaponRuntimeData
-- @return SpreadSimulator
function SpreadSimulator.New(weaponRuntimeData)
	local self = {}
	setmetatable(self, SpreadSimulator)

	self.runtimeData = weaponRuntimeData
	self.weaponDefinition = weaponRuntimeData:GetWeaponDefinition()

	if not self.weaponDefinition:GetSpreadRange() then
		return nil
	end

	-- Constants
	self.minSpread = self.weaponDefinition:GetSpreadRange().x
	self.maxSpread = self.weaponDefinition:GetSpreadRange().y
	self.spreadIntensity = self.weaponDefinition:GetSpreadIntensity()
	self.spreadReduction = self.weaponDefinition:GetSpreadReduction()
	self.rng = Random.new()

	-- Variables
	self.currentSpread = self.minSpread

	return self
end
