NewRaycastWeaponBase._orig_fire_raycast = NewRaycastWeaponBase._fire_raycast

Hooks:PostHook( NewRaycastWeaponBase, "init", "RaysForRifles_init", function( self )
	self._damage_near = tweak_data.weapon[self._name_id].damage_near or 2000
	self._damage_far = tweak_data.weapon[self._name_id].damage_far or 3000
	self._rays = tweak_data.weapon[self._name_id].rays or 1
	self._range = self._damage_far
end)

Hooks:PostHook( NewRaycastWeaponBase, "_update_stats_values", "RaysForRifles__update_stats_values", function( self )
	if self._ammo_data then
		if self._ammo_data.rays ~= nil then
			self._rays = self._ammo_data.rays
		end

		if self._ammo_data.damage_near ~= nil then
			self._damage_near = self._ammo_data.damage_near
		end

		if self._damage_near and self._ammo_data.damage_near_mul ~= nil then
			self._damage_near = self._damage_near * self._ammo_data.damage_near_mul
		end

		if self._ammo_data.damage_far ~= nil then
			self._damage_far = self._ammo_data.damage_far
		end

		if self._damage_far and self._ammo_data.damage_far_mul ~= nil then
			self._damage_far = self._damage_far * self._ammo_data.damage_far_mul
		end

		self._range = self._damage_far or 3000
	end
end)

function NewRaycastWeaponBase:_fire_raycast( ... )
	if self._rays > 1 and ShotgunBase and ShotgunBase._fire_raycast then
		return ShotgunBase._fire_raycast( self, ... )
	else
		return self:_orig_fire_raycast( ... )
	end
end