Compare commits

..

No commits in common. "915f463b2ab6e91b8ff22fb5bb37f5ed6209cb0d" and "85f9d855db91bd6073628a0d0dc461c17452d926" have entirely different histories.

8 changed files with 98 additions and 245 deletions

View File

@ -35,7 +35,6 @@ function ENT:SetupDataTables()
self:NetworkVar( "Float", "CapturePercent" ) self:NetworkVar( "Float", "CapturePercent" )
self:NetworkVar( "Int", "TeamTaking" ) self:NetworkVar( "Int", "TeamTaking" )
self:NetworkVar( "Int", "TeamOwned" ) self:NetworkVar( "Int", "TeamOwned" )
self:NetworkVar( "Bool", "Contested" )
end end
function ENT:Think() function ENT:Think()
@ -57,8 +56,6 @@ function ENT:Think()
end end
end end
self:SetContested( Contested )
local BlockPoints = false local BlockPoints = false
local RoundActive = BennyGame:GetState() == BG_STATE_ACTIVE local RoundActive = BennyGame:GetState() == BG_STATE_ACTIVE
@ -80,18 +77,6 @@ function ENT:Think()
self:EmitSound("buttons/button9.wav", 70, 100, 1) self:EmitSound("buttons/button9.wav", 70, 100, 1)
end end
elseif self:GetTeamOwned() != TeamOnPoint then elseif self:GetTeamOwned() != TeamOnPoint then
if self:GetCapturePercent() > 0 and self:GetTeamTaking() != TeamOnPoint then
-- Clearing the progress of another team on yet another team's point
local COLLECTED = (1/math.max( 1, 6-amtOnPoint )) * FrameTime()
self:SetCapturePercent( math.Approach( self:GetCapturePercent(), 0, COLLECTED ) )
if self:GetCapturePercent() == 0 then
-- Point successfully cleared
self:SetTeamTaking( 0 )
self:EmitSound("buttons/button6.wav", 70, 100, 1)
end
BlockPoints = true -- Block points for this saboteur
else
-- Enemy or early bird taking this point -- Enemy or early bird taking this point
local COLLECTED = (1/math.max( 1, 6-amtOnPoint )) * FrameTime() local COLLECTED = (1/math.max( 1, 6-amtOnPoint )) * FrameTime()
self:SetCapturePercent( math.Approach( self:GetCapturePercent(), 1, COLLECTED ) ) self:SetCapturePercent( math.Approach( self:GetCapturePercent(), 1, COLLECTED ) )
@ -115,7 +100,6 @@ function ENT:Think()
ply:RewardXP( sap ) ply:RewardXP( sap )
end end
end end
end
elseif self:GetTeamOwned() == TeamOnPoint then elseif self:GetTeamOwned() == TeamOnPoint then
-- Team that owns the point is on the point -- Team that owns the point is on the point
@ -127,7 +111,7 @@ function ENT:Think()
if self:GetCapturePercent() == 0 then if self:GetCapturePercent() == 0 then
-- Point successfully cleared -- Point successfully cleared
self:SetTeamTaking( 0 ) self:SetTeamTaking( 0 )
self:EmitSound("buttons/bell1.wav", 70, 100, 1) self:EmitSound("buttons/button10.wav", 70, 100, 1)
end end
end end

View File

@ -46,21 +46,6 @@ local function dospawn( self )
return return
end end
local function doteamselect( self )
LocalPlayer():ConCommand( "b-cheat_setteam " .. self.iIndex )
self:GetParent():Remove()
end
local function painterly( self, w, h )
surface.SetDrawColor( self.iFaction.COLOR_DARK )
surface.DrawRect( 0, 0, w, h )
surface.SetDrawColor( self.iFaction.COLOR_MAIN )
surface.DrawOutlinedRect( 1, 1, w-2, h-2, 1 )
draw.SimpleText( l8(self.iData.name), "HUD_24", w/2, 4, self.iFaction.COLOR_MAIN, TEXT_ALIGN_CENTER )
return true
end
local function OpenDebugMenu() local function OpenDebugMenu()
if IsValid(DebugMenu) then DebugMenu:Remove() end if IsValid(DebugMenu) then DebugMenu:Remove() end
DebugMenu = vgui.Create("DFrame") DebugMenu = vgui.Create("DFrame")
@ -96,29 +81,18 @@ local function OpenDebugMenu()
vsplit:SetTop( modeller ) vsplit:SetTop( modeller )
modeller:SetModel( "models/weapons/w_pistol.mdl" ) modeller:SetModel( "models/weapons/w_pistol.mdl" )
modeller:SetFOV( 5 ) modeller:SetFOV( 5 )
local original = Vector( 0, 50, 0 )
modeller:SetCamPos( original ) modeller:SetCamPos( original )
modeller:SetLookAt( vector_origin ) modeller:SetLookAt( vector_origin )
modeller:SetPos( vector_origin )
modeller.Entity:SetAngles( angle_zero )
modeller.Standard = Vector( 0, 100, 0 )
modeller.Finalized = Vector()
function modeller:LayoutEntity( ent ) function modeller:LayoutEntity( ent )
local the = Vector(modeller.Finalized) ent:SetPos( Vector( 0, 0, 0 ) )
the:Rotate( Angle( 0, (360/4) * RealTime() % 360, 0 ) ) ent:SetAngles( Angle( 0, 0 * RealTime() * 10 % 360, 0 ) )
modeller:SetCamPos( the )
-- ent:SetPos( Vector( 0, 0, 0 ) )
--ent:SetAngles( Angle( 0, 10 * RealTime() * 10 % 360, 0 ) )
return return
end end
modeller:SetAmbientLight( HSLToColor( 0, 0, 0.00 ) ) modeller:SetAmbientLight( HSLToColor( 0, 0, 1.00 ) )
modeller:SetDirectionalLight(BOX_TOP, HSLToColor( 0, 0, 1.00 ) )
modeller:SetDirectionalLight(BOX_TOP, HSLToColor( 0, 0, 0.50 ) ) modeller:SetDirectionalLight(BOX_FRONT, HSLToColor( 0, 0, 1.00 ) )
modeller:SetDirectionalLight(BOX_BOTTOM, HSLToColor( 0, 0, 0.50 ) )
modeller:SetDirectionalLight(BOX_FRONT, HSLToColor( 0, 0, 0.50 ) )
modeller:SetDirectionalLight(BOX_BACK, HSLToColor( 0, 0, 0.50 ) )
modeller:SetDirectionalLight(BOX_LEFT, HSLToColor( 0, 0, 1.00 ) )
modeller:SetDirectionalLight(BOX_RIGHT, HSLToColor( 0, 0, 1.00 ) ) modeller:SetDirectionalLight(BOX_RIGHT, HSLToColor( 0, 0, 1.00 ) )
function modeller:Update( mdl ) function modeller:Update( mdl )
@ -127,19 +101,15 @@ local function OpenDebugMenu()
local worked = self.Entity:PhysicsInit( SOLID_VPHYSICS ) local worked = self.Entity:PhysicsInit( SOLID_VPHYSICS )
if worked then if worked then
-- Factors the USP's bodygroup suppressor for some reason. Great
-- Factors the USP's bodygroup suppressor for some reason. Great -- Not anymore, changed it to Physics Object AABB local mins, maxs = self.Entity:GetCollisionBounds()
local mins, maxs = self.Entity:GetPhysicsObject():GetAABB()
local wsc = Vector() local wsc = Vector()
wsc:Add( mins ) wsc:Add( mins )
wsc:Add( maxs ) wsc:Add( maxs )
wsc:Div( 2 ) wsc:Div( 2 )
self.Entity:SetPos( -wsc ) self:SetLookAt( wsc )
self:SetCamPos( wsc+original )
self:SetLookAt( vector_origin )
modeller.Finalized:Set(modeller.Standard)
--self:SetCamPos( modeller.Standard )
-- local HFOV = 45-5 -- local HFOV = 45-5
-- local hfovRad = HFOV * math.pi / 180 -- local hfovRad = HFOV * math.pi / 180
@ -150,26 +120,26 @@ local function OpenDebugMenu()
-- scale test -- scale test
if true then for i=1, 50 do if true then for i=1, 50 do
local S1, S2 = false, false local S1, S2 = false, false
local aimVector = (self:GetLookAt() - modeller.Finalized):GetNormalized() local aimVector = (self:GetLookAt() - self:GetCamPos()):GetNormalized()
do -- test 1, mins do -- test 1, mins
local entVector = mins - modeller.Finalized local entVector = mins - self:GetCamPos()
local angCos = aimVector:Dot(entVector) / entVector:Length() local angCos = aimVector:Dot(entVector) / entVector:Length()
S1 = (angCos >= directionAngCos) S1 = (angCos >= directionAngCos)
end end
do -- test 2: maxs do -- test 2: maxs
local entVector = maxs - modeller.Finalized local entVector = maxs - self:GetCamPos()
local angCos = aimVector:Dot(entVector) / entVector:Length() local angCos = aimVector:Dot(entVector) / entVector:Length()
S2 = (angCos >= directionAngCos) S2 = (angCos >= directionAngCos)
end end
if S1 and S2 then if S1 and S2 then
self.indicate = i self.indicate = "took " .. i
--modeller.Finalized:Add( Vector( 0, 20, 0 ) ) self.vCamPos:Add( Vector( 0, 20, 0 ) )
--self.vLookatPos:Add( Vector( 0, 0, 0 ) ) --self.vLookatPos:Add( Vector( 0, 0, 0 ) )
--self.vLookatPos:Set( (mins+maxs)/2 ) --self.vLookatPos:Set( (mins+maxs)/2 )
break break
else else
self.indicate = "failed" self.indicate = "failed"
modeller.Finalized:Sub( (aimVector*20) ) self.vCamPos:Sub( (aimVector*20) )
end end
end end end end
else else
@ -212,14 +182,12 @@ local function OpenDebugMenu()
self:DrawModel() self:DrawModel()
render.MaterialOverride() render.MaterialOverride()
if false and self.Entity:GetPhysicsObject():IsValid() then local mins, maxs = self.Entity:GetCollisionBounds()
local pos = self.Entity:GetPos()
local mins, maxs = self.Entity:GetPhysicsObject():GetAABB() -- render.SetColorMaterial()
render.SetColorMaterial() -- render.DrawSphere( mins, .5, 30, 30, Color( 255, 0, 0 ) )
render.DrawSphere( pos+mins, .5, 30, 30, Color( 255, 0, 0 ) ) -- render.DrawSphere( maxs, .5, 30, 30, Color( 0, 0, 255 ) )
render.DrawSphere( pos+maxs, .5, 30, 30, Color( 0, 0, 255 ) ) -- render.DrawWireframeBox( vector_origin, angle_zero, mins, maxs, Color( 0, 0, 0, 127 ))
render.DrawWireframeBox( pos, angle_zero, mins, maxs, Color( 0, 0, 0, 127 ))
end
render.SuppressEngineLighting( false ) render.SuppressEngineLighting( false )
cam.End3D() cam.End3D()
@ -227,15 +195,15 @@ local function OpenDebugMenu()
self.LastPaint = RealTime() self.LastPaint = RealTime()
end end
function modeller:Paint( w, h ) function modeller:Paint( w, h )
surface.SetDrawColor( HSLToColor( 0.9, 0.2, 0 ) ) surface.SetDrawColor( color_black )
surface.DrawRect( 0, 0, w, h ) surface.DrawRect( 0, 0, w, h )
self:Paint1( w, h ) self:Paint1( w, h )
if self.Failed then if self.Failed then
draw.SimpleText("Failed physinit, not cached?", "HUD_36", w/2, h/2, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) draw.SimpleText("Failed physinit, not cached?", "HUD_36", w/2, h/2, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
end end
if self.indicate then -- if self.indicate then
draw.SimpleText(self.indicate, "HUD_16", 4, 4, color_white) -- draw.SimpleText(self.indicate, "HUD_36", w/2, h/2 + 48, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
end -- end
end end
end end
@ -279,40 +247,9 @@ local function OpenDebugMenu()
end end
end end
local function OpenMyTeamMenu()
if IsValid(DebugMenu) then DebugMenu:Remove() end
DebugMenu = vgui.Create("DFrame")
DebugMenu:SetSize( 200, 300 )
DebugMenu:MakePopup()
DebugMenu:SetKeyboardInputEnabled( false )
DebugMenu:SetSizable(false)
for index, data in ipairs( TEAMS ) do
local faction = FACTIONS[ data.factionid ]
if !faction then continue end
local button = DebugMenu:Add("DButton")
button:Dock( TOP )
button:DockMargin( 0, 0, 0, 5 )
button:SetText( l8( data.name ) )
button.iIndex = index
button.iData = data
button.iFaction = faction
button:SetTall(28)
button.DoClick = doteamselect
button.Paint = painterly
end
DebugMenu:InvalidateLayout( true )
DebugMenu:SizeToChildren( false, true )
DebugMenu:Center()
end
hook.Add("PlayerButtonDown", "PlayerButtonDown_DebugMenu", function( ply, button ) hook.Add("PlayerButtonDown", "PlayerButtonDown_DebugMenu", function( ply, button )
if button == KEY_F1 then if button == KEY_F1 then
OpenDebugMenu() OpenDebugMenu()
elseif button == KEY_F2 then
OpenMyTeamMenu()
end end
end) end)

View File

@ -17,21 +17,15 @@ function BennyGame:GetType()
return cGametype:GetBool() and BG_GTYPE_MP or BG_GTYPE_CAMPAIGN return cGametype:GetBool() and BG_GTYPE_MP or BG_GTYPE_CAMPAIGN
end end
GM.TeamBased = BennyGame:GetType() == BG_GTYPE_MP
function BennyGame:GetMode() function BennyGame:GetMode()
return cGamemode:GetString() return cGamemode:GetString()
end end
function BennyGame:GetModeData()
return BennyGame.Gamemodes[ BennyGame:GetMode() ]
end
BennyGame.TeamsInPlay = { BennyGame.TeamsInPlay = {
4, 4,
3, 3,
--2,
--1,
--5,
--6,
} }
BennyGame.TeamCount = #BennyGame.TeamsInPlay BennyGame.TeamCount = #BennyGame.TeamsInPlay
@ -45,51 +39,49 @@ BennyGame.Gamemodes = {
description = "#Gamemode.tdm.Description", description = "#Gamemode.tdm.Description",
scorelimit = CreateConVar("b-g_tdm_scorelimit", 75 ), scorelimit = CreateConVar("b-g_tdm_scorelimit", 75 ),
timelimit = CreateConVar("b-g_tdm_timelimit", 10*60 ), timelimit = CreateConVar("b-g_tdm_timelimit", 10 ),
}, },
["ffa"] = { ["ffa"] = {
name = "#Gamemode.ffa.Name", name = "#Gamemode.ffa.Name",
description = "#Gamemode.ffa.Description", description = "#Gamemode.ffa.Description",
scorelimit = CreateConVar("b-g_ffa_scorelimit", 30 ), scorelimit = CreateConVar("b-g_ffa_scorelimit", 30 ),
timelimit = CreateConVar("b-g_ffa_timelimit", 10*60 ), timelimit = CreateConVar("b-g_ffa_timelimit", 10 ),
}, },
["snd"] = { ["snd"] = {
name = "#Gamemode.snd.Name", name = "#Gamemode.snd.Name",
description = "#Gamemode.snd.Description", description = "#Gamemode.snd.Description",
scorelimit = CreateConVar("b-g_snd_scorelimit", 6 ), scorelimit = CreateConVar("b-g_snd_scorelimit", 6 ),
timelimit = CreateConVar("b-g_snd_timelimit", 2.5*60 ), timelimit = CreateConVar("b-g_snd_timelimit", 2.5 ),
}, },
["ctf"] = { ["ctf"] = {
name = "#Gamemode.ctf.Name", name = "#Gamemode.ctf.Name",
description = "#Gamemode.ctf.Description", description = "#Gamemode.ctf.Description",
scorelimit = CreateConVar("b-g_ctf_scorelimit", 3 ), scorelimit = CreateConVar("b-g_ctf_scorelimit", 3 ),
timelimit = CreateConVar("b-g_ctf_timelimit", 10*60 ), timelimit = CreateConVar("b-g_ctf_timelimit", 10 ),
}, },
["dom"] = { ["dom"] = {
name = "#Gamemode.dom.Name", name = "#Gamemode.dom.Name",
description = "#Gamemode.dom.Description", description = "#Gamemode.dom.Description",
scorelimit = CreateConVar("b-g_dom_scorelimit", 1000 ), scorelimit = CreateConVar("b-g_dom_scorelimit", 1000 ),
timelimit = CreateConVar("b-g_dom_timelimit", 10*60 ), timelimit = CreateConVar("b-g_dom_timelimit", 10 ),
roundlimit = CreateConVar("b-g_dom_roundlimit", 1 ),
}, },
["dem"] = { ["dem"] = {
name = "#Gamemode.dem.Name", name = "#Gamemode.dem.Name",
description = "#Gamemode.dem.Description", description = "#Gamemode.dem.Description",
scorelimit = CreateConVar("b-g_dem_scorelimit", 3 ), scorelimit = CreateConVar("b-g_dem_scorelimit", 3 ),
timelimit = CreateConVar("b-g_dem_timelimit", 5*60 ), timelimit = CreateConVar("b-g_dem_timelimit", 5 ),
roundlimit = CreateConVar("b-g_dom_roundlimit", 2 ),
}, },
["hp"] = { ["hp"] = {
name = "#Gamemode.hp.Name", name = "#Gamemode.hp.Name",
description = "#Gamemode.hp.Description", description = "#Gamemode.hp.Description",
scorelimit = CreateConVar("b-g_hp_scorelimit", 300 ), scorelimit = CreateConVar("b-g_hp_scorelimit", 300 ),
timelimit = CreateConVar("b-g_hp_timelimit", 10*60 ), timelimit = CreateConVar("b-g_hp_timelimit", 10 ),
}, },
} }
@ -179,11 +171,6 @@ function BennyGame:GetTimeLimit()
return BennyGame.Gamemodes[BennyGame:GetMode()].timelimit:GetInt() + BennyGame:GetTimeExtension() return BennyGame.Gamemodes[BennyGame:GetMode()].timelimit:GetInt() + BennyGame:GetTimeExtension()
end end
function BennyGame:GetRoundLimit()
if !BennyGame.Gamemodes[BennyGame:GetMode()].roundlimit then return false end
return BennyGame.Gamemodes[BennyGame:GetMode()].roundlimit:GetInt()
end
function BennyGame:GetPregameTime() function BennyGame:GetPregameTime()
return cPregame:GetInt() return cPregame:GetInt()
@ -218,16 +205,15 @@ end
BG_ER_TIMELIMIT = 0 BG_ER_TIMELIMIT = 0
BG_ER_SCORELIMIT = 1 BG_ER_SCORELIMIT = 1
BG_ER_NUKE = 2 BG_ER_NUKE = 2
BG_ER_FORCE = 3
function BennyGame:StartRound() function BennyGame:StartRound()
PrintMessage(HUD_PRINTCENTER, "Round start!") PrintMessage(HUD_PRINTCENTER, "Round start!")
BennyGame:SetState( BG_STATE_ACTIVE ) BennyGame:SetState( BG_STATE_ACTIVE )
BennyGame:SetRoundStartedAt( CurTime() ) BennyGame:SetRoundStartedAt( CurTime() )
game.CleanUpMap() --game.CleanUpMap()
for _, ply in player.Iterator() do --for _, ply in player.Iterator() do
ply:Spawn() -- ply:Spawn()
end --end
end end
function BennyGame:EndRound( reason, forceteam ) function BennyGame:EndRound( reason, forceteam )
@ -244,6 +230,7 @@ function BennyGame:EndRound( reason, forceteam )
if HighestScore < ThisScore then if HighestScore < ThisScore then
HighestScore = ThisScore HighestScore = ThisScore
HighestTeam = RealTeamID HighestTeam = RealTeamID
print("highest score to do it to em", HighestScore, TEAMS[HighestTeam].name)
winningteam = HighestTeam winningteam = HighestTeam
end end
end end
@ -252,9 +239,9 @@ function BennyGame:EndRound( reason, forceteam )
local ThisScore = BennyGame:GetScoreForTeam( RealTeamID ) local ThisScore = BennyGame:GetScoreForTeam( RealTeamID )
if RealTeamID == HighestTeam then continue end if RealTeamID == HighestTeam then continue end
if HighestScore < ThisScore then if HighestScore < ThisScore then
-- print("clearly there's been a failure", RealTeamID, ThisScore, HighestTeam, HighestScore) print("clearly there's been a failure", RealTeamID, ThisScore, HighestTeam, HighestScore)
elseif HighestScore == ThisScore then elseif HighestScore == ThisScore then
-- print("this looks like a tie", RealTeamID, HighestTeam) print("this looks like a tie", RealTeamID, HighestTeam)
winningteam = 0 winningteam = 0
break break
end end
@ -273,14 +260,7 @@ function BennyGame:EndRound( reason, forceteam )
PrintMessage(HUD_PRINTCENTER, TheFull) PrintMessage(HUD_PRINTCENTER, TheFull)
local roundtime = CurTime() - BennyGame:GetRoundStartedAt() local roundtime = CurTime() - BennyGame:GetRoundStartedAt()
print( "That round lasted " .. math.ceil(roundtime) .. " seconds." )
local rf = string.FormattedTime( 269 )
local nicely = ""
if rf.h > 0 then
nicely = nicely .. rf.h .. ":"
end
nicely = nicely .. string.format( "%02i:%02i.", rf.m, rf.s )
print( "That round lasted " .. nicely )
end end
concommand.Add("b-cheat_scoreset", function( ply, cmd, args ) concommand.Add("b-cheat_scoreset", function( ply, cmd, args )
@ -323,12 +303,6 @@ end, function( cmd, args )
return BENNY.SimpleAutoComplete( cmd, args, TEAMS_IDs ) return BENNY.SimpleAutoComplete( cmd, args, TEAMS_IDs )
end ) end )
concommand.Add("b-cheat_endround", function( ply, cmd, args )
BennyGame:EndRound( args[1] or BG_ER_FORCE, args[2] )
end, function( cmd, args )
return BENNY.SimpleAutoComplete( cmd, args, TEAMS_IDs )
end )
hook.Add("Think", "Benny_Gamestate_Think", function() hook.Add("Think", "Benny_Gamestate_Think", function()
if SERVER then if SERVER then
local World = Entity(0) local World = Entity(0)
@ -366,9 +340,6 @@ hook.Add("Think", "Benny_Gamestate_Think", function()
if BennyGame:GetRoundFinishedAt() + BennyGame:GetPostgameTime() <= CurTime() then if BennyGame:GetRoundFinishedAt() + BennyGame:GetPostgameTime() <= CurTime() then
for TeamID, RealTeamID in ipairs( BennyGame.TeamsInPlay ) do
BennyGame:SetScoreForTeam( RealTeamID, 0 )
end
BennyGame:SetState( BG_STATE_WAITINGFORPLAYERS ) BennyGame:SetState( BG_STATE_WAITINGFORPLAYERS )
end end

View File

@ -119,7 +119,7 @@ local function regenfonts()
end end
regenfonts() regenfonts()
FACTIONS = { local FACTIONS = {
["benny"] = { ["benny"] = {
COLOR_MAIN = Color( 255, 238, 169 ), COLOR_MAIN = Color( 255, 238, 169 ),
COLOR_DARK = Color( 54, 44, 39 ), COLOR_DARK = Color( 54, 44, 39 ),
@ -428,7 +428,7 @@ function GM:HUDPaint()
local wep = handler:GetActiveR() local wep = handler:GetActiveR()
if wep and wep.GetClip then if wep and wep.GetClip then
local Bw, Bh = 8+(8+2)*30-2+8, 160 local Bw, Bh = 328, 160
S_Push( w - 20 - Bw, h - 20 - Bh ) S_Push( w - 20 - Bw, h - 20 - Bh )
hCol( COLOR_DARK ) hCol( COLOR_DARK )
hRect( 0, 0, Bw, Bh ) hRect( 0, 0, Bw, Bh )
@ -644,9 +644,7 @@ function GM:HUDPaint()
local TITLE = "CAPTURING" local TITLE = "CAPTURING"
local PERCENT = obj:GetCapturePercent() local PERCENT = obj:GetCapturePercent()
if obj:GetContested() then if obj:GetTeamOwned() == myteam then
TITLE = "CONTESTED"
elseif obj:GetTeamOwned() == myteam then
if obj:GetCapturePercent() > 0 then if obj:GetCapturePercent() > 0 then
TITLE = "CLEARING" TITLE = "CLEARING"
else else
@ -657,18 +655,15 @@ function GM:HUDPaint()
TITLE = "CLEARING" TITLE = "CLEARING"
end end
local BARCOLOR = FACTIONS[ TEAMS[obj:GetTeamOwned()].factionid ] local BARCOLOR_MAIN = TEAMS[obj:GetTeamOwned()].factionid
local TAKCOLOR = FACTIONS[ TEAMS[obj:GetTeamTaking()].factionid ] BARCOLOR_MAIN = FACTIONS[BARCOLOR_MAIN].COLOR_MAIN
local CONTOLER = FACTIONS[ "unassigned" ] local BARCOLOR_DARK = TEAMS[obj:GetTeamOwned()].factionid
BARCOLOR_DARK = FACTIONS[BARCOLOR_DARK].COLOR_DARK
BARCOLOR_MAIN = BARCOLOR.COLOR_MAIN local TAKCOLOR_MAIN = TEAMS[obj:GetTeamTaking()].factionid
BARCOLOR_DARK = BARCOLOR.COLOR_DARK TAKCOLOR_MAIN = FACTIONS[TAKCOLOR_MAIN].COLOR_MAIN
local TAKCOLOR_DARK = TEAMS[obj:GetTeamTaking()].factionid
TAKCOLOR_MAIN = TAKCOLOR.COLOR_MAIN TAKCOLOR_DARK = FACTIONS[TAKCOLOR_DARK].COLOR_DARK
TAKCOLOR_DARK = TAKCOLOR.COLOR_DARK
CONTOLER_MAIN = CONTOLER.COLOR_MAIN
CONTOLER_DARK = CONTOLER.COLOR_DARK
local BWIDE, BTALL = 180, 16 local BWIDE, BTALL = 180, 16
@ -685,19 +680,19 @@ function GM:HUDPaint()
local x, y = hXY( 0, TITLE=="SECURE" and 62 or 40 ) 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 ) qt( TITLE, "HUD_24", x, y, COLOR_MAIN, TEXT_ALIGN_CENTER, nil, COLOR_DARK )
if TITLE!="SECURE" then if TITLE!="SECURE" then
S_Push( -BWIDE/2, 62 ) S_Push( -BWIDE/2, 62 )
hCol( TAKCOLOR_DARK ) hCol( COLOR_DARK )
hRect( 0, 0, 180, BTALL ) hRect( 0, 0, 180, BTALL )
hCol( TAKCOLOR_MAIN ) hCol( COLOR_MAIN )
hORect( 1, 1, 180-2, BTALL-2 ) hORect( 1, 1, 180-2, BTALL-2 )
hCol( TAKCOLOR_MAIN ) hCol( TITLE=="CLEARING" and TAKCOLOR_MAIN or COLOR_MAIN )
hRect( 3, 3, math.floor((BWIDE-6) * PERCENT), BTALL-6 ) hRect( 3, 3, math.floor((BWIDE-6) * PERCENT), BTALL-6 )
S_Pop() S_Pop()
local x, y = hXY( 0, 78 ) 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 ) qt( math.floor(PERCENT*100) .. "%", "HUD_36", x, y, COLOR_MAIN, TEXT_ALIGN_CENTER, nil, COLOR_DARK )
end end
S_Pop() S_Pop()
end end

View File

@ -218,9 +218,7 @@ AddItem( "base_firearm", {
p:LagCompensation(false) p:LagCompensation(false)
local ply = handler:GetOwner() local ply = handler:GetOwner()
if SERVER or CLIENT and IsFirstTimePredicted() then
ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD, ply:LookupSequence( AnimationLookup["fire"][class.HoldType] ), 0, true ) ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD, ply:LookupSequence( AnimationLookup["fire"][class.HoldType] ), 0, true )
end
ent:PlayAnimation( ent:LookupSequence("fire") ) ent:PlayAnimation( ent:LookupSequence("fire") )
end, end,
@ -239,18 +237,14 @@ AddItem( "base_firearm", {
handler:EmitSound( class.MagOutSound, 70, 100, 0.4, CHAN_STATIC ) handler:EmitSound( class.MagOutSound, 70, 100, 0.4, CHAN_STATIC )
ent:SetLoaded( false ) ent:SetLoaded( false )
ent:SetClip( 0 ) ent:SetClip( 0 )
if SERVER or CLIENT and IsFirstTimePredicted() then
ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD, ply:LookupSequence( AnimationLookup["reload"][class.HoldType] ), 0, true ) ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD, ply:LookupSequence( AnimationLookup["reload"][class.HoldType] ), 0, true )
end
time = 0.4 time = 0.4
ent:PlayAnimation( ent:LookupSequence("magout") ) ent:PlayAnimation( ent:LookupSequence("magout") )
else else
handler:EmitSound( class.MagInSound, 70, 100, 0.4, CHAN_STATIC ) handler:EmitSound( class.MagInSound, 70, 100, 0.4, CHAN_STATIC )
ent:SetLoaded( true ) ent:SetLoaded( true )
ent:SetRefillTime( CurTime() + 0.5 ) ent:SetRefillTime( CurTime() + 0.5 )
if SERVER or CLIENT and IsFirstTimePredicted() then
ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD, ply:LookupSequence( AnimationLookup["reload_insert"][class.HoldType] ), 0, true ) ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD, ply:LookupSequence( AnimationLookup["reload_insert"][class.HoldType] ), 0, true )
end
time = 0.8 time = 0.8
ent:PlayAnimation( ent:LookupSequence("magin") ) ent:PlayAnimation( ent:LookupSequence("magin") )
end end
@ -262,9 +256,7 @@ AddItem( "base_firearm", {
ent:SetDelay( CurTime() + 0.5 ) ent:SetDelay( CurTime() + 0.5 )
local ply = handler:GetOwner() local ply = handler:GetOwner()
if SERVER or CLIENT and IsFirstTimePredicted() then
ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD, ply:LookupSequence( AnimationLookup["deploy"][class.HoldType] ), 0, true ) ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD, ply:LookupSequence( AnimationLookup["deploy"][class.HoldType] ), 0, true )
end
end, end,
["Holster"] = function( class, ent, handler ) ["Holster"] = function( class, ent, handler )
@ -274,9 +266,7 @@ AddItem( "base_firearm", {
ent:SetDelay( CurTime() + 0.25 ) ent:SetDelay( CurTime() + 0.25 )
local ply = handler:GetOwner() local ply = handler:GetOwner()
if SERVER or CLIENT and IsFirstTimePredicted() then
ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD, ply:LookupSequence( AnimationLookup["holster"][class.HoldType] ), 0, true ) ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD, ply:LookupSequence( AnimationLookup["holster"][class.HoldType] ), 0, true )
end
end, end,
}) })
@ -668,31 +658,6 @@ do -- Rifles
end end
do -- MGs
AddItem( "qbb", {
PrintName = "#Item.qbb.Name",
Description = "#Item.qbb.Description",
Category = "machinegun",
Base = "base_firearm",
Model = "models/benny/weapons/test_qbb.mdl",
HoldType = "rifle",
ClipSize = 75,
Delay = (60/750),
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,
})
end
do -- SMGs do -- SMGs
AddItem( "tmp", { AddItem( "tmp", {

View File

@ -32,9 +32,6 @@ L["#Item.fnc.Description"] = "Imported assault rifle"
L["#Item.qbz.Name"] = "QBZ-95" L["#Item.qbz.Name"] = "QBZ-95"
L["#Item.qbz.Description"] = "Low-profile bullpup assault rifle" L["#Item.qbz.Description"] = "Low-profile bullpup assault rifle"
L["#Item.qbb.Name"] = "QBB-LSW"
L["#Item.qbb.Description"] = "Bullpup machine gun"
L["#Item.m16a2.Name"] = "M16A2" L["#Item.m16a2.Name"] = "M16A2"
L["#Item.m16a2.Description"] = "Rugged burst rifle" L["#Item.m16a2.Description"] = "Rugged burst rifle"

View File

@ -368,9 +368,7 @@ hook.Add("Move", "Benny_Move", function( ply, mv )
ply:SetGroundEntity( NULL ) ply:SetGroundEntity( NULL )
ply:SetInDive( true ) ply:SetInDive( true )
ply:SetDivedAt( CurTime() ) ply:SetDivedAt( CurTime() )
if SERVER or CLIENT and IsFirstTimePredicted() then
ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_JUMP, ply:LookupSequence( "dive_start_handgun" ), 0, true ) ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_JUMP, ply:LookupSequence( "dive_start_handgun" ), 0, true )
end
if (SERVER) or (CLIENT and IsFirstTimePredicted()) then if (SERVER) or (CLIENT and IsFirstTimePredicted()) then
local rfil = nil local rfil = nil
if SERVER then if SERVER then
@ -380,6 +378,8 @@ hook.Add("Move", "Benny_Move", function( ply, mv )
end end
ply:EmitSound("weapons/slam/throw.wav", 70, 100, .25, nil, nil, nil, rfil) ply:EmitSound("weapons/slam/throw.wav", 70, 100, .25, nil, nil, nil, rfil)
end end
ply:SetHull( Vector( -8, -8, 32 ), Vector( 8, 8, 72 ) )
ply:SetHullDuck( Vector( -8, -8, 32 ), Vector( 8, 8, 48 ) )
end end
if ply:OnGround() and ply:GetInDive() then if ply:OnGround() and ply:GetInDive() then
if (SERVER) or (CLIENT and IsFirstTimePredicted()) then if (SERVER) or (CLIENT and IsFirstTimePredicted()) then
@ -393,11 +393,12 @@ hook.Add("Move", "Benny_Move", function( ply, mv )
end end
ply:SetInDive(false) ply:SetInDive(false)
ply:SetDivedAt( CurTime() ) ply:SetDivedAt( CurTime() )
if SERVER or CLIENT and IsFirstTimePredicted() then
ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_JUMP, ply:LookupSequence( "dive_end_handgun" ), 0, true ) ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_JUMP, ply:LookupSequence( "dive_end_handgun" ), 0, true )
end ply:SetHull( Vector( -8, -8, 0 ), Vector( 8, 8, 72 ) )
ply:SetHullDuck( Vector( -8, -8, 0 ), Vector( 8, 8, 48 ) )
mv:SetVelocity( mv:GetVelocity() + Vector( 0, 0, 120 ) ) mv:SetVelocity( mv:GetVelocity() + Vector( 0, 0, 120 ) )
ply:SetGroundEntity( NULL ) ply:SetGroundEntity( NULL )
mv:SetOrigin( mv:GetOrigin() + vector_up*32 )
end end
--if !ply:OnGround() and ply:GetInDive() then --if !ply:OnGround() and ply:GetInDive() then
-- local da = ply:GetDivedAt() -- local da = ply:GetDivedAt()

View File

@ -9,7 +9,7 @@ concommand.Add("b-cheat_setteam", function( ply, cmd, args )
print( index .. " - " .. data.id ) print( index .. " - " .. data.id )
end end
else else
ply:SetTeam( TEAMS_IDorName( tonumber(args[1]) or args[1] ) ) ply:SetTeam( TEAMS_IDorName( args[1] ) )
end end
end, function( cmd, args ) end, function( cmd, args )
return BENNY.SimpleAutoComplete( cmd, args, TEAMS_IDs ) return BENNY.SimpleAutoComplete( cmd, args, TEAMS_IDs )
@ -120,8 +120,10 @@ function GM:CreateTeams()
end end
function GM:PlayerSelectTeamSpawn( TeamID, ply ) function GM:PlayerSelectTeamSpawn( TeamID, ply )
print( TeamID )
local SpawnPoints = team.GetSpawnPoints( TeamID ) local SpawnPoints = team.GetSpawnPoints( TeamID )
if ( !SpawnPoints || table.IsEmpty( SpawnPoints ) ) then return end PrintTable( SpawnPoints )
if ( !SpawnPoints || table.IsEmpty( SpawnPoints ) ) then print("fail")return end
local ChosenSpawnPoint = nil local ChosenSpawnPoint = nil
@ -140,7 +142,8 @@ function GM:PlayerSelectSpawn( ply, transition )
if BennyGame:GetType() == BG_GTYPE_MP then if BennyGame:GetType() == BG_GTYPE_MP then
local ent = self:PlayerSelectTeamSpawn( ply:Team(), ply ) local ent = self:PlayerSelectTeamSpawn( ply:Team(), ply )
if IsValid( ent ) then return ent end debug.Trace()
if IsValid( ent ) then print("win") return ent end
end end
end end