A ton of stuff I forgot

This commit is contained in:
Fesiug 2024-08-30 18:30:03 -04:00
parent a7d0c55142
commit 5b4497a0cd
Signed by: Fesiug
GPG Key ID: 374BFF45E1EEF243
8 changed files with 509 additions and 138 deletions

View File

@ -41,7 +41,7 @@ if CLIENT then
local s = ScreenScaleH
local function DST( text, font, x, y, color )
for O=1, 2 do
for O=1, 1 do
draw.SimpleText( text, font, x-O, y-O, color_black )
draw.SimpleText( text, font, x, y-O, color_black )
draw.SimpleText( text, font, x+O, y-O, color_black )
@ -213,14 +213,14 @@ ENT.States = {
if (self.NextFire or 0) <= CurTime() then
local rp = RecipientFilter()
rp:AddAllPlayers()
self:EmitSound("benny/weapons/usp/01.ogg", 100, 100, 0.2, nil, nil, nil, rp )
self:FireBullets( {
Attacker = self,
Inflictor = self,
Damage = 3,
Dir = self:EyeAngles():Forward(),
Src = self:EyePos()
} )
self:EmitSound("benny/weapons/usp/01.ogg", 80, 100, 0.2, nil, nil, nil, rp )
--self:FireBullets( {
-- Attacker = self,
-- Inflictor = self,
-- Damage = 3,
-- Dir = self:EyeAngles():Forward(),
-- Src = self:EyePos()
--} )
self.NextFire = CurTime() + 0.5
end
else

View File

@ -3,7 +3,7 @@
-- Your Name is Benny
---------------------
local cam_f = CreateConVar( "b-cam_f", -50 )
local cam_f = CreateConVar( "b-cam_f", -75 )
local cam_r = CreateConVar( "b-cam_r", 12 )
local cam_u = CreateConVar( "b-cam_u", 0 )
local cam_fov = CreateConVar( "b-cam_fov", 75 )

View File

@ -26,7 +26,7 @@ end
local function OpenDebugMenu()
if IsValid(DebugMenu) then DebugMenu:Remove() end
DebugMenu = vgui.Create("DFrame")
DebugMenu:SetSize( 400, 300 )
DebugMenu:SetSize( 200, 500 )
DebugMenu:Center()
DebugMenu:MakePopup()
DebugMenu:SetKeyboardInputEnabled( false )
@ -34,10 +34,21 @@ local function OpenDebugMenu()
local opt = DebugMenu:Add("DScrollPanel")
opt:Dock( FILL )
local categories = {}
for iname, idata in SortedPairs( ITEMS ) do
local button = opt:Add("DButton")
if !categories[idata.Category] then
local cate = opt:Add("DCollapsibleCategory")
cate:Dock(TOP)
cate:SetLabel(idata.Category)
local plist = vgui.Create("DPanelList")
cate:SetContents(plist)
categories[idata.Category] = plist
end
local plist = categories[idata.Category]
local button = plist:Add("DButton")
button:Dock( TOP )
button:DockMargin( 4, 4, 4, 0 )
button:DockMargin( 0, 0, 0, 0 )
button:SetText( l8( idata.PrintName ) )
button.iName = iname
button.iData = idata

View File

@ -40,6 +40,14 @@ local function hRect( x, y, w, h )
surface.DrawRect( x, y, w, h )
end
local function hRRect( x, y, w, h, r )
gx, gy = hXY()
x = (x or 0) + gx
y = (y or 0) + gy
draw.RoundedBox( r, x, y, w, h, surface.GetDrawColor() )
end
local function hTRect( x, y, w, h )
gx, gy = hXY()
x = (x or 0) + gx
@ -147,6 +155,11 @@ local function commoncode( set )
end
end
local fmlookup = {
[1] = "SEMI",
[math.huge] = "AUTO",
}
-- Drawing
function GM:HUDPaint()
local p = LocalPlayer()
@ -154,24 +167,42 @@ function GM:HUDPaint()
local handler = p:HandlerCheck()
stack = util.Stack()
S_Push( 20, 20 )
-- S_Push( math.random( -4, 4 ), math.random( -4, 4 ) )
S_Push( 20, h - 20 - 64 )
hCol( COLOR_DARK )
hRect( 0, 0, 320, 40 )
hRRect( 0, 0, 328, 64, 8 )
local x, y = hXY( 6, 0 )
draw.SimpleText( "BENNY", "HUD_48", x, y, COLOR_MAIN )
hCol( COLOR_MAIN )
hRect( 4, 4, (320-4-4) * p:GetHealth_Blood()/1000, 40-4-4 )
hRect( 8, 8, (320-4-4) * p:GetHealth_Blood()/1000, 40-4-4 )
hCol( COLOR_DARK )
hORect( 8+1, 8+1, (320-4-4)-2, 40-4-4-2, 1 )
hScis( 4, 4, (320-4-4) * p:GetHealth_Blood()/1000, 40-4-4 )
local x, y = hXY( 6, 0 )
hCol( COLOR_MAIN )
hScis( 8, 8, (320-4-4) * p:GetHealth_Blood()/1000, 40-4-4 )
local x, y = hXY( 10, 4 )
draw.SimpleText( "BENNY", "HUD_48", x, y, COLOR_DARK )
hScisoff()
local slen = (320-4-4-4-4-4)
hCol( COLOR_MAIN )
hRect( 8, 44, slen*0.25, 12 )
hRect( 8 + (slen*0.25+4), 44, slen*0.25, 12 )
hRect( 8 + (slen*0.25+4)*2, 44, slen*0.25, 12 )
hRect( 8 + (slen*0.25+4)*3, 44, slen*0.25, 12 )
hCol( COLOR_DARK )
hORect( 8+1, 44+1, slen*0.25 - 2, 12-2, 1 )
hORect( 8+1 + (slen*0.25+4), 44+1, slen*0.25 - 2, 12-2, 1 )
hORect( 8+1 + (slen*0.25+4)*2, 44+1, slen*0.25 - 2, 12-2, 1 )
hORect( 8+1 + (slen*0.25+4)*3, 44+1, slen*0.25 - 2, 12-2, 1 )
S_Pop()
if handler then
S_Push( 20, h - 60 - 20 )
S_Push( 20, 20 )
for i, v in ipairs( p:GetInventory():GetWeighted() ) do
hCol( v == handler:GetActiveR() and COLOR_BRIGHT or COLOR_DARK )
hRect( (i-1)*(120+10), 0, 120, 60 )
@ -194,6 +225,40 @@ function GM:HUDPaint()
end
end
S_Pop()
local wep = handler:GetActiveR()
if wep and wep.GetClip then
local Bw, Bh = 328, 160
S_Push( w - 20 - Bw, h - 20 - Bh )
hCol( COLOR_DARK )
hRRect( 0, 0, Bw, Bh, 8 )
hCol( COLOR_MAIN )
local leng = Bw-8-8
hRect( 8, 8, leng-70, 26 )
hRect( 8 + leng - 70 + 4, 8, leng-(leng-70)-4, 26 )
local x, y = hXY( 12, 6 )
draw.SimpleText( l8( wep.Class.PrintName ), "HUD_36", x, y, COLOR_DARK )
local x, y = hXY( 10 + (leng - 70) + 70/2, 11 )
local bc = wep.Class.BurstCount
draw.SimpleText( fmlookup[bc] or bc .. "RND", "HUD_24", x, y, COLOR_DARK, TEXT_ALIGN_CENTER )
S_Push( Bw - 8 - 8, Bh - 18 - 8 )
for i=0, wep.Class.ClipSize-1 do
if (wep:GetClip() + (wep:GetSlideState() == SLIDE_FORWARD and 1 or 0)) >= (i+1) then
hCol( COLOR_MAIN )
hRect( (0 - 8 - 2)*i, 0, 8, 18 )
hCol( COLOR_DARK )
hRect( (0 - 8 - 2)*i, 14, 8, 2 )
else
hCol( COLOR_BRIGHT )
hORect( (0 - 8 - 2)*i, 0, 8, 18 )
--hORect( (0 - 8 - 2)*i+1, 1, 8-2, 18-2 )
end
end
S_Pop()
S_Pop()
end
end
if false then
@ -213,10 +278,12 @@ function GM:HUDPaint()
S_Pop()
end
local itemcheck = handler:ItemCheckTrace()
--local itemcheck = handler:ItemCheckTrace()
-- Hints
if true then
S_Push( w - 20, h - 20 )
S_Push( w - 20, 20 )
local hints = {}
@ -229,23 +296,32 @@ function GM:HUDPaint()
table.insert( hints, { "[E]", "THROW" } )
table.insert( hints, { "[R]", "RELOAD" } )
table.insert( hints, { "", "RETAIN MAG", "HOLD" } )
elseif itemcheck.Entity:IsValid() and itemcheck.Entity.BennyItem then
table.insert( hints, { "", "- - - - - - - - - - - -" } )
table.insert( hints, { "[E]", "PICK UP" } )
--elseif itemcheck.Entity:IsValid() and itemcheck.Entity.BennyItem then
-- table.insert( hints, { "", "- - - - - - - - - - - -" } )
-- table.insert( hints, { "[E]", "PICK UP" } )
end
local x, y = hXY( 0, (#hints-1)*(-24) )
local x, y = hXY( 0, 0 )
for i, v in ipairs( hints ) do
draw.SimpleText( v[1], "HUD_24", x - 150, y - 24 + (24*(i-1)), COLOR_MAIN, TEXT_ALIGN_CENTER )
draw.SimpleText( v[2], "HUD_24", x, y - 24 + (24*(i-1)), COLOR_MAIN, TEXT_ALIGN_RIGHT )
draw.SimpleText( v[1], "HUD_24", x - 150 + 1, y + (24*(i-1)) + 1, COLOR_DARK, TEXT_ALIGN_CENTER )
draw.SimpleText( v[2], "HUD_24", x + 1, y + (24*(i-1)) + 1, COLOR_DARK, TEXT_ALIGN_RIGHT )
if v[3] then
draw.SimpleText( v[3], "HUD_16", x - 150, y - 24+3 + (24*(i-1)), COLOR_MAIN, TEXT_ALIGN_CENTER )
draw.SimpleText( v[3], "HUD_16", x - 150 + 1, y+3 + (24*(i-1)) + 1, COLOR_DARK, TEXT_ALIGN_CENTER )
end
end
for i, v in ipairs( hints ) do
draw.SimpleText( v[1], "HUD_24", x - 150, y + (24*(i-1)), COLOR_MAIN, TEXT_ALIGN_CENTER )
draw.SimpleText( v[2], "HUD_24", x, y + (24*(i-1)), COLOR_MAIN, TEXT_ALIGN_RIGHT )
if v[3] then
draw.SimpleText( v[3], "HUD_16", x - 150, y+3 + (24*(i-1)), COLOR_MAIN, TEXT_ALIGN_CENTER )
end
end
S_Pop()
end
-- S_Pop()
local trac = p:GetEyeTrace().HitPos:ToScreen()
local trac2 = util.TraceLine( {
start = CamSpot(),
@ -256,7 +332,7 @@ function GM:HUDPaint()
for i=1, 2 do
local shadowtime = i==1
local traac = shadowtime and trac2 or trac
local cx, cy = traac.x, traac.y
local cx, cy = math.Round(traac.x), math.Round(traac.y)
S_Push( cx, cy )
local lol = shadowtime and 0 or 255
surface.SetDrawColor( lol, lol, lol )

View File

@ -76,27 +76,27 @@ AddItem( "base", {
local AnimationLookup = {
["fire"] = {
["handgun"] = "fire_handgun",
["handgun"] = "handgun_fire",
["rifle"] = "rifle_fire",
},
["reload"] = {
["handgun"] = "reload_handgun",
["handgun"] = "handgun_reload",
["rifle"] = "rifle_reload",
},
["reload_rack"] = {
["handgun"] = "reload_handgun_rack",
["handgun"] = "handgun_reload_rack",
["rifle"] = "rifle_reload_rack",
},
["reload_insert"] = {
["handgun"] = "reload_handgun_insert",
["handgun"] = "handgun_reload_insert",
["rifle"] = "rifle_reload_insert",
},
["deploy"] = {
["handgun"] = "deploy_handgun",
["handgun"] = "handgun_deploy",
["rifle"] = "rifle_deploy",
},
["holster"] = {
["handgun"] = "holster_handgun",
["handgun"] = "handgun_holster",
["rifle"] = "holster_handgun",
},
}
@ -218,6 +218,7 @@ AddItem( "base_firearm", {
local acc = math.rad( class.Accuracy or 0 )
local p = handler:GetOwner()
p:LagCompensation(true)
handler:FireBullets( {
Attacker = p,
Damage = 1,
@ -227,6 +228,7 @@ AddItem( "base_firearm", {
Src = p:GetShootPos(),
Spread = Vector( acc, acc, 0 ),
} )
p:LagCompensation(false)
local ply = handler:GetOwner()
ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD, ply:LookupSequence( AnimationLookup["fire"][class.HoldType] ), 0, true )
@ -240,36 +242,41 @@ AddItem( "base_firearm", {
if ent:GetDelay() > CurTime() then return end
ent:SetDelay( CurTime() + 0.6 )
local ply = handler:GetOwner()
local time = 0.6
if (ent:GetClip() > 0) and ent:GetSlideState() == SLIDE_BACK 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 )
ent:SetLoaded( false )
ent:SetClip( 0 )
ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD, ply:LookupSequence( AnimationLookup["reload"][class.HoldType] ), 0, true )
time = 0.4
else
handler:EmitSound( class.MagInSound, 70, 100, 0.4, CHAN_STATIC )
ent:SetLoaded( true )
ent:SetRefillTime( CurTime() + 0.5 )
ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD, ply:LookupSequence( AnimationLookup["reload_insert"][class.HoldType] ), 0, true )
time = 0.6
end
ent:SetDelay( CurTime() + time )
end,
["Deploy"] = function( class, ent, handler )
handler:EmitSound( "weapons/usp/usp_slideback.wav", 70, 125, 0.4, CHAN_STATIC )
ent:SetDelay( CurTime() + 0.25 )
ent:SetDelay( CurTime() + 0.5 )
local ply = handler:GetOwner()
ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD, ply:LookupSequence( AnimationLookup["deploy"][class.HoldType] ), 0, true )
@ -412,6 +419,76 @@ AddItem( "satchels", {
end,
})
AddItem( "toolgun", {
PrintName = "#Item.toolgun.Name",
Description = "#Item.toolgun.Description",
Category = "dev",
Base = "base",
Model = "models/benny/weapons/testgun.mdl",
HoldType = "handgun",
Vars = {
["Float"] = {
"Delay",
},
["Int"] = {
"BurstCount",
},
},
["Attack"] = function( class, ent, handler )
if ent:GetBurstCount() >= 1 then return end
if ent:GetDelay() > CurTime() then return end
ent:SetDelay( CurTime() + 0.1 )
ent:SetBurstCount( ent:GetBurstCount() + 1 )
handler:EmitSound("weapons/airboat/airboat_gun_lastshot1.wav", 100, 100, 1, CHAN_STATIC)
if SERVER then
local p = handler:GetOwner()
local tr = p:GetEyeTrace()
local summon = ents.Create( "b-npc_human" )
summon:SetPos( tr.HitPos + tr.HitNormal )
local ang = Angle( 0, p:EyeAngles().y+0, 0 )
summon:SetAngles( ang )
summon:Spawn()
end
end,
["AttackAlt"] = function( class, ent, handler )
if ent:GetDelay() > CurTime() then return end
ent:SetDelay( CurTime() + 0.5 )
end,
["Reload"] = function( class, ent, handler )
end,
["Think"] = function( class, ent, handler )
if ent:GetBurstCount() > 0 and !handler:GetOwner():KeyDown( IN_ATTACK ) then
ent:SetBurstCount( 0 )
end
end,
["Deploy"] = function( class, ent, handler )
ent:SetDelay( CurTime() + 0.5 )
local ply = handler:GetOwner()
ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD, ply:LookupSequence( AnimationLookup["deploy"][class.HoldType] ), 0, true )
end,
["Holster"] = function( class, ent, handler )
ent:SetDelay( CurTime() + 0.25 )
local ply = handler:GetOwner()
ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD, ply:LookupSequence( AnimationLookup["holster"][class.HoldType] ), 0, true )
end,
})
do -- Handguns
AddItem( "mk23", {
PrintName = "#Item.mk23.Name",
Description = "#Item.mk23.Description",
@ -440,9 +517,14 @@ AddItem( "mk23", {
Accuracy_Decay = 5,
})
end
do -- Rifles
AddItem( "fnc", {
PrintName = "#Item.fnc.Name",
Description = "#Item.fnc.Description",
Category = "assaultrifle",
Base = "base_firearm_ubgl",
Model = "models/benny/weapons/testrifle2.mdl",--"models/weapons/w_rif_ar556.mdl",
@ -462,9 +544,33 @@ AddItem( "fnc", {
Accuracy_Decay = 12,
})
AddItem( "qbz", {
PrintName = "#Item.qbz.Name",
Description = "#Item.qbz.Description",
Category = "assaultrifle",
Base = "base_firearm",
Model = "models/benny/weapons/testrifle2.mdl",--"models/weapons/w_rif_ar556.mdl",
HoldType = "rifle",
ClipSize = 30,
Delay = (60/750),
FireSound = {
"benny/weapons/stoner63/01.ogg",
"benny/weapons/stoner63/02.ogg",
"benny/weapons/stoner63/03.ogg",
},
Accuracy = 1,
Accuracy_Add = 0.4,
Accuracy_Reset = 0.4,
Accuracy_Decay = 12,
})
AddItem( "m16a2", {
PrintName = "#Item.m16a2.Name",
Description = "#Item.m16a2.Description",
Category = "assaultrifle",
Base = "base_firearm",
Model = "models/benny/weapons/testrifle3.mdl",--"models/weapons/w_rif_m16a2.mdl",
@ -488,9 +594,90 @@ AddItem( "m16a2", {
Accuracy_Decay = 12,
})
end
do -- SMGs
AddItem( "tmp", {
PrintName = "#Item.tmp.Name",
Description = "#Item.tmp.Description",
Category = "smg",
Base = "base_firearm",
Model = "models/benny/weapons/testrifle2.mdl",--"models/weapons/w_rif_ar556.mdl",
HoldType = "handgun",
ClipSize = 15,
Delay = (60/850),
FireSound = {
"benny/weapons/tmp/01.ogg",
"benny/weapons/tmp/02.ogg",
"benny/weapons/tmp/03.ogg",
},
})
AddItem( "mp7", {
PrintName = "#Item.mp7.Name",
Description = "#Item.mp7.Description",
Category = "smg",
Base = "base_firearm",
Model = "models/benny/weapons/testrifle2.mdl",--"models/weapons/w_rif_ar556.mdl",
HoldType = "handgun",
ClipSize = 20,
Delay = (60/950),
FireSound = {
"benny/weapons/mp7/01.ogg",
"benny/weapons/mp7/02.ogg",
"benny/weapons/mp7/03.ogg",
},
})
AddItem( "mp5k", {
PrintName = "#Item.mp5k.Name",
Description = "#Item.mp5k.Description",
Category = "smg",
Base = "base_firearm",
Model = "models/benny/weapons/testrifle2.mdl",--"models/weapons/w_rif_ar556.mdl",
HoldType = "handgun",
ClipSize = 15,
Delay = (60/750),
FireSound = {
"benny/weapons/mp5k/01.ogg",
"benny/weapons/mp5k/02.ogg",
"benny/weapons/mp5k/03.ogg",
},
})
AddItem( "mac11", {
PrintName = "#Item.mac11.Name",
Description = "#Item.mac11.Description",
Category = "smg",
Base = "base_firearm",
Model = "models/benny/weapons/testrifle2.mdl",--"models/weapons/w_rif_ar556.mdl",
HoldType = "handgun",
ClipSize = 16,
Delay = (60/1000),
FireSound = {
"benny/weapons/mac11/01.ogg",
"benny/weapons/mac11/02.ogg",
"benny/weapons/mac11/03.ogg",
},
})
end
do -- Shotguns
AddItem( "spas12", {
PrintName = "#Item.spas12.Name",
Description = "#Item.spas12.Description",
Category = "shotgun",
Base = "base_firearm",
Model = "models/weapons/w_shotgun.mdl",
@ -516,6 +703,33 @@ AddItem( "spas12", {
Accuracy_Decay = 12,
})
end
-- bat
-- bat_wood
-- machete
-- kabar
-- baton
-- deagle
-- cz75a
-- glock
-- 1911
-- mk23
-- nambu
-- anaconda
-- tmp
-- mp7
-- mp5k
-- mac11
-- bizon
-- chicom
-- fnc
-- qbz
-- m16a2
for ID, Data in pairs(ITEMS) do
local tent = {}
tent.Base = "b-itembase"

View File

@ -9,11 +9,29 @@ L["#Item.mk23.Description"] = "Special forces sidearm"
L["#Item.fnc.Name"] = "FNC Para"
L["#Item.fnc.Description"] = "Imported assault rifle"
L["#Item.qbz.Name"] = "QBZ-95"
L["#Item.qbz.Description"] = "Low-profile bullpup assault rifle"
L["#Item.m16a2.Name"] = "M16A2"
L["#Item.m16a2.Description"] = "Rugged burst rifle"
L["#Item.spas12.Name"] = "SPAS-12"
L["#Item.spas12.Description"] = "Chrome-lined autoshotgun"
L["#Item.tmp.Name"] = "TMP"
L["#Item.tmp.Description"] = "Concealable machine pistol"
L["#Item.mp5k.Name"] = "MP5K"
L["#Item.mp5k.Description"] = "High-quality SMG"
L["#Item.mp7.Name"] = "MP7"
L["#Item.mp7.Description"] = "Special forces PDW"
L["#Item.mac11.Name"] = "MAC-11"
L["#Item.mac11.Description"] = "Tiny hornet gun"
L["#Item.satchels.Name"] = "Satchels"
L["#Item.satchels.Description"] = "Packs of bombs and a detonator"
L["#Item.toolgun.Name"] = "Tool gun"
L["#Item.toolgun.Description"] = "Developer tools"

View File

@ -144,11 +144,58 @@ function GM:UpdateAnimation( ply, vel, maxseqgroundspeed )
normal:Rotate( Angle( 0, -ply:EyeAngles().y, 0 ) )
local speed = (len2d/200)
--print( string.format( "x: %G, y: %G", normal.x, normal.y ))
local biggerone = math.max( math.abs(normal.x), math.abs(normal.y) )
local needer = 1+((1-biggerone)/biggerone)
normal.x = normal.x * needer
normal.y = normal.y * needer
local diveend = ply:GetLayerSequence( GESTURE_SLOT_JUMP ) == ply:LookupSequence("dive_end_handgun")
local divestart = ply:GetLayerSequence( GESTURE_SLOT_JUMP ) == ply:LookupSequence("dive_start_handgun")
if ply:GetInDive() or diveend then speed = 1 end
ply:SetPoseParameter( "move_x", normal.x * speed )
ply:SetPoseParameter( "move_y", normal.y * speed )
ply:SetAllowFullRotation( true )
ply:SetAngles( Angle( 0, ply:EyeAngles().y, 0 ) )
local magic = ply:EyeAngles().y
magic = -(magic - ply:GetRenderAngles().y)
--magic = magic % 180
if magic < -180 then
magic = magic + 360
elseif magic > 180 then
magic = magic - 360
end
magic = magic * 0.75
ply:SetPoseParameter( "aim_p", -ply:EyeAngles().p/90 )
ply:SetPoseParameter( "aim_y", 0 )--magic/90 )
ply:SetAllowFullRotation( false )
--ply:SetAngles( Angle( 0, ply:EyeAngles().y, 0 ) )
ply:SetRenderAngles( Angle( 0, ply:EyeAngles().y, 0 ) )
if diveend then
local magicnumber = ply:GetLayerCycle( GESTURE_SLOT_JUMP )
magicnumber = math.Remap( magicnumber, 0.5, 0.75, 1, 0 )
magicnumber = math.Clamp( magicnumber, 0, 1 )
ply:AnimSetGestureWeight( GESTURE_SLOT_JUMP, magicnumber )
elseif divestart then
local magicnumber = ply:GetLayerCycle( GESTURE_SLOT_JUMP )
magicnumber = math.Remap( magicnumber, 0.1, 0.6, 1, 0 )
magicnumber = math.Clamp( magicnumber, 0, 1 )
ply:AnimSetGestureWeight( GESTURE_SLOT_JUMP, magicnumber )
else
ply:AnimSetGestureWeight( GESTURE_SLOT_JUMP, 1 )
end
--local dir = ply:GetVelocity():GetNormalized()
--local dira
@ -211,7 +258,7 @@ function GM:CalcMainActivity( ply, velocity )
end
if ply:GetInDive() then
plyTable.CalcSeqOverride = ply:LookupSequence( "dive_idle" )
plyTable.CalcSeqOverride = ply:LookupSequence( "dive_idle_handgun" )
end
plyTable.m_bWasOnGround = ply:IsOnGround()
@ -269,8 +316,6 @@ if CLIENT then
end
hook.Add("Move", "Benny_Move", function( ply, mv )
ply:SetHull( Vector( -8, -8, 0 ), Vector( 8, 8, 72 ) )
ply:SetHullDuck( Vector( -8, -8, 0 ), Vector( 8, 8, 32 ) )
if mv:KeyDown( IN_SPEED ) and !ply:GetInDive() and (ply:GetDivedAt() + 0.5 <= CurTime()) then
local cool = Vector( mv:GetForwardSpeed(), -mv:GetSideSpeed(), 0 )
cool:Normalize()
@ -281,7 +326,7 @@ hook.Add("Move", "Benny_Move", function( ply, mv )
ply:SetGroundEntity( NULL )
ply:SetInDive( true )
ply:SetDivedAt( CurTime() )
ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_JUMP, ply:LookupSequence( "dive_start" ), 0, true )
ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_JUMP, ply:LookupSequence( "dive_start_handgun" ), 0, true )
if (SERVER) or (CLIENT and IsFirstTimePredicted()) then
local rfil = nil
if SERVER then
@ -291,6 +336,8 @@ hook.Add("Move", "Benny_Move", function( ply, mv )
end
ply:EmitSound("weapons/slam/throw.wav", 70, 100, .25, nil, nil, nil, rfil)
end
ply:SetHull( Vector( -8, -8, 32 ), Vector( 8, 8, 72 ) )
ply:SetHullDuck( Vector( -8, -8, 32 ), Vector( 8, 8, 48 ) )
end
if ply:OnGround() and ply:GetInDive() then
if (SERVER) or (CLIENT and IsFirstTimePredicted()) then
@ -304,7 +351,12 @@ hook.Add("Move", "Benny_Move", function( ply, mv )
end
ply:SetInDive(false)
ply:SetDivedAt( CurTime() )
ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_JUMP, ply:LookupSequence( "dive_end" ), 0, true )
ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_JUMP, ply:LookupSequence( "dive_end_handgun" ), 0, true )
ply:SetHull( Vector( -8, -8, 0 ), Vector( 8, 8, 72 ) )
ply:SetHullDuck( Vector( -8, -8, 0 ), Vector( 8, 8, 48 ) )
mv:SetVelocity( mv:GetVelocity() + Vector( 0, 0, 120 ) )
ply:SetGroundEntity( NULL )
mv:SetOrigin( mv:GetOrigin() + vector_up*32 )
end
--if !ply:OnGround() and ply:GetInDive() then
-- local da = ply:GetDivedAt()