mirror of
https://github.com/fortressforever/fortressforever-scripts.git
synced 2024-11-29 15:51:42 +00:00
Convert ff_aardvark.lua to take advantage of the new base_shutdown.lua
This commit is contained in:
parent
1c9e2a0efd
commit
1cb481bc06
1 changed files with 27 additions and 142 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,36 @@ 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
|
local security_off_base = security_off or function() end
|
||||||
sec_icony = 30
|
function security_off( team )
|
||||||
sec_iconw = 16
|
security_off_base( team )
|
||||||
sec_iconh = 16
|
|
||||||
|
|
||||||
function red_aardvarksec:ontouch( touch_entity )
|
OpenDoor(team.."_aardvarkdoorhack")
|
||||||
if IsPlayer( touch_entity ) then
|
local opposite_team = team == "red" and "blue" or "red"
|
||||||
local player = CastToPlayer( touch_entity )
|
OutputEvent("sec_"..opposite_team.."_slayer", "Disable")
|
||||||
if player:GetTeamId() == Team.kBlue then
|
|
||||||
if redsecstatus == 1 then
|
AddSchedule("aardvarksecup10"..team, SECURITY_LENGTH - 10, function()
|
||||||
redsecstatus = 0
|
BroadCastMessage("#FF_"..team:upper().."_SEC_10")
|
||||||
AddSchedule("aardvarksecup10red",20,aardvarksecup10red)
|
end)
|
||||||
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_on_base = security_on or function() end
|
||||||
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",20,aardvarksecup10blue)
|
|
||||||
AddSchedule("aardvarksecupblue",30,aardvarksecupblue)
|
|
||||||
OpenDoor("blue_aardvarkdoorhack")
|
|
||||||
BroadCastMessage("#FF_BLUE_SEC_30")
|
|
||||||
--BroadCastSound( "otherteam.flagstolen")
|
|
||||||
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
|
|
||||||
|
|
||||||
function aardvarksecupred()
|
CloseDoor(team.."_aardvarkdoorhack")
|
||||||
redsecstatus = 1
|
local opposite_team = team == "red" and "blue" or "red"
|
||||||
CloseDoor("red_aardvarkdoorhack")
|
OutputEvent("sec_"..opposite_team.."_slayer", "Enable")
|
||||||
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()
|
|
||||||
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", 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
|
|
||||||
|
|
Loading…
Reference in a new issue