mirror of
https://github.com/fortressforever/fortressforever-scripts.git
synced 2024-11-26 06:20:46 +00:00
Merge pull request #1 from fortressforever/features/better-base-shutdown
Better base_shutdown.lua
This commit is contained in:
commit
c3dfd19ae1
7 changed files with 293 additions and 684 deletions
|
@ -8,14 +8,14 @@ SNIPER_LIMIT = 1;
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- includes
|
-- includes
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
IncludeScript("base");
|
IncludeScript("base_shutdown");
|
||||||
IncludeScript("base_ctf");
|
|
||||||
IncludeScript("base_location");
|
IncludeScript("base_location");
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- global overrides
|
-- global overrides
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
POINTS_PER_CAPTURE = 10;
|
POINTS_PER_CAPTURE = 10;
|
||||||
FLAG_RETURN_TIME = 60;
|
FLAG_RETURN_TIME = 60;
|
||||||
|
SECURITY_LENGTH = 30;
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- unique aardvark locations
|
-- unique aardvark locations
|
||||||
|
@ -59,23 +59,14 @@ location_midmap = location_info:new({ text = "Outside", team = NO_TEAM })
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- set class limits
|
-- set class limits
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
local startup_base = startup or function() end
|
||||||
function startup()
|
function startup()
|
||||||
SetGameDescription("Capture the Flag")
|
startup_base()
|
||||||
|
|
||||||
-- set up team limits on each team
|
|
||||||
SetPlayerLimit(Team.kBlue, 0)
|
|
||||||
SetPlayerLimit(Team.kRed, 0)
|
|
||||||
SetPlayerLimit(Team.kYellow, -1)
|
|
||||||
SetPlayerLimit(Team.kGreen, -1)
|
|
||||||
|
|
||||||
-- CTF maps generally don't have civilians,
|
|
||||||
-- so override in map LUA file if you want 'em
|
|
||||||
local team = GetTeam(Team.kBlue)
|
local team = GetTeam(Team.kBlue)
|
||||||
team:SetClassLimit(Player.kCivilian, -1)
|
|
||||||
team:SetClassLimit(Player.kSniper, SNIPER_LIMIT)
|
team:SetClassLimit(Player.kSniper, SNIPER_LIMIT)
|
||||||
|
|
||||||
team = GetTeam(Team.kRed)
|
team = GetTeam(Team.kRed)
|
||||||
team:SetClassLimit(Player.kCivilian, -1)
|
|
||||||
team:SetClassLimit(Player.kSniper, SNIPER_LIMIT)
|
team:SetClassLimit(Player.kSniper, SNIPER_LIMIT)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -160,142 +151,42 @@ red_aardvarkresup = aardvarkresup:new({ team = Team.kRed })
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- aardvark security
|
-- aardvark security
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
red_aardvarksec = trigger_ff_script:new()
|
red_aardvarksec = red_security_trigger:new()
|
||||||
blue_aardvarksec = trigger_ff_script:new()
|
blue_aardvarksec = blue_security_trigger:new()
|
||||||
bluesecstatus = 1
|
|
||||||
redsecstatus = 1
|
|
||||||
|
|
||||||
sec_iconx = 60
|
-- utility function for getting the name of the opposite team,
|
||||||
sec_icony = 30
|
-- where team is a string, like "red"
|
||||||
sec_iconw = 16
|
local function get_opposite_team(team)
|
||||||
sec_iconh = 16
|
if team == "red" then return "blue" else return "red" end
|
||||||
|
|
||||||
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",20,aardvarksecup10red)
|
|
||||||
AddSchedule("aardvarksecupred",30,aardvarksecupred)
|
|
||||||
OpenDoor("red_aardvarkdoorhack")
|
|
||||||
BroadCastMessage("#FF_RED_SEC_30")
|
|
||||||
--BroadCastSound( "otherteam.flagstolen")
|
|
||||||
SpeakAll( "SD_REDDOWN" )
|
|
||||||
RemoveHudItemFromAll( "red-sec-up" )
|
|
||||||
AddHudIconToAll( "hud_secdown.vtf", "red-sec-down", sec_iconx, sec_icony, sec_iconw, sec_iconh, 3 )
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function blue_aardvarksec:ontouch( touch_entity )
|
local security_off_base = security_off
|
||||||
if IsPlayer( touch_entity ) then
|
function security_off( team )
|
||||||
local player = CastToPlayer( touch_entity )
|
security_off_base( team )
|
||||||
if player:GetTeamId() == Team.kRed then
|
|
||||||
if bluesecstatus == 1 then
|
OpenDoor(team.."_aardvarkdoorhack")
|
||||||
bluesecstatus = 0
|
local opposite_team = get_opposite_team(team)
|
||||||
AddSchedule("aardvarksecup10blue",20,aardvarksecup10blue)
|
OutputEvent("sec_"..opposite_team.."_slayer", "Disable")
|
||||||
AddSchedule("aardvarksecupblue",30,aardvarksecupblue)
|
|
||||||
OpenDoor("blue_aardvarkdoorhack")
|
AddSchedule("secup10"..team, SECURITY_LENGTH - 10, function()
|
||||||
BroadCastMessage("#FF_BLUE_SEC_30")
|
BroadCastMessage("#FF_"..team:upper().."_SEC_10")
|
||||||
--BroadCastSound( "otherteam.flagstolen")
|
end)
|
||||||
SpeakAll( "SD_BLUEDOWN" )
|
|
||||||
RemoveHudItemFromAll( "blue-sec-up" )
|
|
||||||
AddHudIconToAll( "hud_secdown.vtf", "blue-sec-down", sec_iconx, sec_icony, sec_iconw, sec_iconh, 2 )
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function aardvarksecupred()
|
local security_on_base = security_on
|
||||||
redsecstatus = 1
|
function security_on( team )
|
||||||
CloseDoor("red_aardvarkdoorhack")
|
security_on_base( team )
|
||||||
BroadCastMessage("#FF_RED_SEC_ON")
|
|
||||||
SpeakAll( "SD_REDUP" )
|
|
||||||
RemoveHudItemFromAll( "red-sec-down" )
|
|
||||||
AddHudIconToAll( "hud_secup_red.vtf", "red-sec-up", sec_iconx, sec_icony, sec_iconw, sec_iconh, 3 )
|
|
||||||
end
|
|
||||||
|
|
||||||
function aardvarksecupblue()
|
CloseDoor(team.."_aardvarkdoorhack")
|
||||||
bluesecstatus = 1
|
local opposite_team = get_opposite_team(team)
|
||||||
CloseDoor("blue_aardvarkdoorhack")
|
OutputEvent("sec_"..opposite_team.."_slayer", "Enable")
|
||||||
BroadCastMessage("#FF_BLUE_SEC_ON")
|
|
||||||
SpeakAll( "SD_BLUEUP" )
|
|
||||||
RemoveHudItemFromAll( "blue-sec-down" )
|
|
||||||
AddHudIconToAll( "hud_secup_blue.vtf", "blue-sec-up", sec_iconx, sec_icony, sec_iconw, sec_iconh, 2 )
|
|
||||||
end
|
|
||||||
|
|
||||||
function aardvarksecup10red()
|
|
||||||
BroadCastMessage("#FF_RED_SEC_10")
|
|
||||||
end
|
|
||||||
|
|
||||||
function aardvarksecup10blue()
|
|
||||||
BroadCastMessage("#FF_BLUE_SEC_10")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- aardvark lasers and respawn shields
|
-- respawn shields
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
KILL_KILL_KILL = trigger_ff_script:new({ team = Team.kUnassigned })
|
blue_slayer = not_red_trigger:new()
|
||||||
lasers_KILL_KILL_KILL = trigger_ff_script:new({ team = Team.kUnassigned })
|
red_slayer = not_blue_trigger:new()
|
||||||
|
sec_blue_slayer = not_red_trigger:new()
|
||||||
|
sec_red_slayer = not_blue_trigger:new()
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
function lasers_KILL_KILL_KILL:allowed( activator )
|
|
||||||
local player = CastToPlayer( activator )
|
|
||||||
if player then
|
|
||||||
if player:GetTeamId() == self.team then
|
|
||||||
if self.team == Team.kBlue then
|
|
||||||
if redsecstatus == 1 then
|
|
||||||
return EVENT_ALLOWED
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if self.team == Team.kRed then
|
|
||||||
if bluesecstatus == 1 then
|
|
||||||
return EVENT_ALLOWED
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return EVENT_DISALLOWED
|
|
||||||
end
|
|
||||||
|
|
||||||
blue_slayer = KILL_KILL_KILL:new({ team = Team.kBlue })
|
|
||||||
red_slayer = KILL_KILL_KILL:new({ team = Team.kRed })
|
|
||||||
sec_blue_slayer = lasers_KILL_KILL_KILL:new({ team = Team.kBlue })
|
|
||||||
sec_red_slayer = lasers_KILL_KILL_KILL:new({ team = Team.kRed })
|
|
||||||
|
|
||||||
-------------------------
|
|
||||||
-- 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", sec_iconx, sec_icony, sec_iconw, sec_iconh, 2 )
|
|
||||||
else
|
|
||||||
AddHudIcon( player, "hud_secdown.vtf", "blue-sec-down", sec_iconx, sec_icony, sec_iconw, sec_iconh, 2 )
|
|
||||||
end
|
|
||||||
|
|
||||||
if redsecstatus == 1 then
|
|
||||||
AddHudIcon( player, "hud_secup_red.vtf", "red-sec-up", sec_iconx, sec_icony, sec_iconw, sec_iconh, 3 )
|
|
||||||
else
|
|
||||||
AddHudIcon( player, "hud_secdown.vtf", "red-sec-down", sec_iconx, sec_icony, sec_iconw, sec_iconh, 3 )
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
|
@ -4,8 +4,7 @@
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- includes
|
-- includes
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
IncludeScript("base");
|
IncludeScript("base_shutdown");
|
||||||
IncludeScript("base_ctf");
|
|
||||||
IncludeScript("base_location");
|
IncludeScript("base_location");
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
@ -13,6 +12,7 @@ IncludeScript("base_location");
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
POINTS_PER_CAPTURE = 10;
|
POINTS_PER_CAPTURE = 10;
|
||||||
FLAG_RETURN_TIME = 60;
|
FLAG_RETURN_TIME = 60;
|
||||||
|
SECURITY_LENGTH = 30;
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- locations
|
-- locations
|
||||||
|
@ -37,25 +37,6 @@ location_blueresup = location_info:new({ text = "Resupply", team = Team.kBlue })
|
||||||
|
|
||||||
location_midmap = location_info:new({ text = "Outside", team = NO_TEAM })
|
location_midmap = location_info:new({ text = "Outside", team = NO_TEAM })
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
|
||||||
-- remove mirvs (?) and give full resup on spawn
|
|
||||||
-----------------------------------------------------------------------------
|
|
||||||
function player_spawn( player_entity )
|
|
||||||
local player = CastToPlayer( player_entity )
|
|
||||||
-- if player:GetClass() == Player.kHwguy then
|
|
||||||
-- player:RemoveAmmo(Ammo.kGren2, 4)
|
|
||||||
-- end
|
|
||||||
-- if player:GetClass() == Player.kDemoman then
|
|
||||||
-- player:RemoveAmmo(Ammo.kGren2, 4)
|
|
||||||
-- end
|
|
||||||
player:AddHealth( 400 )
|
|
||||||
player:AddArmor( 400 )
|
|
||||||
player:AddAmmo( Ammo.kNails, 400 )
|
|
||||||
player:AddAmmo( Ammo.kShells, 400 )
|
|
||||||
player:AddAmmo( Ammo.kRockets, 400 )
|
|
||||||
player:AddAmmo( Ammo.kCells, 400 )
|
|
||||||
end
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- bagless resupply
|
-- bagless resupply
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
@ -79,147 +60,46 @@ blue_aardvarkresup = aardvarkresup:new({ team = Team.kBlue })
|
||||||
red_aardvarkresup = aardvarkresup:new({ team = Team.kRed })
|
red_aardvarkresup = aardvarkresup:new({ team = Team.kRed })
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- aardvark security
|
-- security
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
red_aardvarksec = trigger_ff_script:new()
|
red_aardvarksec = red_security_trigger:new()
|
||||||
blue_aardvarksec = trigger_ff_script:new()
|
blue_aardvarksec = blue_security_trigger:new()
|
||||||
bluesecstatus = 1
|
|
||||||
redsecstatus = 1
|
|
||||||
|
|
||||||
sec_iconx = 60
|
-- utility function for getting the name of the opposite team,
|
||||||
sec_icony = 30
|
-- where team is a string, like "red"
|
||||||
sec_iconw = 16
|
local function get_opposite_team(team)
|
||||||
sec_iconh = 16
|
if team == "red" then return "blue" else return "red" end
|
||||||
|
|
||||||
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",20,aardvarksecup10red)
|
|
||||||
AddSchedule("aardvarksecupred",30,aardvarksecupred)
|
|
||||||
OpenDoor("red_aardvarkdoorhack")
|
|
||||||
BroadCastMessage("#FF_RED_SEC_30")
|
|
||||||
--BroadCastSound( "otherteam.flagstolen")
|
|
||||||
SpeakAll( "SD_REDDOWN" )
|
|
||||||
RemoveHudItemFromAll( "red-sec-up" )
|
|
||||||
AddHudIconToAll( "hud_secdown.vtf", "red-sec-down", sec_iconx, sec_icony, sec_iconw, sec_iconh, 3 )
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function blue_aardvarksec:ontouch( touch_entity )
|
local security_off_base = security_off
|
||||||
if IsPlayer( touch_entity ) then
|
function security_off( team )
|
||||||
local player = CastToPlayer( touch_entity )
|
security_off_base( team )
|
||||||
if player:GetTeamId() == Team.kRed then
|
|
||||||
if bluesecstatus == 1 then
|
OpenDoor(team.."_aardvarkdoorhack")
|
||||||
bluesecstatus = 0
|
local opposite_team = get_opposite_team(team)
|
||||||
AddSchedule("aardvarksecup10blue",20,aardvarksecup10blue)
|
OutputEvent("sec_"..opposite_team.."_slayer", "Disable")
|
||||||
AddSchedule("aardvarksecupblue",30,aardvarksecupblue)
|
|
||||||
OpenDoor("blue_aardvarkdoorhack")
|
AddSchedule("secup10"..team, SECURITY_LENGTH - 10, function()
|
||||||
BroadCastMessage("#FF_BLUE_SEC_30")
|
BroadCastMessage("#FF_"..team:upper().."_SEC_10")
|
||||||
--BroadCastSound( "otherteam.flagstolen")
|
end)
|
||||||
SpeakAll( "SD_BLUEDOWN" )
|
|
||||||
RemoveHudItemFromAll( "blue-sec-up" )
|
|
||||||
AddHudIconToAll( "hud_secdown.vtf", "blue-sec-down", sec_iconx, sec_icony, sec_iconw, sec_iconh, 2 )
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function aardvarksecupred()
|
local security_on_base = security_on
|
||||||
redsecstatus = 1
|
function security_on( team )
|
||||||
CloseDoor("red_aardvarkdoorhack")
|
security_on_base( team )
|
||||||
BroadCastMessage("#FF_RED_SEC_ON")
|
|
||||||
SpeakAll( "SD_REDUP" )
|
|
||||||
RemoveHudItemFromAll( "red-sec-down" )
|
|
||||||
AddHudIconToAll( "hud_secup_red.vtf", "red-sec-up", sec_iconx, sec_icony, sec_iconw, sec_iconh, 3 )
|
|
||||||
end
|
|
||||||
|
|
||||||
function aardvarksecupblue()
|
CloseDoor(team.."_aardvarkdoorhack")
|
||||||
bluesecstatus = 1
|
local opposite_team = get_opposite_team(team)
|
||||||
CloseDoor("blue_aardvarkdoorhack")
|
OutputEvent("sec_"..opposite_team.."_slayer", "Enable")
|
||||||
BroadCastMessage("#FF_BLUE_SEC_ON")
|
|
||||||
SpeakAll( "SD_BLUEUP" )
|
|
||||||
RemoveHudItemFromAll( "blue-sec-down" )
|
|
||||||
AddHudIconToAll( "hud_secup_blue.vtf", "blue-sec-up", sec_iconx, sec_icony, sec_iconw, sec_iconh, 2 )
|
|
||||||
end
|
|
||||||
|
|
||||||
function aardvarksecup10red()
|
|
||||||
BroadCastMessage("#FF_RED_SEC_10")
|
|
||||||
end
|
|
||||||
|
|
||||||
function aardvarksecup10blue()
|
|
||||||
BroadCastMessage("#FF_BLUE_SEC_10")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- aardvark lasers and respawn shields
|
-- lasers and respawn shields
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
KILL_KILL_KILL = trigger_ff_script:new({ team = Team.kUnassigned })
|
blue_slayer = not_red_trigger:new()
|
||||||
lasers_KILL_KILL_KILL = trigger_ff_script:new({ team = Team.kUnassigned })
|
red_slayer = not_blue_trigger:new()
|
||||||
|
sec_blue_slayer = not_red_trigger:new()
|
||||||
function KILL_KILL_KILL:allowed( activator )
|
sec_red_slayer = not_blue_trigger:new()
|
||||||
local player = CastToPlayer( activator )
|
|
||||||
if player then
|
|
||||||
if player:GetTeamId() == self.team then
|
|
||||||
return EVENT_ALLOWED
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return EVENT_DISALLOWED
|
|
||||||
end
|
|
||||||
|
|
||||||
function lasers_KILL_KILL_KILL:allowed( activator )
|
|
||||||
local player = CastToPlayer( activator )
|
|
||||||
if player then
|
|
||||||
if player:GetTeamId() == self.team then
|
|
||||||
if self.team == Team.kBlue then
|
|
||||||
if redsecstatus == 1 then
|
|
||||||
return EVENT_ALLOWED
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if self.team == Team.kRed then
|
|
||||||
if bluesecstatus == 1 then
|
|
||||||
return EVENT_ALLOWED
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return EVENT_DISALLOWED
|
|
||||||
end
|
|
||||||
|
|
||||||
blue_slayer = KILL_KILL_KILL:new({ team = Team.kBlue })
|
|
||||||
red_slayer = KILL_KILL_KILL:new({ team = Team.kRed })
|
|
||||||
sec_blue_slayer = lasers_KILL_KILL_KILL:new({ team = Team.kBlue })
|
|
||||||
sec_red_slayer = lasers_KILL_KILL_KILL:new({ team = Team.kRed })
|
|
||||||
|
|
||||||
-------------------------
|
|
||||||
-- 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", sec_iconx, sec_icony, sec_iconw, sec_iconh, 2 )
|
|
||||||
else
|
|
||||||
AddHudIcon( player, "hud_secdown.vtf", "blue-sec-down", sec_iconx, sec_icony, sec_iconw, sec_iconh, 2 )
|
|
||||||
end
|
|
||||||
|
|
||||||
if redsecstatus == 1 then
|
|
||||||
AddHudIcon( player, "hud_secup_red.vtf", "red-sec-up", sec_iconx, sec_icony, sec_iconw, sec_iconh, 3 )
|
|
||||||
else
|
|
||||||
AddHudIcon( player, "hud_secdown.vtf", "red-sec-down", sec_iconx, sec_icony, sec_iconw, sec_iconh, 3 )
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- custom packs
|
-- custom packs
|
||||||
|
|
|
@ -4,8 +4,7 @@
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- includes
|
-- includes
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
IncludeScript("base");
|
IncludeScript("base_shutdown");
|
||||||
IncludeScript("base_ctf");
|
|
||||||
IncludeScript("base_location");
|
IncludeScript("base_location");
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
@ -13,6 +12,7 @@ IncludeScript("base_location");
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
POINTS_PER_CAPTURE = 10;
|
POINTS_PER_CAPTURE = 10;
|
||||||
FLAG_RETURN_TIME = 60;
|
FLAG_RETURN_TIME = 60;
|
||||||
|
SECURITY_LENGTH = 30;
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- unique openfire locations
|
-- unique openfire locations
|
||||||
|
@ -56,147 +56,46 @@ blue_aardvarkresup = aardvarkresup:new({ team = Team.kBlue })
|
||||||
red_aardvarkresup = aardvarkresup:new({ team = Team.kRed })
|
red_aardvarkresup = aardvarkresup:new({ team = Team.kRed })
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- aardvark security
|
-- security
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
red_aardvarksec = trigger_ff_script:new()
|
red_aardvarksec = red_security_trigger:new()
|
||||||
blue_aardvarksec = trigger_ff_script:new()
|
blue_aardvarksec = blue_security_trigger:new()
|
||||||
bluesecstatus = 1
|
|
||||||
redsecstatus = 1
|
|
||||||
|
|
||||||
sec_iconx = 60
|
-- utility function for getting the name of the opposite team,
|
||||||
sec_icony = 30
|
-- where team is a string, like "red"
|
||||||
sec_iconw = 16
|
local function get_opposite_team(team)
|
||||||
sec_iconh = 16
|
if team == "red" then return "blue" else return "red" end
|
||||||
|
|
||||||
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",20,aardvarksecup10red)
|
|
||||||
AddSchedule("aardvarksecupred",30,aardvarksecupred)
|
|
||||||
OpenDoor("red_aardvarkdoorhack")
|
|
||||||
BroadCastMessage("#FF_RED_SEC_30")
|
|
||||||
--BroadCastSound( "otherteam.flagstolen")
|
|
||||||
SpeakAll( "SD_REDDOWN" )
|
|
||||||
RemoveHudItemFromAll( "red-sec-up" )
|
|
||||||
AddHudIconToAll( "hud_secdown.vtf", "red-sec-down", sec_iconx, sec_icony, sec_iconw, sec_iconh, 3 )
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function blue_aardvarksec:ontouch( touch_entity )
|
local security_off_base = security_off
|
||||||
if IsPlayer( touch_entity ) then
|
function security_off( team )
|
||||||
local player = CastToPlayer( touch_entity )
|
security_off_base( team )
|
||||||
if player:GetTeamId() == Team.kRed then
|
|
||||||
if bluesecstatus == 1 then
|
OpenDoor(team.."_aardvarkdoorhack")
|
||||||
bluesecstatus = 0
|
local opposite_team = get_opposite_team(team)
|
||||||
AddSchedule("aardvarksecup10blue",20,aardvarksecup10blue)
|
OutputEvent("sec_"..opposite_team.."_slayer", "Disable")
|
||||||
AddSchedule("aardvarksecupblue",30,aardvarksecupblue)
|
|
||||||
OpenDoor("blue_aardvarkdoorhack")
|
AddSchedule("secup10"..team, SECURITY_LENGTH - 10, function()
|
||||||
BroadCastMessage("#FF_BLUE_SEC_30")
|
BroadCastMessage("#FF_"..team:upper().."_SEC_10")
|
||||||
--BroadCastSound( "otherteam.flagstolen")
|
end)
|
||||||
SpeakAll( "SD_BLUEDOWN" )
|
|
||||||
RemoveHudItemFromAll( "blue-sec-up" )
|
|
||||||
AddHudIconToAll( "hud_secdown.vtf", "blue-sec-down", sec_iconx, sec_icony, sec_iconw, sec_iconh, 2 )
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function aardvarksecupred()
|
local security_on_base = security_on
|
||||||
redsecstatus = 1
|
function security_on( team )
|
||||||
CloseDoor("red_aardvarkdoorhack")
|
security_on_base( team )
|
||||||
BroadCastMessage("#FF_RED_SEC_ON")
|
|
||||||
SpeakAll( "SD_REDUP" )
|
|
||||||
RemoveHudItemFromAll( "red-sec-down" )
|
|
||||||
AddHudIconToAll( "hud_secup_red.vtf", "red-sec-up", sec_iconx, sec_icony, sec_iconw, sec_iconh, 3 )
|
|
||||||
end
|
|
||||||
|
|
||||||
function aardvarksecupblue()
|
CloseDoor(team.."_aardvarkdoorhack")
|
||||||
bluesecstatus = 1
|
local opposite_team = get_opposite_team(team)
|
||||||
CloseDoor("blue_aardvarkdoorhack")
|
OutputEvent("sec_"..opposite_team.."_slayer", "Enable")
|
||||||
BroadCastMessage("#FF_BLUE_SEC_ON")
|
|
||||||
SpeakAll( "SD_BLUEUP" )
|
|
||||||
RemoveHudItemFromAll( "blue-sec-down" )
|
|
||||||
AddHudIconToAll( "hud_secup_blue.vtf", "blue-sec-up", sec_iconx, sec_icony, sec_iconw, sec_iconh, 2 )
|
|
||||||
end
|
|
||||||
|
|
||||||
function aardvarksecup10red()
|
|
||||||
BroadCastMessage("#FF_RED_SEC_10")
|
|
||||||
end
|
|
||||||
|
|
||||||
function aardvarksecup10blue()
|
|
||||||
BroadCastMessage("#FF_BLUE_SEC_10")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- aardvark lasers and respawn shields
|
-- lasers and respawn shields
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
KILL_KILL_KILL = trigger_ff_script:new({ team = Team.kUnassigned })
|
blue_slayer = not_red_trigger:new()
|
||||||
lasers_KILL_KILL_KILL = trigger_ff_script:new({ team = Team.kUnassigned })
|
red_slayer = not_blue_trigger:new()
|
||||||
|
sec_blue_slayer = not_red_trigger:new()
|
||||||
function KILL_KILL_KILL:allowed( activator )
|
sec_red_slayer = not_blue_trigger:new()
|
||||||
local player = CastToPlayer( activator )
|
|
||||||
if player then
|
|
||||||
if player:GetTeamId() == self.team then
|
|
||||||
return EVENT_ALLOWED
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return EVENT_DISALLOWED
|
|
||||||
end
|
|
||||||
|
|
||||||
function lasers_KILL_KILL_KILL:allowed( activator )
|
|
||||||
local player = CastToPlayer( activator )
|
|
||||||
if player then
|
|
||||||
if player:GetTeamId() == self.team then
|
|
||||||
if self.team == Team.kBlue then
|
|
||||||
if redsecstatus == 1 then
|
|
||||||
return EVENT_ALLOWED
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if self.team == Team.kRed then
|
|
||||||
if bluesecstatus == 1 then
|
|
||||||
return EVENT_ALLOWED
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return EVENT_DISALLOWED
|
|
||||||
end
|
|
||||||
|
|
||||||
blue_slayer = KILL_KILL_KILL:new({ team = Team.kBlue })
|
|
||||||
red_slayer = KILL_KILL_KILL:new({ team = Team.kRed })
|
|
||||||
sec_blue_slayer = lasers_KILL_KILL_KILL:new({ team = Team.kBlue })
|
|
||||||
sec_red_slayer = lasers_KILL_KILL_KILL:new({ team = Team.kRed })
|
|
||||||
|
|
||||||
-------------------------
|
|
||||||
-- 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", sec_iconx, sec_icony, sec_iconw, sec_iconh, 2 )
|
|
||||||
else
|
|
||||||
AddHudIcon( player, "hud_secdown.vtf", "blue-sec-down", sec_iconx, sec_icony, sec_iconw, sec_iconh, 2 )
|
|
||||||
end
|
|
||||||
|
|
||||||
if redsecstatus == 1 then
|
|
||||||
AddHudIcon( player, "hud_secup_red.vtf", "red-sec-up", sec_iconx, sec_icony, sec_iconw, sec_iconh, 3 )
|
|
||||||
else
|
|
||||||
AddHudIcon( player, "hud_secdown.vtf", "red-sec-down", sec_iconx, sec_icony, sec_iconw, sec_iconh, 3 )
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- custom openfire pack
|
-- custom openfire pack
|
||||||
|
|
|
@ -99,20 +99,8 @@ red_windowpack = windowpack:new({ touchflags = { AllowFlags.kOnlyPlayers, AllowF
|
||||||
-- kills those who wander into the enemy spawn
|
-- kills those who wander into the enemy spawn
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
|
||||||
spawn_protection = trigger_ff_script:new({ team = Team.kUnassigned })
|
red_spawn_protection = not_red_trigger:new()
|
||||||
|
blue_spawn_protection = not_blue_trigger:new()
|
||||||
function spawn_protection:allowed( activator )
|
|
||||||
local player = CastToPlayer( activator )
|
|
||||||
if player then
|
|
||||||
if player:GetTeamId() == self.team then
|
|
||||||
return EVENT_ALLOWED
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return EVENT_DISALLOWED
|
|
||||||
end
|
|
||||||
|
|
||||||
red_spawn_protection = spawn_protection:new({ team = Team.kBlue })
|
|
||||||
blue_spawn_protection = spawn_protection:new({ team = Team.kRed })
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- OFFENSIVE AND DEFENSIVE SPAWNS
|
-- OFFENSIVE AND DEFENSIVE SPAWNS
|
||||||
|
@ -136,84 +124,38 @@ blue_dspawn = { validspawn = blue_d_only }
|
||||||
-- AND THEN, SOME MORE STUFF...
|
-- AND THEN, SOME MORE STUFF...
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
|
||||||
red_sec = trigger_ff_script:new()
|
red_sec = red_security_trigger:new()
|
||||||
blue_sec = trigger_ff_script:new()
|
blue_sec = blue_security_trigger:new()
|
||||||
bluesecstatus = 1
|
|
||||||
redsecstatus = 1
|
|
||||||
|
|
||||||
sec_iconx = 60
|
-- utility function for getting the name of the opposite team,
|
||||||
sec_icony = 30
|
-- where team is a string, like "red"
|
||||||
sec_iconw = 16
|
local function get_opposite_team(team)
|
||||||
sec_iconh = 16
|
if team == "red" then return "blue" else return "red" end
|
||||||
|
|
||||||
function red_sec: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("secup10red", SECURITY_LENGTH - 10, secup10red)
|
|
||||||
AddSchedule("beginclosered", SECURITY_LENGTH - 6, beginclosered)
|
|
||||||
AddSchedule("secupred",SECURITY_LENGTH,secupred)
|
|
||||||
OpenDoor("red_secdoor")
|
|
||||||
BroadCastMessage("#FF_RED_SEC_40")
|
|
||||||
SpeakAll( "SD_REDDOWN" )
|
|
||||||
RemoveHudItemFromAll( "red-sec-up" )
|
|
||||||
AddHudIconToAll( "hud_secdown.vtf", "red-sec-down", sec_iconx, sec_icony, sec_iconw, sec_iconh, 3 )
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function blue_sec:ontouch( touch_entity )
|
local security_off_base = security_off
|
||||||
if IsPlayer( touch_entity ) then
|
function security_off( team )
|
||||||
local player = CastToPlayer( touch_entity )
|
security_off_base( team )
|
||||||
if player:GetTeamId() == Team.kRed then
|
|
||||||
if bluesecstatus == 1 then
|
OpenDoor(team.."_secdoor")
|
||||||
bluesecstatus = 0
|
local opposite_team = get_opposite_team(team)
|
||||||
AddSchedule("secup10blue", SECURITY_LENGTH - 10, secup10blue)
|
OutputEvent("sec_"..opposite_team.."_slayer", "Disable")
|
||||||
AddSchedule("begincloseblue", SECURITY_LENGTH - 6, begincloseblue)
|
|
||||||
AddSchedule("secupblue",SECURITY_LENGTH,secupblue)
|
AddSchedule("secup10"..team, SECURITY_LENGTH - 10, function()
|
||||||
OpenDoor("blue_secdoor")
|
BroadCastMessage("#FF_"..team:upper().."_SEC_10")
|
||||||
BroadCastMessage("#FF_BLUE_SEC_40")
|
end)
|
||||||
SpeakAll( "SD_BLUEDOWN" )
|
AddSchedule("beginclose"..team, SECURITY_LENGTH - 6, function()
|
||||||
RemoveHudItemFromAll( "blue-sec-up" )
|
CloseDoor(team.."_secdoor")
|
||||||
AddHudIconToAll( "hud_secdown.vtf", "blue-sec-down", sec_iconx, sec_icony, sec_iconw, sec_iconh, 2 )
|
end)
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function secupred()
|
local security_on_base = security_on
|
||||||
redsecstatus = 1
|
function security_on( team )
|
||||||
BroadCastMessage("#FF_RED_SEC_ON")
|
security_on_base( team )
|
||||||
SpeakAll( "SD_REDUP" )
|
|
||||||
RemoveHudItemFromAll( "red-sec-down" )
|
|
||||||
AddHudIconToAll( "hud_secup_red.vtf", "red-sec-up", sec_iconx, sec_icony, sec_iconw, sec_iconh, 3 )
|
|
||||||
end
|
|
||||||
|
|
||||||
function begincloseblue()
|
CloseDoor(team.."_secdoor")
|
||||||
CloseDoor("blue_secdoor")
|
local opposite_team = get_opposite_team(team)
|
||||||
end
|
OutputEvent("sec_"..opposite_team.."_slayer", "Enable")
|
||||||
|
|
||||||
function beginclosered()
|
|
||||||
CloseDoor("red_secdoor")
|
|
||||||
end
|
|
||||||
|
|
||||||
function secupblue()
|
|
||||||
bluesecstatus = 1
|
|
||||||
BroadCastMessage("#FF_BLUE_SEC_ON")
|
|
||||||
SpeakAll( "SD_BLUEUP" )
|
|
||||||
RemoveHudItemFromAll( "blue-sec-down" )
|
|
||||||
AddHudIconToAll( "hud_secup_blue.vtf", "blue-sec-up", sec_iconx, sec_icony, sec_iconw, sec_iconh, 2 )
|
|
||||||
end
|
|
||||||
|
|
||||||
function secup10red()
|
|
||||||
BroadCastMessage("#FF_RED_SEC_10")
|
|
||||||
end
|
|
||||||
|
|
||||||
function secup10blue()
|
|
||||||
BroadCastMessage("#FF_BLUE_SEC_10")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
grp = bigpack:new({
|
grp = bigpack:new({
|
||||||
|
@ -222,29 +164,3 @@ gren1=4,gren2=4,model=
|
||||||
"models/items/backpack/backpack.mdl",
|
"models/items/backpack/backpack.mdl",
|
||||||
respawntime=1,touchsound="Backpack.Touch"})
|
respawntime=1,touchsound="Backpack.Touch"})
|
||||||
function grp:dropatspawn() return false end
|
function grp:dropatspawn() return false 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", sec_iconx, sec_icony, sec_iconw, sec_iconh, 2 )
|
|
||||||
else
|
|
||||||
AddHudIcon( player, "hud_secdown.vtf", "blue-sec-down", sec_iconx, sec_icony, sec_iconw, sec_iconh, 2 )
|
|
||||||
end
|
|
||||||
|
|
||||||
if redsecstatus == 1 then
|
|
||||||
AddHudIcon( player, "hud_secup_red.vtf", "red-sec-up", sec_iconx, sec_icony, sec_iconw, sec_iconh, 3 )
|
|
||||||
else
|
|
||||||
AddHudIcon( player, "hud_secdown.vtf", "red-sec-down", sec_iconx, sec_icony, sec_iconw, sec_iconh, 3 )
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
|
@ -5,122 +5,34 @@
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
IncludeScript("base_shutdown");
|
IncludeScript("base_shutdown");
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
SECURITY_LENGTH = 60
|
||||||
-- unique shutdown2 locations
|
|
||||||
-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- aardvark security
|
-- security
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
red_aardvarksec = trigger_ff_script:new()
|
red_aardvarksec = red_security_trigger:new()
|
||||||
blue_aardvarksec = trigger_ff_script:new()
|
blue_aardvarksec = blue_security_trigger:new()
|
||||||
bluesecstatus = 1
|
|
||||||
redsecstatus = 1
|
|
||||||
|
|
||||||
function red_aardvarksec:ontouch( touch_entity )
|
local security_off_base = security_off
|
||||||
if IsPlayer( touch_entity ) then
|
function security_off( team )
|
||||||
local player = CastToPlayer( touch_entity )
|
security_off_base( team )
|
||||||
if player:GetTeamId() == Team.kBlue then
|
|
||||||
if redsecstatus == 1 then
|
OpenDoor(team.."_aardvarkdoorhack")
|
||||||
redsecstatus = 0
|
|
||||||
AddSchedule("aardvarksecup10red",50,aardvarksecup10red)
|
AddSchedule("secup10"..team, SECURITY_LENGTH - 10, function()
|
||||||
AddSchedule("aardvarksecupred",60,aardvarksecupred)
|
BroadCastMessage("#FF_"..team:upper().."_SEC_10")
|
||||||
OpenDoor("red_aardvarkdoorhack")
|
end)
|
||||||
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
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function blue_aardvarksec:ontouch( touch_entity )
|
local security_on_base = security_on
|
||||||
if IsPlayer( touch_entity ) then
|
function security_on( team )
|
||||||
local player = CastToPlayer( touch_entity )
|
security_on_base( team )
|
||||||
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
|
|
||||||
|
|
||||||
function aardvarksecupred()
|
CloseDoor(team.."_aardvarkdoorhack")
|
||||||
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
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- respawn shields
|
-- respawn shields
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
KILL_KILL_KILL = trigger_ff_script:new({ team = Team.kUnassigned })
|
blue_slayer = not_red_trigger:new()
|
||||||
|
red_slayer = not_blue_trigger:new()
|
||||||
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 })
|
|
||||||
|
|
|
@ -13,6 +13,69 @@ IncludeScript("base_respawnturret");
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
POINTS_PER_CAPTURE = 10;
|
POINTS_PER_CAPTURE = 10;
|
||||||
FLAG_RETURN_TIME = 60;
|
FLAG_RETURN_TIME = 60;
|
||||||
|
SECURITY_LENGTH = 45;
|
||||||
|
|
||||||
|
local base_shutdown_base = {}
|
||||||
|
base_shutdown_base.startup = startup
|
||||||
|
|
||||||
|
function startup()
|
||||||
|
if type(base_shutdown_base.startup) == "function" then
|
||||||
|
-- call the saved function
|
||||||
|
base_shutdown_base.startup()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- this will take care of lights, etc when map loads or round gets restarted/prematch ends
|
||||||
|
security_on("red")
|
||||||
|
security_on("blue")
|
||||||
|
end
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
-- Security events
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- called when security gets turned off (team is a string prefix, like "red")
|
||||||
|
function security_off( team )
|
||||||
|
-- turn off security light, brush, hurt, etc
|
||||||
|
OutputEvent(team.."_security_light", "TurnOff")
|
||||||
|
OutputEvent(team.."_security_brush", "Disable")
|
||||||
|
OutputEvent(team.."_security_hurt", "Disable")
|
||||||
|
OutputEvent(team.."_laser_hurt", "Disable") -- a possible alias
|
||||||
|
|
||||||
|
-- get the clip entities
|
||||||
|
local clips = Collection()
|
||||||
|
local clipname = team.."_security_clip"
|
||||||
|
clips:GetByName({clipname})
|
||||||
|
|
||||||
|
for clip in clips.items do
|
||||||
|
clip = CastToTriggerClip(clip)
|
||||||
|
if clip and _G[clipname] and _G[clipname].clipflags then
|
||||||
|
-- clear flags, but send a dummy flag (for some reason with zero flags it blocks everything)
|
||||||
|
clip:SetClipFlags({ClipFlags.kClipTeamBlue})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- called when security gets turned on (team is a string prefix, like "red")
|
||||||
|
function security_on( team )
|
||||||
|
-- turn on security light, brush, hurt, etc
|
||||||
|
OutputEvent(team.."_security_light", "TurnOn")
|
||||||
|
OutputEvent(team.."_security_brush", "Enable")
|
||||||
|
OutputEvent(team.."_security_hurt", "Enable")
|
||||||
|
OutputEvent(team.."_laser_hurt", "Enable") -- a possible alias
|
||||||
|
|
||||||
|
-- get the clip entities
|
||||||
|
local clips = Collection()
|
||||||
|
local clipname = team.."_security_clip"
|
||||||
|
clips:GetByName({clipname})
|
||||||
|
|
||||||
|
for clip in clips.items do
|
||||||
|
clip = CastToTriggerClip(clip)
|
||||||
|
if clip and _G[clipname] and _G[clipname].clipflags then
|
||||||
|
-- reset flags to normal
|
||||||
|
clip:SetClipFlags(_G[clipname].clipflags)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- Buttons
|
-- Buttons
|
||||||
|
@ -32,7 +95,6 @@ function button_common:allowed( allowed_entity )
|
||||||
return EVENT_DISALLOWED
|
return EVENT_DISALLOWED
|
||||||
end
|
end
|
||||||
|
|
||||||
-- TODO this doesn't work
|
|
||||||
function button_common:onfailuse( use_entity )
|
function button_common:onfailuse( use_entity )
|
||||||
if IsPlayer( use_entity ) then
|
if IsPlayer( use_entity ) then
|
||||||
local player = CastToPlayer( use_entity )
|
local player = CastToPlayer( use_entity )
|
||||||
|
@ -45,8 +107,6 @@ end
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
|
||||||
-- red button
|
-- red button
|
||||||
--button_red = button_common:new({ team = Team.kBlue, sec_up = true })
|
|
||||||
|
|
||||||
button_red = button_common:new({
|
button_red = button_common:new({
|
||||||
team = Team.kBlue,
|
team = Team.kBlue,
|
||||||
sec_up = true,
|
sec_up = true,
|
||||||
|
@ -63,7 +123,11 @@ button_red = button_common:new({
|
||||||
-- Button responses
|
-- Button responses
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
function button_red:onin()
|
function button_red:onin()
|
||||||
|
if SECURITY_LENGTH == 60 or SECURITY_LENGTH == 30 then
|
||||||
|
BroadCastMessage( "#FF_RED_SEC_"..SECURITY_LENGTH )
|
||||||
|
else
|
||||||
BroadCastMessage( "#FF_RED_SECURITY_DEACTIVATED" )
|
BroadCastMessage( "#FF_RED_SECURITY_DEACTIVATED" )
|
||||||
|
end
|
||||||
SpeakAll( "SD_REDDOWN" )
|
SpeakAll( "SD_REDDOWN" )
|
||||||
|
|
||||||
self.sec_up = false
|
self.sec_up = false
|
||||||
|
@ -72,6 +136,7 @@ function button_red:onin()
|
||||||
AddHudIconToAll( self.sec_down_icon, "red-sec-down", self.iconx, self.icony, self.iconw, self.iconh, self.iconalign )
|
AddHudIconToAll( self.sec_down_icon, "red-sec-down", self.iconx, self.icony, self.iconw, self.iconh, self.iconalign )
|
||||||
LogLuaEvent(0, 0, "security_down", "team", "red")
|
LogLuaEvent(0, 0, "security_down", "team", "red")
|
||||||
|
|
||||||
|
security_off("red")
|
||||||
end
|
end
|
||||||
|
|
||||||
function button_red:onout()
|
function button_red:onout()
|
||||||
|
@ -84,6 +149,7 @@ function button_red:onout()
|
||||||
AddHudIconToAll( self.sec_up_icon, "red-sec-up", self.iconx, self.icony, self.iconw, self.iconh, self.iconalign )
|
AddHudIconToAll( self.sec_up_icon, "red-sec-up", self.iconx, self.icony, self.iconw, self.iconh, self.iconalign )
|
||||||
LogLuaEvent(0, 0, "security_up", "team", "red")
|
LogLuaEvent(0, 0, "security_up", "team", "red")
|
||||||
|
|
||||||
|
security_on("red")
|
||||||
end
|
end
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
@ -91,8 +157,6 @@ end
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
|
||||||
-- blue button
|
-- blue button
|
||||||
--button_blue = button_common:new({ team = Team.kRed, sec_up = true })
|
|
||||||
|
|
||||||
button_blue = button_common:new({
|
button_blue = button_common:new({
|
||||||
team = Team.kRed,
|
team = Team.kRed,
|
||||||
sec_up = true,
|
sec_up = true,
|
||||||
|
@ -109,7 +173,11 @@ button_blue = button_common:new({
|
||||||
-- Button responses
|
-- Button responses
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
function button_blue:onin()
|
function button_blue:onin()
|
||||||
|
if SECURITY_LENGTH == 60 or SECURITY_LENGTH == 30 or SECURITY_LENGTH == 40 then
|
||||||
|
BroadCastMessage( "#FF_BLUE_SEC_"..SECURITY_LENGTH )
|
||||||
|
else
|
||||||
BroadCastMessage( "#FF_BLUE_SECURITY_DEACTIVATED" )
|
BroadCastMessage( "#FF_BLUE_SECURITY_DEACTIVATED" )
|
||||||
|
end
|
||||||
SpeakAll( "SD_BLUEDOWN" )
|
SpeakAll( "SD_BLUEDOWN" )
|
||||||
|
|
||||||
self.sec_up = false
|
self.sec_up = false
|
||||||
|
@ -118,6 +186,7 @@ function button_blue:onin()
|
||||||
AddHudIconToAll( self.sec_down_icon, "blue-sec-down", self.iconx, self.icony, self.iconw, self.iconh, self.iconalign )
|
AddHudIconToAll( self.sec_down_icon, "blue-sec-down", self.iconx, self.icony, self.iconw, self.iconh, self.iconalign )
|
||||||
LogLuaEvent(0, 0, "security_down", "team", "blue")
|
LogLuaEvent(0, 0, "security_down", "team", "blue")
|
||||||
|
|
||||||
|
security_off("blue")
|
||||||
end
|
end
|
||||||
|
|
||||||
function button_blue:onout()
|
function button_blue:onout()
|
||||||
|
@ -129,37 +198,56 @@ function button_blue:onout()
|
||||||
RemoveHudItemFromAll( "blue-sec-down")
|
RemoveHudItemFromAll( "blue-sec-down")
|
||||||
AddHudIconToAll( self.sec_up_icon, "blue-sec-up", self.iconx, self.icony, self.iconw, self.iconh, self.iconalign )
|
AddHudIconToAll( self.sec_up_icon, "blue-sec-up", self.iconx, self.icony, self.iconw, self.iconh, self.iconalign )
|
||||||
LogLuaEvent(0, 0, "security_up", "team", "blue")
|
LogLuaEvent(0, 0, "security_up", "team", "blue")
|
||||||
|
|
||||||
|
security_on("blue")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
-- Trigger-based security toggling
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
base_security_trigger = not_team_only_trigger:new({ button = "" })
|
||||||
|
|
||||||
|
function base_security_trigger:ontrigger( player )
|
||||||
|
-- only take sec down if its up currently
|
||||||
|
local button = _G[self.button]
|
||||||
|
if button and button.sec_up then
|
||||||
|
self:onsecuritydown( player )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function base_security_trigger:onsecuritydown( player )
|
||||||
|
-- call the button's onin directly
|
||||||
|
local button = _G[self.button]
|
||||||
|
button.onin( button )
|
||||||
|
AddSchedule( self.button.."_security", SECURITY_LENGTH, function() self:onsecurityup() end )
|
||||||
|
end
|
||||||
|
function base_security_trigger:onsecurityup()
|
||||||
|
-- call the button's onout directly
|
||||||
|
local button = _G[self.button]
|
||||||
|
button.onout( button )
|
||||||
|
end
|
||||||
|
|
||||||
|
red_security_trigger = base_security_trigger:new( { team = Team.kRed, button = "button_red" } )
|
||||||
|
blue_security_trigger = base_security_trigger:new( { team = Team.kBlue, button = "button_blue" } )
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- Hurts
|
-- Hurts
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
hurt = trigger_ff_script:new({ team = Team.kUnassigned })
|
|
||||||
function hurt:allowed( allowed_entity )
|
|
||||||
if IsPlayer( allowed_entity ) then
|
|
||||||
local player = CastToPlayer( allowed_entity )
|
|
||||||
if player:GetTeamId() == self.team then
|
|
||||||
return EVENT_ALLOWED
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return EVENT_DISALLOWED
|
|
||||||
end
|
|
||||||
|
|
||||||
-- red lasers hurt blue and vice-versa
|
-- red lasers hurt blue and vice-versa
|
||||||
|
red_security_hurt = not_red_trigger:new({})
|
||||||
|
blue_security_hurt = not_blue_trigger:new({})
|
||||||
|
-- the trigger_hurts can also be named like this
|
||||||
|
red_laser_hurt = red_security_hurt
|
||||||
|
blue_laser_hurt = blue_security_hurt
|
||||||
|
|
||||||
red_laser_hurt = hurt:new({ team = Team.kBlue })
|
-----------------------------------------------------------------------------
|
||||||
blue_laser_hurt = hurt:new({ team = Team.kRed })
|
-- Clips
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
-- function precache()
|
|
||||||
-- precache sounds
|
|
||||||
-- PrecacheSound("vox.blueup")
|
|
||||||
-- PrecacheSound("vox.bluedown")
|
|
||||||
-- PrecacheSound("vox.redup")
|
|
||||||
-- PrecacheSound("vox.reddown")
|
|
||||||
-- end
|
|
||||||
|
|
||||||
|
|
||||||
|
red_security_clip = clip_red:new()
|
||||||
|
blue_security_clip = clip_blue:new()
|
||||||
|
|
||||||
-------------------------
|
-------------------------
|
||||||
-- flaginfo
|
-- flaginfo
|
||||||
|
|
|
@ -97,6 +97,29 @@ end
|
||||||
no_annoyances = noannoyances
|
no_annoyances = noannoyances
|
||||||
spawn_protection = noannoyances
|
spawn_protection = noannoyances
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
-- Useful trigger definitions
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- team only triggers
|
||||||
|
team_only_trigger = trigger_ff_script:new({ team = Team.kUnassigned, allow = true })
|
||||||
|
function team_only_trigger:allowed( allowed_entity ) if allowed_entity and IsPlayer(allowed_entity) and CastToPlayer(allowed_entity):GetTeamId() == self.team then return self.allow else return not self.allow end end
|
||||||
|
|
||||||
|
-- triggers that allow any team except the given team
|
||||||
|
not_team_only_trigger = team_only_trigger:new({allow = false})
|
||||||
|
|
||||||
|
-- allow only if on the team
|
||||||
|
red_trigger = team_only_trigger:new({ team = Team.kRed })
|
||||||
|
blue_trigger = team_only_trigger:new({ team = Team.kBlue })
|
||||||
|
yellow_trigger = team_only_trigger:new({ team = Team.kYellow })
|
||||||
|
green_trigger = team_only_trigger:new({ team = Team.kGreen })
|
||||||
|
|
||||||
|
-- allow only if not on the team
|
||||||
|
not_red_trigger = not_team_only_trigger:new({ team = Team.kRed })
|
||||||
|
not_blue_trigger = not_team_only_trigger:new({ team = Team.kBlue })
|
||||||
|
not_yellow_trigger = not_team_only_trigger:new({ team = Team.kYellow })
|
||||||
|
not_green_trigger = not_team_only_trigger:new({ team = Team.kGreen })
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- Trigger_ff_clips
|
-- Trigger_ff_clips
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in a new issue