Skip to content

Commit

Permalink
Convert ff_ksour.lua to take advantage of the new round timer system
Browse files Browse the repository at this point in the history
  • Loading branch information
alaswell committed Jan 11, 2015
1 parent 7a5a9c9 commit eb86bca
Showing 1 changed file with 34 additions and 6 deletions.
40 changes: 34 additions & 6 deletions maps/ff_ksour.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ function startup()
-- start the timer for the points
AddScheduleRepeating("addpoints", PERIOD_TIME, addpoints)

setup_door_timer("start_gate", INITIAL_ROUND_DELAY)
-- start the timer for the round timer
setup_round_timer( INITIAL_ROUND_DELAY )

setup_door_timer("start_gate", INITIAL_ROUND_DELAY)
if INITIAL_ROUND_DELAY > 30 then AddSchedule( "dooropen30sec" , INITIAL_ROUND_DELAY - 30 , schedulemessagetoall, "Gates open in 30 seconds!" ) end
if INITIAL_ROUND_DELAY > 10 then AddSchedule( "dooropen10sec" , INITIAL_ROUND_DELAY - 10 , schedulemessagetoall, "Gates open in 10 seconds!" ) end
if INITIAL_ROUND_DELAY > 5 then AddSchedule( "dooropen5sec" , INITIAL_ROUND_DELAY - 5 , schedulemessagetoall, "5" ) end
Expand Down Expand Up @@ -130,6 +133,10 @@ function base_id_cap:oncapture(player, item)

AddSchedule("switch_teams", TEAM_SWITCH_DELAY, switch_teams)
else
-- out with the old timer, in with the new
destroy_round_timer()
setup_round_timer( ROUND_DELAY )

phase = phase + 1

-- enable the next flag after a time
Expand All @@ -148,15 +155,15 @@ function base_id_cap:oncapture(player, item)

end

function switch_teams()
function switch_teams()
if attackers == Team.kBlue then
attackers = Team.kRed
defenders = Team.kBlue
else
attackers = Team.kBlue
defenders = Team.kRed
end

local team = GetTeam(attackers)
team:SetClassLimit(Player.kCivilian, -1)
team:SetClassLimit(Player.kDemoman, 0)
Expand Down Expand Up @@ -199,6 +206,10 @@ function switch_teams()
RespawnAllPlayers()
setup_door_timer("start_gate", INITIAL_ROUND_DELAY)

-- out with the old timer, in with the new
destroy_round_timer()
setup_round_timer( INITIAL_ROUND_DELAY )

-- run custom round reset stuff
onroundreset()
update_hud()
Expand Down Expand Up @@ -354,6 +365,25 @@ end
---------------------------------------
--Resetting round
------------------------------------

function forceRoundEnd()
-- end and stuff

RemoveHudItemFromAll("cp"..phase.."_flag")
--cancel any flag action
local flag = GetInfoScriptByName("cp"..phase.."_flag")
if flag then
flag:Remove()
end

phase = 1

OutputEvent( "start_gate", "Close" )
BroadCastMessage("#ADZ_Switch")

AddSchedule("switch_teams", 0, switch_teams)
end

detpack_wall_open = nil

function onroundreset()
Expand Down Expand Up @@ -399,6 +429,4 @@ end

-- Don't want any body touching/triggering it except the detpack
function trigger_detpackable_door:allowed( trigger_entity ) return EVENT_DISALLOWED
end


end

0 comments on commit eb86bca

Please sign in to comment.