mirror of
https://github.com/fortressforever/fortressforever-scripts.git
synced 2024-11-22 20:51:28 +00:00
Convert ff_schtop.lua to take advantage of the new base_shutdown.lua
This commit is contained in:
parent
4dc3ed5f9f
commit
d5adad6174
2 changed files with 24 additions and 114 deletions
|
@ -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,32 @@ 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
|
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_sec:ontouch( touch_entity )
|
OpenDoor(team.."_secdoor")
|
||||||
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("secup10red", SECURITY_LENGTH - 10, secup10red)
|
end)
|
||||||
AddSchedule("beginclosered", SECURITY_LENGTH - 6, beginclosered)
|
AddSchedule("beginclose"..team, SECURITY_LENGTH - 6, function()
|
||||||
AddSchedule("secupred",SECURITY_LENGTH,secupred)
|
CloseDoor(team.."_secdoor")
|
||||||
OpenDoor("red_secdoor")
|
end)
|
||||||
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_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("secup10blue", SECURITY_LENGTH - 10, secup10blue)
|
|
||||||
AddSchedule("begincloseblue", SECURITY_LENGTH - 6, begincloseblue)
|
|
||||||
AddSchedule("secupblue",SECURITY_LENGTH,secupblue)
|
|
||||||
OpenDoor("blue_secdoor")
|
|
||||||
BroadCastMessage("#FF_BLUE_SEC_40")
|
|
||||||
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 secupred()
|
CloseDoor(team.."_secdoor")
|
||||||
redsecstatus = 1
|
local opposite_team = team == "red" and "blue" or "red"
|
||||||
BroadCastMessage("#FF_RED_SEC_ON")
|
OutputEvent("sec_"..opposite_team.."_slayer", "Enable")
|
||||||
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("blue_secdoor")
|
|
||||||
end
|
|
||||||
|
|
||||||
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 +158,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
|
|
||||||
|
|
|
@ -165,7 +165,7 @@ 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 then
|
if SECURITY_LENGTH == 60 or SECURITY_LENGTH == 30 or SECURITY_LENGTH == 40 then
|
||||||
BroadCastMessage( "#FF_BLUE_SEC_"..SECURITY_LENGTH )
|
BroadCastMessage( "#FF_BLUE_SEC_"..SECURITY_LENGTH )
|
||||||
else
|
else
|
||||||
BroadCastMessage( "#FF_BLUE_SECURITY_DEACTIVATED" )
|
BroadCastMessage( "#FF_BLUE_SECURITY_DEACTIVATED" )
|
||||||
|
|
Loading…
Reference in a new issue