Compare commits

...

3 Commits

Author SHA1 Message Date
Fesiug 79d9b040f3
SCOREBOARD, better text function 2024-09-21 23:45:20 -04:00
Fesiug 32d7bee0ec
FP can have different FOV for VM, debug spawner has preferred order 2024-09-21 23:44:54 -04:00
Fesiug a7825e495a
Guns are now very drop-unsafe
Adds more guns
2024-09-21 23:44:08 -04:00
8 changed files with 637 additions and 122 deletions

View File

@ -60,6 +60,8 @@ function ENT:Think()
end
end
self.Class:EntThink( self )
if CLIENT then return true end
self.BAsleep = self.BAsleep or false
@ -72,7 +74,7 @@ function ENT:Think()
net.WriteEntity(self)
net.Broadcast()
print("SV Stopping prediction on", self)
self:SetCollisionGroup( COLLISION_GROUP_WEAPON )
--self:SetCollisionGroup( COLLISION_GROUP_WEAPON )
self.BAsleep = true
end
elseif self.BAsleep then
@ -114,6 +116,7 @@ end
if SERVER then
function ENT:PhysicsCollide( data, collider )
self.Class:EntPhysicsCollide( self, data, collider )
if ( data.DeltaTime > 0.1 ) then
--self:EmitSound( str, 70, 100, 1, CHAN_STATIC )
end

View File

@ -205,14 +205,11 @@ function SWEP:Think()
local ActiveR_Valid = ActiveR:IsValid()
if DesireR != ActiveR then
print(DesireR, ActiveR)
if ActiveR_Valid then
if ActiveR:GetHolsterIn() == 0 then
--self:Deactive()
print("hi?")
ActiveR.Class.Holster( ActiveR.Class, ActiveR, self )
else
-- wait
-- Waiting for holster to finish
end
else
if DesireR_Valid then

View File

@ -9,6 +9,7 @@ local cam_u = CreateConVar( "b-cam_u", 12 )
local cam_fov = CreateConVar( "b-cam_fov", 75 )
local cam_fp = CreateConVar( "b-cam_fp", 0 )
local cam_fp_fov = CreateConVar( "b-cam_fp_fov", 75 )
local lastfp
local m = 3
@ -35,6 +36,43 @@ function CamSpot( ang, pos )
return tr.HitPos
end
function Convert( fovDegrees, ratio )
local halfAngleRadians = fovDegrees * ( 0.5 * math.pi / 180 )
local t = math.tan( halfAngleRadians )
t = t * ratio
local retDegrees = ( 180 / math.pi ) * math.atan( t )
return retDegrees * 2
end
function QConvert( fovDegrees )
return Convert( fovDegrees, (3/4)/(ScrH()/ScrW()) )
end
function GM:PreDrawViewModels()
local fp = cam_fp:GetBool()
if fp then
cam.Start3D( nil, nil, QConvert( cam_fp_fov:GetFloat() ) )
cam.IgnoreZ( true )
local p = LocalPlayer()
p.IWantDraw = true
p:DrawModel()
local w = p:HandlerCheck()
if w:GetActiveR():IsValid() then
w:GetActiveR():DrawModel()
end
p.IWantDraw = false
cam.IgnoreZ( false )
cam.End3D()
end
end
function GM:PrePlayerDraw( ply, flags )
local fp = cam_fp:GetBool()
if fp and ply == LocalPlayer() and !ply.IWantDraw then
return true
end
end
function GM:CalcView( ply, pos, ang, fov )
local view = {
origin = CamSpot(TPSOverride), -- pos includes the smoothstair offset which looks stupid here

View File

@ -60,6 +60,7 @@ local function painterly( self, w, h )
return true
end
local preferredcategoryorder = { "pistol", "smg", "assaultrifle", "machinegun", "shotgun", "utility" }
local function OpenDebugMenu()
if IsValid(DebugMenu) then DebugMenu:Remove() end
@ -253,6 +254,19 @@ local function OpenDebugMenu()
local categories = {}
-- preferred order
for index, category in SortedPairs( preferredcategoryorder ) do
if category == "base" then continue end
if !categories[category] then
local cate = opt:Add("DCollapsibleCategory")
cate:Dock(TOP)
cate:SetLabel(category)
local plist = vgui.Create("DPanelList")
cate:SetContents(plist)
categories[category] = plist
end
end
for iname, idata in SortedPairs( ITEMS ) do
if idata.Category == "base" then continue end
if !categories[idata.Category] then
@ -338,7 +352,7 @@ local function recursebones( ent, O_id, level )
local gap = ""
for i=1, level do gap = gap .. " " end
for index, id in ipairs( ent:GetChildBones( O_id ) ) do
chat.AddText( gap, c_id, tostring(id), c_white, " - ", c_name, ent:GetBoneName(id) )
MsgC( gap, c_id, tostring(id), c_white, " - ", c_name, ent:GetBoneName(id) .. "\n" )
recursebones( ent, id, level+1 )
end
end
@ -349,7 +363,7 @@ function printallbones( ent )
for id=0, ent:GetBoneCount()-1 do
if ent:GetBoneName(id) == "__INVALIDBONE__" then continue end
if ent:GetBoneParent(id) != -1 then continue end
chat.AddText( gap, c_id, tostring(id), c_white, " - ", c_name, ent:GetBoneName(id) )
MsgC( c_id, tostring(id), c_white, " - ", c_name, ent:GetBoneName(id) .. "\n" )
recursebones( ent, id, 1 )
end
end

View File

@ -29,6 +29,9 @@ end
function hCol( r, g, b, a )
if IsColor(r) and g then
return surface.SetDrawColor( ColorAlpha( r, g ) )
end
return surface.SetDrawColor( r, g, b, a )
end
@ -100,6 +103,21 @@ function qt( text, font, x, y, col, xalign, yalign, col2 )
draw.SimpleText( text, font, x, y, col, xalign, yalign )
end
function hText( text, font, x, y, col, xalign, yalign )
local x, y = hXY( x, y )
draw.SimpleText( text, font, x, y, col, xalign, yalign )
end
function hTextQ( text, font, x, y, col, xalign, yalign, col2 )
local x, y = hXY( x, y )
qt( text, font, x, y, col, xalign, yalign, col2 )
end
function hTextS( text, font, x, y, col, xalign, yalign, col2 )
local x, y = hXY( x, y )
draw.SimpleText( text, font, x+1, y+1, col2, xalign, yalign )
draw.SimpleText( text, font, x, y, col, xalign, yalign )
end
local sizes = {
8, 10, 16, 24, 36, 48
@ -227,17 +245,11 @@ local function QuickDrawBar( BARWIDE, BARTALL, RealTeamID, TeamID, way )
end
if way then
local x, y = hXY( BARWIDE - 5, 0 )
qt( faction_info.CHARNAME, "HUD_36", x, y, faction_info.COLOR_DARK, TEXT_ALIGN_RIGHT, nil, faction_info.COLOR_MAIN )
local x, y = hXY( BARWIDE, BARTALL )
qt( Score_Current .. " / " .. Score_ToWin, "HUD_24", x, y, faction_info.COLOR_MAIN, TEXT_ALIGN_RIGHT, nil, faction_info.COLOR_DARK )
hTextQ( faction_info.CHARNAME, "HUD_36", BARWIDE - 5, 0, faction_info.COLOR_DARK, TEXT_ALIGN_RIGHT, nil, faction_info.COLOR_MAIN )
hTextQ( Score_Current .. " / " .. Score_ToWin, "HUD_24", BARWIDE, BARTALL, faction_info.COLOR_MAIN, TEXT_ALIGN_RIGHT, nil, faction_info.COLOR_DARK )
else
local x, y = hXY( 5, 0 )
qt( faction_info.CHARNAME, "HUD_36", x, y, faction_info.COLOR_DARK, nil, nil, faction_info.COLOR_MAIN )
local x, y = hXY( 0, BARTALL )
qt( Score_Current .. " / " .. Score_ToWin, "HUD_24", x, y, faction_info.COLOR_MAIN, nil, nil, faction_info.COLOR_DARK )
hTextQ( faction_info.CHARNAME, "HUD_36", 5, 0, faction_info.COLOR_DARK, nil, nil, faction_info.COLOR_MAIN )
hTextQ( Score_Current .. " / " .. Score_ToWin, "HUD_24", 0, BARTALL, faction_info.COLOR_MAIN, nil, nil, faction_info.COLOR_DARK )
end
-- Players alive
@ -285,8 +297,7 @@ function GM:HUDPaint()
hCol( COLOR_DARK )
hRect( 0, 0, 328, 65 )
local x, y = hXY( 10, 4 )
qt( CHARNAME, "HUD_48", x, y, COLOR_DARK, nil, nil, COLOR_MAIN )
hTextQ( CHARNAME, "HUD_48", 10, 4, COLOR_DARK, nil, nil, COLOR_MAIN )
local HEALTHPER = p:GetHealth_Blood()/1000
--HEALTHPER = 11/100
@ -299,8 +310,7 @@ function GM:HUDPaint()
hCol( COLOR_MAIN )
hScis( 8, 8, (320-4-4) * HEALTHPER, 41-4-4 )
local x, y = hXY( 10, 4 )
draw.SimpleText( CHARNAME, "HUD_48", x, y, COLOR_DARK )
hText( CHARNAME, "HUD_48", 10, 4, COLOR_DARK )
hScisoff()
local slen = (320-4-4-4-4-4)
@ -349,51 +359,36 @@ function GM:HUDPaint()
end
end
local x, y = hXY( 0, -14 )
qt( p:GetLevel_XP() .. " / 15000", "HUD_16", x, y, COLOR_MAIN, nil, nil, COLOR_DARK )
--qt( "", "HUD_24", x+328, y, COLOR_MAIN, TEXT_ALIGN_RIGHT, nil, COLOR_DARK )
hTextQ( p:GetLevel_XP() .. " / 15000", "HUD_16", 0, -14, COLOR_MAIN, nil, nil, COLOR_DARK )
S_Pop()
end
S_Pop()
if handler then
-- Inventory
S_Push( 20, 20 )
local x, y = hXY( 5, 65+16*0 )
draw.SimpleText( "SelectedNumber: " .. (p.SelectedNumber or 0), "HUD_16", x, y, COLOR_MAIN )
local x, y = hXY( 5, 65+16*1 )
draw.SimpleText( "DesireR: " .. tostring(handler:GetDesireR()), "HUD_16", x, y, COLOR_MAIN )
local x, y = hXY( 5, 65+16*2 )
draw.SimpleText( "ActiveR: " .. tostring(handler:GetActiveR()), "HUD_16", x, y, COLOR_MAIN )
local x, y = hXY( 5, 65+16*3 )
draw.SimpleText( "DesireL: " .. tostring(handler:GetDesireL()), "HUD_16", x, y, COLOR_MAIN )
local x, y = hXY( 5, 65+16*4 )
draw.SimpleText( "ActiveL: " .. tostring(handler:GetActiveL()), "HUD_16", x, y, COLOR_MAIN )
local Pw, Ph, Pg = 110, 30, 10
local thespace = 0
for i, v in ipairs( p:GetInventory():GetWeighted() ) do
thespace = thespace + Pw + Pg
end
thespace = thespace - Pg
thespace = thespace/2
S_Push( ScrW()/2 - thespace, ScrH() - 20 - Ph )
for i, v in ipairs( p:GetInventory():GetWeighted() ) do
hCol( v == handler:GetActiveR() and COLOR_BRIGHT or COLOR_DARK )
hRect( (i-1)*(120+10), 0, 120, 60 )
local x, y = hXY( (i-1)*(120+10), 0 )
draw.SimpleText( l8( v.Class.PrintName ), "HUD_24", x + 120/2, y + 60/2 - (10), COLOR_MAIN, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
if v.GetClip2 then
draw.SimpleText( v:GetClip2() .. "/" .. v.Class.ClipSize2, "HUD_16", x + 10, y + 60/2 + (4), COLOR_MAIN, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER )
end
if v.GetClip then
local drawer = ""
drawer = drawer .. v:GetClip()
drawer = drawer .. "/"
drawer = drawer .. v.Class.ClipSize
draw.SimpleText( drawer, "HUD_16", x + 10, y + 60/2 + (16), COLOR_MAIN, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER )
draw.SimpleText( v:GetFiremode(), "HUD_16", x + 120 - 10, y + 60/2 + (16), COLOR_MAIN, TEXT_ALIGN_RIGHT, TEXT_ALIGN_CENTER )
hCol( v == handler:GetDesireR() and COLOR_BRIGHT or COLOR_DARK )
hRect( (i-1)*(Pw+Pg), 0, Pw, Ph )
if v == handler:GetActiveR() then
hCol( COLOR_MAIN )
hORect( (i-1)*(Pw+Pg)+1, 1, Pw-2, Ph-2, 1 )
end
local x, y = (i-1)*(Pw+Pg), 0
hText( l8( v.Class.PrintName ), "HUD_24", x + Pw/2, y + 5, COLOR_MAIN, TEXT_ALIGN_CENTER )
hText( i, "HUD_16", x + 4, y + 2, COLOR_MAIN )
end
S_Pop()
local wep = handler:GetActiveR()
local wep = handler:GetDesireR()
if wep and wep.GetClip then
local Bw, Bh = 8+(8+2)*30-2+8, 160
S_Push( w - 20 - Bw, h - 20 - Bh )
@ -405,23 +400,37 @@ function GM:HUDPaint()
local leng = Bw-8-8
hRect( 8, 8, leng-70, 26 )
hRect( 8 + leng - 70 + 4, 8, leng-(leng-70)-4, 26 )
local x, y = hXY( 12, 6 )
draw.SimpleText( l8( wep.Class.PrintName ), "HUD_36", x, y, COLOR_DARK )
local x, y = hXY( 10 + (leng - 70) + 70/2, 11 )
hText( l8( wep.Class.PrintName ), "HUD_36", 12, 6, COLOR_DARK )
local bc = wep.Class.BurstCount
draw.SimpleText( fmlookup[bc] or bc .. "RND", "HUD_24", x, y, COLOR_DARK, TEXT_ALIGN_CENTER )
hText( fmlookup[bc] or bc .. "RND", "HUD_24", 10 + (leng - 70) + 70/2, 11, COLOR_DARK, TEXT_ALIGN_CENTER )
S_Pop()
S_Push( Bw - 8 - 8, Bh - 18 - 8 )
local Tw, Th = 6, 18
if wep.Class.ClipSize>45 then
Tw = 3
Th = 13
elseif wep.Class.ClipSize<14 then
Tw = 8
Th = 22
end
S_Push( Bw - Tw - 8, Bh - Th - 8 )
for i=0, wep.Class.ClipSize-1 do
if i>29 then
hCol( COLOR_DARK )
hRect( (0 - Tw - 2)*i-4, -4, Tw+2, Th+8 )
end
end
for i=0, wep.Class.ClipSize-1 do
if wep:GetClip() >= (i+1) then
hCol( COLOR_MAIN )
hRect( (0 - 8 - 2)*i, 0, 8, 18 )
hRect( (0 - Tw - 2)*i, 0, Tw, Th )
hCol( COLOR_DARK )
hRect( (0 - 8 - 2)*i, 14, 8, 2 )
hRect( (0 - Tw - 2)*i, Th-4, Tw, 2 )
else
hCol( COLOR_BRIGHT )
hORect( (0 - 8 - 2)*i, 0, 8, 18 )
hORect( (0 - Tw - 2)*i, 0, Tw, Th )
--hORect( (0 - 8 - 2)*i+1, 1, 8-2, 18-2 )
end
end
@ -472,12 +481,10 @@ function GM:HUDPaint()
if BennyGame:GetState() != BG_STATE_WAITINGFORPLAYERS then
local d1, d2
local tt = string.FormattedTime( math.max( stupidtime, 0 ) )
if tt.m > 0 then
if tt.h > 0 then
d1 = string.format( "%01i:%02i:%02i", tt.h, tt.m, tt.s )
elseif tt.m > 0 then
d1 = string.format( "%01i:%02i", tt.m, tt.s )
d2 = false--tt.s
if tt.h > 0 then
d1 = tt.h .. ":" .. d1
end
else
d1 = string.format( "%02i", tt.s )
d2 = string.format( ".%02i", tt.ms )
@ -490,16 +497,13 @@ function GM:HUDPaint()
twid = twid + surface.GetTextSize(".00")
end
local x, y = hXY( DISPLAYWIDE/2 + 0 - twid/2, 4 )
draw.SimpleText( d1, "HUD_48", x, y, COLOR_MAIN )
hText( d1, "HUD_48", DISPLAYWIDE/2 + 0 - twid/2, 4, COLOR_MAIN )
local twid2 = surface.GetTextSize(d1)
if d2 then
local x, y = hXY( DISPLAYWIDE/2 + twid2 - twid/2, 11 )
draw.SimpleText( d2, "HUD_36", x, y, COLOR_MAIN )
hText( d2, "HUD_36", DISPLAYWIDE/2 + twid2 - twid/2, 11, COLOR_MAIN )
end
end
local x, y = hXY( DISPLAYWIDE/2, -16 )
local TITLE
if BennyGame:GetState() == BG_STATE_PRE then
TITLE = "PREGAME"
@ -509,7 +513,7 @@ function GM:HUDPaint()
TITLE = "WAITING FOR PLAYERS"
end
if TITLE then
qt( TITLE, "HUD_16", x, y, COLOR_MAIN, TEXT_ALIGN_CENTER, nil, COLOR_DARK )
hTextS( TITLE, "HUD_24", DISPLAYWIDE/2, -18, COLOR_MAIN, TEXT_ALIGN_CENTER, nil, COLOR_DARK )
end
if false then
@ -582,8 +586,7 @@ function GM:HUDPaint()
hORect( 1, 1, 48-2, 48-2, math.floor(23 * capturepercent) )
end
local x, y = hXY( 48/2, 9 )
qt( alphabet[i] or i, "HUD_36", x, y, faction_info.COLOR_MAIN, TEXT_ALIGN_CENTER, nil, faction_info.COLOR_DARK )
hTextQ( alphabet[i] or i, "HUD_36", 48/2, 9, faction_info.COLOR_MAIN, TEXT_ALIGN_CENTER, nil, faction_info.COLOR_DARK )
S_Pop()
end
S_Pop()
@ -637,12 +640,9 @@ function GM:HUDPaint()
hORect( -100+1, 35+1, 200-2, 76-2 )
hCol( BARCOLOR_MAIN )
hORect( -80+1, 1, 160-2, 38-2, 1 )
local x, y = hXY( 0, 4 )
qt( "POINT " .. (alphabet[ AllFlagFlip[obj] ] or AllFlagFlip[obj]), "HUD_36", x, y, BARCOLOR_MAIN, TEXT_ALIGN_CENTER, nil, BARCOLOR_DARK )
local x, y = hXY( 0, TITLE=="SECURE" and 62 or 40 )
qt( TITLE, "HUD_24", x, y, obj:GetContested() and CONTOLER_MAIN or COLOR_MAIN, TEXT_ALIGN_CENTER, nil, COLOR_DARK )
hTextQ( "POINT " .. (alphabet[ AllFlagFlip[obj] ] or AllFlagFlip[obj]), "HUD_36", 0, 4, BARCOLOR_MAIN, TEXT_ALIGN_CENTER, nil, BARCOLOR_DARK )
hTextQ( TITLE, "HUD_24", 0, TITLE=="SECURE" and 62 or 40, obj:GetContested() and CONTOLER_MAIN or COLOR_MAIN, TEXT_ALIGN_CENTER, nil, COLOR_DARK )
if TITLE!="SECURE" then
S_Push( -BWIDE/2, 62 )
@ -653,8 +653,7 @@ function GM:HUDPaint()
hCol( TAKCOLOR_MAIN )
hRect( 3, 3, math.floor((BWIDE-6) * PERCENT), BTALL-6 )
S_Pop()
local x, y = hXY( 0, 78 )
qt( math.floor(PERCENT*100) .. "%", "HUD_36", x, y, obj:GetContested() and CONTOLER_MAIN or COLOR_MAIN, TEXT_ALIGN_CENTER, nil, obj:GetContested() and CONTOLER_DARK or COLOR_DARK )
hTextQ( math.floor(PERCENT*100) .. "%", "HUD_36", 0, 78, obj:GetContested() and CONTOLER_MAIN or COLOR_MAIN, TEXT_ALIGN_CENTER, nil, obj:GetContested() and CONTOLER_DARK or COLOR_DARK )
end
S_Pop()
end
@ -683,19 +682,11 @@ function GM:HUDPaint()
-- table.insert( hints, { "[E]", "PICK UP" } )
end
local x, y = hXY( 0, 0 )
for i, v in ipairs( hints ) do
draw.SimpleText( v[1], "HUD_24", x - 150 + 1, y + (24*(i-1)) + 1, COLOR_DARK, TEXT_ALIGN_CENTER )
draw.SimpleText( v[2], "HUD_24", x + 1, y + (24*(i-1)) + 1, COLOR_DARK, TEXT_ALIGN_RIGHT )
hTextS( v[1], "HUD_24", -150, (24*(i-1)), COLOR_MAIN, TEXT_ALIGN_CENTER, nil, COLOR_DARK )
hTextS( v[2], "HUD_24", 0, (24*(i-1)), COLOR_MAIN, TEXT_ALIGN_RIGHT, nil, COLOR_DARK )
if v[3] then
draw.SimpleText( v[3], "HUD_16", x - 150 + 1, y+3 + (24*(i-1)) + 1, COLOR_DARK, TEXT_ALIGN_CENTER )
end
end
for i, v in ipairs( hints ) do
draw.SimpleText( v[1], "HUD_24", x - 150, y + (24*(i-1)), COLOR_MAIN, TEXT_ALIGN_CENTER )
draw.SimpleText( v[2], "HUD_24", x, y + (24*(i-1)), COLOR_MAIN, TEXT_ALIGN_RIGHT )
if v[3] then
draw.SimpleText( v[3], "HUD_16", x - 150, y+3 + (24*(i-1)), COLOR_MAIN, TEXT_ALIGN_CENTER )
hTextS( v[3], "HUD_16", -150, 3 + (24*(i-1)), COLOR_MAIN, TEXT_ALIGN_CENTER, nil, COLOR_DARK )
end
end
@ -778,4 +769,165 @@ function GM:HUDShouldDraw( name )
else
return true
end
end
--local players = {
-- { name = "Jim", Team = "mp_arng" },
-- { name = "Sas", Team = "mp_arng" },
-- { name = "Greg", Team = "mp_arng" },
-- { name = "Nate", Team = "mp_arng" },
--
-- { name = "Ion", Team = "mp_plasof" },
-- { name = "Beo", Team = "mp_plasof" },
-- { name = "Poe", Team = "mp_plasof" },
-- { name = "Zio", Team = "mp_plasof" },
--}
local things = {
{ name = "Score", size = 100,
get = function( ply )
return 0
end,},
{ name = "Kills", size = 50,
get = function( ply )
return ply:Frags()
end,},
{ name = "Deaths", size = 50,
get = function( ply )
return ply:Deaths()
end,},
{ name = "Time", size = 50,
get = function( ply )
return ":00"
end,},
{ name = "Ping", size = 50,
get = function( ply )
return ply:Ping()
end,} -- Ping
}
local function QuickDrawStat( wide, data, first )
local gap = 0
local teamd = TEAMS[data.id]
local faction = FACTIONS[teamd.factionid]
local TeamName = l8( teamd.name )
hTextQ( TeamName, "HUD_36", 0, 0, faction.COLOR_MAIN, nil, nil, faction.COLOR_DARK )
gap = gap + 30
hCol( faction.COLOR_DARK )
hRect( -5+1, gap+1, wide+10, 2 )
hCol( faction.COLOR_MAIN )
hRect( -5, gap, wide+10, 2 )
gap = gap + 6
local blep = wide
for i, v in ipairs(things) do blep = blep - v.size end
if first then
local bloop = 0
for i, v in ipairs(things) do
hCol( 127, 127, 127, 80 )
local x, y = blep+bloop, 12
if v.name then
hTextS( v.name, "HUD_16", x+(v.size/2), y, color_white, TEXT_ALIGN_CENTER, nil, color_black )
end
bloop = bloop + v.size
end
end
for i, ply in ipairs( data.players ) do
local bloop = 0
hCol( faction.COLOR_MAIN, 30 )
hRect( 0, gap, wide, 30 )
hCol( faction.COLOR_DARK )
hORect( 3, gap+3, wide-4, 30-4, 1 )
hCol( faction.COLOR_MAIN )
hORect( 2, gap+2, wide-4, 30-4, 1 )
hTextQ( ply:GetLevel(), "HUD_16", 18, gap+8, Color( 255, 255, 0 ), TEXT_ALIGN_CENTER, nil, color_black )
hTextQ( ply:Nick(), "HUD_24", 32, gap+5, color_white, nil, nil, color_black )
local bloop = 0
for i, v in ipairs(things) do
hCol( 255, 0, 0 )
local x, y = blep+bloop, gap+8
hTextS( v.get( ply ), "HUD_16", x+(v.size/2), y, color_white, TEXT_ALIGN_CENTER, nil, color_black )
bloop = bloop + v.size
end
gap = gap + 32
end
return gap
end
local ScoreWide = 600
function GM:ScoreboardShow()
drawscoreboard = true
end
function GM:ScoreboardHide()
drawscoreboard = false
end
function GM:HUDDrawScoreBoard()
if !drawscoreboard then return end
local p = LocalPlayer()
local w, h = ScrW(), ScrH()
local handler = p:HandlerCheck()
stack = util.Stack()
local myteam = p:Team()
local CURRCHAR
if BennyGame:GetType() == BG_GTYPE_CAMPAIGN then
CURRCHAR = "benny"
else
CURRCHAR = TEAMS[myteam].factionid
end
local COLOR_MAIN = FACTIONS[CURRCHAR].COLOR_MAIN
local COLOR_DARK = FACTIONS[CURRCHAR].COLOR_DARK
local CHARNAME = FACTIONS[CURRCHAR].CHARNAME
local MP = BennyGame:GetType() == BG_GTYPE_MP
if MP then
S_Push( w/2 - ScoreWide/2, h/2 - 400/2 )
local OrganizedTeams = {}
local IDtoOrg = {}
local MyCreation = { id = myteam, players = {} }
table.insert( OrganizedTeams, MyCreation )
IDtoOrg[myteam] = MyCreation
for TeamID, RealTeamID in ipairs( BennyGame.TeamsInPlay ) do
if RealTeamID == myteam then continue end
local MyCreation = { id = RealTeamID, players = {} }
table.insert( OrganizedTeams, MyCreation )
IDtoOrg[RealTeamID] = MyCreation
end
for _, ply in player.Iterator() do
local thisteam = ply:Team()
if !IDtoOrg[thisteam] then
local MyCreation = { id = thisteam, players = {} }
table.insert( OrganizedTeams, MyCreation )
IDtoOrg[thisteam] = MyCreation
end
table.insert( IDtoOrg[thisteam].players, ply )
end
local gap = 0
for index, data in ipairs( OrganizedTeams ) do
S_Push( 0, 0 + gap )
gap = gap + QuickDrawStat( ScoreWide, data, index==1 )
S_Pop()
end
S_Pop()
else
-- Timer, player & team score
end
if stack:Size() != 0 then print("Stack unfinished.") end
return
end

View File

@ -102,6 +102,12 @@ AddItem( "base", {
end
end,
["EntThink"] = function( class, ent, handler )
end,
["EntPhysicsCollide"] = function( class, ent, data, collider )
end,
["Reload"] = function( class, ent, handler )
end,
})
@ -129,7 +135,7 @@ local AnimationLookup = {
},
["holster"] = {
["handgun"] = "handgun_holster",
["rifle"] = "holster_handgun",
["rifle"] = "handgun_holster",
},
}
@ -191,7 +197,10 @@ AddItem( "base_firearm", {
local Topped = ent:GetBurstCount() == class.BurstCount
local Runaway = class.BurstRunaway
local BAuto = class.BurstAuto
local Firedown = handler:GetOwner():KeyDown( IN_ATTACK )
local Firedown = false
if IsValid(handler) then
Firedown = handler:GetOwner():KeyDown( IN_ATTACK )
end
if Runaway and InProcess and !Topped then
class:Attack( ent, handler )
else
@ -213,6 +222,33 @@ AddItem( "base_firearm", {
BaseClass.Think( class, ent, handler )
end,
["EntThink"] = function( class, ent, handler )
if IsValid(handler) then return end
local InProcess = ent:GetBurstCount() > 0
local Topped = ent:GetBurstCount() == class.BurstCount
local Runaway = class.BurstRunaway
local BAuto = class.BurstAuto
local Firedown = false
if Runaway and InProcess and !Topped then
class:Attack( ent, handler )
else
if !Firedown then
if !Topped and InProcess then
ent:SetDelayBurst( CurTime() + class.BurstDelay )
end
ent:SetBurstCount( 0 )
end
if Topped and BAuto then
ent:SetBurstCount( 0 )
ent:SetDelayBurst( CurTime() + class.BurstDelay )
end
end
if ent:GetRefillTime() != 0 and ent:GetRefillTime() <= CurTime() then
ent:SetClip( class.ClipSize )
ent:SetRefillTime( 0 )
end
end,
["Attack"] = function( class, ent, handler )
if ent:GetClip() <= 0 then return end
if ent:GetDelay() > CurTime() then return end
@ -220,6 +256,9 @@ AddItem( "base_firearm", {
if ent:GetBurstCount() >= class.BurstCount then return end
if ent:GetHolsterIn() != 0 then return end
local HandlerValid = IsValid(handler)
local handlerorself = HandlerValid and handler or ent
local Runaway = class.BurstRunaway
local BAuto = class.BurstAuto
ent:SetBurstCount( ent:GetBurstCount() + 1 )
@ -232,29 +271,47 @@ AddItem( "base_firearm", {
ent:SetClip( ent:GetClip() - 1 )
if ent:GetClip() == 0 then
handler:EmitSound( "benny/weapons/1911/slidedrop.ogg", 70, 100, 0.4, CHAN_STATIC )
handlerorself:EmitSound( "benny/weapons/1911/slidedrop.ogg", 70, 100, 0.4, CHAN_STATIC )
end
ent:SetDelay( CurTime() + class.Delay )
handler:EmitSound( istable(class.FireSound) and TSelShared(class.FireSound, "FireSound") or class.FireSound, 140, 100, 0.4, CHAN_STATIC )
handlerorself:EmitSound( istable(class.FireSound) and TSelShared(class.FireSound, "FireSound") or class.FireSound, 100, 100, 0.5, CHAN_STATIC )
local acc = math.rad( class.Accuracy or 0 )
local p = handler:GetOwner()
p:LagCompensation(true)
handler:FireBullets( {
Attacker = p,
Damage = 1,
Force = 1,
Tracer = 0,
Num = class.Pellets,
Dir = p:GetAimVector(),
Src = p:GetShootPos(),
Spread = Vector( acc, acc, 0 ),
} )
p:LagCompensation(false)
if HandlerValid then
local p = handler:GetOwner()
p:LagCompensation(true)
handler:FireBullets( {
Attacker = p,
Damage = 1,
Force = 5,
Tracer = 0,
Num = class.Pellets,
Dir = p:GetAimVector(),
Src = p:GetShootPos(),
Spread = Vector( acc, acc, 0 ),
} )
p:LagCompensation(false)
else
ent:FireBullets( {
Attacker = ent,
Damage = 1,
Force = 1,
Tracer = 0,
Num = class.Pellets,
Dir = ent:GetForward(),
Src = ent:GetPos(),
Spread = Vector( acc, acc, 0 ),
} )
local physobj = ent:GetPhysicsObject()
if physobj:IsValid() then
physobj:AddVelocity( ent:GetForward() * -300 )
physobj:AddAngleVelocity( VectorRand( -360*20, 360*20 ) )
end
end
local ply = handler:GetOwner()
if SERVER or CLIENT and IsFirstTimePredicted() then
local ply = handlerorself:GetOwner()
if HandlerValid and (SERVER or CLIENT and IsFirstTimePredicted()) then
ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD, ply:LookupSequence( AnimationLookup["fire"][class.HoldType] ), 0, true )
end
@ -317,6 +374,12 @@ AddItem( "base_firearm", {
ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD, ply:LookupSequence( AnimationLookup["holster"][class.HoldType] ), 0, true )
end
end,
["EntPhysicsCollide"] = function( class, ent, data, collider )
if ( data.DeltaTime > 0.1 and data.Speed > 200 ) then
class:Attack( ent )
end
end,
["FinishHolster"] = function( class, ent, handler )
handler:EmitSound( "weapons/m4a1/m4a1_deploy.wav", 70, 125, 0.4, CHAN_STATIC )
@ -727,6 +790,7 @@ do -- Rifles
end
do -- MGs
AddItem( "qbb", {
PrintName = "#Item.qbb.Name",
Description = "#Item.qbb.Description",
@ -749,6 +813,53 @@ do -- MGs
Accuracy_Reset = 0.4,
Accuracy_Decay = 12,
})
AddItem( "stoner", {
PrintName = "#Item.stoner.Name",
Description = "#Item.stoner.Description",
Category = "machinegun",
Base = "base_firearm",
Model = "models/benny/weapons/test_stoner.mdl",
HoldType = "rifle",
ClipSize = 100,
Delay = (60/880),
FireSound = {
"benny/weapons/stoner63/01.ogg",
"benny/weapons/stoner63/02.ogg",
"benny/weapons/stoner63/03.ogg",
},
Accuracy = 1,
Accuracy_Add = 0.4,
Accuracy_Reset = 0.4,
Accuracy_Decay = 12,
})
AddItem( "hk21", {
PrintName = "#Item.hk21.Name",
Description = "#Item.hk21.Description",
Category = "machinegun",
Base = "base_firearm",
Model = "models/benny/weapons/test_hk21.mdl",
HoldType = "rifle",
ClipSize = 70,
Delay = (60/640),
FireSound = {
"benny/weapons/hk21/39_01.ogg",
"benny/weapons/hk21/39_02.ogg",
"benny/weapons/hk21/39_03.ogg",
},
Accuracy = 1,
Accuracy_Add = 0.4,
Accuracy_Reset = 0.4,
Accuracy_Decay = 12,
})
end
do -- SMGs
@ -835,7 +946,7 @@ do -- Shotguns
Category = "shotgun",
Base = "base_firearm",
Model = "models/weapons/w_shotgun.mdl",
Model = "models/benny/weapons/test_spas12.mdl",
HoldType = "rifle",
ClipSize = 8,
@ -858,6 +969,180 @@ do -- Shotguns
Accuracy_Decay = 12,
})
AddItem( "aa12", {
PrintName = "#Item.aa12.Name",
Description = "#Item.aa12.Description",
Category = "shotgun",
Base = "base_firearm",
Model = "models/benny/weapons/test_aa12.mdl",
HoldType = "rifle",
ClipSize = 8,
Pellets = 8,
Delay = 0.4,
BurstCount = 1,
FireSound = {
"benny/weapons/spas12/01.ogg",
"benny/weapons/spas12/02.ogg",
"benny/weapons/spas12/03.ogg",
},
MagOutSound = "benny/weapons/spas12/magout-01.ogg",
MagInSound = "benny/weapons/spas12/magout-02.ogg",
BoltDropSound = "benny/weapons/spas12/magin.ogg",
BoltPullSound = "benny/weapons/glock/magin.ogg",
Accuracy = 8,
Accuracy_Add = 0.4,
Accuracy_Reset = 0.4,
Accuracy_Decay = 12,
})
AddItem( "db", {
PrintName = "#Item.db.Name",
Description = "#Item.db.Description",
Category = "shotgun",
Base = "base_firearm",
Model = "models/benny/weapons/test_db.mdl",
HoldType = "rifle",
ClipSize = 2,
Pellets = 8,
Delay = 0.4,
BurstCount = 1,
FireSound = {
"benny/weapons/spas12/01.ogg",
"benny/weapons/spas12/02.ogg",
"benny/weapons/spas12/03.ogg",
},
MagOutSound = "benny/weapons/spas12/magout-01.ogg",
MagInSound = "benny/weapons/spas12/magout-02.ogg",
BoltDropSound = "benny/weapons/spas12/magin.ogg",
BoltPullSound = "benny/weapons/glock/magin.ogg",
Accuracy = 4,
Accuracy_Add = 0.4,
Accuracy_Reset = 0.4,
Accuracy_Decay = 12,
})
AddItem( "1887", {
PrintName = "#Item.1887.Name",
Description = "#Item.1887.Description",
Category = "shotgun",
Base = "base_firearm",
Model = "models/benny/weapons/test_1887.mdl",
HoldType = "rifle",
ClipSize = 5,
Pellets = 8,
Delay = 0.4,
BurstCount = 1,
FireSound = {
"benny/weapons/spas12/01.ogg",
"benny/weapons/spas12/02.ogg",
"benny/weapons/spas12/03.ogg",
},
MagOutSound = "benny/weapons/spas12/magout-01.ogg",
MagInSound = "benny/weapons/spas12/magout-02.ogg",
BoltDropSound = "benny/weapons/spas12/magin.ogg",
BoltPullSound = "benny/weapons/glock/magin.ogg",
Accuracy = 8,
Accuracy_Add = 0.4,
Accuracy_Reset = 0.4,
Accuracy_Decay = 12,
})
AddItem( "spas15", {
PrintName = "#Item.spas15.Name",
Description = "#Item.spas15.Description",
Category = "shotgun",
Base = "base_firearm",
Model = "models/benny/weapons/test_spas15.mdl",
HoldType = "rifle",
ClipSize = 6,
Pellets = 8,
Delay = 0.6,
BurstCount = 1,
FireSound = {
"benny/weapons/spas12/01.ogg",
"benny/weapons/spas12/02.ogg",
"benny/weapons/spas12/03.ogg",
},
MagOutSound = "benny/weapons/spas12/magout-01.ogg",
MagInSound = "benny/weapons/spas12/magout-02.ogg",
BoltDropSound = "benny/weapons/spas12/magin.ogg",
BoltPullSound = "benny/weapons/glock/magin.ogg",
Accuracy = 8,
Accuracy_Add = 0.4,
Accuracy_Reset = 0.4,
Accuracy_Decay = 12,
})
AddItem( "r870", {
PrintName = "#Item.r870.Name",
Description = "#Item.r870.Description",
Category = "shotgun",
Base = "base_firearm",
Model = "models/benny/weapons/test_r870.mdl",
HoldType = "rifle",
ClipSize = 4,
Pellets = 8,
Delay = 0.6,
BurstCount = 1,
FireSound = {
"benny/weapons/spas12/01.ogg",
"benny/weapons/spas12/02.ogg",
"benny/weapons/spas12/03.ogg",
},
MagOutSound = "benny/weapons/spas12/magout-01.ogg",
MagInSound = "benny/weapons/spas12/magout-02.ogg",
BoltDropSound = "benny/weapons/spas12/magin.ogg",
BoltPullSound = "benny/weapons/glock/magin.ogg",
Accuracy = 8,
Accuracy_Add = 0.4,
Accuracy_Reset = 0.4,
Accuracy_Decay = 12,
})
AddItem( "striker", {
PrintName = "#Item.striker.Name",
Description = "#Item.striker.Description",
Category = "shotgun",
Base = "base_firearm",
Model = "models/benny/weapons/test_striker.mdl",
HoldType = "rifle",
ClipSize = 12,
Pellets = 8,
Delay = 0.3,
BurstCount = 1,
FireSound = {
"benny/weapons/spas12/01.ogg",
"benny/weapons/spas12/02.ogg",
"benny/weapons/spas12/03.ogg",
},
MagOutSound = "benny/weapons/spas12/magout-01.ogg",
MagInSound = "benny/weapons/spas12/magout-02.ogg",
BoltDropSound = "benny/weapons/spas12/magin.ogg",
BoltPullSound = "benny/weapons/glock/magin.ogg",
Accuracy = 8,
Accuracy_Add = 0.4,
Accuracy_Reset = 0.4,
Accuracy_Decay = 12,
})
end
-- bat

View File

@ -35,6 +35,12 @@ L["#Item.qbz.Description"] = "Low-profile bullpup assault rifle"
L["#Item.qbb.Name"] = "QBB-LSW"
L["#Item.qbb.Description"] = "Bullpup machine gun"
L["#Item.stoner.Name"] = "STONER-63"
L["#Item.stoner.Description"] = "Modular machine gun"
L["#Item.hk21.Name"] = "HK-21"
L["#Item.hk21.Description"] = "Powerful medium machine gun"
L["#Item.m16a2.Name"] = "M16A2"
L["#Item.m16a2.Description"] = "Rugged burst rifle"
@ -56,6 +62,24 @@ L["#Item.mp7.Description"] = "Special forces PDW"
L["#Item.mac11.Name"] = "MAC-11"
L["#Item.mac11.Description"] = "Tiny hornet gun"
L["#Item.1887.Name"] = "1887"
L["#Item.1887.Description"] = "Lever-action"
L["#Item.db.Name"] = "DB"
L["#Item.db.Description"] = "Side-by-side shotgun"
L["#Item.aa12.Name"] = "AA-12"
L["#Item.aa12.Description"] = "Automatic combat shotgun"
L["#Item.striker.Name"] = "Streetsweeper"
L["#Item.striker.Description"] = "Semi-automatic drum-fed shotgun"
L["#Item.r870.Name"] = "R870"
L["#Item.r870.Description"] = "Sawn-off pump-action shotgun"
L["#Item.spas15.Name"] = "SPAS-15"
L["#Item.spas15.Description"] = "Mag-fed pump-action shotgun"
L["#Item.satchels.Name"] = "Satchels"
L["#Item.satchels.Description"] = "Packs of bombs and a detonator"

View File

@ -7,18 +7,19 @@ local function qpaint( self, w, h )
surface.SetDrawColor( COLOR_MAIN )
surface.DrawOutlinedRect( 1, 1, w-2, h-2, 1 )
draw.SimpleText( self.text, "HUD_24", w/2, 6, COLOR_MAIN, TEXT_ALIGN_CENTER )
draw.SimpleText( self.text, "HUD_36", w/2, 4, COLOR_MAIN, TEXT_ALIGN_CENTER )
end
local settings = {
{
name = "Camera",
items = {
{ type = TYPE_BOOL, cvar = "b-cam_fp", name = "First-person Mode" },
{ type = TYPE_NUMBER, cvar = "b-cam_f", min = -200, max = 200, name = "Camera Forward" },
{ type = TYPE_NUMBER, cvar = "b-cam_r", min = -30, max = 30, name = "Camera Right" },
{ type = TYPE_NUMBER, cvar = "b-cam_u", min = -30, max = 30, name = "Camera Up" },
{ type = TYPE_NUMBER, cvar = "b-cam_fov", min = 1, max = 140, name = "Camera FOV" },
{ type = TYPE_NUMBER, cvar = "b-cam_f", min = -200, max = 200, name = "Camera Forward" },
{ type = TYPE_NUMBER, cvar = "b-cam_r", min = -30, max = 30, name = "Camera Right" },
{ type = TYPE_NUMBER, cvar = "b-cam_u", min = -30, max = 30, name = "Camera Up" },
{ type = TYPE_NUMBER, cvar = "b-cam_fov", min = 30, max = 120, name = "Camera FOV" },
{ type = TYPE_BOOL, cvar = "b-cam_fp", name = "First-person Mode" },
{ type = TYPE_NUMBER, cvar = "b-cam_fp_fov", min = 30, max = 120, name = "FP weapon FOV" },
}
},
{
@ -111,9 +112,10 @@ local function StartPauseMenu()
if PauseMenu and PauseMenu:IsValid() then PauseMenu:Remove() return end
PauseMenu = vgui.Create("EditablePanel")
PauseMenu:SetSize( 300, 500 )
PauseMenu:SetPos( 100, ScrH() - 500 - 100 )
PauseMenu:SetSize( 300, 300 )
PauseMenu:SetPos( ScrW()/2 - 300 - 5, ScrH()/2 - 300/2 )
PauseMenu:MakePopup()
PauseMenu:SetKeyboardInputEnabled( true )
local p = LocalPlayer()
local myteam = p:Team()
@ -145,7 +147,7 @@ local function StartPauseMenu()
button:Dock(TOP)
button:DockMargin( 0, 0, 0, 10 )
button:SetText( "" )
button:SetTall( 32 )
button:SetTall( 40 )
button.text = data.name
button.Paint = qpaint
button.DoClick = data.DoClick