void ctf_CaptureRecord(entity flag, entity player)
{
- entity tmp_entity;
float cap_record = ctf_captimerecord;
float cap_time = (time - flag.ctf_pickuptime);
string refername = db_get(ServerProgsDB, strcat(GetMapname(), "/captimerecord/netname"));
// notify about shit
- FOR_EACH_REALCLIENT(tmp_entity)
- {
- if(tmp_entity.CAPTURE_VERBOSE)
- {
- if(!ctf_captimerecord) { Send_Notification(NOTIF_ONE_ONLY, tmp_entity, MSG_INFO, APP_TEAM_ENT_4(flag, INFO_CTF_CAPTURE_TIME_), player.netname, (cap_time * 100)); }
- else if(cap_time < cap_record) { Send_Notification(NOTIF_ONE_ONLY, tmp_entity, MSG_INFO, APP_TEAM_ENT_4(flag, INFO_CTF_CAPTURE_BROKEN_), player.netname, refername, (cap_time * 100), (cap_record * 100)); }
- else { Send_Notification(NOTIF_ONE_ONLY, tmp_entity, MSG_INFO, APP_TEAM_ENT_4(flag, INFO_CTF_CAPTURE_UNBROKEN_), player.netname, refername, (cap_time * 100), (cap_record * 100)); }
- }
- else { Send_Notification(NOTIF_ONE_ONLY, tmp_entity, MSG_INFO, APP_TEAM_ENT_4(flag, INFO_CTF_CAPTURE_), player.netname); }
- }
-
- // the previous notification broadcast is only sent to real clients, this will notify server log too
- if(server_is_dedicated)
- {
- if(autocvar_notification_ctf_capture_verbose)
- {
- if(!ctf_captimerecord) { Local_Notification(MSG_INFO, APP_TEAM_ENT_4(flag, INFO_CTF_CAPTURE_TIME_), player.netname, (cap_time * 100)); }
- else if(cap_time < cap_record) { Local_Notification(MSG_INFO, APP_TEAM_ENT_4(flag, INFO_CTF_CAPTURE_BROKEN_), player.netname, refername, (cap_time * 100), (cap_record * 100)); }
- else { Local_Notification(MSG_INFO, APP_TEAM_ENT_4(flag, INFO_CTF_CAPTURE_UNBROKEN_), player.netname, refername, (cap_time * 100), (cap_record * 100)); }
- }
- else { Local_Notification(MSG_INFO, APP_TEAM_ENT_4(flag, INFO_CTF_CAPTURE_), player.netname); }
- }
+ if(!ctf_captimerecord) { Send_Notification(NOTIF_ALL, world, MSG_CHOICE, APP_TEAM_ENT_4(flag, CHOICE_CTF_CAPTURE_TIME_), player.netname, (cap_time * 100)); }
+ else if(cap_time < cap_record) { Send_Notification(NOTIF_ALL, world, MSG_CHOICE, APP_TEAM_ENT_4(flag, CHOICE_CTF_CAPTURE_BROKEN_), player.netname, refername, (cap_time * 100), (cap_record * 100)); }
+ else { Send_Notification(NOTIF_ALL, world, MSG_CHOICE, APP_TEAM_ENT_4(flag, CHOICE_CTF_CAPTURE_UNBROKEN_), player.netname, refername, (cap_time * 100), (cap_record * 100)); }
// write that shit in the database
if((!ctf_captimerecord) || (cap_time < cap_record))
else { return TRUE; }
}
-float ctf_IsDifferentTeam(entity a, entity b)
+float ctf_Stalemate_customizeentityforclient()
{
- float f = IsDifferentTeam(a, b);
- return (autocvar_g_ctf_reverse) ? !f : f;
+ // make spectators see what the player would see
+ entity e, wp_owner;
+ e = WaypointSprite_getviewentity(other);
+ wp_owner = self.owner;
+
+ // team waypoints
+ if(CTF_SAMETEAM(wp_owner.flagcarried, wp_owner))
+ return FALSE;
+
+ if not(IS_PLAYER(e))
+ return FALSE;
+
+ return TRUE;
}
players_total = players_worseeq = 0;
FOR_EACH_PLAYER(e)
{
- if(IsDifferentTeam(e, p))
+ if(DIFF_TEAM(e, p))
continue;
se = PlayerScore_Add(e, SP_CTF_CAPS, 0);
se2 = PlayerScore_Add(e, SP_CTF_PICKUPS, 0);
float ctf_CaptureShield_Customize()
{
if(!other.ctf_captureshielded) { return FALSE; }
- if(!ctf_IsDifferentTeam(self, other)) { return FALSE; }
+ if(SAME_TEAM(self, other)) { return FALSE; }
return TRUE;
}
void ctf_CaptureShield_Touch()
{
if(!other.ctf_captureshielded) { return; }
- if(!ctf_IsDifferentTeam(self, other)) { return; }
+ if(SAME_TEAM(self, other)) { return; }
vector mymid = (self.absmin + self.absmax) * 0.5;
vector othermid = (other.absmin + other.absmax) * 0.5;
// messages and sounds
Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_4(flag, INFO_CTF_LOST_), player.netname);
- sound(flag, CH_TRIGGER, flag.snd_flag_dropped, VOL_BASE, ATTN_NONE);
+ sound(flag, CH_TRIGGER, flag.snd_flag_dropped, VOL_BASE, ATTEN_NONE);
ctf_EventLog("dropped", player.team, player);
// scoring
flag.ctf_status = FLAG_CARRY;
// messages and sounds
- sound(player, CH_TRIGGER, flag.snd_flag_pass, VOL_BASE, ATTN_NORM);
+ sound(player, CH_TRIGGER, flag.snd_flag_pass, VOL_BASE, ATTEN_NORM);
ctf_EventLog("receive", flag.team, player);
FOR_EACH_REALPLAYER(tmp_player)
Send_Notification(NOTIF_ONE, tmp_player, MSG_CENTER, APP_TEAM_ENT_4(flag, CENTER_CTF_PASS_SENT_), player.netname);
else if(tmp_player == player)
Send_Notification(NOTIF_ONE, tmp_player, MSG_CENTER, APP_TEAM_ENT_4(flag, CENTER_CTF_PASS_RECEIVED_), sender.netname);
- else if(!ctf_IsDifferentTeam(tmp_player, sender))
+ else if(SAME_TEAM(tmp_player, sender))
Send_Notification(NOTIF_ONE, tmp_player, MSG_CENTER, APP_TEAM_ENT_4(flag, CENTER_CTF_PASS_OTHER_), sender.netname, player.netname);
}
flag.ctf_status = FLAG_PASSING;
// other
- sound(player, CH_TRIGGER, flag.snd_flag_touch, VOL_BASE, ATTN_NORM);
+ sound(player, CH_TRIGGER, flag.snd_flag_touch, VOL_BASE, ATTEN_NORM);
WarpZone_TrailParticles(world, particleeffectnum(flag.passeffect), player.origin, targ_origin);
ctf_EventLog("pass", flag.team, player);
break;
float old_time, new_time;
if not(player) { return; } // without someone to give the reward to, we can't possibly cap
- if(ctf_IsDifferentTeam(player, flag)) { return; }
+ if(CTF_DIFFTEAM(player, flag)) { return; }
// messages and sounds
Send_Notification(NOTIF_ONE, player, MSG_CENTER, APP_TEAM_ENT_4(enemy_flag, CENTER_CTF_CAPTURE_));
ctf_CaptureRecord(enemy_flag, player);
- sound(player, CH_TRIGGER, ((IsDifferentTeam(player, flag)) ? enemy_flag.snd_flag_capture : flag.snd_flag_capture), VOL_BASE, ATTN_NONE);
+ sound(player, CH_TRIGGER, ((CTF_DIFFTEAM(player, flag)) ? enemy_flag.snd_flag_capture : flag.snd_flag_capture), VOL_BASE, ATTEN_NONE);
switch(capturetype)
{
// messages and sounds
Send_Notification(NOTIF_ONE, player, MSG_CENTER, APP_TEAM_ENT_4(flag, CENTER_CTF_RETURN_));
Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_4(flag, INFO_CTF_RETURN_), player.netname);
- sound(player, CH_TRIGGER, flag.snd_flag_returned, VOL_BASE, ATTN_NONE);
+ sound(player, CH_TRIGGER, flag.snd_flag_returned, VOL_BASE, ATTEN_NONE);
ctf_EventLog("return", flag.team, player);
// scoring
void ctf_Handle_Pickup(entity flag, entity player, float pickuptype)
{
// declarations
- entity tmp_player; // temporary entity which the FOR_EACH_PLAYER loop uses to scan players
float pickup_dropped_score; // used to calculate dropped pickup score
// attach the flag to the player
}
// messages and sounds
- Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_4(flag, INFO_CTF_PICKUP_), player.netname);
- sound(player, CH_TRIGGER, flag.snd_flag_taken, VOL_BASE, ATTN_NONE);
-
- FOR_EACH_REALPLAYER(tmp_player)
- {
- if(tmp_player == player)
- {
- Send_Notification(NOTIF_ONE, tmp_player, MSG_CENTER, APP_TEAM_ENT_4(flag, CENTER_CTF_PICKUP_));
- if(ctf_stalemate) { Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_CTF_STALEMATE_CARRIER); }
- }
- else if(!IsDifferentTeam(tmp_player, player) && tmp_player != player)
- {
- if(tmp_player.PICKUP_TEAM_VERBOSE)
- Send_Notification(NOTIF_ONE, tmp_player, MSG_CENTER, APP_TEAM_ENT_4(flag, CENTER_CTF_PICKUP_TEAM_VERBOSE_), Team_ColorCode(player.team), player.netname);
- else
- Send_Notification(NOTIF_ONE, tmp_player, MSG_CENTER, APP_TEAM_ENT_4(flag, CENTER_CTF_PICKUP_TEAM_), Team_ColorCode(player.team));
- }
- else if(ctf_IsDifferentTeam(tmp_player, player) && !ctf_IsDifferentTeam(flag, tmp_player))
- {
- if(tmp_player.PICKUP_ENEMY_VERBOSE)
- Send_Notification(NOTIF_ONE, tmp_player, MSG_CENTER, CENTER_CTF_PICKUP_ENEMY_VERBOSE, Team_ColorCode(player.team), player.netname);
- else
- Send_Notification(NOTIF_ONE, tmp_player, MSG_CENTER, CENTER_CTF_PICKUP_ENEMY, Team_ColorCode(player.team));
- }
- }
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_4(flag, INFO_CTF_PICKUP_), player.netname);
+ Send_Notification(NOTIF_ONE, player, MSG_CENTER, APP_TEAM_ENT_4(flag, CENTER_CTF_PICKUP_));
+ if(ctf_stalemate) { Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_CTF_STALEMATE_CARRIER); }
+
+ Send_Notification(NOTIF_TEAM_EXCEPT, player, MSG_CHOICE, APP_TEAM_ENT_4(flag, CHOICE_CTF_PICKUP_TEAM_), Team_ColorCode(player.team), player.netname);
+ Send_Notification(NOTIF_TEAM, flag, MSG_CHOICE, CHOICE_CTF_PICKUP_ENEMY, Team_ColorCode(player.team), player.netname);
+
+ sound(player, CH_TRIGGER, flag.snd_flag_taken, VOL_BASE, ATTEN_NONE);
// scoring
PlayerScore_Add(player, SP_CTF_PICKUPS, 1);
case RETURN_TIMEOUT:
{ Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_4(flag, INFO_CTF_FLAGRETURN_TIMEOUT_)); break; }
}
- sound(flag, CH_TRIGGER, flag.snd_flag_respawn, VOL_BASE, ATTN_NONE);
+ sound(flag, CH_TRIGGER, flag.snd_flag_respawn, VOL_BASE, ATTEN_NONE);
ctf_EventLog("returned", flag.team, world);
ctf_RespawnFlag(flag);
}
tmp_entity.ctf_staleflagnext = ctf_staleflaglist; // link flag into staleflaglist
ctf_staleflaglist = tmp_entity;
- if(tmp_entity.team == NUM_TEAM_1) { ++stale_red_flags; }
- if(tmp_entity.team == NUM_TEAM_2) { ++stale_blue_flags; }
- if(tmp_entity.team == NUM_TEAM_3) { ++stale_yellow_flags; }
- if(tmp_entity.team == NUM_TEAM_4) { ++stale_pink_flags; }
+ switch(tmp_entity.team)
+ {
+ case NUM_TEAM_1: ++stale_red_flags; break;
+ case NUM_TEAM_2: ++stale_blue_flags; break;
+ case NUM_TEAM_3: ++stale_yellow_flags; break;
+ case NUM_TEAM_4: ++stale_pink_flags; break;
+ }
}
}
- stale_flags = (stale_red_flags > 0) + (stale_blue_flags > 0) + (stale_yellow_flags > 0) + (stale_pink_flags > 0);
+ stale_flags = (stale_red_flags >= 1) + (stale_blue_flags >= 1) + (stale_yellow_flags >= 1) + (stale_pink_flags >= 1);
- if(stale_flags >= ctf_teams)
+ if(stale_flags == ctf_teams)
ctf_stalemate = TRUE;
- else if(stale_flags < ctf_teams && autocvar_g_ctf_stalemate_endcondition == 2)
+ else if(stale_flags == 0 && autocvar_g_ctf_stalemate_endcondition == 2)
{ ctf_stalemate = FALSE; wpforenemy_announced = FALSE; }
- else if(stale_flags > 0 && autocvar_g_ctf_stalemate_endcondition == 1)
+ else if(stale_flags < ctf_teams && autocvar_g_ctf_stalemate_endcondition == 1)
{ ctf_stalemate = FALSE; wpforenemy_announced = FALSE; }
// if sufficient stalemate, then set up the waypointsprite and announce the stalemate if necessary
for(tmp_entity = ctf_staleflaglist; tmp_entity; tmp_entity = tmp_entity.ctf_staleflagnext)
{
if((tmp_entity.owner) && (!tmp_entity.owner.wps_enemyflagcarrier))
- WaypointSprite_Spawn("enemyflagcarrier", 0, 0, tmp_entity.owner, FLAG_WAYPOINT_OFFSET, world, tmp_entity.team, tmp_entity.owner, wps_enemyflagcarrier, TRUE, RADARICON_FLAG, WPCOLOR_ENEMYFC(tmp_entity.owner.team));
+ {
+ WaypointSprite_Spawn("enemyflagcarrier", 0, 0, tmp_entity.owner, FLAG_WAYPOINT_OFFSET, world, 0, tmp_entity.owner, wps_enemyflagcarrier, TRUE, RADARICON_FLAG, WPCOLOR_ENEMYFC(tmp_entity.owner.team));
+ tmp_entity.owner.wps_enemyflagcarrier.customizeentityforclient = ctf_Stalemate_customizeentityforclient;
+ }
}
if not(wpforenemy_announced)
wpforenemy_nextthink = time + WPFE_THINKRATE; // waypoint for enemy think rate (to reduce unnecessary spam of this check)
}
}
+ if(CTF_SAMETEAM(self, self.owner))
+ {
+ // drop the flag if reverse status has changed
+ ctf_Handle_Throw(self.owner, world, DROP_THROW);
+ }
return;
}
// special touch behaviors
if(toucher.vehicle_flags & VHF_ISVEHICLE)
{
- if(autocvar_g_ctf_allow_vehicle_touch)
+ if(autocvar_g_ctf_allow_vehicle_touch && toucher.owner)
toucher = toucher.owner; // the player is actually the vehicle owner, not other
else
return; // do nothing
if(time > self.wait) // if we haven't in a while, play a sound/effect
{
pointparticles(particleeffectnum(self.toucheffect), self.origin, '0 0 0', 1);
- sound(self, CH_TRIGGER, self.snd_flag_touch, VOL_BASE, ATTN_NORM);
+ sound(self, CH_TRIGGER, self.snd_flag_touch, VOL_BASE, ATTEN_NORM);
self.wait = time + FLAG_TOUCHRATE;
}
return;
{
case FLAG_BASE:
{
- if(!ctf_IsDifferentTeam(toucher, self) && (toucher.flagcarried) && IsDifferentTeam(toucher.flagcarried, self))
+ if(SAME_TEAM(toucher, self) && (toucher.flagcarried) && DIFF_TEAM(toucher.flagcarried, self))
ctf_Handle_Capture(self, toucher, CAPTURE_NORMAL); // toucher just captured the enemies flag to his base
- else if(ctf_IsDifferentTeam(toucher, self) && (!toucher.flagcarried) && (!toucher.ctf_captureshielded) && (time > toucher.next_take_time))
+ else if(DIFF_TEAM(toucher, self) && (!toucher.flagcarried) && (!toucher.ctf_captureshielded) && (time > toucher.next_take_time))
ctf_Handle_Pickup(self, toucher, PICKUP_BASE); // toucher just stole the enemies flag
break;
}
case FLAG_DROPPED:
{
- if(!ctf_IsDifferentTeam(toucher, self))
+ if(SAME_TEAM(toucher, self))
ctf_Handle_Return(self, toucher); // toucher just returned his own flag
else if((!toucher.flagcarried) && ((toucher != self.ctf_dropper) || (time > self.ctf_droptime + autocvar_g_ctf_flag_collect_delay)))
ctf_Handle_Pickup(self, toucher, PICKUP_DROPPED); // toucher just picked up a dropped enemy flag
{
if((IS_PLAYER(toucher)) && (toucher.deadflag == DEAD_NO) && (toucher != self.pass_sender))
{
- if(ctf_IsDifferentTeam(toucher, self.pass_sender))
+ if(DIFF_TEAM(toucher, self.pass_sender))
ctf_Handle_Return(self, toucher);
else
ctf_Handle_Retrieve(self, toucher);
// reset the player (if there is one)
if((flag.owner) && (flag.owner.flagcarried == flag))
{
- if(flag.owner.wps_enemyflagcarrier)
- WaypointSprite_Kill(flag.owner.wps_enemyflagcarrier);
-
+ WaypointSprite_Kill(flag.owner.wps_enemyflagcarrier);
WaypointSprite_Kill(flag.wps_flagcarrier);
flag.owner.flagcarried = world;
ctf_FakeTimeLimit(flag.owner, -1);
}
- if((flag.ctf_status == FLAG_DROPPED) && (flag.wps_flagdropped))
+ if(flag.ctf_status == FLAG_DROPPED)
{ WaypointSprite_Kill(flag.wps_flagdropped); }
// reset the flag
flag.ctf_status = FLAG_BASE;
// appearence
- if(!flag.scale) { flag.scale = FLAG_SCALE; }
- if(flag.model == "") { flag.model = strzone(cvar_string(strcat("g_ctf_flag_", Static_Team_ColorName_Lower(teamnumber), "_model"))); }
- if(flag.toucheffect == "") { flag.toucheffect = strzone(strcat(Static_Team_ColorName_Lower(teamnumber), "_touch")); }
- if(flag.passeffect == "") { flag.passeffect = strzone(strcat(Static_Team_ColorName_Lower(teamnumber), "_pass")); }
- if(flag.capeffect == "") { flag.capeffect = strzone(strcat(Static_Team_ColorName_Lower(teamnumber), "_cap")); }
- if(!flag.skin) { flag.skin = cvar(strcat("g_ctf_flag_", Static_Team_ColorName_Lower(teamnumber), "_skin")); }
+ if(flag.model == "") { flag.model = strzone(cvar_string(strcat("g_ctf_flag_", Static_Team_ColorName_Lower(teamnumber), "_model"))); }
+ if(!flag.scale) { flag.scale = FLAG_SCALE; }
+ if(!flag.skin) { flag.skin = cvar(strcat("g_ctf_flag_", Static_Team_ColorName_Lower(teamnumber), "_skin")); }
+ if(flag.toucheffect == "") { flag.toucheffect = strzone(strcat(Static_Team_ColorName_Lower(teamnumber), "_touch")); }
+ if(flag.passeffect == "") { flag.passeffect = strzone(strcat(Static_Team_ColorName_Lower(teamnumber), "_pass")); }
+ if(flag.capeffect == "") { flag.capeffect = strzone(strcat(Static_Team_ColorName_Lower(teamnumber), "_cap")); }
// sound
if(flag.snd_flag_taken == "") { flag.snd_flag_taken = strzone(strcat("ctf/", Static_Team_ColorName_Lower(teamnumber), "_taken.wav")); }
if(autocvar_g_ctf_flag_glowtrails)
{
- //flag.glow_color = ((teamnumber) ? 251 : 210); // 251: red - 210: blue
switch(teamnumber)
{
case NUM_TEAM_1: flag.glow_color = 251; break; // red
if(autocvar_g_ctf_fullbrightflags) { flag.effects |= EF_FULLBRIGHT; }
if(autocvar_g_ctf_dynamiclights)
{
- // flag.effects |= ((teamnumber) ? EF_RED : EF_BLUE);
switch(teamnumber)
{
case NUM_TEAM_1: flag.effects |= EF_RED; break;
f = ctf_worldflaglist;
while (f)
{
- if (bot.team == f.team)
+ if (CTF_SAMETEAM(bot, f))
return f;
f = f.ctf_worldflagnext;
}
f = ctf_worldflaglist;
while (f)
{
- if (bot.team != f.team)
+ if (CTF_DIFFTEAM(bot, f))
return f;
f = f.ctf_worldflagnext;
}
head = ctf_worldflaglist;
while (head)
{
- if (self.team == head.team)
+ if (CTF_SAMETEAM(self, head))
break;
head = head.ctf_worldflagnext;
}
head = ctf_worldflaglist;
while (head)
{
- if (self.team == head.team)
+ if (CTF_SAMETEAM(self, head))
break;
head = head.ctf_worldflagnext;
}
head = ctf_worldflaglist;
while (head)
{
- if (self.team != head.team)
+ if(CTF_DIFFTEAM(self, head))
break;
head = head.ctf_worldflagnext;
}
{
// Can't navigate to my own base, suicide!
// TODO: drop it and wander around
- Damage(self, self, self, 100000, DEATH_KILL, self.origin, '0 0 0');
+ //Damage(self, self, self, 100000, DEATH_KILL, self.origin, '0 0 0');
return;
}
}
float t = 0, t2 = 0, t3 = 0;
// initially clear items so they can be set as necessary later.
- self.items &~= (IT_RED_FLAG_CARRYING | IT_RED_FLAG_TAKEN | IT_RED_FLAG_LOST
- | IT_BLUE_FLAG_CARRYING | IT_BLUE_FLAG_TAKEN | IT_BLUE_FLAG_LOST
- | IT_YELLOW_FLAG_CARRYING | IT_YELLOW_FLAG_TAKEN | IT_YELLOW_FLAG_LOST
- | IT_PINK_FLAG_CARRYING | IT_PINK_FLAG_TAKEN | IT_PINK_FLAG_LOST
+ self.items &= ~(IT_RED_FLAG_CARRYING | IT_RED_FLAG_TAKEN | IT_RED_FLAG_LOST
+ | IT_BLUE_FLAG_CARRYING | IT_BLUE_FLAG_TAKEN | IT_BLUE_FLAG_LOST
+ | IT_YELLOW_FLAG_CARRYING | IT_YELLOW_FLAG_TAKEN | IT_YELLOW_FLAG_LOST
+ | IT_PINK_FLAG_CARRYING | IT_PINK_FLAG_TAKEN | IT_PINK_FLAG_LOST
| IT_CTF_SHIELDED);
// scan through all the flags and notify the client about them
for(flag = ctf_worldflaglist; flag; flag = flag.ctf_worldflagnext)
{
- switch(flag.team)
- {
- case NUM_TEAM_1: t = IT_RED_FLAG_CARRYING; t2 = IT_RED_FLAG_TAKEN; t3 = IT_RED_FLAG_LOST; break;
- case NUM_TEAM_2: t = IT_BLUE_FLAG_CARRYING; t2 = IT_BLUE_FLAG_TAKEN; t3 = IT_BLUE_FLAG_LOST; break;
- case NUM_TEAM_3: t = IT_YELLOW_FLAG_CARRYING; t2 = IT_YELLOW_FLAG_TAKEN; t3 = IT_YELLOW_FLAG_LOST; break;
- case NUM_TEAM_4: t = IT_PINK_FLAG_CARRYING; t2 = IT_PINK_FLAG_TAKEN; t3 = IT_PINK_FLAG_LOST; break;
- }
+ if(flag.team == NUM_TEAM_1) { t = IT_RED_FLAG_CARRYING; t2 = IT_RED_FLAG_TAKEN; t3 = IT_RED_FLAG_LOST; }
+ if(flag.team == NUM_TEAM_2) { t = IT_BLUE_FLAG_CARRYING; t2 = IT_BLUE_FLAG_TAKEN; t3 = IT_BLUE_FLAG_LOST; }
+ if(flag.team == NUM_TEAM_3) { t = IT_YELLOW_FLAG_CARRYING; t2 = IT_YELLOW_FLAG_TAKEN; t3 = IT_YELLOW_FLAG_LOST; }
+ if(flag.team == NUM_TEAM_4) { t = IT_PINK_FLAG_CARRYING; t2 = IT_PINK_FLAG_TAKEN; t3 = IT_PINK_FLAG_LOST; }
switch(flag.ctf_status)
{
frag_force *= autocvar_g_ctf_flagcarrier_forcefactor;
}
}
- else if(frag_target.flagcarried && (frag_target.deadflag == DEAD_NO) && ctf_IsDifferentTeam(frag_target, frag_attacker)) // if the target is a flagcarrier
+ else if(frag_target.flagcarried && (frag_target.deadflag == DEAD_NO) && DIFF_TEAM(frag_target, frag_attacker)) // if the target is a flagcarrier
{
if(autocvar_g_ctf_flagcarrier_auto_helpme_damage > ('1 0 0' * healtharmor_maxdamage(frag_target.health, frag_target.armorvalue, autocvar_g_balance_armor_blockpercent)))
if(time > frag_target.wps_helpme_time + autocvar_g_ctf_flagcarrier_auto_helpme_time)
while(head) // find the closest acceptable target to pass to
{
if(IS_PLAYER(head) && head.deadflag == DEAD_NO)
- if(head != player && !ctf_IsDifferentTeam(head, player))
+ if(head != player && SAME_TEAM(head, player))
if(!head.speedrunning && !head.vehicle)
{
// if it's a player, use the view origin as reference (stolen from RadiusDamage functions in g_damage.qc)
return TRUE;
}
-MUTATOR_HOOKFUNCTION(ctf_GetCvars)
-{
- GetCvars_handleFloat(get_cvars_s, get_cvars_f, CAPTURE_VERBOSE, "notification_ctf_capture_verbose");
- GetCvars_handleFloat(get_cvars_s, get_cvars_f, PICKUP_TEAM_VERBOSE, "notification_ctf_pickup_team_verbose");
- GetCvars_handleFloat(get_cvars_s, get_cvars_f, PICKUP_ENEMY_VERBOSE, "notification_ctf_pickup_enemy_verbose");
- return TRUE;
-}
-
MUTATOR_HOOKFUNCTION(ctf_GetTeamCount)
{
ret_float = ctf_teams;
return 0;
}
-
// ==========
// Spawnfuncs
// ==========
entity tmp_entity;
for(tmp_entity = ctf_worldflaglist; tmp_entity; tmp_entity = tmp_entity.ctf_worldflagnext)
- if(tmp_entity.team == NUM_TEAM_3)
- {
- ++ctf_teams;
- break; // found 1 flag for this team
- }
- for(tmp_entity = ctf_worldflaglist; tmp_entity; tmp_entity = tmp_entity.ctf_worldflagnext)
- if(tmp_entity.team == NUM_TEAM_4)
{
- ++ctf_teams;
- break; // found 1 flag for this team
+ if(tmp_entity.team == NUM_TEAM_3) { ctf_teams = max(3, ctf_teams); }
+ if(tmp_entity.team == NUM_TEAM_4) { ctf_teams = max(4, ctf_teams); }
}
ctf_teams = bound(2, ctf_teams, 4);
ctf_SpawnTeam("Pink", NUM_TEAM_4 - 1);
}
- ret_float = ctf_teams;
ctf_ScoreRules(ctf_teams);
}
MUTATOR_HOOK(VehicleExit, ctf_VehicleExit, CBC_ORDER_ANY);
MUTATOR_HOOK(AbortSpeedrun, ctf_AbortSpeedrun, CBC_ORDER_ANY);
MUTATOR_HOOK(HavocBot_ChooseRule, ctf_BotRoles, CBC_ORDER_ANY);
- MUTATOR_HOOK(GetCvars, ctf_GetCvars, CBC_ORDER_ANY);
MUTATOR_HOOK(GetTeamCount, ctf_GetTeamCount, CBC_ORDER_ANY);
MUTATOR_ONADD