subtle recoil changes

This commit is contained in:
Darsu 2025-01-06 04:22:37 +07:00
parent a5c1e2e7e0
commit f9aa83bdbe
2 changed files with 8 additions and 12 deletions

View File

@ -205,7 +205,7 @@ function SWEP:DoRTScope(model, atttbl, active)
if self:ShouldDoScope() then
self.RenderingRTScope = true
local sight = self:GetSight()
sightzang = sight.Ang.z
sightzang = sight.Ang.z - self.SubtleVisualRecoilAng.z -- less shaky with negation of subtle recoil
local sightpos = sight.ShadowPos or (sight.OriginalSightTable or {}).Pos or sight.Pos or Vector(0, 0, 0)
sightpos = sightpos * ((sight.slottbl or {}).Scale or 1)
@ -301,7 +301,7 @@ function SWEP:DoRTScope(model, atttbl, active)
surface.SetDrawColor(color)
surface.SetMaterial(reticle)
-- surface.DrawTexturedRect(rtr_x, rtr_y, size, size)
surface.DrawTexturedRectRotated(size / 2 + rtr_x, size / 2 + rtr_y, size, size, -self.ViewModelAng.z + sightzang)
surface.DrawTexturedRectRotated(size / 2 + rtr_x, size / 2 + rtr_y, size, size, -self.LastViewModelAng.z + sightzang)
end
if atttbl.RTScopeDrawFunc then
@ -345,8 +345,7 @@ function SWEP:DoRTScope(model, atttbl, active)
if sd > 0.5 then render.SetToneMappingScaleLinear(vec1) end
rtsurf:SetTexture("$basetexture", rtmat)
rtsurf:SetFloat("$rot", ((atttbl.RTScopeShadowIntensity or 0) > 1 or atttbl.RTCollimator) and self.ViewModelAng.z - sightzang or 0)
rtsurf:SetFloat("$rot", ((atttbl.RTScopeShadowIntensity or 0) > 1 or atttbl.RTCollimator) and self.LastViewModelAng.z - sightzang or 0)
-- rtsurf:SetMatrix("$basetexturetransform", Matrix({{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, 1}}))
-- model:SetSubMaterial()

View File

@ -358,11 +358,12 @@ function SWEP:DoSubtleVisualRecoil(mult) -- cl only
-- mult = mult * self:GetProcessedValue("Recoil", true)
mult = self.SubtleVisualRecoil * 0.75
if !self:GetInSights() then mult = mult * 2 end
local upp = randuptable[math.random(#randuptable)]
if !self:GetInSights() then mult = mult * (self.SubtleVisualRecoilHipFire or 2) end
local funnynumber = 1.3 - math.min(self:GetRecoilAmount(), 4.5) / 4.5
self.SubtleVisualRecoilPos = self.SubtleVisualRecoilPos + Vector(math.Rand(-0.05, 0.03), -1.0, math.Rand(-0.06, 0.03)) * mult
self.SubtleVisualRecoilAng = self.SubtleVisualRecoilAng + Vector(randuptable[math.random(#randuptable)], 0, (self.SubtleVisualRecoilDirection or 0) * funnynumber + randdirectstable[math.random(#randdirectstable)]) * mult
self.SubtleVisualRecoilAng = self.SubtleVisualRecoilAng + Vector(upp, 0, (self.SubtleVisualRecoilDirection or 0) * funnynumber + randdirectstable[math.random(#randdirectstable)]) * mult
end
function SWEP:DoVisualRecoil()
@ -388,13 +389,9 @@ function SWEP:DoVisualRecoil()
up, side, roll, punch = self.VisualRecoilDoingFunc(up, side, roll, punch, self:GetRecoilAmount(), self)
end
local fake = 0
local fake = self:GetProcessedValue("VisualRecoilPositionBump", true) or 1.5
fake = self:GetProcessedValue("VisualRecoilPositionBump", true) or 1.5
local isRTscoped = CLIENT and self:GetSight() and self:GetSight().atttbl and self:GetSight().atttbl.RTScope -- horible
local bumpup = (isRTscoped and self:GetProcessedValue("VisualRecoilPositionBumpUpRTScope", true) or self:GetProcessedValue("VisualRecoilPositionBumpUp", true)) or 0.08
local bumpup = (self:IsUsingRTScope() and self.VisualRecoilPositionBumpUpRTScope or self:GetProcessedValue("VisualRecoilPositionBumpUp")) or 0.08
fake = Lerp(self:GetSightDelta(), fake, 1)