// player is in the worse half, if >= half the players are better than him, or consequently, if < half of the players are worse
// use this rule here
-
+
if(players_worseeq >= players_total * captureshield_max_ratio)
return FALSE;
self.basewaypoint = self.nearestwaypoint;
if(self.team == COLOR_TEAM1)
- {
- WaypointSprite_SpawnFixed("redbase", self.origin + '0 0 61', self, sprite);
- WaypointSprite_UpdateTeamRadar(self.sprite, RADARICON_FLAG, colormapPaletteColor(COLOR_TEAM1 - 1, FALSE));
- }
+ WaypointSprite_SpawnFixed("redbase", self.origin + '0 0 61', self, sprite, RADARICON_FLAG, colormapPaletteColor(COLOR_TEAM1 - 1, FALSE));
else
- {
- WaypointSprite_SpawnFixed("bluebase", self.origin + '0 0 61', self, sprite);
- WaypointSprite_UpdateTeamRadar(self.sprite, RADARICON_FLAG, colormapPaletteColor(COLOR_TEAM2 - 1, FALSE));
- }
+ WaypointSprite_SpawnFixed("bluebase", self.origin + '0 0 61', self, sprite, RADARICON_FLAG, colormapPaletteColor(COLOR_TEAM2 - 1, FALSE));
}
float ctf_score_value(string parameter)
setattachment(self, world, "");
self.mdl = self.model;
- self.flags = FL_ITEM;
+ self.flags = FL_ITEM | FL_NOTARGET;
self.solid = SOLID_TRIGGER;
self.movetype = MOVETYPE_NONE;
self.velocity = '0 0 0';
e.angles = e.mangle;
e.cnt = FLAG_BASE;
e.owner = world;
- e.flags = FL_ITEM; // clear FL_ONGROUND and any other junk
+ e.flags = FL_ITEM | FL_NOTARGET; // clear FL_ONGROUND and any other junk
};
void ReturnFlag(entity e)
ctf_captureshield_update(p, 0); // shield only
e.playerid = attacker.playerid;
e.ctf_droptime = time;
- WaypointSprite_Spawn("flagdropped", 0, 0, e, '0 0 1' * 61, world, COLOR_TEAM1 + COLOR_TEAM2 - e.team, e, waypointsprite_attachedforcarrier, FALSE);
+ WaypointSprite_Spawn("flagdropped", 0, 0, e, '0 0 1' * 61, world, COLOR_TEAM1 + COLOR_TEAM2 - e.team, e, waypointsprite_attachedforcarrier, FALSE, RADARICON_FLAG, '0 1 1');
+ WaypointSprite_Ping(e.waypointsprite_attachedforcarrier);
if(p.waypointsprite_attachedforcarrier)
{
- WaypointSprite_Ping(p.waypointsprite_attachedforcarrier);
WaypointSprite_DetachCarrier(p);
}
else
backtrace("Flag carrier had no flag sprite?!?");
}
LogCTF("dropped", p.team, p);
- sound (self, CHAN_TRIGGER, self.noise4, VOL_BASE, ATTN_NONE);
+ sound (p, CH_TRIGGER, self.noise4, VOL_BASE, ATTN_NONE);
setattachment(e, world, "");
e.damageforcescale = autocvar_g_balance_ctf_damageforcescale;
p.flagcarried = world;
e.owner = world;
- e.flags = FL_ITEM; // clear FL_ONGROUND and any other junk
+ e.flags = FL_ITEM | FL_NOTARGET; // clear FL_ONGROUND and any other junk
e.solid = SOLID_TRIGGER;
e.movetype = MOVETYPE_TOSS;
// setsize(e, '-16 -16 0', '16 16 74');
{
bprint("The ", self.netname, " became impatient after ", ftos_decimals(flagcaptimerecord, 2), " seconds and returned itself\n");
- sound (self, CHAN_TRIGGER, self.noise3, VOL_BASE, ATTN_NONE);
+ sound (self, CH_TRIGGER_SINGLE, self.noise3, VOL_BASE, ATTN_NONE);
self.owner.impulse = 141; // returning!
e = self;
if (time > self.pain_finished)
{
bprint("The ", self.netname, " has returned to base\n");
- sound (self, CHAN_TRIGGER, self.noise3, VOL_BASE, ATTN_NONE);
+ sound (self, CH_TRIGGER_SINGLE, self.noise3, VOL_BASE, ATTN_NONE);
LogCTF("returned", self.team, world);
ReturnFlag(self);
}
DropFlag(self, world, world);
return;
}
-
- if(autocvar_g_ctf_allow_drop)
- if(e.BUTTON_USE)
- DropFlag(self, e, world);
};
+float ctf_usekey()
+{
+ if(self.flagcarried)
+ {
+ DropFlag(self.flagcarried, self, world);
+ return TRUE;
+ }
+ return FALSE;
+}
+
void flag_cap_ring_spawn(vector org)
{
shockwave_spawn("models/ctf/shockwavetransring.md3", org - '0 0 15', -0.8, 0, 1);
}
}
- sound (other, CHAN_AUTO, self.noise2, VOL_BASE, ATTN_NONE);
+ sound (other, CH_ITEMS, self.noise2, VOL_BASE, ATTN_NONE);
WaypointSprite_DetachCarrier(other);
if(self.speedrunning)
FakeTimeLimit(other, -1);
{
if (other.next_take_time > time)
return;
-
+
if (autocvar_g_ctf_flag_pickup_effects) // pickup effect
pointparticles(particleeffectnum("smoke_ring"), 0.5 * (self.absmin + self.absmax), '0 0 0', 1);
-
+
// pick up
self.flagpickuptime = time; // used for timing runs
self.speedrunning = other.speedrunning; // if speedrunning, flag will self-return and teleport the owner back after the record
self.dropperid = other.playerid;
PlayerScore_Add(other, SP_CTF_PICKUPS, 1);
LogCTF("steal", self.team, other);
- sound (other, CHAN_AUTO, self.noise, VOL_BASE, ATTN_NONE);
+ sound (other, CH_ITEMS, self.noise, VOL_BASE, ATTN_NONE);
FOR_EACH_PLAYER(player)
if(player.team == self.team)
self.movetype = MOVETYPE_NONE;
setorigin(self, FLAG_CARRY_POS);
setattachment(self, other, "");
- WaypointSprite_AttachCarrier("flagcarrier", other);
- WaypointSprite_UpdateTeamRadar(other.waypointsprite_attachedforcarrier, RADARICON_FLAGCARRIER, '1 1 0');
+ WaypointSprite_AttachCarrier("flagcarrier", other, RADARICON_FLAGCARRIER, '1 1 0');
WaypointSprite_Ping(self.sprite);
return;
if (self.cnt == FLAG_DROPPED)
{
- self.flags = FL_ITEM; // clear FL_ONGROUND and any other junk
+ self.flags = FL_ITEM | FL_NOTARGET; // clear FL_ONGROUND and any other junk
if (other.team == self.team || (other.team != COLOR_TEAM1 && other.team != COLOR_TEAM2))
{
// return flag
}
PlayerScore_Add(other, SP_CTF_RETURNS, 1);
LogCTF("return", self.team, other);
- sound (other, CHAN_AUTO, self.noise1, VOL_BASE, ATTN_NONE);
+ sound (other, CH_ITEMS, self.noise1, VOL_BASE, ATTN_NONE);
ReturnFlag(self);
}
else if (!other.flagcarried && (other.playerid != self.dropperid || time > self.ctf_droptime + autocvar_g_balance_ctf_delay_collect))
if (autocvar_g_ctf_flag_pickup_effects) // field pickup effect
pointparticles(particleeffectnum("smoke_ring"), 0.5 * (self.absmin + self.absmax), '0 0 0', 1);
-
+
// pick up
self.solid = SOLID_NOT;
setorigin(self, self.origin); // relink
UpdateFrags(other, f);
PlayerScore_Add(other, SP_CTF_PICKUPS, 1);
LogCTF("pickup", self.team, other);
- sound (other, CHAN_AUTO, self.noise, VOL_BASE, ATTN_NONE);
+ sound (other, CH_ITEMS, self.noise, VOL_BASE, ATTN_NONE);
FOR_EACH_PLAYER(player)
if(player.team == self.team)
setattachment(self, other, "");
self.damageforcescale = 0;
self.takedamage = DAMAGE_NO;
- WaypointSprite_AttachCarrier("flagcarrier", other);
- WaypointSprite_UpdateTeamRadar(other.waypointsprite_attachedforcarrier, RADARICON_FLAGCARRIER, '1 1 0');
+ WaypointSprite_AttachCarrier("flagcarrier", other, RADARICON_FLAGCARRIER, '1 1 0');
}
}
};
if(self.team == COLOR_TEAM2)
// Blue
self.glow_color = 210;
-
+
self.glow_size = 25;
self.glow_trail = 1;
}
entity pl;
if(cteam != COLOR_TEAM1 || cteam != COLOR_TEAM2)
return world;
-
+
FOR_EACH_REALPLAYER(pl) {
if(pl.team == cteam && pl.iscommander) {
return pl;
void(float cteam) ctf_new_commander =
{
entity pl, plmax;
-
+
plmax = world;
FOR_EACH_REALPLAYER(pl) {
if(pl.team == cteam) {
void() ctf_clientconnect =
{
self.iscommander = FALSE;
-
+
if(!self.team || self.classname != "player") {
ctf_setstate(self, -1);
} else
ctf_setstate(self, 0);
self.team_saved = self.team;
-
+
if(self.team != 0 && self.classname == "player" && !ctf_team_has_commander(self.team)) {
ctf_new_commander(self.team);
}
ctf_setstate(self, -1);
ctf_new_commander(self.team_saved);
}
-
+
self.team_saved = self.team;
-
+
ctf_new_commander(self.team);
};