mirror of
https://github.com/HaodongMo/ARC-9.git
synced 2025-03-04 03:02:58 -05:00
traversal sprint, double tap w
This commit is contained in:
parent
31c2d4fe28
commit
ee6935c02a
@ -15,6 +15,10 @@ function ARC9.Move(ply, mv, cmd)
|
||||
if ply:KeyDown(IN_SPEED) then
|
||||
mult = mult / Lerp(wpn:GetSightAmount(), 1, ply:GetRunSpeed() / ply:GetWalkSpeed())
|
||||
end
|
||||
else
|
||||
if wpn:GetTraversalSprint() then
|
||||
mult = 1
|
||||
end
|
||||
end
|
||||
|
||||
mv:SetMaxSpeed(basespd * mult)
|
||||
|
@ -150,10 +150,6 @@ function SWEP:DoRTScopeEffects()
|
||||
|
||||
render.UpdateScreenEffectTexture()
|
||||
|
||||
if atttbl.RTScopeMotionBlur then
|
||||
DrawMotionBlur(0.1, 0.5, 0)
|
||||
end
|
||||
|
||||
if atttbl.RTScopeNoPP then return end
|
||||
|
||||
pp_ca_r:SetTexture("$basetexture", rtmat)
|
||||
@ -173,6 +169,10 @@ function SWEP:DoRTScopeEffects()
|
||||
-- Sharpen
|
||||
-- DrawSharpen(0.05, 12) -- dont work for some reason
|
||||
|
||||
if atttbl.RTScopeMotionBlur then
|
||||
DrawMotionBlur(0.1, 0.5, 0)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function SWEP:DoRTScope(model, atttbl)
|
||||
|
@ -6,6 +6,8 @@ local function qerp(delta, a, b)
|
||||
return Lerp(qdelta, a, b)
|
||||
end
|
||||
|
||||
local lhik_ts_delta = 0
|
||||
|
||||
function SWEP:DoRHIK()
|
||||
-- local vm = self:GetOwner():GetHands()
|
||||
local vm = self:GetVM()
|
||||
@ -15,10 +17,20 @@ function SWEP:DoRHIK()
|
||||
|
||||
vm:SetupBones()
|
||||
|
||||
local cdelta = self:Curve(self.CustomizeDelta)
|
||||
local lh_delta = 1
|
||||
local rh_delta = 1
|
||||
|
||||
lhik_ts_delta = self:GetTraversalSprintAmount()
|
||||
|
||||
local hide_lh_d = 0
|
||||
local hide_rh_d = 0
|
||||
|
||||
hide_lh_d = math.max(lhik_ts_delta, self.CustomizeDelta)
|
||||
hide_rh_d = self.CustomizeDelta
|
||||
|
||||
hide_lh_d = math.ease.InCubic(hide_lh_d)
|
||||
hide_rh_d = math.ease.InCubic(hide_rh_d)
|
||||
|
||||
local iktl = (self.Animations[self:GetIKAnimation() or ""] or {}).IKTimeLine
|
||||
local iket = self:GetIKTime()
|
||||
local iklt = math.Clamp((CurTime() - self:GetIKTimeLineStart()) / iket, 0, 1)
|
||||
@ -261,7 +273,7 @@ function SWEP:DoRHIK()
|
||||
end
|
||||
end
|
||||
|
||||
if cdelta > 0 then
|
||||
if hide_lh_d > 0 then
|
||||
for _, bone in ipairs(ARC9.LHIKBones) do
|
||||
local vmbone = vm:LookupBone(bone)
|
||||
|
||||
@ -276,12 +288,14 @@ function SWEP:DoRHIK()
|
||||
|
||||
local newtransform = Matrix()
|
||||
|
||||
newtransform:SetTranslation(LerpVector(cdelta, vm_pos, vm_pos - (EyeAngles():Up() * 128) - (EyeAngles():Forward() * 128)))
|
||||
newtransform:SetTranslation(LerpVector(hide_lh_d, vm_pos, vm_pos - (EyeAngles():Up() * 48) - (EyeAngles():Forward() * 16)))
|
||||
newtransform:SetAngles(vm_ang)
|
||||
|
||||
vm:SetBoneMatrix(vmbone, newtransform)
|
||||
end
|
||||
end
|
||||
|
||||
if hide_rh_d > 0 then
|
||||
for _, bone in ipairs(ARC9.RHIKBones) do
|
||||
local vmbone = vm:LookupBone(bone)
|
||||
|
||||
@ -296,7 +310,7 @@ function SWEP:DoRHIK()
|
||||
|
||||
local newtransform = Matrix()
|
||||
|
||||
newtransform:SetTranslation(LerpVector(cdelta, vm_pos, vm_pos - (EyeAngles():Up() * 128) - (EyeAngles():Forward() * 128)))
|
||||
newtransform:SetTranslation(LerpVector(hide_rh_d, vm_pos, vm_pos - (EyeAngles():Up() * 48) - (EyeAngles():Forward() * 16)))
|
||||
newtransform:SetAngles(vm_ang)
|
||||
|
||||
vm:SetBoneMatrix(vmbone, newtransform)
|
||||
|
@ -64,6 +64,8 @@ SWEP.BobCT = 0
|
||||
function SWEP:GetViewModelBob(pos, ang)
|
||||
local step = 10
|
||||
local mag = 1
|
||||
local ts = self:GetTraversalSprintAmount()
|
||||
-- ts = 1
|
||||
|
||||
if self:GetCustomize() then return pos, ang end
|
||||
|
||||
@ -78,14 +80,15 @@ function SWEP:GetViewModelBob(pos, ang)
|
||||
self.ViewModelNotOnGround = math.Approach(self.ViewModelNotOnGround, 1, FrameTime() / 1)
|
||||
end
|
||||
|
||||
d = d * Lerp(self:GetSightAmount(), 1, 0.5)
|
||||
d = d * Lerp(self:GetSightAmount(), 1, 0.5) * Lerp(ts, 1, 1.5)
|
||||
mag = d * 2
|
||||
mag = mag * Lerp(ts, 1, 1.5)
|
||||
step = 10
|
||||
|
||||
ang:RotateAroundAxis(ang:Forward(), math.sin(self.BobCT * step * 0.5) * ((math.sin(CurTime() * 6.151) * 0.2) + 1) * 4.5 * d)
|
||||
ang:RotateAroundAxis(ang:Right(), math.sin(self.BobCT * step * 0.12) * ((math.sin(CurTime() * 1.521) * 0.2) + 1) * 2.11 * d)
|
||||
pos = pos - (ang:Up() * math.sin(self.BobCT * step) * 0.07 * ((math.sin(CurTime() * 3.515) * 0.2) + 1) * mag)
|
||||
pos = pos + (ang:Forward() * math.sin(self.BobCT * step * 0.3) * 0.11 * ((math.sin(CurTime() * 1.615) * 0.2) + 1) * mag)
|
||||
pos = pos + (ang:Forward() * math.sin(self.BobCT * step * 0.3) * 0.11 * ((math.sin(CurTime() * 2) * ts * 1.25) + 1) * ((math.sin(CurTime() * 1.615) * 0.2) + 1) * mag)
|
||||
pos = pos + (ang:Right() * (math.sin(self.BobCT * step * 0.15) + (math.cos(self.BobCT * step * 0.3332))) * 0.16 * mag)
|
||||
|
||||
local steprate = Lerp(d, 1, 2.5)
|
||||
|
@ -92,11 +92,22 @@ function SWEP:GetViewModelPosition(pos, ang)
|
||||
local curvedcustomizedelta = self:Curve(self.CustomizeDelta)
|
||||
|
||||
-- local sprintdelta = self:Curve(self:GetSprintDelta())
|
||||
local sprintdelta = math.ease.InOutQuad(self:GetSprintDelta()) - curvedcustomizedelta
|
||||
local sprintdelta = self:GetSprintDelta()
|
||||
local ts_sprintdelta = self:GetTraversalSprintAmount()
|
||||
sprintdelta = math.ease.InOutQuad(sprintdelta) - curvedcustomizedelta
|
||||
ts_sprintdelta = math.ease.InOutSine(ts_sprintdelta)
|
||||
|
||||
sprintdelta = math.max(sprintdelta, ts_sprintdelta)
|
||||
|
||||
if sprintdelta > 0 then
|
||||
offsetpos = LerpVector(sprintdelta, offsetpos, self:GetProcessedValue("SprintPos") or self:GetProcessedValue("HolsterPos"))
|
||||
offsetang = LerpAngle(sprintdelta, offsetang, self:GetProcessedValue("SprintAng") or self:GetProcessedValue("HolsterAng"))
|
||||
local sprpos = self:GetProcessedValue("SprintPos") or self:GetProcessedValue("RestPos")
|
||||
local sprang = self:GetProcessedValue("SprintAng") or self:GetProcessedValue("RestAng")
|
||||
|
||||
sprpos = LerpVector(ts_sprintdelta, sprpos, self:GetProcessedValue("TraversalSprintPos"))
|
||||
sprang = LerpAngle(ts_sprintdelta, sprang, self:GetProcessedValue("TraversalSprintAng"))
|
||||
|
||||
offsetpos = LerpVector(sprintdelta, offsetpos, sprpos)
|
||||
offsetang = LerpAngle(sprintdelta, offsetang, sprang)
|
||||
|
||||
extra_offsetang = LerpAngle(sprintdelta, extra_offsetang, Angle(0, 0, 0))
|
||||
end
|
||||
|
@ -69,7 +69,7 @@ function SWEP:ToggleSafety(onoff)
|
||||
end
|
||||
|
||||
function SWEP:ThinkFiremodes()
|
||||
if self:GetOwner():KeyPressed(IN_ATTACK2) and self:GetOwner():KeyDown(IN_USE) then
|
||||
if IsFirstTimePredicted() and self:GetOwner():KeyPressed(IN_ATTACK2) and self:GetOwner():KeyDown(IN_USE) then
|
||||
self:ToggleSafety()
|
||||
end
|
||||
|
||||
|
@ -30,6 +30,8 @@ function SWEP:Deploy()
|
||||
self:SetPrimedAttack(false)
|
||||
self:SetReloading(false)
|
||||
self:SetHolster_Time(0)
|
||||
self:SetTraversalSprint(false)
|
||||
self:SetLastPressedWTime(0)
|
||||
|
||||
self:SetBlindFire(false)
|
||||
self:SetBlindFireLeft(false)
|
||||
|
@ -24,6 +24,7 @@ function SWEP:Reload()
|
||||
|
||||
if self:StillWaiting() then return end
|
||||
if self:GetCapacity() <= 0 then return end
|
||||
if self:GetTraversalSprintAmount() >= 1 then return end
|
||||
if self:Clip1() >= self:GetCapacity() then return end
|
||||
if self:Ammo1() <= 0 then return end
|
||||
|
||||
|
@ -21,6 +21,7 @@ end
|
||||
|
||||
function SWEP:SprintLock()
|
||||
if self:GetSprintAmount() > 0 then return true end
|
||||
if self:GetTraversalSprintAmount() > 0 then return true end
|
||||
if self:GetIsSprinting() then return true end
|
||||
|
||||
return false
|
||||
|
@ -2,6 +2,10 @@ function SWEP:GetSprintToFireTime()
|
||||
return self:GetProcessedValue("SprintToFireTime")
|
||||
end
|
||||
|
||||
function SWEP:GetTraverseSprintToFireTime()
|
||||
return self:GetProcessedValue("SprintToFireTime") * 1.5
|
||||
end
|
||||
|
||||
function SWEP:GetIsSprinting()
|
||||
local owner = self:GetOwner()
|
||||
|
||||
@ -49,6 +53,7 @@ function SWEP:ThinkSprint()
|
||||
end
|
||||
|
||||
local amt = self:GetSprintAmount()
|
||||
local ts_amt = self:GetTraversalSprintAmount()
|
||||
|
||||
if self.LastWasSprinting and !sprinting then
|
||||
self:ExitSprint()
|
||||
@ -60,9 +65,29 @@ function SWEP:ThinkSprint()
|
||||
|
||||
if sprinting then
|
||||
amt = math.Approach(amt, 1, FrameTime() / self:GetSprintToFireTime())
|
||||
if self:GetTraversalSprint() then
|
||||
ts_amt = math.Approach(ts_amt, 1, FrameTime() / (self:GetTraverseSprintToFireTime()))
|
||||
end
|
||||
else
|
||||
amt = math.Approach(amt, 0, FrameTime() / self:GetSprintToFireTime())
|
||||
end
|
||||
|
||||
if !self:GetTraversalSprint() then
|
||||
ts_amt = math.Approach(ts_amt, 0, FrameTime() / (self:GetTraverseSprintToFireTime()))
|
||||
end
|
||||
|
||||
self:SetTraversalSprintAmount(ts_amt)
|
||||
self:SetSprintAmount(amt)
|
||||
|
||||
if self:GetOwner():KeyDown(IN_SPEED) and self:GetOwner():KeyPressed(IN_FORWARD) then
|
||||
if self:GetLastPressedWTime() >= (CurTime() - 0.33) then
|
||||
self:SetTraversalSprint(true)
|
||||
else
|
||||
self:SetLastPressedWTime(CurTime())
|
||||
end
|
||||
end
|
||||
|
||||
if self:GetTraversalSprint() and (!sprinting or !self:GetOwner():KeyDown(IN_FORWARD)) then
|
||||
self:SetTraversalSprint(false)
|
||||
end
|
||||
end
|
@ -522,6 +522,9 @@ SWEP.RestAng = Angle(-4.633, 36.881, 0)
|
||||
SWEP.SprintPos = nil
|
||||
SWEP.SprintAng = nil
|
||||
|
||||
SWEP.TraversalSprintPos = Vector(2, 3, -13)
|
||||
SWEP.TraversalSprintAng = Angle(0, 75, 0)
|
||||
|
||||
SWEP.HolsterPos = Vector(0, 0, -5)
|
||||
SWEP.HolsterAng = Angle(0, -15, 25)
|
||||
|
||||
@ -776,6 +779,8 @@ function SWEP:SetupDataTables()
|
||||
self:NetworkVar("Float", 16, "IKTimeLineStart")
|
||||
self:NetworkVar("Float", 17, "IKTime")
|
||||
self:NetworkVar("Float", 18, "Holster_Time")
|
||||
self:NetworkVar("Float", 19, "LastPressedWTime")
|
||||
self:NetworkVar("Float", 20, "TraversalSprintAmount")
|
||||
|
||||
self:NetworkVar("Int", 0, "BurstCount")
|
||||
self:NetworkVar("Int", 1, "NthShot")
|
||||
@ -799,6 +804,7 @@ function SWEP:SetupDataTables()
|
||||
self:NetworkVar("Bool", 12, "BlindFire")
|
||||
self:NetworkVar("Bool", 13, "BlindFireLeft")
|
||||
self:NetworkVar("Bool", 14, "NeedsCycle")
|
||||
self:NetworkVar("Bool", 15, "TraversalSprint")
|
||||
|
||||
self:NetworkVar("Angle", 0, "FreeAimAngle")
|
||||
self:NetworkVar("Angle", 1, "LastAimAngle")
|
||||
|
Loading…
Reference in New Issue
Block a user