Burst rifle and weapon fixes
This commit is contained in:
parent
6f4ec8dac0
commit
42be9ec6ab
|
@ -137,6 +137,7 @@ function SWEP:EquipItem( ent )
|
|||
|
||||
ent:AddEFlags( EFL_KEEP_ON_RECREATE_ENTITIES )
|
||||
ent:AddEffects( EF_BONEMERGE )
|
||||
ent:PhysicsInit( SOLID_NONE )
|
||||
ent:SetMoveType( MOVETYPE_NONE )
|
||||
ent:SetNoDraw( true )
|
||||
ent:SetParent( p )
|
||||
|
@ -171,6 +172,7 @@ function SWEP:DropItem()
|
|||
|
||||
ent:RemoveEFlags( EFL_KEEP_ON_RECREATE_ENTITIES )
|
||||
ent:RemoveEffects( EF_BONEMERGE )
|
||||
ent:PhysicsInit( SOLID_VPHYSICS )
|
||||
ent:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
ent:SetNoDraw( false )
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
-- Your Name is Benny
|
||||
---------------------
|
||||
|
||||
local cam_f = CreateConVar( "b-cam_f", -40 )
|
||||
local cam_r = CreateConVar( "b-cam_r", 12 )
|
||||
local cam_f = CreateConVar( "b-cam_f", -50 )
|
||||
local cam_r = CreateConVar( "b-cam_r", 14 )
|
||||
local cam_u = CreateConVar( "b-cam_u", 0 )
|
||||
local cam_fov = CreateConVar( "b-cam_fov", 75 )
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ local function OpenDebugMenu()
|
|||
DebugMenu:SetSize( 400, 300 )
|
||||
DebugMenu:Center()
|
||||
DebugMenu:MakePopup()
|
||||
DebugMenu:SetKeyboardInputEnabled( false )
|
||||
|
||||
local opt = DebugMenu:Add("DCollapsibleCategory")
|
||||
opt:Dock( TOP )
|
||||
|
@ -43,6 +44,15 @@ local function OpenDebugMenu()
|
|||
button.iData = idata
|
||||
button.DoClick = dospawn
|
||||
end
|
||||
|
||||
local button = DebugMenu:Add("DButton")
|
||||
button:Dock( BOTTOM )
|
||||
button:DockMargin( 4, 4, 4, 4 )
|
||||
button:SetText( "CLOSE" )
|
||||
button:SetTall( 36 )
|
||||
button.DoClick = function( self )
|
||||
DebugMenu:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
hook.Add("PlayerButtonDown", "PlayerButtonDown_DebugMenu", function( ply, button )
|
||||
|
|
|
@ -116,7 +116,8 @@ function GM:HUDPaint()
|
|||
hCol( v == handler:GetActiveR() and COLOR_BRIGHT or COLOR_DARK )
|
||||
hRect( (i-1)*(120+10), 0, 120, 60 )
|
||||
local x, y = hXY( (i-1)*(120+10), 0 )
|
||||
draw.SimpleText( l8( v.Class.PrintName ) .. "(" .. v:GetClip() .. "/" .. v.Class.ClipSize .. ")", "HUD_24", x + 120/2, y + 60/2, COLOR_MAIN, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
|
||||
draw.SimpleText( l8( v.Class.PrintName ), "HUD_24", x + 120/2, y + 60/2 - (10), COLOR_MAIN, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
|
||||
draw.SimpleText( "[ " .. v:GetClip() .. "/" .. v.Class.ClipSize .. " ]", "HUD_24", x + 120/2, y + 60/2 + (10), COLOR_MAIN, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
|
||||
end
|
||||
S_Pop()
|
||||
end
|
||||
|
|
|
@ -94,6 +94,7 @@ AddItem( "base_firearm", {
|
|||
|
||||
Delay = 0.1,
|
||||
Pellets = 1,
|
||||
Accuracy = 1,
|
||||
ClipSize = 15,
|
||||
BurstCount = math.huge,
|
||||
BurstRunaway = false,
|
||||
|
@ -133,14 +134,23 @@ AddItem( "base_firearm", {
|
|||
["Attack"] = function( class, ent, handler )
|
||||
if ent:GetClip() <= 0 then return end
|
||||
if ent:GetDelay() > CurTime() then return end
|
||||
if ent:GetDelayBurst() > CurTime() then return end
|
||||
if ent:GetBurstCount() >= class.BurstCount then return end
|
||||
|
||||
local Runaway = class.BurstRunaway
|
||||
local BAuto = class.BurstAuto
|
||||
ent:SetBurstCount( ent:GetBurstCount() + 1 )
|
||||
if ent:GetBurstCount() >= class.BurstCount then
|
||||
ent:SetDelayBurst( CurTime() + class.BurstDelay )
|
||||
if BAuto then
|
||||
ent:SetBurstCount( 0 )
|
||||
end
|
||||
end
|
||||
ent:SetClip( ent:GetClip() - 1 )
|
||||
ent:SetDelay( CurTime() + class.Delay )
|
||||
handler:EmitSound( class.FireSound, 140, 100, 0.4, CHAN_STATIC )
|
||||
handler:EmitSound( istable(class.FireSound) and TSelShared(class.FireSound, "FireSound") or class.FireSound, 140, 100, 0.4, CHAN_STATIC )
|
||||
|
||||
local acc = 0
|
||||
local acc = math.rad( class.Accuracy or 0 )
|
||||
local p = handler:GetOwner()
|
||||
handler:FireBullets( {
|
||||
Attacker = p,
|
||||
|
@ -157,18 +167,18 @@ AddItem( "base_firearm", {
|
|||
if ent:GetClip() >= class.ClipSize then return end
|
||||
if ent:GetDelay() > CurTime() then return end
|
||||
handler:EmitSound( "weapons/m4a1/m4a1_boltpull.wav", 70, 125, 0.4, CHAN_STATIC )
|
||||
ent:SetDelay( CurTime() + 0.5 )
|
||||
ent:SetDelay( CurTime() + 0.25 )
|
||||
ent:SetClip( class.ClipSize )
|
||||
end,
|
||||
|
||||
["Deploy"] = function( class, ent, handler )
|
||||
handler:EmitSound( "weapons/usp/usp_slideback.wav", 70, 125, 0.4, CHAN_STATIC )
|
||||
ent:SetDelay( CurTime() + 0.5 )
|
||||
ent:SetDelay( CurTime() + 0.25 )
|
||||
end,
|
||||
|
||||
["Holster"] = function( class, ent, handler )
|
||||
handler:EmitSound( "weapons/m4a1/m4a1_deploy.wav", 70, 125, 0.4, CHAN_STATIC )
|
||||
ent:SetDelay( CurTime() + 0.5 )
|
||||
ent:SetDelay( CurTime() + 0.25 )
|
||||
end,
|
||||
})
|
||||
|
||||
|
@ -183,7 +193,11 @@ AddItem( "mk23", {
|
|||
|
||||
ClipSize = 12,
|
||||
Delay = (60/350),
|
||||
FireSound = "weapons/usp/usp_unsil-1.wav",
|
||||
FireSound = {
|
||||
"benny/weapons/usp/01.ogg",
|
||||
"benny/weapons/usp/02.ogg",
|
||||
"benny/weapons/usp/03.ogg",
|
||||
},
|
||||
|
||||
Accuracy = 5/60,
|
||||
BurstCount = 1,
|
||||
|
@ -202,7 +216,11 @@ AddItem( "fnc", {
|
|||
|
||||
ClipSize = 30,
|
||||
Delay = (60/750),
|
||||
FireSound = "weapons/m4a1/m4a1_unsil-1.wav",
|
||||
FireSound = {
|
||||
"benny/weapons/m16a2/fire-01.ogg",
|
||||
"benny/weapons/m16a2/fire-02.ogg",
|
||||
"benny/weapons/m16a2/fire-03.ogg",
|
||||
},
|
||||
|
||||
Accuracy = 1,
|
||||
Accuracy_Add = 0.4,
|
||||
|
@ -210,6 +228,56 @@ AddItem( "fnc", {
|
|||
Accuracy_Decay = 12,
|
||||
})
|
||||
|
||||
AddItem( "m16a2", {
|
||||
PrintName = "#Item.m16a2.Name",
|
||||
Description = "#Item.m16a2.Description",
|
||||
Base = "base_firearm",
|
||||
|
||||
Model = "models/weapons/w_rif_ar556.mdl",
|
||||
HoldType = "rpg",
|
||||
|
||||
ClipSize = 30,
|
||||
Delay = (60/900),
|
||||
BurstCount = 3,
|
||||
BurstRunaway = true,
|
||||
BurstAuto = true,
|
||||
BurstDelay = 0.2,
|
||||
FireSound = {
|
||||
"benny/weapons/m16a2/fire-01.ogg",
|
||||
"benny/weapons/m16a2/fire-02.ogg",
|
||||
"benny/weapons/m16a2/fire-03.ogg",
|
||||
},
|
||||
|
||||
Accuracy = 1,
|
||||
Accuracy_Add = 0.4,
|
||||
Accuracy_Reset = 0.4,
|
||||
Accuracy_Decay = 12,
|
||||
})
|
||||
|
||||
AddItem( "spas12", {
|
||||
PrintName = "#Item.spas12.Name",
|
||||
Description = "#Item.spas12.Description",
|
||||
Base = "base_firearm",
|
||||
|
||||
Model = "models/weapons/w_shotgun.mdl",
|
||||
HoldType = "rpg",
|
||||
|
||||
ClipSize = 8,
|
||||
Pellets = 8,
|
||||
Delay = 0.4,
|
||||
BurstCount = 1,
|
||||
FireSound = {
|
||||
"benny/weapons/spas12/01.ogg",
|
||||
"benny/weapons/spas12/02.ogg",
|
||||
"benny/weapons/spas12/03.ogg",
|
||||
},
|
||||
|
||||
Accuracy = 8,
|
||||
Accuracy_Add = 0.4,
|
||||
Accuracy_Reset = 0.4,
|
||||
Accuracy_Decay = 12,
|
||||
})
|
||||
|
||||
for ID, Data in pairs(ITEMS) do
|
||||
local tent = {}
|
||||
tent.Base = "b-itembase"
|
||||
|
|
|
@ -8,3 +8,9 @@ L["#Item.mk23.Description"] = "Special forces sidearm"
|
|||
|
||||
L["#Item.fnc.Name"] = "FNC Para"
|
||||
L["#Item.fnc.Description"] = "Imported 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"
|
|
@ -10,6 +10,10 @@ local AC, IN = AddCSLuaFile, include
|
|||
|
||||
local CL = SERVER and AddCSLuaFile or include
|
||||
|
||||
function TSelShared( tbl, seed )
|
||||
return tbl[math.Round( util.SharedRandom( seed, 1, #tbl ) )]
|
||||
end
|
||||
|
||||
AC("language.lua")
|
||||
IN("language.lua")
|
||||
AC("camera.lua")
|
||||
|
|
Loading…
Reference in New Issue