Toolgun reload menu & categorization
This commit is contained in:
parent
c3461ec7c9
commit
bc36188668
|
@ -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.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"] = {
|
||||
Name = "TOOL GUN",
|
||||
Description = "Developer development device",
|
||||
|
@ -167,14 +210,8 @@ WEAPONS["toolgun"] = {
|
|||
local p = self:GetOwner()
|
||||
|
||||
local tr = p:GetEyeTrace()
|
||||
if SERVER then
|
||||
local summon = ents.Create( "bitem_ammo" )
|
||||
-- summon:SetModel( "models/props_junk/cardboard_box001a.mdl" )
|
||||
-- summon:Give( "weapon_stunstick")
|
||||
summon:SetPos( tr.HitPos + tr.HitNormal )
|
||||
summon:Spawn()
|
||||
|
||||
end
|
||||
local tool = p:GetInfo( "benny_toolgun" )
|
||||
if ToolGunTools[tool] then ToolGunTools[tool]( self, p, tr ) end
|
||||
|
||||
if CLIENT and IsFirstTimePredicted() then
|
||||
local vStart = self:GetAttachment( 1 ).Pos
|
||||
|
@ -190,8 +227,8 @@ WEAPONS["toolgun"] = {
|
|||
end,
|
||||
|
||||
Reload = function( self, slot )
|
||||
if self:GetOwner():KeyPressed( IN_RELOAD ) then
|
||||
print( self )
|
||||
if CLIENT and self:GetOwner():KeyPressed( IN_RELOAD ) then
|
||||
CreateSelect()
|
||||
end
|
||||
|
||||
-- Return true to skip weapon logic
|
||||
|
@ -201,7 +238,9 @@ WEAPONS["toolgun"] = {
|
|||
Features = "firearm",
|
||||
}
|
||||
|
||||
-- Melee
|
||||
end
|
||||
|
||||
do -- Melee
|
||||
|
||||
WEAPONS["melee_bat"] = {
|
||||
Name = "BAT",
|
||||
|
@ -267,7 +306,9 @@ WEAPONS["melee_machete"] = {
|
|||
Features = "melee",
|
||||
}
|
||||
|
||||
-- Handguns
|
||||
end
|
||||
|
||||
do -- Handguns
|
||||
|
||||
WEAPONS["1911"] = {
|
||||
Name = "COBRA .45",
|
||||
|
@ -465,7 +506,9 @@ WEAPONS["deagle"] = {
|
|||
Features = "firearm",
|
||||
}
|
||||
|
||||
-- SMGs & PDWs
|
||||
end
|
||||
|
||||
do -- SMGs & PDWs
|
||||
|
||||
WEAPONS["tmp"] = {
|
||||
Name = "TMP",
|
||||
|
@ -611,7 +654,9 @@ WEAPONS["chicom"] = {
|
|||
Features = "firearm",
|
||||
}
|
||||
|
||||
-- Shotguns
|
||||
end
|
||||
|
||||
do -- Shotguns
|
||||
|
||||
WEAPONS["spas12"] = {
|
||||
Name = "SPAS-12",
|
||||
|
@ -638,7 +683,7 @@ WEAPONS["spas12"] = {
|
|||
}
|
||||
|
||||
WEAPONS["cqb70"] = {
|
||||
Name = "CQB-70",
|
||||
Name = "CS-70",
|
||||
Description = "meow",
|
||||
Type = "shotgun",
|
||||
|
||||
|
@ -709,7 +754,9 @@ WEAPONS["aa12"] = {
|
|||
Features = "firearm",
|
||||
}
|
||||
|
||||
-- Rifles
|
||||
end
|
||||
|
||||
do -- Rifles
|
||||
|
||||
WEAPONS["fnc"] = {
|
||||
Name = "FNC PARA",
|
||||
|
@ -783,7 +830,9 @@ WEAPONS["m16a2"] = {
|
|||
Features = "firearm",
|
||||
}
|
||||
|
||||
-- Machine guns
|
||||
end
|
||||
|
||||
do -- Machine guns
|
||||
|
||||
WEAPONS["stoner63"] = {
|
||||
Name = "STONER 63",
|
||||
|
@ -829,8 +878,9 @@ WEAPONS["qbblsw"] = {
|
|||
Features = "firearm",
|
||||
}
|
||||
|
||||
-- Grenades
|
||||
-- Nothing here is guaranteed.
|
||||
end
|
||||
|
||||
do -- Grenades, nothing here is guaranteed.
|
||||
|
||||
local function GrenadeFire( self )
|
||||
local p = self:GetOwner()
|
||||
|
@ -989,7 +1039,9 @@ WEAPONS["g_shockcharge"] = {
|
|||
Features = "grenade",
|
||||
}
|
||||
|
||||
-- Equipment
|
||||
end
|
||||
|
||||
do -- Equipment, nothing here is guaranteed.
|
||||
|
||||
WEAPONS["e_tacinsertion"] = {
|
||||
Name = "TACTICAL INSERTION",
|
||||
|
@ -1110,3 +1162,5 @@ WEAPONS["e_antiarmor"] = {
|
|||
|
||||
Features = "grenade",
|
||||
}
|
||||
|
||||
end
|
Loading…
Reference in New Issue