Remove this stupid ass slide system, make a better one l8r

This commit is contained in:
Fesiug 2024-08-30 18:34:28 -04:00
parent 5b4497a0cd
commit f6089bf156
Signed by: Fesiug
GPG Key ID: 374BFF45E1EEF243
2 changed files with 6 additions and 36 deletions

View File

@ -217,7 +217,6 @@ function GM:HUDPaint()
local drawer = "" local drawer = ""
drawer = drawer .. v:GetClip() drawer = drawer .. v:GetClip()
drawer = drawer .. "+" .. (v:GetSlideState() == SLIDE_FORWARD and 1 or 0)
drawer = drawer .. "/" drawer = drawer .. "/"
drawer = drawer .. v.Class.ClipSize drawer = drawer .. v.Class.ClipSize
draw.SimpleText( drawer, "HUD_16", x + 10, y + 60/2 + (16), COLOR_MAIN, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER ) draw.SimpleText( drawer, "HUD_16", x + 10, y + 60/2 + (16), COLOR_MAIN, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER )
@ -245,7 +244,7 @@ function GM:HUDPaint()
S_Push( Bw - 8 - 8, Bh - 18 - 8 ) S_Push( Bw - 8 - 8, Bh - 18 - 8 )
for i=0, wep.Class.ClipSize-1 do for i=0, wep.Class.ClipSize-1 do
if (wep:GetClip() + (wep:GetSlideState() == SLIDE_FORWARD and 1 or 0)) >= (i+1) then if wep:GetClip() >= (i+1) then
hCol( COLOR_MAIN ) hCol( COLOR_MAIN )
hRect( (0 - 8 - 2)*i, 0, 8, 18 ) hRect( (0 - 8 - 2)*i, 0, 8, 18 )
hCol( COLOR_DARK ) hCol( COLOR_DARK )

View File

@ -101,10 +101,6 @@ local AnimationLookup = {
}, },
} }
SLIDE_FORWARD = 0 -- loaded
SLIDE_EMPTY = 1 -- empty
SLIDE_BACK = 2 -- back
AddItem( "base_firearm", { AddItem( "base_firearm", {
PrintName = "Base Firearm", PrintName = "Base Firearm",
Description = "Item base for firearms.", Description = "Item base for firearms.",
@ -121,7 +117,6 @@ AddItem( "base_firearm", {
"Clip", "Clip",
"BurstCount", "BurstCount",
"Firemode", "Firemode",
"SlideState", -- 0 = forward and loaded, 1 = forward and empty, 2 = back and empty
}, },
["Float"] = { ["Float"] = {
"Delay", "Delay",
@ -185,11 +180,10 @@ AddItem( "base_firearm", {
end, end,
["Attack"] = function( class, ent, handler ) ["Attack"] = function( class, ent, handler )
--if ent:GetClip() <= 0 then return end if ent:GetClip() <= 0 then return end
if ent:GetDelay() > CurTime() then return end if ent:GetDelay() > CurTime() then return end
if ent:GetDelayBurst() > CurTime() then return end if ent:GetDelayBurst() > CurTime() then return end
if ent:GetBurstCount() >= class.BurstCount then return end if ent:GetBurstCount() >= class.BurstCount then return end
if ent:GetSlideState() != SLIDE_FORWARD then handler:EmitSound( "benny/weapons/noammo.ogg", 70, 150, 0.4, CHAN_STATIC ) ent:SetDelay( CurTime() + 0.25 ) ent:SetBurstCount( 0 ) return end
local Runaway = class.BurstRunaway local Runaway = class.BurstRunaway
local BAuto = class.BurstAuto local BAuto = class.BurstAuto
@ -201,16 +195,9 @@ AddItem( "base_firearm", {
end end
end end
ent:SetSlideState( SLIDE_BACK ) ent:SetClip( ent:GetClip() - 1 )
--if ent:GetClip() == 0 then if ent:GetClip() == 0 then
if ent:GetClip() > 0 then
ent:SetClip( ent:GetClip() - 1 )
ent:SetSlideState( SLIDE_FORWARD )
else
handler:EmitSound( "benny/weapons/1911/slidedrop.ogg", 70, 100, 0.4, CHAN_STATIC ) handler:EmitSound( "benny/weapons/1911/slidedrop.ogg", 70, 100, 0.4, CHAN_STATIC )
if !ent:GetLoaded() then
ent:SetSlideState( SLIDE_EMPTY )
end
end end
ent:SetDelay( CurTime() + class.Delay ) ent:SetDelay( CurTime() + class.Delay )
@ -239,26 +226,12 @@ AddItem( "base_firearm", {
--handler:EmitSound( "weapons/m4a1/m4a1_boltpull.wav", 70, 125, 0.4, CHAN_STATIC ) --handler:EmitSound( "weapons/m4a1/m4a1_boltpull.wav", 70, 125, 0.4, CHAN_STATIC )
--ent:SetRefillTime( CurTime() + 0.1 ) --ent:SetRefillTime( CurTime() + 0.1 )
--handler:EmitSound( "benny/weapons/basic.ogg", 70, 100, 0.4, CHAN_STATIC ) --handler:EmitSound( "benny/weapons/basic.ogg", 70, 100, 0.4, CHAN_STATIC )
if ent:GetDelay() > CurTime() then return end if ent:GetDelay() > CurTime() then return end
local ply = handler:GetOwner() local ply = handler:GetOwner()
local time = 0.6 local time = 0.6
if (ent:GetClip() > 0) and ent:GetSlideState() == SLIDE_BACK then if ent:GetLoaded() then
handler:EmitSound( class.BoltDropSound, 70, 100, 0.4, CHAN_STATIC )
ent:SetSlideState( SLIDE_FORWARD )
ent:SetClip( ent:GetClip() - 1 )
ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD, ply:LookupSequence( AnimationLookup["reload_rack"][class.HoldType] ), 0, true )
time = 0.4
elseif (ent:GetClip() > 0) and ent:GetSlideState() == SLIDE_EMPTY then
handler:EmitSound( class.BoltPullSound, 70, 100, 0.4, CHAN_STATIC )
ent:SetSlideState( SLIDE_FORWARD )
ent:SetClip( ent:GetClip() - 1 )
ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD, ply:LookupSequence( AnimationLookup["reload_rack"][class.HoldType] ), 0, true )
time = 0.4
elseif ent:GetLoaded() then
handler:EmitSound( class.MagOutSound, 70, 100, 0.4, CHAN_STATIC ) handler:EmitSound( class.MagOutSound, 70, 100, 0.4, CHAN_STATIC )
ent:SetLoaded( false ) ent:SetLoaded( false )
ent:SetClip( 0 ) ent:SetClip( 0 )
@ -269,7 +242,7 @@ AddItem( "base_firearm", {
ent:SetLoaded( true ) ent:SetLoaded( true )
ent:SetRefillTime( CurTime() + 0.5 ) ent:SetRefillTime( CurTime() + 0.5 )
ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD, ply:LookupSequence( AnimationLookup["reload_insert"][class.HoldType] ), 0, true ) ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD, ply:LookupSequence( AnimationLookup["reload_insert"][class.HoldType] ), 0, true )
time = 0.6 time = 0.8
end end
ent:SetDelay( CurTime() + time ) ent:SetDelay( CurTime() + time )
end, end,
@ -288,8 +261,6 @@ AddItem( "base_firearm", {
handler:EmitSound( "weapons/m4a1/m4a1_deploy.wav", 70, 125, 0.4, CHAN_STATIC ) handler:EmitSound( "weapons/m4a1/m4a1_deploy.wav", 70, 125, 0.4, CHAN_STATIC )
ent:SetDelay( CurTime() + 0.25 ) ent:SetDelay( CurTime() + 0.25 )
if ent:GetSlideState() == SLIDE_BACK then ent:SetSlideState( SLIDE_EMPTY ) end
local ply = handler:GetOwner() local ply = handler:GetOwner()
ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD, ply:LookupSequence( AnimationLookup["holster"][class.HoldType] ), 0, true ) ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD, ply:LookupSequence( AnimationLookup["holster"][class.HoldType] ), 0, true )
end, end,