mirror of
https://github.com/fortressforever/fortressforever-scripts.git
synced 2024-11-22 12:41:17 +00:00
251 lines
9.9 KiB
Lua
251 lines
9.9 KiB
Lua
-- ff_openfire.lua
|
|
-- based on aardvark 15/09/07
|
|
|
|
-----------------------------------------------------------------------------
|
|
-- includes
|
|
-----------------------------------------------------------------------------
|
|
IncludeScript("base");
|
|
IncludeScript("base_ctf");
|
|
IncludeScript("base_location");
|
|
|
|
-----------------------------------------------------------------------------
|
|
-- global overrides
|
|
-----------------------------------------------------------------------------
|
|
POINTS_PER_CAPTURE = 10;
|
|
FLAG_RETURN_TIME = 60;
|
|
|
|
-----------------------------------------------------------------------------
|
|
-- unique openfire locations
|
|
-----------------------------------------------------------------------------
|
|
location_redspawn = location_info:new({ text = "Respawn", team = Team.kRed })
|
|
location_redsec = location_info:new({ text = "Fire Control", team = Team.kRed })
|
|
location_redfr = location_info:new({ text = "Flag Room", team = Team.kRed })
|
|
location_redwater = location_info:new({ text = "Perilous Passage", team = Team.kRed })
|
|
location_redfrontdoor = location_info:new({ text = "Front Door Corridor", team = Team.kRed })
|
|
location_redbalcony = location_info:new({ text = "Balcony", team = Team.kRed })
|
|
|
|
location_bluespawn = location_info:new({ text = "Respawn", team = Team.kBlue })
|
|
location_bluesec = location_info:new({ text = "Fire Control", team = Team.kBlue })
|
|
location_bluefr = location_info:new({ text = "Flag Room", team = Team.kBlue })
|
|
location_bluewater = location_info:new({ text = "Perilous Passage", team = Team.kBlue })
|
|
location_bluefrontdoor = location_info:new({ text = "Front Door Corridor", team = Team.kBlue })
|
|
location_bluebalcony = location_info:new({ text = "Balcony", team = Team.kBlue })
|
|
|
|
location_midmap = location_info:new({ text = "Outside", team = NO_TEAM })
|
|
|
|
-----------------------------------------------------------------------------
|
|
-- bagless resupply
|
|
-----------------------------------------------------------------------------
|
|
aardvarkresup = trigger_ff_script:new({ team = Team.kUnassigned })
|
|
|
|
function aardvarkresup:ontouch( touch_entity )
|
|
if IsPlayer( touch_entity ) then
|
|
local player = CastToPlayer( touch_entity )
|
|
if player:GetTeamId() == self.team then
|
|
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
|
|
end
|
|
end
|
|
|
|
blue_aardvarkresup = aardvarkresup:new({ team = Team.kBlue })
|
|
red_aardvarkresup = aardvarkresup:new({ team = Team.kRed })
|
|
|
|
-----------------------------------------------------------------------------
|
|
-- aardvark security
|
|
-----------------------------------------------------------------------------
|
|
red_aardvarksec = trigger_ff_script:new()
|
|
blue_aardvarksec = trigger_ff_script:new()
|
|
bluesecstatus = 1
|
|
redsecstatus = 1
|
|
|
|
sec_iconx = 60
|
|
sec_icony = 30
|
|
sec_iconw = 16
|
|
sec_iconh = 16
|
|
|
|
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
|
|
|
|
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",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()
|
|
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", 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
|
|
|
|
-----------------------------------------------------------------------------
|
|
-- aardvark lasers and respawn shields
|
|
-----------------------------------------------------------------------------
|
|
KILL_KILL_KILL = trigger_ff_script:new({ team = Team.kUnassigned })
|
|
lasers_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
|
|
|
|
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
|
|
-----------------------------------------------------------------------------
|
|
aardvarkpack = genericbackpack:new({
|
|
health = 50,
|
|
armor = 50,
|
|
grenades = 400,
|
|
nails = 400,
|
|
shells = 400,
|
|
rockets = 400,
|
|
cells = 130,
|
|
respawntime = 8,
|
|
model = "models/items/backpack/backpack.mdl",
|
|
materializesound = "Item.Materialize",
|
|
touchsound = "Backpack.Touch",
|
|
botgoaltype = Bot.kBackPack_Ammo
|
|
})
|
|
|
|
function aardvarkpack:dropatspawn() return false end
|
|
|
|
-----------------------------------------------------------------------------
|
|
-- backpack entity setup (modified for aardvarkpack)
|
|
-----------------------------------------------------------------------------
|
|
function build_backpacks(tf)
|
|
return healthkit:new({touchflags = tf}),
|
|
armorkit:new({touchflags = tf}),
|
|
ammobackpack:new({touchflags = tf}),
|
|
bigpack:new({touchflags = tf}),
|
|
grenadebackpack:new({touchflags = tf}),
|
|
aardvarkpack:new({touchflags = tf})
|
|
end
|
|
|
|
blue_healthkit, blue_armorkit, blue_ammobackpack, blue_bigpack, blue_grenadebackpack, blue_aardvarkpack = build_backpacks({AllowFlags.kOnlyPlayers,AllowFlags.kBlue})
|
|
red_healthkit, red_armorkit, red_ammobackpack, red_bigpack ,red_grenadebackpack, red_aardvarkpack = build_backpacks({AllowFlags.kOnlyPlayers,AllowFlags.kRed})
|
|
yellow_healthkit, yellow_armorkit, yellow_ammobackpack, yellow_bigpack, yellow_grenadebackpack, yellow_aardvarkpack = build_backpacks({AllowFlags.kOnlyPlayers,AllowFlags.kYellow})
|
|
green_healthkit, green_armorkit, green_ammobackpack, green_bigpack, green_grenadebackpack, green_aardvarkpack = build_backpacks({AllowFlags.kOnlyPlayers,AllowFlags.kGreen})
|
|
|
|
-----------------------------------------------------------------------------
|
|
-- SPAWNS
|
|
-----------------------------------------------------------------------------
|
|
red_o_only = function(self,player) return ((player:GetTeamId() == Team.kRed) and ((player:GetClass() == Player.kScout) or (player:GetClass() == Player.kMedic) or (player:GetClass() == Player.kSpy) or (player:GetClass() == Player.kSniper))) end
|
|
red_d_only = function(self,player) return ((player:GetTeamId() == Team.kRed) and (((player:GetClass() == Player.kScout) == false) and ((player:GetClass() == Player.kMedic) == false) and ((player:GetClass() == Player.kSpy) == false) and ((player:GetClass() == Player.kSniper) == false))) end
|
|
|
|
redspawn_balc = { validspawn = red_o_only }
|
|
redspawn_fr = { validspawn = red_d_only }
|
|
|
|
blue_o_only = function(self,player) return ((player:GetTeamId() == Team.kBlue) and ((player:GetClass() == Player.kScout) or (player:GetClass() == Player.kMedic) or (player:GetClass() == Player.kSpy) or (player:GetClass() == Player.kSniper))) end
|
|
blue_d_only = function(self,player) return ((player:GetTeamId() == Team.kBlue) and (((player:GetClass() == Player.kScout) == false) and ((player:GetClass() == Player.kMedic) == false) and ((player:GetClass() == Player.kSpy) == false) and ((player:GetClass() == Player.kSniper) == false))) end
|
|
|
|
bluespawn_balc = { validspawn = blue_o_only }
|
|
bluespawn_fr = { validspawn = blue_d_only }
|