Rounds work, rounds ending, domination flags get contested
This commit is contained in:
parent
85f9d855db
commit
1286e17447
|
@ -35,6 +35,7 @@ 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()
|
||||||
|
@ -56,6 +57,8 @@ 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
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,10 @@ 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,
|
||||||
|
@ -39,49 +43,51 @@ 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 ),
|
timelimit = CreateConVar("b-g_tdm_timelimit", 10*60 ),
|
||||||
},
|
},
|
||||||
["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 ),
|
timelimit = CreateConVar("b-g_ffa_timelimit", 10*60 ),
|
||||||
},
|
},
|
||||||
["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 ),
|
timelimit = CreateConVar("b-g_snd_timelimit", 2.5*60 ),
|
||||||
},
|
},
|
||||||
["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 ),
|
timelimit = CreateConVar("b-g_ctf_timelimit", 10*60 ),
|
||||||
},
|
},
|
||||||
["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 ),
|
timelimit = CreateConVar("b-g_dom_timelimit", 10*60 ),
|
||||||
|
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 ),
|
timelimit = CreateConVar("b-g_dem_timelimit", 5*60 ),
|
||||||
|
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 ),
|
timelimit = CreateConVar("b-g_hp_timelimit", 10*60 ),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,6 +177,11 @@ 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()
|
||||||
|
@ -205,15 +216,16 @@ 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 )
|
||||||
|
@ -303,6 +315,12 @@ 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)
|
||||||
|
@ -340,6 +358,9 @@ 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
|
||||||
|
|
||||||
|
|
|
@ -644,7 +644,9 @@ function GM:HUDPaint()
|
||||||
|
|
||||||
local TITLE = "CAPTURING"
|
local TITLE = "CAPTURING"
|
||||||
local PERCENT = obj:GetCapturePercent()
|
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
|
if obj:GetCapturePercent() > 0 then
|
||||||
TITLE = "CLEARING"
|
TITLE = "CLEARING"
|
||||||
else
|
else
|
||||||
|
@ -655,15 +657,18 @@ function GM:HUDPaint()
|
||||||
TITLE = "CLEARING"
|
TITLE = "CLEARING"
|
||||||
end
|
end
|
||||||
|
|
||||||
local BARCOLOR_MAIN = TEAMS[obj:GetTeamOwned()].factionid
|
local BARCOLOR = FACTIONS[ TEAMS[obj:GetTeamOwned()].factionid ]
|
||||||
BARCOLOR_MAIN = FACTIONS[BARCOLOR_MAIN].COLOR_MAIN
|
local TAKCOLOR = FACTIONS[ TEAMS[obj:GetTeamTaking()].factionid ]
|
||||||
local BARCOLOR_DARK = TEAMS[obj:GetTeamOwned()].factionid
|
local CONTOLER = FACTIONS[ "unassigned" ]
|
||||||
BARCOLOR_DARK = FACTIONS[BARCOLOR_DARK].COLOR_DARK
|
|
||||||
|
|
||||||
local TAKCOLOR_MAIN = TEAMS[obj:GetTeamTaking()].factionid
|
BARCOLOR_MAIN = BARCOLOR.COLOR_MAIN
|
||||||
TAKCOLOR_MAIN = FACTIONS[TAKCOLOR_MAIN].COLOR_MAIN
|
BARCOLOR_DARK = BARCOLOR.COLOR_DARK
|
||||||
local TAKCOLOR_DARK = TEAMS[obj:GetTeamTaking()].factionid
|
|
||||||
TAKCOLOR_DARK = FACTIONS[TAKCOLOR_DARK].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
|
local BWIDE, BTALL = 180, 16
|
||||||
|
|
||||||
|
@ -680,19 +685,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, 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
|
if TITLE!="SECURE" then
|
||||||
S_Push( -BWIDE/2, 62 )
|
S_Push( -BWIDE/2, 62 )
|
||||||
hCol( COLOR_DARK )
|
hCol( obj:GetContested() and CONTOLER_DARK or COLOR_DARK )
|
||||||
hRect( 0, 0, 180, BTALL )
|
hRect( 0, 0, 180, BTALL )
|
||||||
hCol( COLOR_MAIN )
|
hCol( obj:GetContested() and CONTOLER_MAIN or COLOR_MAIN )
|
||||||
hORect( 1, 1, 180-2, BTALL-2 )
|
hORect( 1, 1, 180-2, BTALL-2 )
|
||||||
hCol( TITLE=="CLEARING" and TAKCOLOR_MAIN or COLOR_MAIN )
|
hCol( obj:GetContested() and CONTOLER_MAIN or 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, 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
|
end
|
||||||
S_Pop()
|
S_Pop()
|
||||||
end
|
end
|
||||||
|
|
|
@ -120,10 +120,8 @@ 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 )
|
||||||
PrintTable( SpawnPoints )
|
if ( !SpawnPoints || table.IsEmpty( SpawnPoints ) ) then return end
|
||||||
if ( !SpawnPoints || table.IsEmpty( SpawnPoints ) ) then print("fail")return end
|
|
||||||
|
|
||||||
local ChosenSpawnPoint = nil
|
local ChosenSpawnPoint = nil
|
||||||
|
|
||||||
|
@ -142,8 +140,7 @@ 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 )
|
||||||
debug.Trace()
|
if IsValid( ent ) then return ent end
|
||||||
if IsValid( ent ) then print("win") return ent end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue