-- ff_destroy.lua -- caesium 01/2009 ----------------------------------------------------------------------------- -- includes ----------------------------------------------------------------------------- IncludeScript("base"); IncludeScript("base_ctf"); IncludeScript("base_location"); ----------------------------------------------------------------------------- -- global overrides ----------------------------------------------------------------------------- POINTS_PER_CAPTURE = 10; FLAG_RETURN_TIME = 60; ----------------------------------------------------------------------------- -- locations ----------------------------------------------------------------------------- location_redfd = location_info:new({ text = "Foyer", team = Team.kRed }) location_redramp = location_info:new({ text = "Main Ramps", team = Team.kRed }) location_redspawn = location_info:new({ text = "Respawn", team = Team.kRed }) location_redtopramp = location_info:new({ text = "Top Main Ramps", team = Team.kRed }) location_redbalc = location_info:new({ text = "Balcony", team = Team.kRed }) location_redsec = location_info:new({ text = "Security Control", team = Team.kRed }) location_redfr = location_info:new({ text = "Flag Room", team = Team.kRed }) location_redresup = location_info:new({ text = "Resupply", team = Team.kRed }) location_bluefd = location_info:new({ text = "Foyer", team = Team.kBlue }) location_blueramp = location_info:new({ text = "Main Ramps", team = Team.kBlue }) location_bluespawn = location_info:new({ text = "Respawn", team = Team.kBlue }) location_bluetopramp = location_info:new({ text = "Top Main Ramps", team = Team.kBlue }) location_bluebalc = location_info:new({ text = "Balcony", team = Team.kBlue }) location_bluesec = location_info:new({ text = "Security Control", team = Team.kBlue }) location_bluefr = location_info:new({ text = "Flag Room", team = Team.kBlue }) location_blueresup = location_info:new({ text = "Resupply", team = Team.kBlue }) 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 ----------------------------------------------------------------------------- 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 packs ----------------------------------------------------------------------------- aardvarkpack_fr = genericbackpack:new({ health = 50, armor = 50, grenades = 400, nails = 400, shells = 400, rockets = 400, cells = 130, gren1 = 0, gren2 = 0, respawntime = 20, model = "models/items/backpack/backpack.mdl", materializesound = "Item.Materialize", touchsound = "Backpack.Touch", botgoaltype = Bot.kBackPack_Ammo }) aardvarkpack_ramp = genericbackpack:new({ health = 50, armor = 50, grenades = 400, nails = 400, shells = 400, rockets = 400, cells = 0, gren1 = 0, gren2 = 0, respawntime = 15, model = "models/items/backpack/backpack.mdl", materializesound = "Item.Materialize", touchsound = "Backpack.Touch", botgoaltype = Bot.kBackPack_Ammo }) aardvarkpack_sec = genericbackpack:new({ health = 50, armor = 50, grenades = 400, nails = 400, shells = 400, rockets = 400, cells = 0, gren1 = 1, gren2 = 1, respawntime = 20, model = "models/items/backpack/backpack.mdl", materializesound = "Item.Materialize", touchsound = "Backpack.Touch", botgoaltype = Bot.kBackPack_Ammo }) function aardvarkpack_fr:dropatspawn() return false end function aardvarkpack_ramp:dropatspawn() return false end function aardvarkpack_sec:dropatspawn() return false end ----------------------------------------------------------------------------- -- backpack entity setup (modified for aardvarkpacks) ----------------------------------------------------------------------------- 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_fr:new({touchflags = tf}), aardvarkpack_ramp:new({touchflags = tf}), aardvarkpack_sec:new({touchflags = tf}) end blue_healthkit, blue_armorkit, blue_ammobackpack, blue_bigpack, blue_grenadebackpack, blue_aardvarkpack_fr, blue_aardvarkpack_ramp, blue_aardvarkpack_sec = build_backpacks({AllowFlags.kOnlyPlayers,AllowFlags.kBlue}) red_healthkit, red_armorkit, red_ammobackpack, red_bigpack, red_grenadebackpack, red_aardvarkpack_fr, red_aardvarkpack_ramp, red_aardvarkpack_sec = build_backpacks({AllowFlags.kOnlyPlayers,AllowFlags.kRed}) yellow_healthkit, yellow_armorkit, yellow_ammobackpack, yellow_bigpack, yellow_grenadebackpack, yellow_aardvarkpack_fr, yellow_aardvarkpack_ramp, yellow_aardvarkpack_sec = build_backpacks({AllowFlags.kOnlyPlayers,AllowFlags.kYellow}) green_healthkit, green_armorkit, green_ammobackpack, green_bigpack, green_grenadebackpack, green_aardvarkpack_fr, green_aardvarkpack_ramp, green_aardvarkpack_sec = build_backpacks({AllowFlags.kOnlyPlayers,AllowFlags.kGreen}) ----------------------------------------------------------------------------- -- bouncepads for lifts ----------------------------------------------------------------------------- base_jump = trigger_ff_script:new({ pushz = 0 }) function base_jump:ontouch( trigger_entity ) if IsPlayer( trigger_entity ) then local player = CastToPlayer( trigger_entity ) local playerVel = player:GetVelocity() playerVel.z = self.pushz player:SetVelocity( playerVel ) end end lift_red = base_jump:new({ pushz = 600 }) lift_blue = base_jump:new({ pushz = 600 })