Bizon, weapon switching (sorta), wip!

This commit is contained in:
Fesiug 2023-09-24 18:38:00 -04:00
parent 57b50709bb
commit ac374ae803
4 changed files with 95 additions and 4 deletions

View File

@ -76,7 +76,7 @@ function SWEP:PrimaryAttack()
-- self:EmitSound( "benny/weapons/1911/0".. math.random(1,3) ..".ogg", 110, 100, 1, CHAN_STATIC ) -- self:EmitSound( "benny/weapons/1911/0".. math.random(1,3) ..".ogg", 110, 100, 1, CHAN_STATIC )
self:B_Ammo1( self:Clip1() - 1 ) self:B_Ammo1( self:Clip1() - 1 )
self:SetDelay1( CurTime() + 0.2 ) self:SetDelay1( CurTime() + self.B_ClassT1.Delay )
return true return true
end end

View File

@ -23,6 +23,25 @@ CAPTIONS["en-us"]["1911.Reload"] = {
LifeTime = 0.5, LifeTime = 0.5,
} }
CAPTIONS["en-us"]["Bizon.Fire"] = {
Name = "Bizon",
Color = color_white,
Text = "[fire]",
Bold = false,
Italic = true,
TypeTime = 0.1,
LifeTime = 0.5,
}
CAPTIONS["en-us"]["Bizon.Reload"] = {
Name = "Bizon",
Color = color_white,
Text = "[reload]",
Bold = false,
Italic = true,
TypeTime = 0.1,
LifeTime = 0.5,
}
CAPTIONS = CAPTIONS["en-us"] CAPTIONS = CAPTIONS["en-us"]
SOUNDS = {} SOUNDS = {}
@ -40,6 +59,7 @@ end
local screwup = SERVER and Color(150, 255, 255) or Color(255, 200, 150) local screwup = SERVER and Color(150, 255, 255) or Color(255, 200, 150)
function B_Sound( ent, tag ) function B_Sound( ent, tag )
if !tag then return end
local tagt = SOUNDS[tag] local tagt = SOUNDS[tag]
if !tagt then MsgC( screwup, "Invalid sound " .. tag .. "\n" ) return end if !tagt then MsgC( screwup, "Invalid sound " .. tag .. "\n" ) return end
local path, sndlevel, pitch, volume, channel = tagt.path, tagt.sndlevel, tagt.pitch, tagt.volume, tagt.channel local path, sndlevel, pitch, volume, channel = tagt.path, tagt.sndlevel, tagt.pitch, tagt.volume, tagt.channel

View File

@ -57,6 +57,20 @@ if CLIENT then
end) end)
end end
-- PROTO: Move this all into weapon code.
concommand.Add("benny_inv_equip", function( ply, cmd, args )
local inv = ply:INV_Get()
local wep = ply:GetActiveWeapon()
local item = inv[args[1]]
-- PROTO: Check that this is the correct 'benny' weapon.
assert( item, "That item doesn't exist." )
wep:SetWep1( args[1] )
wep:SetClip1( item.Ammo )
wep:OnReloaded()
end)
-- Debug inv
if CLIENT then if CLIENT then
local function regen_items( itemlist ) local function regen_items( itemlist )
local ply = LocalPlayer() local ply = LocalPlayer()
@ -69,12 +83,28 @@ if CLIENT then
button:Dock( TOP ) button:Dock( TOP )
button:DockMargin( 0, 0, 0, ss(4) ) button:DockMargin( 0, 0, 0, ss(4) )
button.Text_ID = i button.ID = i
local Class = WEAPONS[v.Class] local Class = WEAPONS[v.Class]
button.Text_Name = Class.Name button.Text_Name = Class.Name
button.Text_Desc = Class.Description button.Text_Desc = Class.Description
-- PROTO: This paint function doesn'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()
local Menu = DermaMenu()
Menu:AddOption( "Equip", function()
RunConsoleCommand("benny_inv_equip", button.ID)
end )
Menu:AddOption( "Discard", function()
RunConsoleCommand("benny_inv_discard", button.ID)
end )
Menu:Open()
end
function button:DoRightClick()
end
function button:Paint( w, h ) function button:Paint( w, h )
surface.SetDrawColor( schemes["benny"]["fg"] ) surface.SetDrawColor( schemes["benny"]["fg"] )
surface.DrawRect( 0, 0, w, h ) surface.DrawRect( 0, 0, w, h )
@ -91,7 +121,7 @@ if CLIENT then
surface.SetFont( "Benny_10" ) surface.SetFont( "Benny_10" )
surface.SetTextPos( ss(4), ss(4 + 20) ) surface.SetTextPos( ss(4), ss(4 + 20) )
surface.DrawText( self.Text_ID ) surface.DrawText( self.ID )
return true return true
end end
end end

View File

@ -7,8 +7,16 @@ AddSound( "1911.Fire", {
"benny/weapons/1911/03.ogg", "benny/weapons/1911/03.ogg",
}, 140, 100, 0.5, CHAN_STATIC ) }, 140, 100, 0.5, CHAN_STATIC )
AddSound( "Bizon.Fire", {
"benny/weapons/bizon/01.ogg",
"benny/weapons/bizon/02.ogg",
"benny/weapons/bizon/03.ogg",
}, 140, 100, 0.5, CHAN_STATIC )
AddSound( "1911.Reload", "benny/weapons/1911/slidedrop.ogg", 140, 100, 0.5, CHAN_STATIC ) AddSound( "1911.Reload", "benny/weapons/1911/slidedrop.ogg", 140, 100, 0.5, CHAN_STATIC )
AddSound( "Bizon.Reload", "benny/weapons/bizon/boltdrop.ogg", 140, 100, 0.5, CHAN_STATIC )
local wep = {} local wep = {}
WEAPONS["1911"] = wep WEAPONS["1911"] = wep
wep.Name = "COBRA .45" wep.Name = "COBRA .45"
@ -28,6 +36,8 @@ wep.Name = "USP .45"
wep.Description = "It works for hardasses around the world, it works for you. Higher capacity." wep.Description = "It works for hardasses around the world, it works for you. Higher capacity."
wep.WModel = "models/weapons/w_pist_usp.mdl" wep.WModel = "models/weapons/w_pist_usp.mdl"
wep.Sound_Fire = "1911.Fire"
wep.Sound_Reload = "1911.Reload" -- placeholder
wep.Delay = (60/300) wep.Delay = (60/300)
wep.Ammo = 12 wep.Ammo = 12
@ -39,6 +49,8 @@ wep.Name = "GLOCK-18"
wep.Description = "Superb precision but poor capacity." wep.Description = "Superb precision but poor capacity."
wep.WModel = "models/weapons/w_pist_glock18.mdl" wep.WModel = "models/weapons/w_pist_glock18.mdl"
wep.Sound_Fire = "1911.Fire"
wep.Sound_Reload = "1911.Reload" -- placeholder
wep.Delay = (60/800) wep.Delay = (60/800)
wep.Ammo = 17 wep.Ammo = 17
@ -49,6 +61,10 @@ WEAPONS["nambu"] = wep
wep.Name = "NAMBU .38" wep.Name = "NAMBU .38"
wep.Description = "Eastern revolver that hits as much as it costs. Low capacity." wep.Description = "Eastern revolver that hits as much as it costs. Low capacity."
wep.WModel = "models/weapons/w_pist_glock18.mdl"
wep.Sound_Fire = "1911.Fire"
wep.Sound_Reload = "1911.Reload" -- placeholder
wep.Delay = (60/180) wep.Delay = (60/180)
wep.Ammo = 6 wep.Ammo = 6
wep.Damage = 26 wep.Damage = 26
@ -58,6 +74,10 @@ WEAPONS["anaconda"] = wep
wep.Name = "ANACONDA" wep.Name = "ANACONDA"
wep.Description = "Precise and kicks like a mule, but low capacity." wep.Description = "Precise and kicks like a mule, but low capacity."
wep.WModel = "models/weapons/w_pist_glock18.mdl"
wep.Sound_Fire = "1911.Fire"
wep.Sound_Reload = "1911.Reload" -- placeholder
wep.Delay = (60/180) wep.Delay = (60/180)
wep.Ammo = 6 wep.Ammo = 6
wep.Damage = 40 wep.Damage = 40
@ -66,6 +86,11 @@ local wep = {}
WEAPONS["tmp"] = wep WEAPONS["tmp"] = wep
wep.Name = "TMP" wep.Name = "TMP"
wep.Description = "Precise." wep.Description = "Precise."
wep.WModel = "models/weapons/w_pist_glock18.mdl"
wep.Sound_Fire = "1911.Fire"
wep.Sound_Reload = "1911.Reload" -- placeholder
wep.Delay = (60/800) wep.Delay = (60/800)
wep.Ammo = 15 wep.Ammo = 15
wep.Damage = 18 wep.Damage = 18
@ -75,6 +100,10 @@ WEAPONS["mp7"] = wep
wep.Name = "MP7" wep.Name = "MP7"
wep.Description = "Small, pistol-sized, and simple." wep.Description = "Small, pistol-sized, and simple."
wep.WModel = "models/weapons/w_pist_glock18.mdl"
wep.Sound_Fire = "1911.Fire"
wep.Sound_Reload = "1911.Reload" -- placeholder
wep.Delay = (60/700) wep.Delay = (60/700)
wep.Ammo = 15 wep.Ammo = 15
wep.Damage = 16 wep.Damage = 16
@ -84,6 +113,10 @@ WEAPONS["mp5k"] = wep
wep.Name = "MP5K" wep.Name = "MP5K"
wep.Description = "Quality manufacturing, but cumbersome." wep.Description = "Quality manufacturing, but cumbersome."
wep.WModel = "models/weapons/w_pist_glock18.mdl"
wep.Sound_Fire = "1911.Fire"
wep.Sound_Reload = "1911.Reload" -- placeholder
wep.Delay = (60/700) wep.Delay = (60/700)
wep.Ammo = 15 wep.Ammo = 15
wep.Damage = 18 wep.Damage = 18
@ -93,6 +126,10 @@ WEAPONS["mac11"] = wep
wep.Name = "MAC-11" wep.Name = "MAC-11"
wep.Description = "More fit for combat in a phone booth." wep.Description = "More fit for combat in a phone booth."
wep.WModel = "models/weapons/w_pist_glock18.mdl"
wep.Sound_Fire = "1911.Fire"
wep.Sound_Reload = "1911.Reload" -- placeholder
wep.Delay = (60/800) wep.Delay = (60/800)
wep.Ammo = 16 wep.Ammo = 16
wep.Damage = 16 wep.Damage = 16
@ -102,6 +139,10 @@ WEAPONS["bizon"] = wep
wep.Name = "BIZON" wep.Name = "BIZON"
wep.Description = "Unwieldy bullet storm." wep.Description = "Unwieldy bullet storm."
wep.WModel = "models/weapons/w_pist_glock18.mdl"
wep.Sound_Fire = "Bizon.Fire"
wep.Sound_Reload = "Bizon.Reload" -- placeholder
wep.Delay = (60/600) wep.Delay = (60/600)
wep.Ammo = 40 wep.Ammo = 40
wep.Damage = 16 wep.Damage = 16