More weapons and more slots.
This commit is contained in:
parent
29d9a61086
commit
ed336f6cfd
|
@ -254,6 +254,8 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function()
|
||||||
surface.SetDrawColor( scheme["fg"] )
|
surface.SetDrawColor( scheme["fg"] )
|
||||||
surface.DrawRect( sw - b - ss(w-4), sh - b + ss(16) - ss(BOXHEIGHT-4), ss(fmpw), ss(10) )
|
surface.DrawRect( sw - b - ss(w-4), sh - b + ss(16) - ss(BOXHEIGHT-4), ss(fmpw), ss(10) )
|
||||||
|
|
||||||
|
-- PROTO: Make grenade/melee/firearm logic way way better.
|
||||||
|
if wep1c.Features != "grenade" then
|
||||||
surface.SetFont( "Benny_12" )
|
surface.SetFont( "Benny_12" )
|
||||||
local str = wep:B_FiremodeName( false )
|
local str = wep:B_FiremodeName( false )
|
||||||
local tw = surface.GetTextSize( str )
|
local tw = surface.GetTextSize( str )
|
||||||
|
@ -346,6 +348,7 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function()
|
||||||
|
|
||||||
ind = ind + 1
|
ind = ind + 1
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- local prog = {
|
-- local prog = {
|
||||||
-- {
|
-- {
|
||||||
|
@ -663,6 +666,19 @@ do
|
||||||
RunConsoleCommand( "benny_inv_equip", buckets[bucket_selected][item_selected] )
|
RunConsoleCommand( "benny_inv_equip", buckets[bucket_selected][item_selected] )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
local function Wrap( ply, num )
|
||||||
|
local buckets = ply:INV_Buckets()
|
||||||
|
if bucket_selected == num then
|
||||||
|
item_selected = item_selected + 1
|
||||||
|
if item_selected > #buckets[bucket_selected] then
|
||||||
|
item_selected = 1
|
||||||
|
end
|
||||||
|
else
|
||||||
|
bucket_selected = num
|
||||||
|
item_selected = 1
|
||||||
|
end
|
||||||
|
Equip()
|
||||||
|
end
|
||||||
local qt = {
|
local qt = {
|
||||||
["invnext"] = function( ply )
|
["invnext"] = function( ply )
|
||||||
local buckets = ply:INV_Buckets()
|
local buckets = ply:INV_Buckets()
|
||||||
|
@ -696,56 +712,34 @@ do
|
||||||
Equip()
|
Equip()
|
||||||
end,
|
end,
|
||||||
["slot1"] = function( ply )
|
["slot1"] = function( ply )
|
||||||
local buckets = ply:INV_Buckets()
|
Wrap( ply, 1 )
|
||||||
if bucket_selected == 1 then
|
|
||||||
item_selected = item_selected + 1
|
|
||||||
if item_selected > #buckets[bucket_selected] then
|
|
||||||
item_selected = 1
|
|
||||||
end
|
|
||||||
else
|
|
||||||
bucket_selected = 1
|
|
||||||
item_selected = 1
|
|
||||||
end
|
|
||||||
Equip()
|
|
||||||
end,
|
end,
|
||||||
["slot2"] = function( ply )
|
["slot2"] = function( ply )
|
||||||
local buckets = ply:INV_Buckets()
|
Wrap( ply, 2 )
|
||||||
if bucket_selected == 2 then
|
|
||||||
item_selected = item_selected + 1
|
|
||||||
if item_selected > #buckets[bucket_selected] then
|
|
||||||
item_selected = 1
|
|
||||||
end
|
|
||||||
else
|
|
||||||
bucket_selected = 2
|
|
||||||
item_selected = 1
|
|
||||||
end
|
|
||||||
Equip()
|
|
||||||
end,
|
end,
|
||||||
["slot3"] = function( ply )
|
["slot3"] = function( ply )
|
||||||
local buckets = ply:INV_Buckets()
|
Wrap( ply, 3 )
|
||||||
if bucket_selected == 3 then
|
|
||||||
item_selected = item_selected + 1
|
|
||||||
if item_selected > #buckets[bucket_selected] then
|
|
||||||
item_selected = 1
|
|
||||||
end
|
|
||||||
else
|
|
||||||
bucket_selected = 3
|
|
||||||
item_selected = 1
|
|
||||||
end
|
|
||||||
Equip()
|
|
||||||
end,
|
end,
|
||||||
["slot4"] = function( ply )
|
["slot4"] = function( ply )
|
||||||
local buckets = ply:INV_Buckets()
|
Wrap( ply, 4 )
|
||||||
if bucket_selected == 4 then
|
end,
|
||||||
item_selected = item_selected + 1
|
["slot5"] = function( ply )
|
||||||
if item_selected > #buckets[bucket_selected] then
|
Wrap( ply, 5 )
|
||||||
item_selected = 1
|
end,
|
||||||
end
|
["slot6"] = function( ply )
|
||||||
else
|
-- Wrap( ply, 6 )
|
||||||
bucket_selected = 4
|
end,
|
||||||
item_selected = 1
|
["slot7"] = function( ply )
|
||||||
end
|
-- Wrap( ply, 7 )
|
||||||
Equip()
|
end,
|
||||||
|
["slot8"] = function( ply )
|
||||||
|
-- Wrap( ply, 8 )
|
||||||
|
end,
|
||||||
|
["slot9"] = function( ply )
|
||||||
|
-- Wrap( ply, 9 )
|
||||||
|
end,
|
||||||
|
["slot0"] = function( ply )
|
||||||
|
-- Wrap( ply, 0 )
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
hook.Add( "PlayerBindPress", "inv", function( ply, bind, pressed, code )
|
hook.Add( "PlayerBindPress", "inv", function( ply, bind, pressed, code )
|
||||||
|
|
|
@ -69,16 +69,20 @@ concommand.Add("benny_inv_equip", function( ply, cmd, args )
|
||||||
local inv = ply:INV_Get()
|
local inv = ply:INV_Get()
|
||||||
local wep = ply:GetActiveWeapon()
|
local wep = ply:GetActiveWeapon()
|
||||||
local item = inv[args[1]]
|
local item = inv[args[1]]
|
||||||
|
local class = WEAPONS[item.Class]
|
||||||
-- PROTO: Check that this is the correct 'benny' weapon.
|
-- PROTO: Check that this is the correct 'benny' weapon.
|
||||||
assert( item, "That item doesn't exist. " .. tostring(item) )
|
assert( item, "That item doesn't exist. " .. tostring(item) )
|
||||||
|
|
||||||
wep:SetWep1( args[1] )
|
wep:SetWep1( args[1] )
|
||||||
wep:SetWep1Clip( item.Loaded )
|
wep:SetWep1Clip( item.Loaded )
|
||||||
|
|
||||||
|
-- PROTO: Make grenade/melee/firearm logic way way better.
|
||||||
|
if class.Features != "grenade" then
|
||||||
if item.Loaded != 0 then
|
if item.Loaded != 0 then
|
||||||
assert( item[ "Ammo" .. item.Loaded ], "That magazine doesn't exist." )
|
assert( item[ "Ammo" .. item.Loaded ], "That magazine doesn't exist." )
|
||||||
end
|
end
|
||||||
wep:SetClip1( item.Loaded == 0 and 0 or item[ "Ammo" .. item.Loaded ] )
|
wep:SetClip1( item.Loaded == 0 and 0 or item[ "Ammo" .. item.Loaded ] )
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
concommand.Add("benny_inv_sync", function( ply, cmd, args )
|
concommand.Add("benny_inv_sync", function( ply, cmd, args )
|
||||||
|
@ -177,24 +181,44 @@ if CLIENT then
|
||||||
local itemlist = smenu:Add("DScrollPanel")
|
local itemlist = smenu:Add("DScrollPanel")
|
||||||
itemlist:Dock( FILL )
|
itemlist:Dock( FILL )
|
||||||
|
|
||||||
local List = vgui.Create( "DIconLayout", itemlist )
|
-- local List = vgui.Create( "DIconLayout", itemlist )
|
||||||
List:Dock( FILL )
|
-- List:Dock( FILL )
|
||||||
List:SetSpaceX( 5 )
|
-- List:SetSpaceX( 5 )
|
||||||
List:SetSpaceY( 5 )
|
-- List:SetSpaceY( 5 )
|
||||||
|
|
||||||
|
|
||||||
|
local createlist = {}
|
||||||
|
|
||||||
for ClassName, Class in SortedPairsByMemberValue( WEAPONS, "Name" ) do
|
for ClassName, Class in SortedPairsByMemberValue( WEAPONS, "Name" ) do
|
||||||
local button = vgui.Create( "DButton" )
|
if !createlist[Class.Type] then
|
||||||
List:Add( button )
|
createlist[Class.Type] = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
table.insert( createlist[Class.Type], { ClassName = ClassName, Class = Class } )
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
for i, v in pairs( createlist ) do
|
||||||
|
local Collapse = itemlist:Add( "DCollapsibleCategory" )
|
||||||
|
Collapse:Dock( TOP )
|
||||||
|
Collapse:SetLabel( i )
|
||||||
|
local Lays = itemlist:Add( "DIconLayout" )
|
||||||
|
Collapse:SetContents( Lays )
|
||||||
|
Lays:Dock( FILL )
|
||||||
|
Lays:SetSpaceX( 2 )
|
||||||
|
Lays:SetSpaceY( 2 )
|
||||||
|
for Mew, New in ipairs( v ) do
|
||||||
|
local button = Lays:Add( "DButton" )
|
||||||
button:SetSize( ss(96), ss(22) )
|
button:SetSize( ss(96), ss(22) )
|
||||||
--button:Dock( TOP )
|
--button:Dock( TOP )
|
||||||
button:DockMargin( 0, 0, 0, ss(4) )
|
button:DockMargin( 0, 0, 0, ss(4) )
|
||||||
|
|
||||||
button.Text_Name = Class.Name
|
button.Text_Name = New.Class.Name
|
||||||
button.Text_Desc = Class.Description
|
button.Text_Desc = New.Class.Description
|
||||||
|
|
||||||
-- PROTO: These functions don't need to be remade over and over like this.
|
-- PROTO: These functions don't need to be remade over and over like this.
|
||||||
function button:DoClick()
|
function button:DoClick()
|
||||||
RunConsoleCommand( "benny_debug_give", LocalPlayer():EntIndex(), 0, ClassName )
|
RunConsoleCommand( "benny_debug_give", LocalPlayer():EntIndex(), 0, New.ClassName )
|
||||||
end
|
end
|
||||||
|
|
||||||
function button:DoRightClick()
|
function button:DoRightClick()
|
||||||
|
@ -217,6 +241,8 @@ if CLIENT then
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
local function regen_items( itemlist )
|
local function regen_items( itemlist )
|
||||||
local ply = LocalPlayer()
|
local ply = LocalPlayer()
|
||||||
itemlist:Clear()
|
itemlist:Clear()
|
||||||
|
|
|
@ -44,9 +44,11 @@ do
|
||||||
["special"] = { 1, 2 },
|
["special"] = { 1, 2 },
|
||||||
["pistol"] = { 2, 1 },
|
["pistol"] = { 2, 1 },
|
||||||
["smg"] = { 3, 1 },
|
["smg"] = { 3, 1 },
|
||||||
["shotgun"] = { 3, 2 },
|
["shotgun"] = { 4, 1 },
|
||||||
["rifle"] = { 4, 1 },
|
["rifle"] = { 5, 1 },
|
||||||
["machinegun"] = { 4, 2 },
|
["machinegun"] = { 5, 2 },
|
||||||
|
["grenade"] = { 6, 1 },
|
||||||
|
["utility"] = { 6, 2 },
|
||||||
}
|
}
|
||||||
|
|
||||||
-- PROTO: Cache this!
|
-- PROTO: Cache this!
|
||||||
|
@ -56,6 +58,8 @@ do
|
||||||
[2] = {},
|
[2] = {},
|
||||||
[3] = {},
|
[3] = {},
|
||||||
[4] = {},
|
[4] = {},
|
||||||
|
[5] = {},
|
||||||
|
[6] = {},
|
||||||
}
|
}
|
||||||
for i, bucket in ipairs( inventorylist ) do
|
for i, bucket in ipairs( inventorylist ) do
|
||||||
local temp = {}
|
local temp = {}
|
||||||
|
|
|
@ -551,6 +551,28 @@ WEAPONS["bizon"] = {
|
||||||
Spread = 40/60,
|
Spread = 40/60,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WEAPONS["chicom"] = {
|
||||||
|
Name = "QCW-CQB",
|
||||||
|
Description = "Subsonic bullpup SMG.",
|
||||||
|
Type = "smg",
|
||||||
|
|
||||||
|
WModel = "models/weapons/w_rif_famas.mdl",
|
||||||
|
HoldType = "rpg",
|
||||||
|
GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_REVOLVER, 0.34 },
|
||||||
|
|
||||||
|
Sound_Fire = "M92.Fire",
|
||||||
|
Sound_DryFire = "Common.Dryfire.Rifle",
|
||||||
|
Sound_Reload = "Bizon.Reload",
|
||||||
|
Sound_MagOut = "Bizon.MagOut",
|
||||||
|
Sound_MagIn = "Bizon.MagIn",
|
||||||
|
|
||||||
|
Delay = (60/525),
|
||||||
|
Firemodes = FIREMODE_AUTOSEMI,
|
||||||
|
Ammo = 36,
|
||||||
|
Damage = 12,
|
||||||
|
Spread = 40/60,
|
||||||
|
}
|
||||||
|
|
||||||
-- Shotguns
|
-- Shotguns
|
||||||
|
|
||||||
WEAPONS["spas12"] = {
|
WEAPONS["spas12"] = {
|
||||||
|
@ -620,6 +642,27 @@ WEAPONS["fnc"] = {
|
||||||
Damage = 10,
|
Damage = 10,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WEAPONS["qbz"] = {
|
||||||
|
Name = "QBZ-95",
|
||||||
|
Description = "Bullpup assault rifle.",
|
||||||
|
Type = "rifle",
|
||||||
|
|
||||||
|
Icon = Material( "benny/weapons/fnc.png", "smooth" ),
|
||||||
|
WModel = "models/weapons/w_rif_bakm.mdl",
|
||||||
|
HoldType = "rpg",
|
||||||
|
GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_PISTOL, 0.3 },
|
||||||
|
|
||||||
|
Sound_Fire = "FNC.Fire",
|
||||||
|
Sound_DryFire = "Common.Dryfire.Rifle",
|
||||||
|
Sound_MagOut = "FNC.MagOut",
|
||||||
|
Sound_MagIn = "FNC.MagIn",
|
||||||
|
|
||||||
|
Delay = (60/600),
|
||||||
|
Firemodes = FIREMODE_AUTOSEMI,
|
||||||
|
Ammo = 30,
|
||||||
|
Damage = 10,
|
||||||
|
}
|
||||||
|
|
||||||
WEAPONS["m16a2"] = {
|
WEAPONS["m16a2"] = {
|
||||||
Name = "M16A2",
|
Name = "M16A2",
|
||||||
Description = "meow",
|
Description = "meow",
|
||||||
|
@ -665,3 +708,85 @@ WEAPONS["stoner63"] = {
|
||||||
Ammo = 100,
|
Ammo = 100,
|
||||||
Damage = 10,
|
Damage = 10,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WEAPONS["qbblsw"] = {
|
||||||
|
Name = "QBB-LSW",
|
||||||
|
Description = "Bullpup light machine gun.",
|
||||||
|
Type = "machinegun",
|
||||||
|
|
||||||
|
WModel = "models/weapons/w_mach_mg36.mdl",
|
||||||
|
HoldType = "rpg",
|
||||||
|
GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_REVOLVER, 0.3 },
|
||||||
|
|
||||||
|
Sound_Fire = "FNC.Fire",
|
||||||
|
Sound_DryFire = "Common.Dryfire.Rifle",
|
||||||
|
Sound_MagOut = "M16A2.MagOut",
|
||||||
|
Sound_MagIn = "M16A2.MagIn",
|
||||||
|
|
||||||
|
Delay = (60/550),
|
||||||
|
Firemodes = FIREMODE_AUTOSEMI,
|
||||||
|
Ammo = 100,
|
||||||
|
Damage = 10,
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Grenades
|
||||||
|
|
||||||
|
WEAPONS["g_frag"] = {
|
||||||
|
Name = "FRAG GRENADE",
|
||||||
|
Description = "Pull the pin and throw it the hell away!",
|
||||||
|
Type = "grenade",
|
||||||
|
|
||||||
|
WModel = "models/weapons/w_eq_flashbang.mdl",
|
||||||
|
|
||||||
|
Features = "grenade", -- All weapons should have this?
|
||||||
|
}
|
||||||
|
|
||||||
|
WEAPONS["g_semtex"] = {
|
||||||
|
Name = "SEMTEX GRENADE",
|
||||||
|
Description = "Long, audible fuse, but sticks to whatever it touches.",
|
||||||
|
Type = "grenade",
|
||||||
|
|
||||||
|
WModel = "models/weapons/w_eq_flashbang.mdl",
|
||||||
|
|
||||||
|
Features = "grenade", -- All weapons should have this?
|
||||||
|
}
|
||||||
|
|
||||||
|
WEAPONS["g_molotov"] = {
|
||||||
|
Name = "MOLOTOV COCKTAIL",
|
||||||
|
Description = "Alcoholic bottle of flame!",
|
||||||
|
Type = "grenade",
|
||||||
|
|
||||||
|
WModel = "models/weapons/w_eq_flashbang.mdl",
|
||||||
|
|
||||||
|
Features = "grenade", -- All weapons should have this?
|
||||||
|
}
|
||||||
|
|
||||||
|
WEAPONS["g_tknife"] = {
|
||||||
|
Name = "THROWING KNIFE",
|
||||||
|
Description = "Lightweight knife weighted perfectly.",
|
||||||
|
Type = "grenade",
|
||||||
|
|
||||||
|
WModel = "models/weapons/w_eq_flashbang.mdl",
|
||||||
|
|
||||||
|
Features = "grenade", -- All weapons should have this?
|
||||||
|
}
|
||||||
|
|
||||||
|
WEAPONS["g_smoke"] = {
|
||||||
|
Name = "SMOKE GRENADE",
|
||||||
|
Description = "Smoke bomb used to conceal your position.",
|
||||||
|
Type = "grenade",
|
||||||
|
|
||||||
|
WModel = "models/weapons/w_eq_flashbang.mdl",
|
||||||
|
|
||||||
|
Features = "grenade", -- All weapons should have this?
|
||||||
|
}
|
||||||
|
|
||||||
|
WEAPONS["g_flashbang"] = {
|
||||||
|
Name = "FLASHBANG",
|
||||||
|
Description = "Stun grenade that gives off a bright flash and a loud 'bang'.",
|
||||||
|
Type = "grenade",
|
||||||
|
|
||||||
|
WModel = "models/weapons/w_eq_flashbang.mdl",
|
||||||
|
|
||||||
|
Features = "grenade", -- All weapons should have this?
|
||||||
|
}
|
Loading…
Reference in New Issue