Added back DEFENDERS_OBJECTIVE_ONFLAG and

DEFENDERS_OBJECTIVE_ONCARRIER plus code

Changed DEFENDERS_OBJECTIVE_ONFLAG and
DEFENDERS_OBJECTIVE_ONCARRIER to false

Modified/Added if statements to keep old code and still see only
the cap and to include the UpdateTeamObjectiveIcon() for D so
that it only gets called when necessary
This commit is contained in:
alaswell 2014-12-23 01:40:22 -07:00
parent 114e18a93f
commit 120176fca3

View file

@ -1,7 +1,7 @@
-- base_id.lua
-- Invade / Defend gametype
-- Edited Last: Dr.Satan - 22/12/2014
-- Edited Last: Dr.Satan 23/12/2014
-----------------------------------------------------------------------------
-- includes
@ -21,6 +21,9 @@ if onroundreset == nil then onroundreset = function() end end
if FLAG_RETURN_TIME == nil then FLAG_RETURN_TIME = 60; end
if ATTACKERS_OBJECTIVE_ENTITY == nil then ATTACKERS_OBJECTIVE_ENTITY = nil end
if DEFENDERS_OBJECTIVE_ENTITY == nil then DEFENDERS_OBJECTIVE_ENTITY = nil end
-- Satan: DEFENDERS_OBJECTIVE_ONCARRIER and ONFLAG set to false to keep objective on cap
if DEFENDERS_OBJECTIVE_ONFLAG == nil then DEFENDERS_OBJECTIVE_ONFLAG = false end
if DEFENDERS_OBJECTIVE_ONCARRIER == nil then DEFENDERS_OBJECTIVE_ONCARRIER = false end
if TEAM_SWITCH_DELAY == nil then TEAM_SWITCH_DELAY = 2 end
if RESPAWN_AFTER_CAP == nil then RESPAWN_AFTER_CAP = false end
if RESPAWN_DELAY == nil then RESPAWN_DELAY = 2 end
@ -154,6 +157,11 @@ function baseflag:ownercloak( owner_entity )
-- objective icon
ATTACKERS_OBJECTIVE_ENTITY = GetEntityByName( "cp"..phase.."_flag" )
-- Satan: Check to see if we want to point to flag and do stuff
if DEFENDERS_OBJECTIVE_ONFLAG then
DEFENDERS_OBJECTIVE_ENTITY = GetEntityByName( "cp"..phase.."_flag" )
UpdateTeamObjectiveIcon( GetTeam(defenders), DEFENDERS_OBJECTIVE_ENTITY )
end
UpdateTeamObjectiveIcon( GetTeam(attackers), ATTACKERS_OBJECTIVE_ENTITY )
setup_return_timer()
@ -179,6 +187,11 @@ function baseflag:dropitemcmd( owner_entity )
-- objective icon
ATTACKERS_OBJECTIVE_ENTITY = GetEntityByName( "cp"..phase.."_flag" )
-- Satan: Check to see if we want to point to flag and do stuff
if DEFENDERS_OBJECTIVE_ONFLAG then
DEFENDERS_OBJECTIVE_ENTITY = GetEntityByName( "cp"..phase.."_flag" )
UpdateTeamObjectiveIcon( GetTeam(defenders), DEFENDERS_OBJECTIVE_ENTITY )
end
UpdateTeamObjectiveIcon( GetTeam(attackers), ATTACKERS_OBJECTIVE_ENTITY )
setup_return_timer()
@ -198,6 +211,11 @@ function baseflag:onownerforcerespawn( owner_entity )
-- objective icon
ATTACKERS_OBJECTIVE_ENTITY = GetEntityByName( "cp"..phase.."_flag" )
-- Satan: Check to see if we want to point to flag and do stuff
if DEFENDERS_OBJECTIVE_ONFLAG then
DEFENDERS_OBJECTIVE_ENTITY = GetEntityByName( "cp"..phase.."_flag" )
UpdateTeamObjectiveIcon( GetTeam(defenders), DEFENDERS_OBJECTIVE_ENTITY )
end
UpdateTeamObjectiveIcon( GetTeam(attackers), ATTACKERS_OBJECTIVE_ENTITY )
update_hud()
@ -218,6 +236,11 @@ function baseflag:onreturn( )
-- objective icon
ATTACKERS_OBJECTIVE_ENTITY = flag
-- Satan: Check to see if we want to point to flag and do stuff
if DEFENDERS_OBJECTIVE_ONFLAG then
DEFENDERS_OBJECTIVE_ENTITY = flag
UpdateTeamObjectiveIcon( GetTeam(defenders), DEFENDERS_OBJECTIVE_ENTITY )
end
UpdateTeamObjectiveIcon( GetTeam(attackers), ATTACKERS_OBJECTIVE_ENTITY )
destroy_return_timer()
@ -281,7 +304,7 @@ function startup()
flags_set_team( attackers )
ATTACKERS_OBJECTIVE_ENTITY = GetEntityByName( "cp"..phase.."_flag" )
-- Satan: Defenders should always point to the cap and NOT the flag
-- Satan: Defenders should point to the cap and NOT the flag to avoid tracing the flag holder
DEFENDERS_OBJECTIVE_ENTITY = GetEntityByName( "cp"..phase.."_cap" )
UpdateTeamObjectiveIcon( GetTeam(attackers), ATTACKERS_OBJECTIVE_ENTITY )
UpdateTeamObjectiveIcon( GetTeam(defenders), DEFENDERS_OBJECTIVE_ENTITY )
@ -426,6 +449,16 @@ function base_id_flag:touch( touch_entity )
-- change objective icons
ATTACKERS_OBJECTIVE_ENTITY = player
if DEFENDERS_OBJECTIVE_ONFLAG then
-- Satan: we want to target the flag ONLY when it's not being carried, so show D the cap instead
DEFENDERS_OBJECTIVE_ENTITY = GetEntityByName( "cp"..self.phase.."_cap" )
UpdateTeamObjectiveIcon( GetTeam(defenders), DEFENDERS_OBJECTIVE_ENTITY )
end
if DEFENDERS_OBJECTIVE_ONCARRIER then
-- Satan: we want to target the flag, even if it's being carried (not suggested as D can wallhack)
DEFENDERS_OBJECTIVE_ENTITY = player
UpdateTeamObjectiveIcon( GetTeam(defenders), DEFENDERS_OBJECTIVE_ENTITY )
end
UpdateTeamObjectiveIcon( GetTeam(attackers), ATTACKERS_OBJECTIVE_ENTITY )
UpdateObjectiveIcon( player, GetEntityByName( "cp"..self.phase.."_cap" ) )
@ -454,6 +487,11 @@ function base_id_flag:onownerdie( owner_entity )
-- change objective icon
ATTACKERS_OBJECTIVE_ENTITY = flag
-- Satan: Check to see if we want to point to flag and do stuff
if DEFENDERS_OBJECTIVE_ONFLAG then
DEFENDERS_OBJECTIVE_ENTITY = flag
UpdateTeamObjectiveIcon( GetTeam(defenders), DEFENDERS_OBJECTIVE_ENTITY )
end
UpdateTeamObjectiveIcon( GetTeam(attackers), ATTACKERS_OBJECTIVE_ENTITY )
UpdateObjectiveIcon( player, nil )
@ -530,7 +568,8 @@ function base_id_cap:oncapture(player, item)
-- clear objective icon
ATTACKERS_OBJECTIVE_ENTITY = nil
DEFENDERS_OBJECTIVE_ENTITY = nil
if DEFENDERS_OBJECTIVE_ONFLAG or DEFENDERS_OBJECTIVE_ONCARRIER then DEFENDERS_OBJECTIVE_ENTITY = nil
else DEFENDERS_OBJECTIVE_ENTITY = GetEntityByName( "cp"..phase.."_cap" ) end
UpdateTeamObjectiveIcon( GetTeam(attackers), ATTACKERS_OBJECTIVE_ENTITY )
UpdateTeamObjectiveIcon( GetTeam(defenders), DEFENDERS_OBJECTIVE_ENTITY )
@ -575,7 +614,6 @@ function round_end()
-- change objective icon
ATTACKERS_OBJECTIVE_ENTITY = flag
-- Satan: Defenders should always point to the cap and NOT the flag
DEFENDERS_OBJECTIVE_ENTITY = GetEntityByName( "cp"..phase.."_cap" )
UpdateTeamObjectiveIcon( GetTeam(attackers), ATTACKERS_OBJECTIVE_ENTITY )
UpdateTeamObjectiveIcon( GetTeam(defenders), DEFENDERS_OBJECTIVE_ENTITY )
@ -619,6 +657,10 @@ function flag_start(flagname)
-- change objective icon
ATTACKERS_OBJECTIVE_ENTITY = flag
if DEFENDERS_OBJECTIVE_ONFLAG then
DEFENDERS_OBJECTIVE_ENTITY = flag
UpdateTeamObjectiveIcon( GetTeam(defenders), DEFENDERS_OBJECTIVE_ENTITY )
end
UpdateTeamObjectiveIcon( GetTeam(attackers), ATTACKERS_OBJECTIVE_ENTITY )
update_hud()
end