Preset snapshots take consistent angles now

This commit is contained in:
Haodong Mo 2022-03-24 17:33:05 +11:00
parent a6a6d387eb
commit 84de9980e7
5 changed files with 38 additions and 16 deletions

View File

@ -83,6 +83,7 @@ The base weapon is also considered.
HookT: Table hooks. Return a {table} of values. Every hook's returned values are gathered into one big table for later use. Every returned value is used.
HookA: Accumulator hooks. Return an Angle, Vector, or Number - the resulting value is made up of all of these values added together.
HookP: Pipeline hooks. Accept previously returned data, return new data. Each function modifies the data given. Return nil to make no change. Used for things like animation translate.
HookC: Check hooks. Return false to prevent something from happening.
Hooks run in an order that can be compared as such:
1. If A's \[Hook_*\]_Priority value is higher than B (Unspecified is treated as 1) then run it first.

View File

@ -501,6 +501,25 @@ function ARC9.DrawPhysBullets()
local pos = i.Pos
local speedvec = -i.Vel:GetNormalized()
local vec = speedvec
local shoulddraw = true
if IsValid(i.Weapon) then
shoulddraw = i.Weapon:RunHook("HookC_DrawBullet", i)
local fromvec = (i.Weapon:GetTracerOrigin() - pos):GetNormalized()
local d = math.min(i.Travelled / 1024, 1)
if i.Indirect then
d = 1
end
vec = LerpVector(d, fromvec, speedvec)
end
if !shoulddraw then continue end
if i.ModelIndex != 0 then
if IsValid(i.ClientModel) then
i.ClientModel:SetPos(pos)
@ -532,20 +551,6 @@ function ARC9.DrawPhysBullets()
render.SetMaterial(tracer)
local speedvec = -i.Vel:GetNormalized()
local vec = speedvec
if IsValid(i.Weapon) then
local fromvec = (i.Weapon:GetTracerOrigin() - pos):GetNormalized()
local d = math.min(i.Travelled / 1024, 1)
if i.Indirect then
d = 1
end
vec = LerpVector(d, fromvec, speedvec)
end
render.DrawBeam(pos, pos + (vec * math.min(i.Vel:Length() * 0.1, math.min(512, i.Travelled - 64))), size * 0.75, 1, 0, col)
-- cam.End3D()

View File

@ -155,7 +155,22 @@ function SWEP:DoPresetCapture(filename)
ARC9.PresetCam = true
cam.Start3D()
local campos, camang = Vector(0, 0, 0), Angle(0, 0, 0)
local custpos, custang = self:GetProcessedValue("CustomizePos"), self:GetProcessedValue("CustomizeAng")
camang = self.LastViewModelAng
campos = self.LastViewModelPos
camang:RotateAroundAxis(camang:Up(), -custang.p)
camang:RotateAroundAxis(camang:Right(), -custang.y)
camang:RotateAroundAxis(camang:Forward(), -custang.r)
campos = campos + camang:Right() * -custpos.x
campos = campos + camang:Forward() * -custpos.y
campos = campos + camang:Up() * -custpos.z
cam.Start3D(campos, camang, 75, 0, 0, ScrW(), ScrH(), 4, 1024)
render.ClearDepth()

View File

@ -58,7 +58,7 @@ function SWEP:Reload()
local newcliptime = self:GetAnimationEntry(self:TranslateAnimation(anim)).MagSwapTime or 0.25
self:SetTimer(t * newcliptime, function()
self:SetTimer(self:GetProcessedValue("ReloadTime") * newcliptime, function()
self:SetLoadedRounds(math.min(self:GetValue("ClipSize"), self:Clip1() + self:Ammo1()))
end)
end

View File

@ -377,6 +377,7 @@ SWEP.MalfunctionMeanShotsToFail = 1000 -- The mean number of shots between malfu
-- SWEP.Hook_RTScopeReticle = function(self, {rtsize = num, rtmat = Material})
-- SWEP.Hook_ModifyRecoilDir = function(self, dir) return dir end # direction of recoil in degrees, 0 = up
-- SWEP.HookP_ModifyFiremode = function(self, firemode) return firemode end
-- SWEP.HookC_DrawBullet = function(self, bullet) return bool end -- called when a bullet gets drawn, return true to prevent drawing bullet
-- SWEP.HookP_ModifyBullet = function(self, bullet) return end # bullet = phys bullet table, modify in place, does not accept return
-- SWEP.HookP_ModifyNewBullet = function(self, bullet) return end # bullet = phys bullet table, modify in place, does not accept return
-- SWEP.HookP_BlockFire = function(self) return block end # return true to block firing