Compare commits

...

2 Commits

8 changed files with 245 additions and 98 deletions

View File

@ -35,6 +35,7 @@ function ENT:SetupDataTables()
self:NetworkVar( "Float", "CapturePercent" )
self:NetworkVar( "Int", "TeamTaking" )
self:NetworkVar( "Int", "TeamOwned" )
self:NetworkVar( "Bool", "Contested" )
end
function ENT:Think()
@ -56,6 +57,8 @@ function ENT:Think()
end
end
self:SetContested( Contested )
local BlockPoints = false
local RoundActive = BennyGame:GetState() == BG_STATE_ACTIVE
@ -77,27 +80,40 @@ function ENT:Think()
self:EmitSound("buttons/button9.wav", 70, 100, 1)
end
elseif self:GetTeamOwned() != TeamOnPoint then
-- Enemy or early bird taking this point
local COLLECTED = (1/math.max( 1, 6-amtOnPoint )) * FrameTime()
self:SetCapturePercent( math.Approach( self:GetCapturePercent(), 1, COLLECTED ) )
self:SetTeamTaking( TeamOnPoint )
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() == 1 then
-- Point successfully captured!
self:SetTeamOwned( TeamOnPoint )
self:SetTeamTaking( 0 )
self:SetCapturePercent( 0 )
self:EmitSound("buttons/blip1.wav", 70, 100, 1)
end
BlockPoints = true -- Block points for this saboteur
for ply, edata in pairs(self.Memory) do
edata.xpcollected = (edata.xpcollected or 0) + (COLLECTED * 200)
local sap = math.floor(edata.xpcollected)
if sap >= 10 then
edata.xpcollected = edata.xpcollected - sap
ply:RewardXP( sap )
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
local COLLECTED = (1/math.max( 1, 6-amtOnPoint )) * FrameTime()
self:SetCapturePercent( math.Approach( self:GetCapturePercent(), 1, COLLECTED ) )
self:SetTeamTaking( TeamOnPoint )
if self:GetCapturePercent() == 1 then
-- Point successfully captured!
self:SetTeamOwned( TeamOnPoint )
self:SetTeamTaking( 0 )
self:SetCapturePercent( 0 )
self:EmitSound("buttons/blip1.wav", 70, 100, 1)
end
BlockPoints = true -- Block points for this saboteur
for ply, edata in pairs(self.Memory) do
edata.xpcollected = (edata.xpcollected or 0) + (COLLECTED * 200)
local sap = math.floor(edata.xpcollected)
if sap >= 10 then
edata.xpcollected = edata.xpcollected - sap
ply:RewardXP( sap )
end
end
end
elseif self:GetTeamOwned() == TeamOnPoint then
@ -111,7 +127,7 @@ function ENT:Think()
if self:GetCapturePercent() == 0 then
-- Point successfully cleared
self:SetTeamTaking( 0 )
self:EmitSound("buttons/button10.wav", 70, 100, 1)
self:EmitSound("buttons/bell1.wav", 70, 100, 1)
end
end

View File

@ -46,6 +46,21 @@ local function dospawn( self )
return
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()
if IsValid(DebugMenu) then DebugMenu:Remove() end
DebugMenu = vgui.Create("DFrame")
@ -81,18 +96,29 @@ local function OpenDebugMenu()
vsplit:SetTop( modeller )
modeller:SetModel( "models/weapons/w_pistol.mdl" )
modeller:SetFOV( 5 )
local original = Vector( 0, 50, 0 )
modeller:SetCamPos( original )
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 )
ent:SetPos( Vector( 0, 0, 0 ) )
ent:SetAngles( Angle( 0, 0 * RealTime() * 10 % 360, 0 ) )
local the = Vector(modeller.Finalized)
the:Rotate( Angle( 0, (360/4) * RealTime() % 360, 0 ) )
modeller:SetCamPos( the )
-- ent:SetPos( Vector( 0, 0, 0 ) )
--ent:SetAngles( Angle( 0, 10 * RealTime() * 10 % 360, 0 ) )
return
end
modeller:SetAmbientLight( HSLToColor( 0, 0, 1.00 ) )
modeller:SetDirectionalLight(BOX_TOP, HSLToColor( 0, 0, 1.00 ) )
modeller:SetDirectionalLight(BOX_FRONT, HSLToColor( 0, 0, 1.00 ) )
modeller:SetAmbientLight( HSLToColor( 0, 0, 0.00 ) )
modeller:SetDirectionalLight(BOX_TOP, HSLToColor( 0, 0, 0.50 ) )
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 ) )
function modeller:Update( mdl )
@ -101,15 +127,19 @@ local function OpenDebugMenu()
local worked = self.Entity:PhysicsInit( SOLID_VPHYSICS )
if worked then
-- Factors the USP's bodygroup suppressor for some reason. Great
local mins, maxs = self.Entity:GetCollisionBounds()
-- Factors the USP's bodygroup suppressor for some reason. Great -- Not anymore, changed it to Physics Object AABB
local mins, maxs = self.Entity:GetPhysicsObject():GetAABB()
local wsc = Vector()
wsc:Add( mins )
wsc:Add( maxs )
wsc:Div( 2 )
self:SetLookAt( wsc )
self:SetCamPos( wsc+original )
self.Entity:SetPos( -wsc )
self:SetLookAt( vector_origin )
modeller.Finalized:Set(modeller.Standard)
--self:SetCamPos( modeller.Standard )
-- local HFOV = 45-5
-- local hfovRad = HFOV * math.pi / 180
@ -120,26 +150,26 @@ local function OpenDebugMenu()
-- scale test
if true then for i=1, 50 do
local S1, S2 = false, false
local aimVector = (self:GetLookAt() - self:GetCamPos()):GetNormalized()
local aimVector = (self:GetLookAt() - modeller.Finalized):GetNormalized()
do -- test 1, mins
local entVector = mins - self:GetCamPos()
local entVector = mins - modeller.Finalized
local angCos = aimVector:Dot(entVector) / entVector:Length()
S1 = (angCos >= directionAngCos)
end
do -- test 2: maxs
local entVector = maxs - self:GetCamPos()
local entVector = maxs - modeller.Finalized
local angCos = aimVector:Dot(entVector) / entVector:Length()
S2 = (angCos >= directionAngCos)
end
if S1 and S2 then
self.indicate = "took " .. i
self.vCamPos:Add( Vector( 0, 20, 0 ) )
self.indicate = i
--modeller.Finalized:Add( Vector( 0, 20, 0 ) )
--self.vLookatPos:Add( Vector( 0, 0, 0 ) )
--self.vLookatPos:Set( (mins+maxs)/2 )
break
else
self.indicate = "failed"
self.vCamPos:Sub( (aimVector*20) )
modeller.Finalized:Sub( (aimVector*20) )
end
end end
else
@ -182,12 +212,14 @@ local function OpenDebugMenu()
self:DrawModel()
render.MaterialOverride()
local mins, maxs = self.Entity:GetCollisionBounds()
-- render.SetColorMaterial()
-- render.DrawSphere( mins, .5, 30, 30, Color( 255, 0, 0 ) )
-- render.DrawSphere( maxs, .5, 30, 30, Color( 0, 0, 255 ) )
-- render.DrawWireframeBox( vector_origin, angle_zero, mins, maxs, Color( 0, 0, 0, 127 ))
if false and self.Entity:GetPhysicsObject():IsValid() then
local pos = self.Entity:GetPos()
local mins, maxs = self.Entity:GetPhysicsObject():GetAABB()
render.SetColorMaterial()
render.DrawSphere( pos+mins, .5, 30, 30, Color( 255, 0, 0 ) )
render.DrawSphere( pos+maxs, .5, 30, 30, Color( 0, 0, 255 ) )
render.DrawWireframeBox( pos, angle_zero, mins, maxs, Color( 0, 0, 0, 127 ))
end
render.SuppressEngineLighting( false )
cam.End3D()
@ -195,15 +227,15 @@ local function OpenDebugMenu()
self.LastPaint = RealTime()
end
function modeller:Paint( w, h )
surface.SetDrawColor( color_black )
surface.SetDrawColor( HSLToColor( 0.9, 0.2, 0 ) )
surface.DrawRect( 0, 0, w, h )
self:Paint1( w, h )
if self.Failed then
draw.SimpleText("Failed physinit, not cached?", "HUD_36", w/2, h/2, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
end
-- if self.indicate then
-- draw.SimpleText(self.indicate, "HUD_36", w/2, h/2 + 48, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
-- end
if self.indicate then
draw.SimpleText(self.indicate, "HUD_16", 4, 4, color_white)
end
end
end
@ -247,9 +279,40 @@ local function OpenDebugMenu()
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 )
if button == KEY_F1 then
OpenDebugMenu()
elseif button == KEY_F2 then
OpenMyTeamMenu()
end
end)

View File

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

View File

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

View File

@ -218,7 +218,9 @@ AddItem( "base_firearm", {
p:LagCompensation(false)
local ply = handler:GetOwner()
ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD, ply:LookupSequence( AnimationLookup["fire"][class.HoldType] ), 0, true )
if SERVER or CLIENT and IsFirstTimePredicted() then
ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD, ply:LookupSequence( AnimationLookup["fire"][class.HoldType] ), 0, true )
end
ent:PlayAnimation( ent:LookupSequence("fire") )
end,
@ -237,14 +239,18 @@ AddItem( "base_firearm", {
handler:EmitSound( class.MagOutSound, 70, 100, 0.4, CHAN_STATIC )
ent:SetLoaded( false )
ent:SetClip( 0 )
ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD, ply:LookupSequence( AnimationLookup["reload"][class.HoldType] ), 0, true )
if SERVER or CLIENT and IsFirstTimePredicted() then
ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD, ply:LookupSequence( AnimationLookup["reload"][class.HoldType] ), 0, true )
end
time = 0.4
ent:PlayAnimation( ent:LookupSequence("magout") )
else
handler:EmitSound( class.MagInSound, 70, 100, 0.4, CHAN_STATIC )
ent:SetLoaded( true )
ent:SetRefillTime( CurTime() + 0.5 )
ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD, ply:LookupSequence( AnimationLookup["reload_insert"][class.HoldType] ), 0, true )
if SERVER or CLIENT and IsFirstTimePredicted() then
ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD, ply:LookupSequence( AnimationLookup["reload_insert"][class.HoldType] ), 0, true )
end
time = 0.8
ent:PlayAnimation( ent:LookupSequence("magin") )
end
@ -256,7 +262,9 @@ AddItem( "base_firearm", {
ent:SetDelay( CurTime() + 0.5 )
local ply = handler:GetOwner()
ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD, ply:LookupSequence( AnimationLookup["deploy"][class.HoldType] ), 0, true )
if SERVER or CLIENT and IsFirstTimePredicted() then
ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD, ply:LookupSequence( AnimationLookup["deploy"][class.HoldType] ), 0, true )
end
end,
["Holster"] = function( class, ent, handler )
@ -266,7 +274,9 @@ AddItem( "base_firearm", {
ent:SetDelay( CurTime() + 0.25 )
local ply = handler:GetOwner()
ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD, ply:LookupSequence( AnimationLookup["holster"][class.HoldType] ), 0, true )
if SERVER or CLIENT and IsFirstTimePredicted() then
ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD, ply:LookupSequence( AnimationLookup["holster"][class.HoldType] ), 0, true )
end
end,
})
@ -658,6 +668,31 @@ do -- Rifles
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
AddItem( "tmp", {

View File

@ -32,6 +32,9 @@ L["#Item.fnc.Description"] = "Imported assault rifle"
L["#Item.qbz.Name"] = "QBZ-95"
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.Description"] = "Rugged burst rifle"

View File

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

View File

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