ToolGun, Init_Item, .Equipable
This commit is contained in:
parent
93d3bb4b7a
commit
af48ebde81
|
@ -16,7 +16,17 @@ end
|
||||||
-- ItemDef metatable
|
-- ItemDef metatable
|
||||||
ItemDef = {}
|
ItemDef = {}
|
||||||
|
|
||||||
|
ItemDefHelpers = {
|
||||||
|
Get = function( self, key )
|
||||||
|
return self.key
|
||||||
|
end,
|
||||||
|
GetRaw = function( self, key )
|
||||||
|
return rawget( self, key )
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
function ItemDef.__index( self, key )
|
function ItemDef.__index( self, key )
|
||||||
|
if ItemDefHelpers[key] then return ItemDefHelpers[key] end
|
||||||
if rawget(self, "BaseClass") then
|
if rawget(self, "BaseClass") then
|
||||||
return rawget(self, "BaseClass")[key]
|
return rawget(self, "BaseClass")[key]
|
||||||
end
|
end
|
||||||
|
@ -28,9 +38,8 @@ function ItemDef:new( classname, classtable )
|
||||||
newdef.ClassName = classname
|
newdef.ClassName = classname
|
||||||
newdef.BaseClass = WEAPONS[newdef.Base]
|
newdef.BaseClass = WEAPONS[newdef.Base]
|
||||||
|
|
||||||
WEAPONS[classname] = newdef
|
|
||||||
|
|
||||||
setmetatable( newdef, ItemDef )
|
setmetatable( newdef, ItemDef )
|
||||||
|
WEAPONS[classname] = newdef
|
||||||
return newdef
|
return newdef
|
||||||
else
|
else
|
||||||
return WEAPONS[classname]
|
return WEAPONS[classname]
|
||||||
|
|
|
@ -748,7 +748,7 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function()
|
||||||
draw.SimpleText( "L", "Benny_10", b_x + bump + ss(2), b_y + ss(b_h) - ss(9), scheme["bg"], TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP )
|
draw.SimpleText( "L", "Benny_10", b_x + bump + ss(2), b_y + ss(b_h) - ss(9), scheme["bg"], TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if class.Features == "firearm" or class.Features == "grenade" or class.Features == "melee" then
|
if class.Equipable or class.Features == "firearm" or class.Features == "grenade" or class.Features == "melee" then
|
||||||
invid = invid + 1
|
invid = invid + 1
|
||||||
surface.SetDrawColor( scheme[active and "bg" or "fg"] )
|
surface.SetDrawColor( scheme[active and "bg" or "fg"] )
|
||||||
surface.DrawOutlinedRect( b_x + bump + ss(1), b_y + ss(1), boxsize-ss(2), ss(b_h-2), ss(0.5) )
|
surface.DrawOutlinedRect( b_x + bump + ss(1), b_y + ss(1), boxsize-ss(2), ss(b_h-2), ss(0.5) )
|
||||||
|
|
|
@ -5,7 +5,7 @@ if SERVER then
|
||||||
end
|
end
|
||||||
|
|
||||||
function BENNY.CreateItem( classname )
|
function BENNY.CreateItem( classname )
|
||||||
local class = WeaponGet(classname)
|
local class = ItemDef(classname)
|
||||||
|
|
||||||
assert( class, "Invalid Class " .. tostring(classname) )
|
assert( class, "Invalid Class " .. tostring(classname) )
|
||||||
|
|
||||||
|
@ -14,12 +14,14 @@ function BENNY.CreateItem( classname )
|
||||||
Acquisition = CurTime(),
|
Acquisition = CurTime(),
|
||||||
}
|
}
|
||||||
|
|
||||||
if class.Features == "firearm" then
|
class.Init_Item( class, item )
|
||||||
item.Loaded = ""
|
|
||||||
elseif class.Features == "magazine" then
|
--if class.Features == "firearm" then
|
||||||
item.Ammo = class.Ammo
|
-- item.Loaded = ""
|
||||||
end
|
--elseif class.Features == "magazine" then
|
||||||
|
-- item.Ammo = class.Ammo
|
||||||
|
--end
|
||||||
|
--
|
||||||
return item
|
return item
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ local function beatup( ply, num )
|
||||||
for _, item in pairs( weighted ) do
|
for _, item in pairs( weighted ) do
|
||||||
local class = WeaponGet(item.Class)
|
local class = WeaponGet(item.Class)
|
||||||
local id = iflip[item]
|
local id = iflip[item]
|
||||||
if class.Features == "firearm" or class.Features == "grenade" or class.Features == "melee" then
|
if class.Equipable or class.Features == "firearm" or class.Features == "grenade" or class.Features == "melee" then
|
||||||
invid = invid + 1
|
invid = invid + 1
|
||||||
if num == 0 then num = 10 end
|
if num == 0 then num = 10 end
|
||||||
if num == invid then
|
if num == invid then
|
||||||
|
|
|
@ -1,106 +1,6 @@
|
||||||
|
|
||||||
do -- Toolgun
|
do -- Toolgun
|
||||||
|
|
||||||
local ToolGunTools = {
|
|
||||||
["ammocrate"] = function( self, p, tr )
|
|
||||||
if SERVER then
|
|
||||||
local summon = ents.Create( "benny_equipment_ammo" )
|
|
||||||
summon:SetPos( tr.HitPos + tr.HitNormal )
|
|
||||||
summon:Spawn()
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
["summon_human"] = function( self, p, tr )
|
|
||||||
if SERVER then
|
|
||||||
local summon = ents.Create( "benny_npc_human" )
|
|
||||||
summon:SetPos( tr.HitPos + tr.HitNormal )
|
|
||||||
local ang = Angle( 0, p:EyeAngles().y+0, 0 )
|
|
||||||
summon:SetAngles( ang )
|
|
||||||
summon:Spawn()
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
["remover"] = function( self, p, tr )
|
|
||||||
if SERVER then
|
|
||||||
local ent = tr.Entity
|
|
||||||
if IsValid( ent ) then
|
|
||||||
ent:Remove()
|
|
||||||
return
|
|
||||||
end
|
|
||||||
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_wep_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_wep_toolgun", value )
|
|
||||||
Frame:Remove()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
WEAPONS["toolgun"] = {
|
|
||||||
Name = "TOOL GUN",
|
|
||||||
Description = "Developer development device. Hold ALT for Remover",
|
|
||||||
Type = "special",
|
|
||||||
|
|
||||||
WModel = "models/weapons/w_toolgun.mdl",
|
|
||||||
HoldType = "revolver",
|
|
||||||
GestureDraw = { ACT_HL2MP_GESTURE_RELOAD_REVOLVER, 0.8 },
|
|
||||||
|
|
||||||
Delay = (60/300),
|
|
||||||
Firemodes = FIREMODE_SEMI,
|
|
||||||
|
|
||||||
Custom_Fire = function( self, data )
|
|
||||||
if self:GetDelay1() > CurTime() then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
self:SetDelay1( CurTime() + 0.2 )
|
|
||||||
|
|
||||||
local p = self:GetOwner()
|
|
||||||
|
|
||||||
local tr = p:GetEyeTrace()
|
|
||||||
local tool = p:KeyDown( IN_WALK ) and "remover" or p:GetInfo( "benny_wep_toolgun" )
|
|
||||||
if ToolGunTools[tool] then ToolGunTools[tool]( self, p, tr ) else return true end
|
|
||||||
|
|
||||||
if CLIENT and IsFirstTimePredicted() then
|
|
||||||
local vStart = self:GetAttachment( 1 ).Pos
|
|
||||||
local vPoint = tr.HitPos
|
|
||||||
local effectdata = EffectData()
|
|
||||||
effectdata:SetStart( vStart )
|
|
||||||
effectdata:SetOrigin( vPoint )
|
|
||||||
util.Effect( "ToolTracer", effectdata )
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Return true to skip weapon logic
|
|
||||||
return true
|
|
||||||
end,
|
|
||||||
|
|
||||||
Custom_Reload = function( self, data )
|
|
||||||
if CLIENT then
|
|
||||||
CreateSelect()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Return true to skip weapon logic
|
|
||||||
return true
|
|
||||||
end,
|
|
||||||
|
|
||||||
Features = "firearm",
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
WEAPONS["camera"] = {
|
WEAPONS["camera"] = {
|
||||||
Name = "CAMERA",
|
Name = "CAMERA",
|
||||||
|
@ -658,7 +558,7 @@ do -- Grenades, nothing here is guaranteed.
|
||||||
Custom_Reload = GrenadeReload,
|
Custom_Reload = GrenadeReload,
|
||||||
Custom_Think = GrenadeThink,
|
Custom_Think = GrenadeThink,
|
||||||
Custom_Holster = GrenadeHolster,
|
Custom_Holster = GrenadeHolster,
|
||||||
GrenadeEnt = "benny_grenade_frag",
|
GrenadeEnt = "b-gr_frag",
|
||||||
GrenadeFuse = 4,
|
GrenadeFuse = 4,
|
||||||
GrenadeCharge = true,
|
GrenadeCharge = true,
|
||||||
|
|
||||||
|
@ -678,7 +578,7 @@ do -- Grenades, nothing here is guaranteed.
|
||||||
Custom_Reload = GrenadeReload,
|
Custom_Reload = GrenadeReload,
|
||||||
Custom_Think = GrenadeThink,
|
Custom_Think = GrenadeThink,
|
||||||
Custom_Holster = GrenadeHolster,
|
Custom_Holster = GrenadeHolster,
|
||||||
GrenadeEnt = "benny_grenade_semtex",
|
GrenadeEnt = "b-gr_semtex",
|
||||||
GrenadeFuse = 4,
|
GrenadeFuse = 4,
|
||||||
GrenadeCharge = true,
|
GrenadeCharge = true,
|
||||||
|
|
||||||
|
@ -698,7 +598,7 @@ do -- Grenades, nothing here is guaranteed.
|
||||||
Custom_Reload = GrenadeReload,
|
Custom_Reload = GrenadeReload,
|
||||||
Custom_Think = GrenadeThink,
|
Custom_Think = GrenadeThink,
|
||||||
Custom_Holster = GrenadeHolster,
|
Custom_Holster = GrenadeHolster,
|
||||||
GrenadeEnt = "benny_grenade_molotov",
|
GrenadeEnt = "b-gr_molotov",
|
||||||
GrenadeFuse = 4,
|
GrenadeFuse = 4,
|
||||||
GrenadeCharge = true,
|
GrenadeCharge = true,
|
||||||
|
|
||||||
|
@ -718,7 +618,7 @@ do -- Grenades, nothing here is guaranteed.
|
||||||
Custom_Reload = GrenadeReload,
|
Custom_Reload = GrenadeReload,
|
||||||
Custom_Think = GrenadeThink,
|
Custom_Think = GrenadeThink,
|
||||||
Custom_Holster = GrenadeHolster,
|
Custom_Holster = GrenadeHolster,
|
||||||
GrenadeEnt = "benny_grenade_tknife",
|
GrenadeEnt = "b-gr_tknife",
|
||||||
GrenadeFuse = 4,
|
GrenadeFuse = 4,
|
||||||
GrenadeCharge = true,
|
GrenadeCharge = true,
|
||||||
|
|
||||||
|
@ -738,7 +638,7 @@ do -- Grenades, nothing here is guaranteed.
|
||||||
Custom_Reload = GrenadeReload,
|
Custom_Reload = GrenadeReload,
|
||||||
Custom_Think = GrenadeThink,
|
Custom_Think = GrenadeThink,
|
||||||
Custom_Holster = GrenadeHolster,
|
Custom_Holster = GrenadeHolster,
|
||||||
GrenadeEnt = "benny_grenade_smoke",
|
GrenadeEnt = "b-gr_smoke",
|
||||||
GrenadeFuse = 4,
|
GrenadeFuse = 4,
|
||||||
GrenadeCharge = true,
|
GrenadeCharge = true,
|
||||||
|
|
||||||
|
@ -758,7 +658,7 @@ do -- Grenades, nothing here is guaranteed.
|
||||||
Custom_Reload = GrenadeReload,
|
Custom_Reload = GrenadeReload,
|
||||||
Custom_Think = GrenadeThink,
|
Custom_Think = GrenadeThink,
|
||||||
Custom_Holster = GrenadeHolster,
|
Custom_Holster = GrenadeHolster,
|
||||||
GrenadeEnt = "benny_grenade_flashbang",
|
GrenadeEnt = "b-gr_flashbang",
|
||||||
GrenadeFuse = 2,
|
GrenadeFuse = 2,
|
||||||
GrenadeCharge = false,
|
GrenadeCharge = false,
|
||||||
|
|
||||||
|
@ -778,7 +678,7 @@ do -- Grenades, nothing here is guaranteed.
|
||||||
Custom_Reload = GrenadeReload,
|
Custom_Reload = GrenadeReload,
|
||||||
Custom_Think = GrenadeThink,
|
Custom_Think = GrenadeThink,
|
||||||
Custom_Holster = GrenadeHolster,
|
Custom_Holster = GrenadeHolster,
|
||||||
GrenadeEnt = "benny_grenade_prox",
|
GrenadeEnt = "b-gr_prox",
|
||||||
GrenadeFuse = 4,
|
GrenadeFuse = 4,
|
||||||
GrenadeCharge = true,
|
GrenadeCharge = true,
|
||||||
|
|
||||||
|
|
|
@ -110,7 +110,7 @@ WEAPONS["g_gas"] = {
|
||||||
Custom_Reload = GrenadeReload,
|
Custom_Reload = GrenadeReload,
|
||||||
Custom_Think = GrenadeThink,
|
Custom_Think = GrenadeThink,
|
||||||
Custom_Holster = GrenadeHolster,
|
Custom_Holster = GrenadeHolster,
|
||||||
GrenadeEnt = "benny_grenade_gas",
|
GrenadeEnt = "b-gr_gas",
|
||||||
GrenadeFuse = 4,
|
GrenadeFuse = 4,
|
||||||
GrenadeCharge = true,
|
GrenadeCharge = true,
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ WEAPONS["g_claymore"] = {
|
||||||
Custom_Reload = GrenadeReload,
|
Custom_Reload = GrenadeReload,
|
||||||
Custom_Think = GrenadeThink,
|
Custom_Think = GrenadeThink,
|
||||||
Custom_Holster = GrenadeHolster,
|
Custom_Holster = GrenadeHolster,
|
||||||
GrenadeEnt = "benny_grenade_claymore",
|
GrenadeEnt = "b-gr_claymore",
|
||||||
GrenadeFuse = 4,
|
GrenadeFuse = 4,
|
||||||
GrenadeCharge = true,
|
GrenadeCharge = true,
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ WEAPONS["g_scrambler"] = {
|
||||||
Custom_Reload = GrenadeReload,
|
Custom_Reload = GrenadeReload,
|
||||||
Custom_Think = GrenadeThink,
|
Custom_Think = GrenadeThink,
|
||||||
Custom_Holster = GrenadeHolster,
|
Custom_Holster = GrenadeHolster,
|
||||||
GrenadeEnt = "benny_grenade_scrambler",
|
GrenadeEnt = "b-gr_scrambler",
|
||||||
GrenadeFuse = 4,
|
GrenadeFuse = 4,
|
||||||
GrenadeCharge = true,
|
GrenadeCharge = true,
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ WEAPONS["g_emp"] = {
|
||||||
Custom_Reload = GrenadeReload,
|
Custom_Reload = GrenadeReload,
|
||||||
Custom_Think = GrenadeThink,
|
Custom_Think = GrenadeThink,
|
||||||
Custom_Holster = GrenadeHolster,
|
Custom_Holster = GrenadeHolster,
|
||||||
GrenadeEnt = "benny_grenade_emp",
|
GrenadeEnt = "b-gr_emp",
|
||||||
GrenadeFuse = 4,
|
GrenadeFuse = 4,
|
||||||
GrenadeCharge = true,
|
GrenadeCharge = true,
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ WEAPONS["g_shockcharge"] = {
|
||||||
Custom_Reload = GrenadeReload,
|
Custom_Reload = GrenadeReload,
|
||||||
Custom_Think = GrenadeThink,
|
Custom_Think = GrenadeThink,
|
||||||
Custom_Holster = GrenadeHolster,
|
Custom_Holster = GrenadeHolster,
|
||||||
GrenadeEnt = "benny_grenade_shockcharge",
|
GrenadeEnt = "b-gr_shockcharge",
|
||||||
GrenadeFuse = 4,
|
GrenadeFuse = 4,
|
||||||
GrenadeCharge = true,
|
GrenadeCharge = true,
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ WEAPONS["g_thermobaric"] = {
|
||||||
Custom_Reload = GrenadeReload,
|
Custom_Reload = GrenadeReload,
|
||||||
Custom_Think = GrenadeThink,
|
Custom_Think = GrenadeThink,
|
||||||
Custom_Holster = GrenadeHolster,
|
Custom_Holster = GrenadeHolster,
|
||||||
GrenadeEnt = "benny_grenade_thermobaric",
|
GrenadeEnt = "b-gr_thermobaric",
|
||||||
GrenadeFuse = 4,
|
GrenadeFuse = 4,
|
||||||
GrenadeCharge = true,
|
GrenadeCharge = true,
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ do -- Sound definitions
|
||||||
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 )
|
||||||
AddSound( "Common.ReloadFail", "benny/hud/reloadfail.ogg", 70, 100, 0.1, CHAN_STATIC )
|
AddSound( "Common.ReloadFail", "benny/hud/reloadfail.ogg", 70, 100, 0.1, CHAN_STATIC )
|
||||||
|
|
||||||
-- Pistols
|
-- Pistols
|
||||||
-- Deagle
|
-- Deagle
|
||||||
AddSound( "Deagle.Cock", "benny/weapons/deagle/cock.ogg", 70, 100, 0.5, CHAN_STATIC )
|
AddSound( "Deagle.Cock", "benny/weapons/deagle/cock.ogg", 70, 100, 0.5, CHAN_STATIC )
|
||||||
|
|
||||||
|
@ -93,9 +93,11 @@ do -- Sound definitions
|
||||||
AddSound( "P226.MagIn", "benny/weapons/p226/magin.ogg", 70, 100, 0.5, CHAN_STATIC )
|
AddSound( "P226.MagIn", "benny/weapons/p226/magin.ogg", 70, 100, 0.5, CHAN_STATIC )
|
||||||
|
|
||||||
-- CZ-75A
|
-- CZ-75A
|
||||||
|
AddSound( "CZ75A.MagOut", "benny/weapons/cz75a/magout.ogg", 70, 100, 0.5, CHAN_STATIC )
|
||||||
|
AddSound( "CZ75A.MagIn", "benny/weapons/cz75a/magin.ogg", 70, 100, 0.5, CHAN_STATIC )
|
||||||
|
|
||||||
|
|
||||||
-- SMGs
|
-- SMGs
|
||||||
-- Bizon
|
-- Bizon
|
||||||
AddSound( "Bizon.Fire", {
|
AddSound( "Bizon.Fire", {
|
||||||
"benny/weapons/bizon/01.ogg",
|
"benny/weapons/bizon/01.ogg",
|
||||||
|
@ -143,7 +145,7 @@ do -- Sound definitions
|
||||||
AddSound( "TMP.MagIn", "benny/weapons/tmp/magin.ogg", 70, 100, 0.5, CHAN_STATIC )
|
AddSound( "TMP.MagIn", "benny/weapons/tmp/magin.ogg", 70, 100, 0.5, CHAN_STATIC )
|
||||||
|
|
||||||
|
|
||||||
-- Rifles
|
-- Rifles
|
||||||
-- FNC
|
-- FNC
|
||||||
AddSound( "FNC.Fire", {
|
AddSound( "FNC.Fire", {
|
||||||
"benny/weapons/fnc/01.ogg",
|
"benny/weapons/fnc/01.ogg",
|
||||||
|
@ -165,7 +167,7 @@ do -- Sound definitions
|
||||||
AddSound( "M16A2.Cock", "benny/weapons/m16a2/cock.ogg", 70, 100, 0.5, CHAN_STATIC )
|
AddSound( "M16A2.Cock", "benny/weapons/m16a2/cock.ogg", 70, 100, 0.5, CHAN_STATIC )
|
||||||
|
|
||||||
|
|
||||||
-- Shotguns
|
-- Shotguns
|
||||||
-- AA12
|
-- AA12
|
||||||
AddSound( "AA12.Fire", "benny/weapons/aa12/01.ogg", 140, 100, 0.5, CHAN_STATIC )
|
AddSound( "AA12.Fire", "benny/weapons/aa12/01.ogg", 140, 100, 0.5, CHAN_STATIC )
|
||||||
AddSound( "AA12.MagOut", "benny/weapons/aa12/magout.ogg", 70, 100, 0.5, CHAN_STATIC )
|
AddSound( "AA12.MagOut", "benny/weapons/aa12/magout.ogg", 70, 100, 0.5, CHAN_STATIC )
|
||||||
|
@ -185,7 +187,7 @@ do -- Sound definitions
|
||||||
AddSound( "SPAS12.MagIn", "benny/weapons/spas12/magin.ogg", 70, 100, 0.5, CHAN_STATIC )
|
AddSound( "SPAS12.MagIn", "benny/weapons/spas12/magin.ogg", 70, 100, 0.5, CHAN_STATIC )
|
||||||
|
|
||||||
|
|
||||||
-- Machine Guns
|
-- Machine Guns
|
||||||
-- QBB-LSW
|
-- QBB-LSW
|
||||||
AddSound( "QBBLSW.Fire", {
|
AddSound( "QBBLSW.Fire", {
|
||||||
"benny/weapons/qbblsw/fire-01.ogg",
|
"benny/weapons/qbblsw/fire-01.ogg",
|
||||||
|
@ -201,7 +203,7 @@ do -- Sound definitions
|
||||||
}, 140, 100, 0.5, CHAN_STATIC )
|
}, 140, 100, 0.5, CHAN_STATIC )
|
||||||
|
|
||||||
|
|
||||||
-- Snipers
|
-- Snipers
|
||||||
-- Barrett .50
|
-- Barrett .50
|
||||||
AddSound( "Barrett.Fire", {
|
AddSound( "Barrett.Fire", {
|
||||||
"benny/weapons/barrett/fire-01.ogg",
|
"benny/weapons/barrett/fire-01.ogg",
|
||||||
|
@ -233,6 +235,10 @@ do -- Bases
|
||||||
Speed_FiringTime = 0.2,
|
Speed_FiringTime = 0.2,
|
||||||
ShootHolsterTime = 0,
|
ShootHolsterTime = 0,
|
||||||
|
|
||||||
|
Init_Item = function( class, item, class_for )
|
||||||
|
print( class, ": Base says hi")
|
||||||
|
end,
|
||||||
|
|
||||||
Func_Attack = function( self, hand )
|
Func_Attack = function( self, hand )
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
@ -288,6 +294,14 @@ do -- Bases
|
||||||
Reload_MagIn_Bonus1 = 0.56,
|
Reload_MagIn_Bonus1 = 0.56,
|
||||||
Reload_MagIn_Bonus2 = 0.56+0.1,
|
Reload_MagIn_Bonus2 = 0.56+0.1,
|
||||||
|
|
||||||
|
Init_Item = function( class, item )
|
||||||
|
if class.BaseClass:GetRaw( "Init_Item" ) then
|
||||||
|
class.BaseClass:GetRaw( "Init_Item" )( class.BaseClass, item )
|
||||||
|
end
|
||||||
|
print( class, ": Firearm init" )
|
||||||
|
item.Loaded = ""
|
||||||
|
end,
|
||||||
|
|
||||||
Func_Attack = function( self, hand )
|
Func_Attack = function( self, hand )
|
||||||
if self:GetAim() == 1 then
|
if self:GetAim() == 1 then
|
||||||
local p = self:GetOwner()
|
local p = self:GetOwner()
|
||||||
|
@ -404,6 +418,13 @@ do -- Bases
|
||||||
Range = 64,
|
Range = 64,
|
||||||
HullSize = 2,
|
HullSize = 2,
|
||||||
|
|
||||||
|
Init_Item = function( class, item )
|
||||||
|
if class.BaseClass:GetRaw( "Init_Item" ) then
|
||||||
|
class.BaseClass:GetRaw( "Init_Item" )( class.BaseClass, item )
|
||||||
|
end
|
||||||
|
print( class, ": Melee init" )
|
||||||
|
end,
|
||||||
|
|
||||||
Func_Attack = function( self, hand )
|
Func_Attack = function( self, hand )
|
||||||
if self:bGetIntDelay( hand ) > CurTime() then
|
if self:bGetIntDelay( hand ) > CurTime() then
|
||||||
return
|
return
|
||||||
|
@ -473,6 +494,13 @@ do -- Bases
|
||||||
Features = "grenade",
|
Features = "grenade",
|
||||||
Hide = true,
|
Hide = true,
|
||||||
|
|
||||||
|
Init_Item = function( class, item )
|
||||||
|
if class.BaseClass:GetRaw( "Init_Item" ) then
|
||||||
|
class.BaseClass:GetRaw( "Init_Item" )( class.BaseClass, item )
|
||||||
|
end
|
||||||
|
print( class, ": Grenade init" )
|
||||||
|
end,
|
||||||
|
|
||||||
WModel = "models/weapons/w_grenade.mdl",
|
WModel = "models/weapons/w_grenade.mdl",
|
||||||
HoldType = "slam",
|
HoldType = "slam",
|
||||||
})
|
})
|
||||||
|
@ -485,12 +513,139 @@ do -- Bases
|
||||||
Features = "magazine",
|
Features = "magazine",
|
||||||
Hide = true,
|
Hide = true,
|
||||||
|
|
||||||
|
--
|
||||||
|
AmmoStd = 0,
|
||||||
|
AutoGenMag = false,
|
||||||
|
|
||||||
|
Init_Item = function( class, item )
|
||||||
|
if class.BaseClass:GetRaw( "Init_Item" ) then
|
||||||
|
class.BaseClass:GetRaw( "Init_Item" )( class.BaseClass, item )
|
||||||
|
end
|
||||||
|
print( class, ": Clip init" )
|
||||||
|
item.Ammo = class.Ammo
|
||||||
|
end,
|
||||||
|
|
||||||
WModel = "models/weapons/w_slam.mdl",
|
WModel = "models/weapons/w_slam.mdl",
|
||||||
HoldType = "slam",
|
HoldType = "slam",
|
||||||
})
|
})
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
do -- Toolgun
|
||||||
|
|
||||||
|
local ToolGunTools = {
|
||||||
|
["ammocrate"] = function( self, p, tr )
|
||||||
|
if SERVER then
|
||||||
|
local summon = ents.Create( "b-eq_ammo" )
|
||||||
|
summon:SetPos( tr.HitPos + tr.HitNormal )
|
||||||
|
summon:Spawn()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
["summon_human"] = function( self, p, tr )
|
||||||
|
if SERVER then
|
||||||
|
local summon = ents.Create( "benny_npc_human" )
|
||||||
|
summon:SetPos( tr.HitPos + tr.HitNormal )
|
||||||
|
local ang = Angle( 0, p:EyeAngles().y+0, 0 )
|
||||||
|
summon:SetAngles( ang )
|
||||||
|
summon:Spawn()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
["remover"] = function( self, p, tr )
|
||||||
|
if SERVER then
|
||||||
|
local ent = tr.Entity
|
||||||
|
if IsValid( ent ) then
|
||||||
|
ent:Remove()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
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_wep_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_wep_toolgun", value )
|
||||||
|
Frame:Remove()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
WEAPONS["toolgun"] = {
|
||||||
|
Name = "TOOL GUN",
|
||||||
|
Description = "Developer development device. Hold ALT for Remover",
|
||||||
|
Base = "base",
|
||||||
|
Category = "special",
|
||||||
|
Equipable = true,
|
||||||
|
|
||||||
|
WModel = "models/weapons/w_toolgun.mdl",
|
||||||
|
HoldType = "revolver",
|
||||||
|
GestureDraw = { ACT_HL2MP_GESTURE_RELOAD_REVOLVER, 0.8 },
|
||||||
|
|
||||||
|
Delay = (60/300),
|
||||||
|
Firemodes = FIREMODE_SEMI,
|
||||||
|
|
||||||
|
-- These for some reason aren't taken by the base correctly
|
||||||
|
Init_Item = function()
|
||||||
|
end,
|
||||||
|
Speed_Move = 1,
|
||||||
|
Speed_Aiming = 1,
|
||||||
|
Speed_Reloading = 1,
|
||||||
|
Speed_Firing = 1,
|
||||||
|
Speed_FiringTime = 0.2,
|
||||||
|
ShootHolsterTime = 0,
|
||||||
|
--
|
||||||
|
|
||||||
|
Func_Attack = function( self, data )
|
||||||
|
if self:GetDelay1() > CurTime() then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
self:SetDelay1( CurTime() + 0.2 )
|
||||||
|
|
||||||
|
local p = self:GetOwner()
|
||||||
|
|
||||||
|
local tr = p:GetEyeTrace()
|
||||||
|
local tool = p:KeyDown( IN_WALK ) and "remover" or p:GetInfo( "benny_wep_toolgun" )
|
||||||
|
if ToolGunTools[tool] then ToolGunTools[tool]( self, p, tr ) else return true end
|
||||||
|
|
||||||
|
if CLIENT and IsFirstTimePredicted() then
|
||||||
|
local vStart = self:GetAttachment( 1 ).Pos
|
||||||
|
local vPoint = tr.HitPos
|
||||||
|
local effectdata = EffectData()
|
||||||
|
effectdata:SetStart( vStart )
|
||||||
|
effectdata:SetOrigin( vPoint )
|
||||||
|
util.Effect( "ToolTracer", effectdata )
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Return true to skip weapon logic
|
||||||
|
return true
|
||||||
|
end,
|
||||||
|
|
||||||
|
Func_Reload = function( self, data )
|
||||||
|
if CLIENT then
|
||||||
|
CreateSelect()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Return true to skip weapon logic
|
||||||
|
return true
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
do -- Melee
|
do -- Melee
|
||||||
|
|
||||||
ItemDef("bat", {
|
ItemDef("bat", {
|
||||||
|
|
Loading…
Reference in New Issue