Toolgun reload menu & categorization

This commit is contained in:
Fesiug 2023-11-12 00:44:34 -05:00
parent c3461ec7c9
commit bc36188668
1 changed files with 980 additions and 926 deletions

View File

@ -144,6 +144,49 @@ AddSound( "Common.Dryfire.Pistol", "benny/weapons/common/06-13.ogg", 70, 100, 0.
AddSound( "Common.Dryfire.Rifle", "benny/weapons/common/06-12.ogg", 70, 100, 0.5, CHAN_STATIC ) AddSound( "Common.Dryfire.Rifle", "benny/weapons/common/06-12.ogg", 70, 100, 0.5, CHAN_STATIC )
AddSound( "Common.NoAmmo", "benny/weapons/noammo.ogg", 70, 100, 0.5, CHAN_STATIC ) AddSound( "Common.NoAmmo", "benny/weapons/noammo.ogg", 70, 100, 0.5, CHAN_STATIC )
do -- Toolgun
CreateClientConVar( "benny_toolgun", "", true, true )
local ToolGunTools = {
["ammocrate"] = function( self, p, tr )
if SERVER then
local summon = ents.Create( "bitem_ammo" )
summon:SetPos( tr.HitPos + tr.HitNormal )
summon:Spawn()
end
end,
["summon_human"] = function( self, p, tr )
if SERVER then
local summon = ents.Create( "bnpc_human" )
summon:SetPos( tr.HitPos + tr.HitNormal )
summon:Spawn()
end
end,
}
local function CreateSelect()
local Frame = vgui.Create( "DFrame" )
Frame:SetSize( 300, 85 )
Frame:SetTitle( "Toolgun Select" )
Frame:Center()
Frame:MakePopup()
local Text = Frame:Add( "DLabel" )
Text:Dock( TOP )
Text:DockMargin( 10, 0, 10, 0 )
Text:SetText( "Select a tool." )
local List = Frame:Add( "DComboBox" )
List:Dock( TOP )
List:SetValue(GetConVar("benny_toolgun"):GetString())
List:DockMargin( 10, 0, 10, 0 )
for i, v in SortedPairs( ToolGunTools ) do
List:AddChoice( i )
end
List.OnSelect = function( self, index, value )
RunConsoleCommand( "benny_toolgun", value )
Frame:Remove()
end
end
WEAPONS["toolgun"] = { WEAPONS["toolgun"] = {
Name = "TOOL GUN", Name = "TOOL GUN",
Description = "Developer development device", Description = "Developer development device",
@ -167,14 +210,8 @@ WEAPONS["toolgun"] = {
local p = self:GetOwner() local p = self:GetOwner()
local tr = p:GetEyeTrace() local tr = p:GetEyeTrace()
if SERVER then local tool = p:GetInfo( "benny_toolgun" )
local summon = ents.Create( "bitem_ammo" ) if ToolGunTools[tool] then ToolGunTools[tool]( self, p, tr ) end
-- summon:SetModel( "models/props_junk/cardboard_box001a.mdl" )
-- summon:Give( "weapon_stunstick")
summon:SetPos( tr.HitPos + tr.HitNormal )
summon:Spawn()
end
if CLIENT and IsFirstTimePredicted() then if CLIENT and IsFirstTimePredicted() then
local vStart = self:GetAttachment( 1 ).Pos local vStart = self:GetAttachment( 1 ).Pos
@ -190,8 +227,8 @@ WEAPONS["toolgun"] = {
end, end,
Reload = function( self, slot ) Reload = function( self, slot )
if self:GetOwner():KeyPressed( IN_RELOAD ) then if CLIENT and self:GetOwner():KeyPressed( IN_RELOAD ) then
print( self ) CreateSelect()
end end
-- Return true to skip weapon logic -- Return true to skip weapon logic
@ -201,7 +238,9 @@ WEAPONS["toolgun"] = {
Features = "firearm", Features = "firearm",
} }
-- Melee end
do -- Melee
WEAPONS["melee_bat"] = { WEAPONS["melee_bat"] = {
Name = "BAT", Name = "BAT",
@ -267,7 +306,9 @@ WEAPONS["melee_machete"] = {
Features = "melee", Features = "melee",
} }
-- Handguns end
do -- Handguns
WEAPONS["1911"] = { WEAPONS["1911"] = {
Name = "COBRA .45", Name = "COBRA .45",
@ -465,7 +506,9 @@ WEAPONS["deagle"] = {
Features = "firearm", Features = "firearm",
} }
-- SMGs & PDWs end
do -- SMGs & PDWs
WEAPONS["tmp"] = { WEAPONS["tmp"] = {
Name = "TMP", Name = "TMP",
@ -611,7 +654,9 @@ WEAPONS["chicom"] = {
Features = "firearm", Features = "firearm",
} }
-- Shotguns end
do -- Shotguns
WEAPONS["spas12"] = { WEAPONS["spas12"] = {
Name = "SPAS-12", Name = "SPAS-12",
@ -638,7 +683,7 @@ WEAPONS["spas12"] = {
} }
WEAPONS["cqb70"] = { WEAPONS["cqb70"] = {
Name = "CQB-70", Name = "CS-70",
Description = "meow", Description = "meow",
Type = "shotgun", Type = "shotgun",
@ -709,7 +754,9 @@ WEAPONS["aa12"] = {
Features = "firearm", Features = "firearm",
} }
-- Rifles end
do -- Rifles
WEAPONS["fnc"] = { WEAPONS["fnc"] = {
Name = "FNC PARA", Name = "FNC PARA",
@ -783,7 +830,9 @@ WEAPONS["m16a2"] = {
Features = "firearm", Features = "firearm",
} }
-- Machine guns end
do -- Machine guns
WEAPONS["stoner63"] = { WEAPONS["stoner63"] = {
Name = "STONER 63", Name = "STONER 63",
@ -829,8 +878,9 @@ WEAPONS["qbblsw"] = {
Features = "firearm", Features = "firearm",
} }
-- Grenades end
-- Nothing here is guaranteed.
do -- Grenades, nothing here is guaranteed.
local function GrenadeFire( self ) local function GrenadeFire( self )
local p = self:GetOwner() local p = self:GetOwner()
@ -989,7 +1039,9 @@ WEAPONS["g_shockcharge"] = {
Features = "grenade", Features = "grenade",
} }
-- Equipment end
do -- Equipment, nothing here is guaranteed.
WEAPONS["e_tacinsertion"] = { WEAPONS["e_tacinsertion"] = {
Name = "TACTICAL INSERTION", Name = "TACTICAL INSERTION",
@ -1110,3 +1162,5 @@ WEAPONS["e_antiarmor"] = {
Features = "grenade", Features = "grenade",
} }
end