From 1c9e2a0efdd207be092ccf692c5648f51dfc814e Mon Sep 17 00:00:00 2001 From: squeek Date: Sun, 30 Nov 2014 23:38:56 -0800 Subject: [PATCH] Convert ff_shutdown2.lua to take advantage of the new base_shutdown.lua --- maps/ff_shutdown2.lua | 124 ++++++------------------------------------ 1 file changed, 18 insertions(+), 106 deletions(-) diff --git a/maps/ff_shutdown2.lua b/maps/ff_shutdown2.lua index d37147d..829319e 100644 --- a/maps/ff_shutdown2.lua +++ b/maps/ff_shutdown2.lua @@ -5,122 +5,34 @@ ----------------------------------------------------------------------------- IncludeScript("base_shutdown"); ------------------------------------------------------------------------------ --- unique shutdown2 locations ------------------------------------------------------------------------------ +SECURITY_LENGTH = 60 ----------------------------------------------------------------------------- -- aardvark security ----------------------------------------------------------------------------- -red_aardvarksec = trigger_ff_script:new() -blue_aardvarksec = trigger_ff_script:new() -bluesecstatus = 1 -redsecstatus = 1 +red_aardvarksec = red_security_trigger:new() +blue_aardvarksec = blue_security_trigger:new() -function red_aardvarksec:ontouch( touch_entity ) - if IsPlayer( touch_entity ) then - local player = CastToPlayer( touch_entity ) - if player:GetTeamId() == Team.kBlue then - if redsecstatus == 1 then - redsecstatus = 0 - AddSchedule("aardvarksecup10red",50,aardvarksecup10red) - AddSchedule("aardvarksecupred",60,aardvarksecupred) - OpenDoor("red_aardvarkdoorhack") - BroadCastMessage("#FF_RED_SEC_60") - --BroadCastSound( "otherteam.flagstolen") - SpeakAll( "SD_REDDOWN" ) - RemoveHudItemFromAll( "red-sec-up" ) - AddHudIconToAll( "hud_secdown.vtf", "red-sec-down", button_red.iconx, button_red.icony, button_red.iconw, button_red.iconh, 3 ) - end - end - end +local security_off_base = security_off or function() end +function security_off( team ) + security_off_base( team ) + + OpenDoor(team.."_aardvarkdoorhack") + + AddSchedule("aardvarksecup10"..team, SECURITY_LENGTH - 10, function() + BroadCastMessage("#FF_"..team:upper().."_SEC_10") + end) end -function blue_aardvarksec:ontouch( touch_entity ) - if IsPlayer( touch_entity ) then - local player = CastToPlayer( touch_entity ) - if player:GetTeamId() == Team.kRed then - if bluesecstatus == 1 then - bluesecstatus = 0 - AddSchedule("aardvarksecup10blue",50,aardvarksecup10blue) - AddSchedule("aardvarksecupblue",60,aardvarksecupblue) - OpenDoor("blue_aardvarkdoorhack") - BroadCastMessage("#FF_BLUE_SEC_60") - --BroadCastSound( "otherteam.flagstolen") - SpeakAll( "SD_BLUEDOWN" ) - RemoveHudItemFromAll( "blue-sec-up" ) - AddHudIconToAll( "hud_secdown.vtf", "blue-sec-down", button_blue.iconx, button_blue.icony, button_blue.iconw, button_blue.iconh, 2 ) - end - end - end -end +local security_on_base = security_on or function() end +function security_on( team ) + security_on_base( team ) -function aardvarksecupred() - redsecstatus = 1 - CloseDoor("red_aardvarkdoorhack") - BroadCastMessage("#FF_RED_SEC_ON") - SpeakAll( "SD_REDUP" ) - RemoveHudItemFromAll( "red-sec-down" ) - AddHudIconToAll( "hud_secup_red.vtf", "red-sec-up", button_red.iconx, button_red.icony, button_red.iconw, button_red.iconh, 3 ) -end - -function aardvarksecupblue() - bluesecstatus = 1 - CloseDoor("blue_aardvarkdoorhack") - BroadCastMessage("#FF_BLUE_SEC_ON") - SpeakAll( "SD_BLUEUP" ) - RemoveHudItemFromAll( "blue-sec-down" ) - AddHudIconToAll( "hud_secup_blue.vtf", "blue-sec-up", button_blue.iconx, button_blue.icony, button_blue.iconw, button_blue.iconh, 2 ) -end - -function aardvarksecup10red() - BroadCastMessage("#FF_RED_SEC_10") -end - -function aardvarksecup10blue() - BroadCastMessage("#FF_BLUE_SEC_10") -end - -------------------------- --- flaginfo -------------------------- -function flaginfo( player_entity ) - local player = CastToPlayer( player_entity ) - - flaginfo_base(player_entity) --basic CTF HUD items - - RemoveHudItem( player, "red-sec-down" ) - RemoveHudItem( player, "blue-sec-down" ) - RemoveHudItem( player, "red-sec-up" ) - RemoveHudItem( player, "blue-sec-up" ) - - if bluesecstatus == 1 then - AddHudIcon( player, "hud_secup_blue.vtf", "blue-sec-up", button_blue.iconx, button_blue.icony, button_blue.iconw, button_blue.iconh, 2 ) - else - AddHudIcon( player, "hud_secdown.vtf", "blue-sec-down", button_blue.iconx, button_blue.icony, button_blue.iconw, button_blue.iconh, 2 ) - end - - if redsecstatus == 1 then - AddHudIcon( player, "hud_secup_red.vtf", "red-sec-up", button_red.iconx, button_red.icony, button_red.iconw, button_red.iconh, 3 ) - else - AddHudIcon( player, "hud_secdown.vtf", "red-sec-down", button_red.iconx, button_red.icony, button_red.iconw, button_red.iconh, 3 ) - end + CloseDoor(team.."_aardvarkdoorhack") end ----------------------------------------------------------------------------- -- respawn shields ----------------------------------------------------------------------------- -KILL_KILL_KILL = trigger_ff_script:new({ team = Team.kUnassigned }) - -function KILL_KILL_KILL:allowed( activator ) - local player = CastToPlayer( activator ) - if player then - if player:GetTeamId() == self.team then - return EVENT_ALLOWED - end - end - return EVENT_DISALLOWED -end - -blue_slayer = KILL_KILL_KILL:new({ team = Team.kBlue }) -red_slayer = KILL_KILL_KILL:new({ team = Team.kRed }) +blue_slayer = not_red_trigger:new() +red_slayer = not_blue_trigger:new()