Convert ff_ksour.lua to take advantage of the new base_id.lua

This commit is contained in:
alaswell 2015-01-10 17:12:59 -07:00
parent 9dcff94c02
commit ddf7b29a58

View file

@ -18,6 +18,10 @@ end
function startup()
SetGameDescription("Invade Defend")
DEFENDERS_OBJECTIVE_ONCAP = true
DEFENDERS_OBJECTIVE_ONCARRIER = false --set to true to follow flag when carried
DEFENDERS_OBJECTIVE_ONFLAG = false --set to true to follow flag ALWAYS
-- set up team limits
local team = GetTeam( Team.kBlue )
team:SetPlayerLimit( 0 )
@ -94,9 +98,8 @@ function startup()
flags_set_team( attackers )
ATTACKERS_OBJECTIVE_ENTITY = GetEntityByName( "cp"..phase.."_flag" )
DEFENDERS_OBJECTIVE_ENTITY = GetEntityByName( "cp"..phase.."_cap" )
UpdateDefendersObjective()
UpdateTeamObjectiveIcon( GetTeam(attackers), ATTACKERS_OBJECTIVE_ENTITY )
UpdateTeamObjectiveIcon( GetTeam(defenders), DEFENDERS_OBJECTIVE_ENTITY )
end
-- overwriting these functions so that there aren't repeat messages
@ -105,7 +108,7 @@ function round_10secwarn() end
function base_id_cap:oncapture(player, item)
SmartSound(player, "yourteam.flagcap", "yourteam.flagcap", "otherteam.flagcap")
--SmartSound(player, "vox.yourcap", "vox.yourcap", "vox.enemycap")
--SmartSound(player, "vox.yourcap", "vox.yourcap", "vox.enemycap")
SmartSpeak(player, "CTF_YOUCAP", "CTF_TEAMCAP", "CTF_THEYCAP")
SmartMessage(player, "#FF_YOUCAP", "#FF_TEAMCAP", "#FF_OTHERTEAMCAP", Color.kGreen, Color.kGreen, Color.kRed)
@ -134,12 +137,10 @@ function base_id_cap:oncapture(player, item)
if ROUND_DELAY > 30 then AddSchedule("flag_30secwarn", ROUND_DELAY-30, flag_30secwarn) end
if ROUND_DELAY > 10 then AddSchedule("flag_10secwarn", ROUND_DELAY-10, flag_10secwarn) end
-- change objective icon
-- clear objective icon
ATTACKERS_OBJECTIVE_ENTITY = nil
if DEFENDERS_OBJECTIVE_ONFLAG or DEFENDERS_OBJECTIVE_ONCARRIER then DEFENDERS_OBJECTIVE_ENTITY = nil
else DEFENDERS_OBJECTIVE_ENTITY = GetEntityByName( "cp"..phase.."_cap" ) end
UpdateDefendersObjective()
UpdateTeamObjectiveIcon( GetTeam(attackers), ATTACKERS_OBJECTIVE_ENTITY )
UpdateTeamObjectiveIcon( GetTeam(defenders), DEFENDERS_OBJECTIVE_ENTITY )
setup_tobase_timer()
update_hud()
@ -188,9 +189,8 @@ function switch_teams()
-- change objective icon
ATTACKERS_OBJECTIVE_ENTITY = flag
DEFENDERS_OBJECTIVE_ENTITY = GetEntityByName( "cp"..phase.."_cap" )
UpdateDefendersObjective()
UpdateTeamObjectiveIcon( GetTeam(attackers), ATTACKERS_OBJECTIVE_ENTITY )
UpdateTeamObjectiveIcon( GetTeam(defenders), DEFENDERS_OBJECTIVE_ENTITY )
-- reset the timer on points
AddScheduleRepeating("addpoints", PERIOD_TIME, addpoints)